From 015369d6f7957be10c975af215968540c1e957a5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 31 Jan 2023 14:47:23 +0000 Subject: [PATCH] CodeGen from PR 22354 in Azure/azure-rest-api-specs Merge b9d3fed756a3416c0d8cbb4b6e6466c7d0aae3ac into 630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 ++ .../SAMPLE.md | 321 +++++ .../pom.xml | 55 + .../ManagedServiceIdentityManager.java | 335 +++++ .../FederatedIdentityCredentialsClient.java | 149 ++ .../fluent/ManagedServiceIdentityClient.java | 74 + .../generated/fluent/OperationsClient.java | 36 + .../SystemAssignedIdentitiesClient.java | 39 + .../fluent/UserAssignedIdentitiesClient.java | 177 +++ .../FederatedIdentityCredentialInner.java | 133 ++ ...FederatedIdentityCredentialProperties.java | 128 ++ .../fluent/models/IdentityInner.java | 107 ++ .../fluent/models/OperationInner.java | 96 ++ .../models/SystemAssignedIdentityInner.java | 166 +++ .../SystemAssignedIdentityProperties.java | 91 ++ .../UserAssignedIdentityProperties.java | 75 + .../generated/fluent/models/package-info.java | 6 + .../msi/generated/fluent/package-info.java | 6 + .../FederatedIdentityCredentialImpl.java | 194 +++ ...ederatedIdentityCredentialsClientImpl.java | 996 +++++++++++++ .../FederatedIdentityCredentialsImpl.java | 235 ++++ .../implementation/IdentityImpl.java | 197 +++ .../ManagedServiceIdentityClientBuilder.java | 144 ++ .../ManagedServiceIdentityClientImpl.java | 332 +++++ .../implementation/OperationImpl.java | 38 + .../implementation/OperationsClientImpl.java | 268 ++++ .../implementation/OperationsImpl.java | 46 + .../SystemAssignedIdentitiesClientImpl.java | 166 +++ .../SystemAssignedIdentitiesImpl.java | 59 + .../SystemAssignedIdentityImpl.java | 78 ++ .../UserAssignedIdentitiesClientImpl.java | 1232 +++++++++++++++++ .../UserAssignedIdentitiesImpl.java | 183 +++ .../msi/generated/implementation/Utils.java | 204 +++ .../implementation/package-info.java | 6 + .../models/FederatedIdentityCredential.java | 220 +++ .../models/FederatedIdentityCredentials.java | 153 ++ ...ederatedIdentityCredentialsListResult.java | 81 ++ .../msi/generated/models/Identity.java | 230 +++ .../msi/generated/models/IdentityUpdate.java | 148 ++ .../msi/generated/models/Operation.java | 35 + .../generated/models/OperationDisplay.java | 156 +++ .../generated/models/OperationListResult.java | 97 ++ .../msi/generated/models/Operations.java | 31 + .../models/SystemAssignedIdentities.java | 34 + .../models/SystemAssignedIdentity.java | 92 ++ .../models/UserAssignedIdentities.java | 157 +++ .../UserAssignedIdentitiesListResult.java | 81 ++ .../msi/generated/models/package-info.java | 6 + .../msi/generated/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...ntityCredentialsCreateOrUpdateSamples.java | 30 + ...ratedIdentityCredentialsDeleteSamples.java | 23 + ...ederatedIdentityCredentialsGetSamples.java | 23 + ...deratedIdentityCredentialsListSamples.java | 23 + .../generated/OperationsListSamples.java | 21 + ...emAssignedIdentitiesGetByScopeSamples.java | 21 + ...signedIdentitiesCreateOrUpdateSamples.java | 40 + .../UserAssignedIdentitiesDeleteSamples.java | 22 + ...edIdentitiesGetByResourceGroupSamples.java | 22 + ...dIdentitiesListByResourceGroupSamples.java | 21 + .../UserAssignedIdentitiesListSamples.java | 21 + .../UserAssignedIdentitiesUpdateSamples.java | 40 + sdk/msi/ci.yml | 47 + sdk/msi/pom.xml | 15 + 67 files changed, 8399 insertions(+) create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/CHANGELOG.md create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/README.md create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/SAMPLE.md create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/pom.xml create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/ManagedServiceIdentityManager.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/FederatedIdentityCredentialsClient.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/ManagedServiceIdentityClient.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/OperationsClient.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/SystemAssignedIdentitiesClient.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/UserAssignedIdentitiesClient.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialInner.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialProperties.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/IdentityInner.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/OperationInner.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityInner.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityProperties.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/UserAssignedIdentityProperties.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/package-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/package-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsClientImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/IdentityImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientBuilder.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsClientImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesClientImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentityImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesClientImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesImpl.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/Utils.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/package-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredential.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentials.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentialsListResult.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Identity.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/IdentityUpdate.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operation.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationDisplay.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationListResult.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operations.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentities.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentity.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentities.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentitiesListResult.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/package-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/package-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/main/java/module-info.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsCreateOrUpdateSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsDeleteSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsGetSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsListSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/OperationsListSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/SystemAssignedIdentitiesGetByScopeSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesCreateOrUpdateSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesDeleteSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesGetByResourceGroupSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListByResourceGroupSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListSamples.java create mode 100644 sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesUpdateSamples.java create mode 100644 sdk/msi/ci.yml create mode 100644 sdk/msi/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 329fdc0f64be..49c7f8e13127 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -392,6 +392,7 @@ com.azure.resourcemanager:azure-resourcemanager-appcomplianceautomation;1.0.0-be com.azure.resourcemanager:azure-resourcemanager-servicenetworking;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicessiterecovery;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-msi-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 5081c08637ea..457132c25d13 100644 --- a/pom.xml +++ b/pom.xml @@ -116,6 +116,7 @@ sdk/mobilenetwork sdk/modelsrepository sdk/monitor + sdk/msi sdk/mysql sdk/mysqlflexibleserver sdk/netapp diff --git a/sdk/msi/azure-resourcemanager-msi-generated/CHANGELOG.md b/sdk/msi/azure-resourcemanager-msi-generated/CHANGELOG.md new file mode 100644 index 000000000000..ac4b74f1779c --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-01-31) + +- Azure Resource Manager ManagedServiceIdentity client library for Java. This package contains Microsoft Azure SDK for ManagedServiceIdentity Management SDK. The Managed Service Identity Client. Package tag package-2023-01-31. 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/msi/azure-resourcemanager-msi-generated/README.md b/sdk/msi/azure-resourcemanager-msi-generated/README.md new file mode 100644 index 000000000000..ebc54e197315 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager ManagedServiceIdentity client library for Java + +Azure Resource Manager ManagedServiceIdentity client library for Java. + +This package contains Microsoft Azure SDK for ManagedServiceIdentity Management SDK. The Managed Service Identity Client. Package tag package-2023-01-31. 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-msi-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-msi-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(); +ManagedServiceIdentityManager manager = ManagedServiceIdentityManager + .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/msi/azure-resourcemanager-msi-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/msi/azure-resourcemanager-msi-generated/SAMPLE.md b/sdk/msi/azure-resourcemanager-msi-generated/SAMPLE.md new file mode 100644 index 000000000000..ab45157ddf0c --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/SAMPLE.md @@ -0,0 +1,321 @@ +# Code snippets and samples + + +## FederatedIdentityCredentials + +- [CreateOrUpdate](#federatedidentitycredentials_createorupdate) +- [Delete](#federatedidentitycredentials_delete) +- [Get](#federatedidentitycredentials_get) +- [List](#federatedidentitycredentials_list) + +## Operations + +- [List](#operations_list) + +## SystemAssignedIdentities + +- [GetByScope](#systemassignedidentities_getbyscope) + +## UserAssignedIdentities + +- [CreateOrUpdate](#userassignedidentities_createorupdate) +- [Delete](#userassignedidentities_delete) +- [GetByResourceGroup](#userassignedidentities_getbyresourcegroup) +- [List](#userassignedidentities_list) +- [ListByResourceGroup](#userassignedidentities_listbyresourcegroup) +- [Update](#userassignedidentities_update) +### FederatedIdentityCredentials_CreateOrUpdate + +```java +import java.util.Arrays; + +/** Samples for FederatedIdentityCredentials CreateOrUpdate. */ +public final class FederatedIdentityCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialCreate.json + */ + /** + * Sample code: FederatedIdentityCredentialCreate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialCreate( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .define("ficResourceName") + .withExistingUserAssignedIdentity("rgName", "resourceName") + .withIssuer("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID") + .withSubject("system:serviceaccount:ns:svcaccount") + .withAudiences(Arrays.asList("api://AzureADTokenExchange")) + .create(); + } +} +``` + +### FederatedIdentityCredentials_Delete + +```java +/** Samples for FederatedIdentityCredentials Delete. */ +public final class FederatedIdentityCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialDelete.json + */ + /** + * Sample code: FederatedIdentityCredentialDelete. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialDelete( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .deleteWithResponse("rgName", "resourceName", "ficResourceName", com.azure.core.util.Context.NONE); + } +} +``` + +### FederatedIdentityCredentials_Get + +```java +/** Samples for FederatedIdentityCredentials Get. */ +public final class FederatedIdentityCredentialsGetSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json + */ + /** + * Sample code: FederatedIdentityCredentialGet. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialGet( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .getWithResponse("rgName", "resourceName", "ficResourceName", com.azure.core.util.Context.NONE); + } +} +``` + +### FederatedIdentityCredentials_List + +```java +/** Samples for FederatedIdentityCredentials List. */ +public final class FederatedIdentityCredentialsListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialList.json + */ + /** + * Sample code: FederatedIdentityCredentialList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .list("rgName", "resourceName", null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/MsiOperationsList.json + */ + /** + * Sample code: MsiOperationsList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void msiOperationsList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### SystemAssignedIdentities_GetByScope + +```java +/** Samples for SystemAssignedIdentities GetByScope. */ +public final class SystemAssignedIdentitiesGetByScopeSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/SystemAssignedIdentityGet.json + */ + /** + * Sample code: MsiOperationsList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void msiOperationsList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.systemAssignedIdentities().getByScopeWithResponse("scope", com.azure.core.util.Context.NONE); + } +} +``` + +### UserAssignedIdentities_CreateOrUpdate + +```java +import java.util.HashMap; +import java.util.Map; + +/** Samples for UserAssignedIdentities CreateOrUpdate. */ +public final class UserAssignedIdentitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityCreate.json + */ + /** + * Sample code: IdentityCreate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityCreate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .define("resourceName") + .withRegion("eastus") + .withExistingResourceGroup("rgName") + .withTags(mapOf("key1", "value1", "key2", "value2")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### UserAssignedIdentities_Delete + +```java +/** Samples for UserAssignedIdentities Delete. */ +public final class UserAssignedIdentitiesDeleteSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityDelete.json + */ + /** + * Sample code: IdentityDelete. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityDelete(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .deleteByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE); + } +} +``` + +### UserAssignedIdentities_GetByResourceGroup + +```java +/** Samples for UserAssignedIdentities GetByResourceGroup. */ +public final class UserAssignedIdentitiesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json + */ + /** + * Sample code: IdentityGet. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityGet(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .getByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE); + } +} +``` + +### UserAssignedIdentities_List + +```java +/** Samples for UserAssignedIdentities List. */ +public final class UserAssignedIdentitiesListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListBySubscription.json + */ + /** + * Sample code: IdentityListBySubscription. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityListBySubscription( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.userAssignedIdentities().list(com.azure.core.util.Context.NONE); + } +} +``` + +### UserAssignedIdentities_ListByResourceGroup + +```java +/** Samples for UserAssignedIdentities ListByResourceGroup. */ +public final class UserAssignedIdentitiesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json + */ + /** + * Sample code: IdentityListByResourceGroup. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityListByResourceGroup( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.userAssignedIdentities().listByResourceGroup("rgName", com.azure.core.util.Context.NONE); + } +} +``` + +### UserAssignedIdentities_Update + +```java +import com.azure.resourcemanager.msi.generated.models.Identity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for UserAssignedIdentities Update. */ +public final class UserAssignedIdentitiesUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityUpdate.json + */ + /** + * Sample code: IdentityUpdate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityUpdate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + Identity resource = + manager + .userAssignedIdentities() + .getByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/msi/azure-resourcemanager-msi-generated/pom.xml b/sdk/msi/azure-resourcemanager-msi-generated/pom.xml new file mode 100644 index 000000000000..8b3b0ef2e0ed --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-msi-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ManagedServiceIdentity Management + This package contains Microsoft Azure SDK for ManagedServiceIdentity Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Managed Service Identity Client. Package tag package-2023-01-31. + 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 + true + + + + com.azure + azure-core + 1.35.0 + + + com.azure + azure-core-management + 1.10.0 + + + diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/ManagedServiceIdentityManager.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/ManagedServiceIdentityManager.java new file mode 100644 index 000000000000..188b6afe02f0 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/ManagedServiceIdentityManager.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.ManagedServiceIdentityClient; +import com.azure.resourcemanager.msi.generated.implementation.FederatedIdentityCredentialsImpl; +import com.azure.resourcemanager.msi.generated.implementation.ManagedServiceIdentityClientBuilder; +import com.azure.resourcemanager.msi.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.msi.generated.implementation.SystemAssignedIdentitiesImpl; +import com.azure.resourcemanager.msi.generated.implementation.UserAssignedIdentitiesImpl; +import com.azure.resourcemanager.msi.generated.models.FederatedIdentityCredentials; +import com.azure.resourcemanager.msi.generated.models.Operations; +import com.azure.resourcemanager.msi.generated.models.SystemAssignedIdentities; +import com.azure.resourcemanager.msi.generated.models.UserAssignedIdentities; +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 ManagedServiceIdentityManager. The Managed Service Identity Client. */ +public final class ManagedServiceIdentityManager { + private SystemAssignedIdentities systemAssignedIdentities; + + private Operations operations; + + private UserAssignedIdentities userAssignedIdentities; + + private FederatedIdentityCredentials federatedIdentityCredentials; + + private final ManagedServiceIdentityClient clientObject; + + private ManagedServiceIdentityManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ManagedServiceIdentityClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ManagedServiceIdentity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedServiceIdentity service API instance. + */ + public static ManagedServiceIdentityManager 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 ManagedServiceIdentity service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ManagedServiceIdentity service API instance. + */ + public static ManagedServiceIdentityManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ManagedServiceIdentityManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ManagedServiceIdentityManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagedServiceIdentityManager.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 ManagedServiceIdentity service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedServiceIdentity service API instance. + */ + public ManagedServiceIdentityManager 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.msi.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 ManagedServiceIdentityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of SystemAssignedIdentities. + * + * @return Resource collection API of SystemAssignedIdentities. + */ + public SystemAssignedIdentities systemAssignedIdentities() { + if (this.systemAssignedIdentities == null) { + this.systemAssignedIdentities = + new SystemAssignedIdentitiesImpl(clientObject.getSystemAssignedIdentities(), this); + } + return systemAssignedIdentities; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of UserAssignedIdentities. It manages Identity. + * + * @return Resource collection API of UserAssignedIdentities. + */ + public UserAssignedIdentities userAssignedIdentities() { + if (this.userAssignedIdentities == null) { + this.userAssignedIdentities = + new UserAssignedIdentitiesImpl(clientObject.getUserAssignedIdentities(), this); + } + return userAssignedIdentities; + } + + /** + * Gets the resource collection API of FederatedIdentityCredentials. It manages FederatedIdentityCredential. + * + * @return Resource collection API of FederatedIdentityCredentials. + */ + public FederatedIdentityCredentials federatedIdentityCredentials() { + if (this.federatedIdentityCredentials == null) { + this.federatedIdentityCredentials = + new FederatedIdentityCredentialsImpl(clientObject.getFederatedIdentityCredentials(), this); + } + return federatedIdentityCredentials; + } + + /** + * @return Wrapped service client ManagedServiceIdentityClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ManagedServiceIdentityClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/FederatedIdentityCredentialsClient.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/FederatedIdentityCredentialsClient.java new file mode 100644 index 000000000000..9d00fe7588b5 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/FederatedIdentityCredentialsClient.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.models.FederatedIdentityCredentialInner; + +/** An instance of this class provides access to all the operations defined in FederatedIdentityCredentialsClient. */ +public interface FederatedIdentityCredentialsClient { + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String resourceName); + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context); + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters, + Context context); + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FederatedIdentityCredentialInner createOrUpdate( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters); + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName, Context context); + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FederatedIdentityCredentialInner get( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName); + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 deleteWithResponse( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName, Context context); + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 delete(String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/ManagedServiceIdentityClient.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/ManagedServiceIdentityClient.java new file mode 100644 index 000000000000..4a674cbb3f46 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/ManagedServiceIdentityClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagedServiceIdentityClient class. */ +public interface ManagedServiceIdentityClient { + /** + * Gets The Id of the Subscription to which the identity belongs. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the SystemAssignedIdentitiesClient object to access its operations. + * + * @return the SystemAssignedIdentitiesClient object. + */ + SystemAssignedIdentitiesClient getSystemAssignedIdentities(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the UserAssignedIdentitiesClient object to access its operations. + * + * @return the UserAssignedIdentitiesClient object. + */ + UserAssignedIdentitiesClient getUserAssignedIdentities(); + + /** + * Gets the FederatedIdentityCredentialsClient object to access its operations. + * + * @return the FederatedIdentityCredentialsClient object. + */ + FederatedIdentityCredentialsClient getFederatedIdentityCredentials(); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/OperationsClient.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/OperationsClient.java new file mode 100644 index 000000000000..1330148ff373 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/SystemAssignedIdentitiesClient.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/SystemAssignedIdentitiesClient.java new file mode 100644 index 000000000000..ae75cd5645f4 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/SystemAssignedIdentitiesClient.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner; + +/** An instance of this class provides access to all the operations defined in SystemAssignedIdentitiesClient. */ +public interface SystemAssignedIdentitiesClient { + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByScopeWithResponse(String scope, Context context); + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SystemAssignedIdentityInner getByScope(String scope); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/UserAssignedIdentitiesClient.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/UserAssignedIdentitiesClient.java new file mode 100644 index 000000000000..88cd3c7272e4 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/UserAssignedIdentitiesClient.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.models.IdentityInner; +import com.azure.resourcemanager.msi.generated.models.IdentityUpdate; + +/** An instance of this class provides access to all the operations defined in UserAssignedIdentitiesClient. */ +public interface UserAssignedIdentitiesClient { + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String resourceName, IdentityInner parameters, Context context); + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IdentityInner createOrUpdate(String resourceGroupName, String resourceName, IdentityInner parameters); + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourceName, IdentityUpdate parameters, Context context); + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IdentityInner update(String resourceGroupName, String resourceName, IdentityUpdate parameters); + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IdentityInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 deleteWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 delete(String resourceGroupName, String resourceName); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialInner.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialInner.java new file mode 100644 index 000000000000..b5e51fd6f0ac --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a federated identity credential. */ +@Fluent +public final class FederatedIdentityCredentialInner extends ProxyResource { + /* + * Federated identity credential properties. + * + * The properties associated with the federated identity credential. + */ + @JsonProperty(value = "properties") + private FederatedIdentityCredentialProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of FederatedIdentityCredentialInner class. */ + public FederatedIdentityCredentialInner() { + } + + /** + * Get the innerProperties property: Federated identity credential properties. + * + *

The properties associated with the federated identity credential. + * + * @return the innerProperties value. + */ + private FederatedIdentityCredentialProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the issuer property: The URL of the issuer to be trusted. + * + * @return the issuer value. + */ + public String issuer() { + return this.innerProperties() == null ? null : this.innerProperties().issuer(); + } + + /** + * Set the issuer property: The URL of the issuer to be trusted. + * + * @param issuer the issuer value to set. + * @return the FederatedIdentityCredentialInner object itself. + */ + public FederatedIdentityCredentialInner withIssuer(String issuer) { + if (this.innerProperties() == null) { + this.innerProperties = new FederatedIdentityCredentialProperties(); + } + this.innerProperties().withIssuer(issuer); + return this; + } + + /** + * Get the subject property: The identifier of the external identity. + * + * @return the subject value. + */ + public String subject() { + return this.innerProperties() == null ? null : this.innerProperties().subject(); + } + + /** + * Set the subject property: The identifier of the external identity. + * + * @param subject the subject value to set. + * @return the FederatedIdentityCredentialInner object itself. + */ + public FederatedIdentityCredentialInner withSubject(String subject) { + if (this.innerProperties() == null) { + this.innerProperties = new FederatedIdentityCredentialProperties(); + } + this.innerProperties().withSubject(subject); + return this; + } + + /** + * Get the audiences property: The list of audiences that can appear in the issued token. + * + * @return the audiences value. + */ + public List audiences() { + return this.innerProperties() == null ? null : this.innerProperties().audiences(); + } + + /** + * Set the audiences property: The list of audiences that can appear in the issued token. + * + * @param audiences the audiences value to set. + * @return the FederatedIdentityCredentialInner object itself. + */ + public FederatedIdentityCredentialInner withAudiences(List audiences) { + if (this.innerProperties() == null) { + this.innerProperties = new FederatedIdentityCredentialProperties(); + } + this.innerProperties().withAudiences(audiences); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialProperties.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialProperties.java new file mode 100644 index 000000000000..b88ed4d7523c --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/FederatedIdentityCredentialProperties.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.msi.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Federated identity credential properties. + * + *

The properties associated with a federated identity credential. + */ +@Fluent +public final class FederatedIdentityCredentialProperties { + /* + * The URL of the issuer to be trusted. + */ + @JsonProperty(value = "issuer", required = true) + private String issuer; + + /* + * The identifier of the external identity. + */ + @JsonProperty(value = "subject", required = true) + private String subject; + + /* + * The list of audiences that can appear in the issued token. + */ + @JsonProperty(value = "audiences", required = true) + private List audiences; + + /** Creates an instance of FederatedIdentityCredentialProperties class. */ + public FederatedIdentityCredentialProperties() { + } + + /** + * Get the issuer property: The URL of the issuer to be trusted. + * + * @return the issuer value. + */ + public String issuer() { + return this.issuer; + } + + /** + * Set the issuer property: The URL of the issuer to be trusted. + * + * @param issuer the issuer value to set. + * @return the FederatedIdentityCredentialProperties object itself. + */ + public FederatedIdentityCredentialProperties withIssuer(String issuer) { + this.issuer = issuer; + return this; + } + + /** + * Get the subject property: The identifier of the external identity. + * + * @return the subject value. + */ + public String subject() { + return this.subject; + } + + /** + * Set the subject property: The identifier of the external identity. + * + * @param subject the subject value to set. + * @return the FederatedIdentityCredentialProperties object itself. + */ + public FederatedIdentityCredentialProperties withSubject(String subject) { + this.subject = subject; + return this; + } + + /** + * Get the audiences property: The list of audiences that can appear in the issued token. + * + * @return the audiences value. + */ + public List audiences() { + return this.audiences; + } + + /** + * Set the audiences property: The list of audiences that can appear in the issued token. + * + * @param audiences the audiences value to set. + * @return the FederatedIdentityCredentialProperties object itself. + */ + public FederatedIdentityCredentialProperties withAudiences(List audiences) { + this.audiences = audiences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (issuer() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property issuer in model FederatedIdentityCredentialProperties")); + } + if (subject() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property subject in model FederatedIdentityCredentialProperties")); + } + if (audiences() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property audiences in model FederatedIdentityCredentialProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(FederatedIdentityCredentialProperties.class); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/IdentityInner.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/IdentityInner.java new file mode 100644 index 000000000000..d1c41e7d5f6a --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/IdentityInner.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.msi.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Describes an identity resource. */ +@Fluent +public final class IdentityInner extends Resource { + /* + * User Assigned Identity properties. + * + * The properties associated with the identity. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private UserAssignedIdentityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of IdentityInner class. */ + public IdentityInner() { + } + + /** + * Get the innerProperties property: User Assigned Identity properties. + * + *

The properties associated with the identity. + * + * @return the innerProperties value. + */ + private UserAssignedIdentityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public IdentityInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public IdentityInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Get the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.innerProperties() == null ? null : this.innerProperties().clientId(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/OperationInner.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/OperationInner.java new file mode 100644 index 000000000000..405cd5e8460e --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/OperationInner.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.msi.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Microsoft.ManagedIdentity Operation. + * + *

Operation supported by the Microsoft.ManagedIdentity REST API. + */ +@Fluent +public final class OperationInner { + /* + * Operation Name. + * + * The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Operation Display. + * + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: Operation Name. + * + *

The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation Name. + * + *

The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Operation Display. + * + *

The object that describes the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Operation Display. + * + *

The object that describes the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityInner.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityInner.java new file mode 100644 index 000000000000..887860b87b8f --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Describes a system assigned identity resource. */ +@Fluent +public final class SystemAssignedIdentityInner extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * System Assigned Identity properties. + * + * The properties associated with the identity. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private SystemAssignedIdentityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of SystemAssignedIdentityInner class. */ + public SystemAssignedIdentityInner() { + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the SystemAssignedIdentityInner object itself. + */ + public SystemAssignedIdentityInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the SystemAssignedIdentityInner object itself. + */ + public SystemAssignedIdentityInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: System Assigned Identity properties. + * + *

The properties associated with the identity. + * + * @return the innerProperties value. + */ + private SystemAssignedIdentityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Get the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.innerProperties() == null ? null : this.innerProperties().clientId(); + } + + /** + * Get the clientSecretUrl property: The ManagedServiceIdentity DataPlane URL that can be queried to obtain the + * identity credentials. + * + * @return the clientSecretUrl value. + */ + public String clientSecretUrl() { + return this.innerProperties() == null ? null : this.innerProperties().clientSecretUrl(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model SystemAssignedIdentityInner")); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SystemAssignedIdentityInner.class); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityProperties.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityProperties.java new file mode 100644 index 000000000000..cedd22639f5d --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/SystemAssignedIdentityProperties.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** + * System Assigned Identity properties. + * + *

The properties associated with the system assigned identity. + */ +@Immutable +public final class SystemAssignedIdentityProperties { + /* + * The id of the tenant which the identity belongs to. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * The id of the service principal object associated with the created identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The id of the app associated with the identity. This is a random generated UUID by MSI. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /* + * The ManagedServiceIdentity DataPlane URL that can be queried to obtain the identity credentials. + */ + @JsonProperty(value = "clientSecretUrl", access = JsonProperty.Access.WRITE_ONLY) + private String clientSecretUrl; + + /** Creates an instance of SystemAssignedIdentityProperties class. */ + public SystemAssignedIdentityProperties() { + } + + /** + * Get the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Get the clientSecretUrl property: The ManagedServiceIdentity DataPlane URL that can be queried to obtain the + * identity credentials. + * + * @return the clientSecretUrl value. + */ + public String clientSecretUrl() { + return this.clientSecretUrl; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/UserAssignedIdentityProperties.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/UserAssignedIdentityProperties.java new file mode 100644 index 000000000000..1e89f1860f40 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/UserAssignedIdentityProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** + * User Assigned Identity properties. + * + *

The properties associated with the user assigned identity. + */ +@Immutable +public final class UserAssignedIdentityProperties { + /* + * The id of the tenant which the identity belongs to. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * The id of the service principal object associated with the created identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The id of the app associated with the identity. This is a random generated UUID by MSI. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentityProperties class. */ + public UserAssignedIdentityProperties() { + } + + /** + * Get the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/package-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/package-info.java new file mode 100644 index 000000000000..1ea8daad79fa --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// 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 ManagedServiceIdentityClient. The Managed Service Identity Client. */ +package com.azure.resourcemanager.msi.generated.fluent.models; diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/package-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/package-info.java new file mode 100644 index 000000000000..b05819f46a21 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/fluent/package-info.java @@ -0,0 +1,6 @@ +// 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 ManagedServiceIdentityClient. The Managed Service Identity Client. */ +package com.azure.resourcemanager.msi.generated.fluent; diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialImpl.java new file mode 100644 index 000000000000..fc6fd127ed23 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner; +import com.azure.resourcemanager.msi.generated.models.FederatedIdentityCredential; +import java.util.Collections; +import java.util.List; + +public final class FederatedIdentityCredentialImpl + implements FederatedIdentityCredential, FederatedIdentityCredential.Definition, FederatedIdentityCredential.Update { + private FederatedIdentityCredentialInner innerObject; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String issuer() { + return this.innerModel().issuer(); + } + + public String subject() { + return this.innerModel().subject(); + } + + public List audiences() { + List inner = this.innerModel().audiences(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public FederatedIdentityCredentialInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private String federatedIdentityCredentialResourceName; + + public FederatedIdentityCredentialImpl withExistingUserAssignedIdentity( + String resourceGroupName, String resourceName) { + this.resourceGroupName = resourceGroupName; + this.resourceName = resourceName; + return this; + } + + public FederatedIdentityCredential create() { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .createOrUpdateWithResponse( + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public FederatedIdentityCredential create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .createOrUpdateWithResponse( + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.innerModel(), + context) + .getValue(); + return this; + } + + FederatedIdentityCredentialImpl( + String name, com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerObject = new FederatedIdentityCredentialInner(); + this.serviceManager = serviceManager; + this.federatedIdentityCredentialResourceName = name; + } + + public FederatedIdentityCredentialImpl update() { + return this; + } + + public FederatedIdentityCredential apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .createOrUpdateWithResponse( + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public FederatedIdentityCredential apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .createOrUpdateWithResponse( + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.innerModel(), + context) + .getValue(); + return this; + } + + FederatedIdentityCredentialImpl( + FederatedIdentityCredentialInner innerObject, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "userAssignedIdentities"); + this.federatedIdentityCredentialResourceName = + Utils.getValueFromIdByName(innerObject.id(), "federatedIdentityCredentials"); + } + + public FederatedIdentityCredential refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, Context.NONE) + .getValue(); + return this; + } + + public FederatedIdentityCredential refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFederatedIdentityCredentials() + .getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context) + .getValue(); + return this; + } + + public FederatedIdentityCredentialImpl withIssuer(String issuer) { + this.innerModel().withIssuer(issuer); + return this; + } + + public FederatedIdentityCredentialImpl withSubject(String subject) { + this.innerModel().withSubject(subject); + return this; + } + + public FederatedIdentityCredentialImpl withAudiences(List audiences) { + this.innerModel().withAudiences(audiences); + return this; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsClientImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsClientImpl.java new file mode 100644 index 000000000000..6ada442a2a09 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsClientImpl.java @@ -0,0 +1,996 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.msi.generated.fluent.FederatedIdentityCredentialsClient; +import com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner; +import com.azure.resourcemanager.msi.generated.models.FederatedIdentityCredentialsListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FederatedIdentityCredentialsClient. */ +public final class FederatedIdentityCredentialsClientImpl implements FederatedIdentityCredentialsClient { + /** The proxy service used to perform REST calls. */ + private final FederatedIdentityCredentialsService service; + + /** The service client containing this operation class. */ + private final ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of FederatedIdentityCredentialsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FederatedIdentityCredentialsClientImpl(ManagedServiceIdentityClientImpl client) { + this.service = + RestProxy + .create( + FederatedIdentityCredentialsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServiceIdentityClientFederatedIdentityCredentials to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServiceIdenti") + public interface FederatedIdentityCredentialsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}/federatedIdentityCredentials") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("$top") Integer top, + @QueryParam("$skiptoken") String skiptoken, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}/federatedIdentityCredentials" + + "/{federatedIdentityCredentialResourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("federatedIdentityCredentialResourceName") String federatedIdentityCredentialResourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FederatedIdentityCredentialInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}/federatedIdentityCredentials" + + "/{federatedIdentityCredentialResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("federatedIdentityCredentialResourceName") String federatedIdentityCredentialResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}/federatedIdentityCredentials" + + "/{federatedIdentityCredentialResourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @PathParam("federatedIdentityCredentialResourceName") String federatedIdentityCredentialResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String resourceName, Integer top, String skiptoken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + top, + skiptoken, + 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())); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + top, + skiptoken, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String resourceName, Integer top, String skiptoken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, resourceName, top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String resourceName) { + final Integer top = null; + final String skiptoken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, resourceName, top, skiptoken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, resourceName, top, skiptoken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String resourceName) { + final Integer top = null; + final String skiptoken = null; + return new PagedIterable<>(listAsync(resourceGroupName, resourceName, top, skiptoken)); + } + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, resourceName, top, skiptoken, context)); + } + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName 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 + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName 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 + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters) { + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceName, federatedIdentityCredentialResourceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, resourceName, federatedIdentityCredentialResourceName, parameters, context) + .block(); + } + + /** + * Create or update a federated identity credential under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @param parameters Parameters to create or update the federated identity credential. + * @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 describes a federated identity credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FederatedIdentityCredentialInner createOrUpdate( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + FederatedIdentityCredentialInner parameters) { + return createOrUpdateWithResponse( + resourceGroupName, resourceName, federatedIdentityCredentialResourceName, parameters, Context.NONE) + .getValue(); + } + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + return getWithResponseAsync(resourceGroupName, resourceName, federatedIdentityCredentialResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + return getWithResponseAsync(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context) + .block(); + } + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FederatedIdentityCredentialInner get( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + return getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, Context.NONE) + .getValue(); + } + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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> deleteWithResponseAsync( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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> deleteWithResponseAsync( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (federatedIdentityCredentialResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter federatedIdentityCredentialResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + federatedIdentityCredentialResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 deleteAsync( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + return deleteWithResponseAsync(resourceGroupName, resourceName, federatedIdentityCredentialResourceName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 deleteWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context) + .block(); + } + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 delete(String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + deleteWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, Context.NONE); + } + + /** + * 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 values returned by the List operation for federated identity credentials along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 values returned by the List operation for federated identity credentials along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsImpl.java new file mode 100644 index 000000000000..718ffd5bb760 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/FederatedIdentityCredentialsImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.FederatedIdentityCredentialsClient; +import com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner; +import com.azure.resourcemanager.msi.generated.models.FederatedIdentityCredential; +import com.azure.resourcemanager.msi.generated.models.FederatedIdentityCredentials; + +public final class FederatedIdentityCredentialsImpl implements FederatedIdentityCredentials { + private static final ClientLogger LOGGER = new ClientLogger(FederatedIdentityCredentialsImpl.class); + + private final FederatedIdentityCredentialsClient innerClient; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public FederatedIdentityCredentialsImpl( + FederatedIdentityCredentialsClient innerClient, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String resourceName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, resourceName); + return Utils.mapPage(inner, inner1 -> new FederatedIdentityCredentialImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, resourceName, top, skiptoken, context); + return Utils.mapPage(inner, inner1 -> new FederatedIdentityCredentialImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FederatedIdentityCredentialImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FederatedIdentityCredential get( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + FederatedIdentityCredentialInner inner = + this.serviceClient().get(resourceGroupName, resourceName, federatedIdentityCredentialResourceName); + if (inner != null) { + return new FederatedIdentityCredentialImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String resourceGroupName, + String resourceName, + String federatedIdentityCredentialResourceName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context); + } + + public void delete(String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName) { + this.serviceClient().delete(resourceGroupName, resourceName, federatedIdentityCredentialResourceName); + } + + public FederatedIdentityCredential getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + String federatedIdentityCredentialResourceName = Utils.getValueFromIdByName(id, "federatedIdentityCredentials"); + if (federatedIdentityCredentialResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'federatedIdentityCredentials'.", + id))); + } + return this + .getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + String federatedIdentityCredentialResourceName = Utils.getValueFromIdByName(id, "federatedIdentityCredentials"); + if (federatedIdentityCredentialResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'federatedIdentityCredentials'.", + id))); + } + return this.getWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + String federatedIdentityCredentialResourceName = Utils.getValueFromIdByName(id, "federatedIdentityCredentials"); + if (federatedIdentityCredentialResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'federatedIdentityCredentials'.", + id))); + } + this.deleteWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + String federatedIdentityCredentialResourceName = Utils.getValueFromIdByName(id, "federatedIdentityCredentials"); + if (federatedIdentityCredentialResourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'federatedIdentityCredentials'.", + id))); + } + return this + .deleteWithResponse(resourceGroupName, resourceName, federatedIdentityCredentialResourceName, context); + } + + private FederatedIdentityCredentialsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } + + public FederatedIdentityCredentialImpl define(String name) { + return new FederatedIdentityCredentialImpl(name, this.manager()); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/IdentityImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/IdentityImpl.java new file mode 100644 index 000000000000..2d1d9faff543 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/IdentityImpl.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner; +import com.azure.resourcemanager.msi.generated.models.Identity; +import com.azure.resourcemanager.msi.generated.models.IdentityUpdate; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public final class IdentityImpl implements Identity, Identity.Definition, Identity.Update { + private IdentityInner innerObject; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public UUID principalId() { + return this.innerModel().principalId(); + } + + public UUID clientId() { + return this.innerModel().clientId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public IdentityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String resourceName; + + private IdentityUpdate updateParameters; + + public IdentityImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Identity create() { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .createOrUpdateWithResponse(resourceGroupName, resourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Identity create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .createOrUpdateWithResponse(resourceGroupName, resourceName, this.innerModel(), context) + .getValue(); + return this; + } + + IdentityImpl(String name, com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerObject = new IdentityInner(); + this.serviceManager = serviceManager; + this.resourceName = name; + } + + public IdentityImpl update() { + this.updateParameters = new IdentityUpdate(); + return this; + } + + public Identity apply() { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public Identity apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .updateWithResponse(resourceGroupName, resourceName, updateParameters, context) + .getValue(); + return this; + } + + IdentityImpl( + IdentityInner innerObject, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.resourceName = Utils.getValueFromIdByName(innerObject.id(), "userAssignedIdentities"); + } + + public Identity refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) + .getValue(); + return this; + } + + public Identity refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getUserAssignedIdentities() + .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) + .getValue(); + return this; + } + + public IdentityImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public IdentityImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public IdentityImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientBuilder.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientBuilder.java new file mode 100644 index 000000000000..59395e1cd901 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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 ManagedServiceIdentityClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagedServiceIdentityClientImpl.class}) +public final class ManagedServiceIdentityClientBuilder { + /* + * The Id of the Subscription to which the identity belongs. + */ + private String subscriptionId; + + /** + * Sets The Id of the Subscription to which the identity belongs. + * + * @param subscriptionId the subscriptionId value. + * @return the ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder 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 ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder 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 ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder 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 ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder 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 ManagedServiceIdentityClientBuilder. + */ + public ManagedServiceIdentityClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagedServiceIdentityClientImpl with the provided parameters. + * + * @return an instance of ManagedServiceIdentityClientImpl. + */ + public ManagedServiceIdentityClientImpl 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(); + ManagedServiceIdentityClientImpl client = + new ManagedServiceIdentityClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientImpl.java new file mode 100644 index 000000000000..af39f4deefd6 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/ManagedServiceIdentityClientImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.FederatedIdentityCredentialsClient; +import com.azure.resourcemanager.msi.generated.fluent.ManagedServiceIdentityClient; +import com.azure.resourcemanager.msi.generated.fluent.OperationsClient; +import com.azure.resourcemanager.msi.generated.fluent.SystemAssignedIdentitiesClient; +import com.azure.resourcemanager.msi.generated.fluent.UserAssignedIdentitiesClient; +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 ManagedServiceIdentityClientImpl type. */ +@ServiceClient(builder = ManagedServiceIdentityClientBuilder.class) +public final class ManagedServiceIdentityClientImpl implements ManagedServiceIdentityClient { + /** The Id of the Subscription to which the identity belongs. */ + private final String subscriptionId; + + /** + * Gets The Id of the Subscription to which the identity belongs. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The SystemAssignedIdentitiesClient object to access its operations. */ + private final SystemAssignedIdentitiesClient systemAssignedIdentities; + + /** + * Gets the SystemAssignedIdentitiesClient object to access its operations. + * + * @return the SystemAssignedIdentitiesClient object. + */ + public SystemAssignedIdentitiesClient getSystemAssignedIdentities() { + return this.systemAssignedIdentities; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The UserAssignedIdentitiesClient object to access its operations. */ + private final UserAssignedIdentitiesClient userAssignedIdentities; + + /** + * Gets the UserAssignedIdentitiesClient object to access its operations. + * + * @return the UserAssignedIdentitiesClient object. + */ + public UserAssignedIdentitiesClient getUserAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** The FederatedIdentityCredentialsClient object to access its operations. */ + private final FederatedIdentityCredentialsClient federatedIdentityCredentials; + + /** + * Gets the FederatedIdentityCredentialsClient object to access its operations. + * + * @return the FederatedIdentityCredentialsClient object. + */ + public FederatedIdentityCredentialsClient getFederatedIdentityCredentials() { + return this.federatedIdentityCredentials; + } + + /** + * Initializes an instance of ManagedServiceIdentityClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The Id of the Subscription to which the identity belongs. + * @param endpoint server parameter. + */ + ManagedServiceIdentityClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2023-01-31"; + this.systemAssignedIdentities = new SystemAssignedIdentitiesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.userAssignedIdentities = new UserAssignedIdentitiesClientImpl(this); + this.federatedIdentityCredentials = new FederatedIdentityCredentialsClientImpl(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(ManagedServiceIdentityClientImpl.class); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationImpl.java new file mode 100644 index 000000000000..ae6db2de9931 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationImpl.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.msi.generated.models.Operation; +import com.azure.resourcemanager.msi.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsClientImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..68e3fe610e39 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +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.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.msi.generated.fluent.OperationsClient; +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.msi.generated.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagedServiceIdentityClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServiceIdentityClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServiceIdenti") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ManagedIdentity/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.list(this.client.getEndpoint(), 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())); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + 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 + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * 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 operations List along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 operations List along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsImpl.java new file mode 100644 index 000000000000..5acc3fdfd740 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/OperationsImpl.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.msi.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.msi.generated.fluent.OperationsClient; +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.msi.generated.models.Operation; +import com.azure.resourcemanager.msi.generated.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesClientImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesClientImpl.java new file mode 100644 index 000000000000..280db3e8a1f2 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesClientImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +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.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.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.msi.generated.fluent.SystemAssignedIdentitiesClient; +import com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SystemAssignedIdentitiesClient. */ +public final class SystemAssignedIdentitiesClientImpl implements SystemAssignedIdentitiesClient { + /** The proxy service used to perform REST calls. */ + private final SystemAssignedIdentitiesService service; + + /** The service client containing this operation class. */ + private final ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of SystemAssignedIdentitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SystemAssignedIdentitiesClientImpl(ManagedServiceIdentityClientImpl client) { + this.service = + RestProxy + .create(SystemAssignedIdentitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServiceIdentityClientSystemAssignedIdentities to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServiceIdenti") + public interface SystemAssignedIdentitiesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedIdentity/identities/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByScope( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByScopeWithResponseAsync(String scope) { + 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.getByScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByScopeWithResponseAsync(String scope, 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.getByScope(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByScopeAsync(String scope) { + return getByScopeWithResponseAsync(scope).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByScopeWithResponse(String scope, Context context) { + return getByScopeWithResponseAsync(scope, context).block(); + } + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SystemAssignedIdentityInner getByScope(String scope) { + return getByScopeWithResponse(scope, Context.NONE).getValue(); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesImpl.java new file mode 100644 index 000000000000..ff8922db5a64 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentitiesImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +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.msi.generated.fluent.SystemAssignedIdentitiesClient; +import com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner; +import com.azure.resourcemanager.msi.generated.models.SystemAssignedIdentities; +import com.azure.resourcemanager.msi.generated.models.SystemAssignedIdentity; + +public final class SystemAssignedIdentitiesImpl implements SystemAssignedIdentities { + private static final ClientLogger LOGGER = new ClientLogger(SystemAssignedIdentitiesImpl.class); + + private final SystemAssignedIdentitiesClient innerClient; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public SystemAssignedIdentitiesImpl( + SystemAssignedIdentitiesClient innerClient, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByScopeWithResponse(String scope, Context context) { + Response inner = this.serviceClient().getByScopeWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new SystemAssignedIdentityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SystemAssignedIdentity getByScope(String scope) { + SystemAssignedIdentityInner inner = this.serviceClient().getByScope(scope); + if (inner != null) { + return new SystemAssignedIdentityImpl(inner, this.manager()); + } else { + return null; + } + } + + private SystemAssignedIdentitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentityImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentityImpl.java new file mode 100644 index 000000000000..b24c8ba93878 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/SystemAssignedIdentityImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner; +import com.azure.resourcemanager.msi.generated.models.SystemAssignedIdentity; +import java.util.Collections; +import java.util.Map; +import java.util.UUID; + +public final class SystemAssignedIdentityImpl implements SystemAssignedIdentity { + private SystemAssignedIdentityInner innerObject; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + SystemAssignedIdentityImpl( + SystemAssignedIdentityInner innerObject, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager 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 location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public UUID principalId() { + return this.innerModel().principalId(); + } + + public UUID clientId() { + return this.innerModel().clientId(); + } + + public String clientSecretUrl() { + return this.innerModel().clientSecretUrl(); + } + + public SystemAssignedIdentityInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesClientImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesClientImpl.java new file mode 100644 index 000000000000..433e4e0d4c28 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesClientImpl.java @@ -0,0 +1,1232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.msi.generated.fluent.UserAssignedIdentitiesClient; +import com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner; +import com.azure.resourcemanager.msi.generated.models.IdentityUpdate; +import com.azure.resourcemanager.msi.generated.models.UserAssignedIdentitiesListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in UserAssignedIdentitiesClient. */ +public final class UserAssignedIdentitiesClientImpl implements UserAssignedIdentitiesClient { + /** The proxy service used to perform REST calls. */ + private final UserAssignedIdentitiesService service; + + /** The service client containing this operation class. */ + private final ManagedServiceIdentityClientImpl client; + + /** + * Initializes an instance of UserAssignedIdentitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + UserAssignedIdentitiesClientImpl(ManagedServiceIdentityClientImpl client) { + this.service = + RestProxy + .create(UserAssignedIdentitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServiceIdentityClientUserAssignedIdentities to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServiceIdenti") + public interface UserAssignedIdentitiesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ManagedIdentity/userAssignedIdentities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") IdentityInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") IdentityUpdate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity" + + "/userAssignedIdentities/{resourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + 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())); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @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 values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + 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())); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, IdentityInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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 + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String resourceName, IdentityInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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 + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String resourceName, IdentityInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Create or update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to create or update the identity. + * @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 describes an identity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IdentityInner createOrUpdate(String resourceGroupName, String resourceName, IdentityInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, resourceName, parameters, Context.NONE).getValue(); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, IdentityUpdate parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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 + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, IdentityUpdate parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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 + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String resourceName, IdentityUpdate parameters) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourceName, IdentityUpdate parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, resourceName, parameters, context).block(); + } + + /** + * Update an identity in the specified subscription and resource group. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @param parameters Parameters to update the identity. + * @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 describes an identity resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IdentityInner update(String resourceGroupName, String resourceName, IdentityUpdate parameters) { + return updateWithResponse(resourceGroupName, resourceName, parameters, Context.NONE).getValue(); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IdentityInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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> deleteWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithResponseAsync(resourceGroupName, resourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 deleteWithResponse(String resourceGroupName, String resourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 delete(String resourceGroupName, String resourceName) { + deleteWithResponse(resourceGroupName, resourceName, Context.NONE); + } + + /** + * 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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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 + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 values returned by the List operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + 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 + .listByResourceGroupNext(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/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesImpl.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesImpl.java new file mode 100644 index 000000000000..d3b23613c4b9 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/UserAssignedIdentitiesImpl.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.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.msi.generated.fluent.UserAssignedIdentitiesClient; +import com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner; +import com.azure.resourcemanager.msi.generated.models.Identity; +import com.azure.resourcemanager.msi.generated.models.UserAssignedIdentities; + +public final class UserAssignedIdentitiesImpl implements UserAssignedIdentities { + private static final ClientLogger LOGGER = new ClientLogger(UserAssignedIdentitiesImpl.class); + + private final UserAssignedIdentitiesClient innerClient; + + private final com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager; + + public UserAssignedIdentitiesImpl( + UserAssignedIdentitiesClient innerClient, + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new IdentityImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new IdentityImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new IdentityImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new IdentityImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IdentityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Identity getByResourceGroup(String resourceGroupName, String resourceName) { + IdentityInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new IdentityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public Identity getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "userAssignedIdentities"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'userAssignedIdentities'.", + id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + private UserAssignedIdentitiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager() { + return this.serviceManager; + } + + public IdentityImpl define(String name) { + return new IdentityImpl(name, this.manager()); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/Utils.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/Utils.java new file mode 100644 index 000000000000..43bd999744a9 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/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.msi.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/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/package-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/package-info.java new file mode 100644 index 000000000000..f92151ef0f4b --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/implementation/package-info.java @@ -0,0 +1,6 @@ +// 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 ManagedServiceIdentityClient. The Managed Service Identity Client. */ +package com.azure.resourcemanager.msi.generated.implementation; diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredential.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredential.java new file mode 100644 index 000000000000..4c17f7047d74 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredential.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner; +import java.util.List; + +/** An immutable client-side representation of FederatedIdentityCredential. */ +public interface FederatedIdentityCredential { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the issuer property: The URL of the issuer to be trusted. + * + * @return the issuer value. + */ + String issuer(); + + /** + * Gets the subject property: The identifier of the external identity. + * + * @return the subject value. + */ + String subject(); + + /** + * Gets the audiences property: The list of audiences that can appear in the issued token. + * + * @return the audiences value. + */ + List audiences(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner object. + * + * @return the inner object. + */ + FederatedIdentityCredentialInner innerModel(); + + /** The entirety of the FederatedIdentityCredential definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FederatedIdentityCredential definition stages. */ + interface DefinitionStages { + /** The first stage of the FederatedIdentityCredential definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FederatedIdentityCredential definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, resourceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @return the next definition stage. + */ + WithCreate withExistingUserAssignedIdentity(String resourceGroupName, String resourceName); + } + /** + * The stage of the FederatedIdentityCredential 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.WithIssuer, DefinitionStages.WithSubject, DefinitionStages.WithAudiences { + /** + * Executes the create request. + * + * @return the created resource. + */ + FederatedIdentityCredential create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FederatedIdentityCredential create(Context context); + } + /** The stage of the FederatedIdentityCredential definition allowing to specify issuer. */ + interface WithIssuer { + /** + * Specifies the issuer property: The URL of the issuer to be trusted.. + * + * @param issuer The URL of the issuer to be trusted. + * @return the next definition stage. + */ + WithCreate withIssuer(String issuer); + } + /** The stage of the FederatedIdentityCredential definition allowing to specify subject. */ + interface WithSubject { + /** + * Specifies the subject property: The identifier of the external identity.. + * + * @param subject The identifier of the external identity. + * @return the next definition stage. + */ + WithCreate withSubject(String subject); + } + /** The stage of the FederatedIdentityCredential definition allowing to specify audiences. */ + interface WithAudiences { + /** + * Specifies the audiences property: The list of audiences that can appear in the issued token.. + * + * @param audiences The list of audiences that can appear in the issued token. + * @return the next definition stage. + */ + WithCreate withAudiences(List audiences); + } + } + /** + * Begins update for the FederatedIdentityCredential resource. + * + * @return the stage of resource update. + */ + FederatedIdentityCredential.Update update(); + + /** The template for FederatedIdentityCredential update. */ + interface Update extends UpdateStages.WithIssuer, UpdateStages.WithSubject, UpdateStages.WithAudiences { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FederatedIdentityCredential apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FederatedIdentityCredential apply(Context context); + } + /** The FederatedIdentityCredential update stages. */ + interface UpdateStages { + /** The stage of the FederatedIdentityCredential update allowing to specify issuer. */ + interface WithIssuer { + /** + * Specifies the issuer property: The URL of the issuer to be trusted.. + * + * @param issuer The URL of the issuer to be trusted. + * @return the next definition stage. + */ + Update withIssuer(String issuer); + } + /** The stage of the FederatedIdentityCredential update allowing to specify subject. */ + interface WithSubject { + /** + * Specifies the subject property: The identifier of the external identity.. + * + * @param subject The identifier of the external identity. + * @return the next definition stage. + */ + Update withSubject(String subject); + } + /** The stage of the FederatedIdentityCredential update allowing to specify audiences. */ + interface WithAudiences { + /** + * Specifies the audiences property: The list of audiences that can appear in the issued token.. + * + * @param audiences The list of audiences that can appear in the issued token. + * @return the next definition stage. + */ + Update withAudiences(List audiences); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FederatedIdentityCredential refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FederatedIdentityCredential refresh(Context context); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentials.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentials.java new file mode 100644 index 000000000000..c9849bfcae68 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentials.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of FederatedIdentityCredentials. */ +public interface FederatedIdentityCredentials { + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String resourceName); + + /** + * Lists all the federated identity credentials under the specified user assigned identity. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param top Number of records to return. + * @param skiptoken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @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 values returned by the List operation for federated identity credentials as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list( + String resourceGroupName, String resourceName, Integer top, String skiptoken, Context context); + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName, Context context); + + /** + * Gets the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 federated identity credential. + */ + FederatedIdentityCredential get( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName); + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 deleteWithResponse( + String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName, Context context); + + /** + * Deletes the federated identity credential. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the identity resource. + * @param federatedIdentityCredentialResourceName The name of the federated identity credential resource. + * @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 delete(String resourceGroupName, String resourceName, String federatedIdentityCredentialResourceName); + + /** + * Gets the federated identity credential. + * + * @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 federated identity credential along with {@link Response}. + */ + FederatedIdentityCredential getById(String id); + + /** + * Gets the federated identity credential. + * + * @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 federated identity credential along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the federated identity credential. + * + * @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. + */ + void deleteById(String id); + + /** + * Deletes the federated identity credential. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FederatedIdentityCredential resource. + * + * @param name resource name. + * @return the first stage of the new FederatedIdentityCredential definition. + */ + FederatedIdentityCredential.DefinitionStages.Blank define(String name); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentialsListResult.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentialsListResult.java new file mode 100644 index 000000000000..6ffeb443c810 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/FederatedIdentityCredentialsListResult.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.msi.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.msi.generated.fluent.models.FederatedIdentityCredentialInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation for federated identity credentials. */ +@Fluent +public final class FederatedIdentityCredentialsListResult { + /* + * The collection of federated identity credentials returned by the listing operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The url to get the next page of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of FederatedIdentityCredentialsListResult class. */ + public FederatedIdentityCredentialsListResult() { + } + + /** + * Get the value property: The collection of federated identity credentials returned by the listing operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of federated identity credentials returned by the listing operation. + * + * @param value the value value to set. + * @return the FederatedIdentityCredentialsListResult object itself. + */ + public FederatedIdentityCredentialsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The url to get the next page of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The url to get the next page of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the FederatedIdentityCredentialsListResult object itself. + */ + public FederatedIdentityCredentialsListResult 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/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Identity.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Identity.java new file mode 100644 index 000000000000..6fe4f3dc4133 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Identity.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of Identity. */ +public interface Identity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + UUID principalId(); + + /** + * Gets the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + UUID clientId(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner object. + * + * @return the inner object. + */ + IdentityInner innerModel(); + + /** The entirety of the Identity definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The Identity definition stages. */ + interface DefinitionStages { + /** The first stage of the Identity definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Identity definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Identity definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the Identity 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.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + Identity create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Identity create(Context context); + } + /** The stage of the Identity definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the Identity resource. + * + * @return the stage of resource update. + */ + Identity.Update update(); + + /** The template for Identity update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Identity apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Identity apply(Context context); + } + /** The Identity update stages. */ + interface UpdateStages { + /** The stage of the Identity update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Identity refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Identity refresh(Context context); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/IdentityUpdate.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/IdentityUpdate.java new file mode 100644 index 000000000000..8e8ef953c8f1 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/IdentityUpdate.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.msi.generated.fluent.models.UserAssignedIdentityProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Describes an identity resource. */ +@Fluent +public final class IdentityUpdate extends ProxyResource { + /* + * The geo-location where the resource lives + */ + @JsonProperty(value = "location") + private String location; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * User Assigned Identity properties. + * + * The properties associated with the identity. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private UserAssignedIdentityProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of IdentityUpdate class. */ + public IdentityUpdate() { + } + + /** + * Get the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The geo-location where the resource lives. + * + * @param location the location value to set. + * @return the IdentityUpdate object itself. + */ + public IdentityUpdate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the IdentityUpdate object itself. + */ + public IdentityUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: User Assigned Identity properties. + * + *

The properties associated with the identity. + * + * @return the innerProperties value. + */ + private UserAssignedIdentityProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.innerProperties() == null ? null : this.innerProperties().tenantId(); + } + + /** + * Get the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.innerProperties() == null ? null : this.innerProperties().principalId(); + } + + /** + * Get the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.innerProperties() == null ? null : this.innerProperties().clientId(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operation.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operation.java new file mode 100644 index 000000000000..64b27b151032 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operation.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation Name. + * + *

The name of the REST Operation. This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Operation Display. + * + *

The object that describes the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.msi.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationDisplay.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationDisplay.java new file mode 100644 index 000000000000..5b334326f3e9 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationDisplay.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation Display. + * + *

The object that describes the operation. + */ +@Fluent +public final class OperationDisplay { + /* + * Resource Provider Name. + * + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Operation Type. + * + * The type of operation. For example: read, write, delete. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Resource Type. + * + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation description + * + * A description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: Resource Provider Name. + * + *

Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource Provider Name. + * + *

Friendly name of the resource provider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the operation property: Operation Type. + * + *

The type of operation. For example: read, write, delete. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation Type. + * + *

The type of operation. For example: read, write, delete. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource property: Resource Type. + * + *

The resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource Type. + * + *

The resource type on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description property: Operation description + * + *

A description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Operation description + * + *

A description of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationListResult.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationListResult.java new file mode 100644 index 000000000000..ac8568c8faf8 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/OperationListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.msi.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Operations List. + * + *

A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + */ +@Fluent +public final class OperationListResult { + /* + * Operations List. + * + * A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Next Link + * + * The url to get the next page of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: Operations List. + * + *

A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Operations List. + * + *

A list of operations supported by Microsoft.ManagedIdentity Resource Provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Next Link + * + *

The url to get the next page of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Next Link + * + *

The url to get the next page of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult 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/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operations.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operations.java new file mode 100644 index 000000000000..bd5e09017242 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.ManagedIdentity provider. + * + * @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 operations List as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentities.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentities.java new file mode 100644 index 000000000000..009dfdc9c18e --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentities.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of SystemAssignedIdentities. */ +public interface SystemAssignedIdentities { + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope along with {@link Response}. + */ + Response getByScopeWithResponse(String scope, Context context); + + /** + * Gets the systemAssignedIdentity available under the specified RP scope. + * + * @param scope The resource provider scope of the resource. Parent resource being extended by Managed Identities. + * @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 systemAssignedIdentity available under the specified RP scope. + */ + SystemAssignedIdentity getByScope(String scope); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentity.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentity.java new file mode 100644 index 000000000000..a2d75b653ac2 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/SystemAssignedIdentity.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner; +import java.util.Map; +import java.util.UUID; + +/** An immutable client-side representation of SystemAssignedIdentity. */ +public interface SystemAssignedIdentity { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the tenantId property: The id of the tenant which the identity belongs to. + * + * @return the tenantId value. + */ + UUID tenantId(); + + /** + * Gets the principalId property: The id of the service principal object associated with the created identity. + * + * @return the principalId value. + */ + UUID principalId(); + + /** + * Gets the clientId property: The id of the app associated with the identity. This is a random generated UUID by + * MSI. + * + * @return the clientId value. + */ + UUID clientId(); + + /** + * Gets the clientSecretUrl property: The ManagedServiceIdentity DataPlane URL that can be queried to obtain the + * identity credentials. + * + * @return the clientSecretUrl value. + */ + String clientSecretUrl(); + + /** + * Gets the inner com.azure.resourcemanager.msi.generated.fluent.models.SystemAssignedIdentityInner object. + * + * @return the inner object. + */ + SystemAssignedIdentityInner innerModel(); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentities.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentities.java new file mode 100644 index 000000000000..8975d1cff303 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentities.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of UserAssignedIdentities. */ +public interface UserAssignedIdentities { + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all the userAssignedIdentities available under the specified subscription. + * + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the userAssignedIdentities available under the specified ResourceGroup. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Gets the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 identity. + */ + Identity getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 deleteByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes the identity. + * + * @param resourceGroupName The name of the Resource Group to which the identity belongs. + * @param resourceName The name of the identity resource. + * @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 deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Gets the identity. + * + * @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 identity along with {@link Response}. + */ + Identity getById(String id); + + /** + * Gets the identity. + * + * @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 identity along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the identity. + * + * @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. + */ + void deleteById(String id); + + /** + * Deletes the identity. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Identity resource. + * + * @param name resource name. + * @return the first stage of the new Identity definition. + */ + Identity.DefinitionStages.Blank define(String name); +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentitiesListResult.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentitiesListResult.java new file mode 100644 index 000000000000..b3eeac1962ed --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/UserAssignedIdentitiesListResult.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.msi.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.msi.generated.fluent.models.IdentityInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Values returned by the List operation. */ +@Fluent +public final class UserAssignedIdentitiesListResult { + /* + * The collection of userAssignedIdentities returned by the listing operation. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The url to get the next page of results, if any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of UserAssignedIdentitiesListResult class. */ + public UserAssignedIdentitiesListResult() { + } + + /** + * Get the value property: The collection of userAssignedIdentities returned by the listing operation. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of userAssignedIdentities returned by the listing operation. + * + * @param value the value value to set. + * @return the UserAssignedIdentitiesListResult object itself. + */ + public UserAssignedIdentitiesListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The url to get the next page of results, if any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The url to get the next page of results, if any. + * + * @param nextLink the nextLink value to set. + * @return the UserAssignedIdentitiesListResult object itself. + */ + public UserAssignedIdentitiesListResult 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/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/package-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/package-info.java new file mode 100644 index 000000000000..72b6abdaf914 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/models/package-info.java @@ -0,0 +1,6 @@ +// 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 ManagedServiceIdentityClient. The Managed Service Identity Client. */ +package com.azure.resourcemanager.msi.generated.models; diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/package-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/package-info.java new file mode 100644 index 000000000000..6deee599d16e --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/com/azure/resourcemanager/msi/generated/package-info.java @@ -0,0 +1,6 @@ +// 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 ManagedServiceIdentityClient. The Managed Service Identity Client. */ +package com.azure.resourcemanager.msi.generated; diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/module-info.java b/sdk/msi/azure-resourcemanager-msi-generated/src/main/java/module-info.java new file mode 100644 index 000000000000..0297d3e213c9 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-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.msi.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.msi.generated; + exports com.azure.resourcemanager.msi.generated.fluent; + exports com.azure.resourcemanager.msi.generated.fluent.models; + exports com.azure.resourcemanager.msi.generated.models; + + opens com.azure.resourcemanager.msi.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.msi.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsCreateOrUpdateSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..e32ab2ebef6e --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsCreateOrUpdateSamples.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +import java.util.Arrays; + +/** Samples for FederatedIdentityCredentials CreateOrUpdate. */ +public final class FederatedIdentityCredentialsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialCreate.json + */ + /** + * Sample code: FederatedIdentityCredentialCreate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialCreate( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .define("ficResourceName") + .withExistingUserAssignedIdentity("rgName", "resourceName") + .withIssuer("https://oidc.prod-aks.azure.com/TenantGUID/IssuerGUID") + .withSubject("system:serviceaccount:ns:svcaccount") + .withAudiences(Arrays.asList("api://AzureADTokenExchange")) + .create(); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsDeleteSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsDeleteSamples.java new file mode 100644 index 000000000000..8c4ef6730b77 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for FederatedIdentityCredentials Delete. */ +public final class FederatedIdentityCredentialsDeleteSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialDelete.json + */ + /** + * Sample code: FederatedIdentityCredentialDelete. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialDelete( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .deleteWithResponse("rgName", "resourceName", "ficResourceName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsGetSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsGetSamples.java new file mode 100644 index 000000000000..7c330d77d612 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for FederatedIdentityCredentials Get. */ +public final class FederatedIdentityCredentialsGetSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialGet.json + */ + /** + * Sample code: FederatedIdentityCredentialGet. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialGet( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .getWithResponse("rgName", "resourceName", "ficResourceName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsListSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsListSamples.java new file mode 100644 index 000000000000..6b267d6640c1 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/FederatedIdentityCredentialsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for FederatedIdentityCredentials List. */ +public final class FederatedIdentityCredentialsListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/FederatedIdentityCredentialList.json + */ + /** + * Sample code: FederatedIdentityCredentialList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void federatedIdentityCredentialList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .federatedIdentityCredentials() + .list("rgName", "resourceName", null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/OperationsListSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/OperationsListSamples.java new file mode 100644 index 000000000000..0d4ff636f581 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/OperationsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/MsiOperationsList.json + */ + /** + * Sample code: MsiOperationsList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void msiOperationsList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/SystemAssignedIdentitiesGetByScopeSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/SystemAssignedIdentitiesGetByScopeSamples.java new file mode 100644 index 000000000000..495c21793daf --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/SystemAssignedIdentitiesGetByScopeSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for SystemAssignedIdentities GetByScope. */ +public final class SystemAssignedIdentitiesGetByScopeSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/SystemAssignedIdentityGet.json + */ + /** + * Sample code: MsiOperationsList. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void msiOperationsList( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.systemAssignedIdentities().getByScopeWithResponse("scope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesCreateOrUpdateSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..65c6b3e0ec90 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesCreateOrUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +import java.util.HashMap; +import java.util.Map; + +/** Samples for UserAssignedIdentities CreateOrUpdate. */ +public final class UserAssignedIdentitiesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityCreate.json + */ + /** + * Sample code: IdentityCreate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityCreate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .define("resourceName") + .withRegion("eastus") + .withExistingResourceGroup("rgName") + .withTags(mapOf("key1", "value1", "key2", "value2")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesDeleteSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesDeleteSamples.java new file mode 100644 index 000000000000..f8b800be6985 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for UserAssignedIdentities Delete. */ +public final class UserAssignedIdentitiesDeleteSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityDelete.json + */ + /** + * Sample code: IdentityDelete. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityDelete(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .deleteByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesGetByResourceGroupSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..ad69e9691d28 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for UserAssignedIdentities GetByResourceGroup. */ +public final class UserAssignedIdentitiesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityGet.json + */ + /** + * Sample code: IdentityGet. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityGet(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager + .userAssignedIdentities() + .getByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListByResourceGroupSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListByResourceGroupSamples.java new file mode 100644 index 000000000000..8bbda0071957 --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for UserAssignedIdentities ListByResourceGroup. */ +public final class UserAssignedIdentitiesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListByResourceGroup.json + */ + /** + * Sample code: IdentityListByResourceGroup. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityListByResourceGroup( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.userAssignedIdentities().listByResourceGroup("rgName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListSamples.java new file mode 100644 index 000000000000..81df614fb55d --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +/** Samples for UserAssignedIdentities List. */ +public final class UserAssignedIdentitiesListSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityListBySubscription.json + */ + /** + * Sample code: IdentityListBySubscription. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityListBySubscription( + com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + manager.userAssignedIdentities().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesUpdateSamples.java b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesUpdateSamples.java new file mode 100644 index 000000000000..e26d154757be --- /dev/null +++ b/sdk/msi/azure-resourcemanager-msi-generated/src/samples/java/com/azure/resourcemanager/msi/generated/generated/UserAssignedIdentitiesUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.msi.generated.generated; + +import com.azure.resourcemanager.msi.generated.models.Identity; +import java.util.HashMap; +import java.util.Map; + +/** Samples for UserAssignedIdentities Update. */ +public final class UserAssignedIdentitiesUpdateSamples { + /* + * x-ms-original-file: specification/msi/resource-manager/Microsoft.ManagedIdentity/stable/2023-01-31/examples/IdentityUpdate.json + */ + /** + * Sample code: IdentityUpdate. + * + * @param manager Entry point to ManagedServiceIdentityManager. + */ + public static void identityUpdate(com.azure.resourcemanager.msi.generated.ManagedServiceIdentityManager manager) { + Identity resource = + manager + .userAssignedIdentities() + .getByResourceGroupWithResponse("rgName", "resourceName", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/msi/ci.yml b/sdk/msi/ci.yml new file mode 100644 index 000000000000..91ba4d5b123d --- /dev/null +++ b/sdk/msi/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/msi/ci.yml + - sdk/msi/azure-resourcemanager-msi-generated/ + exclude: + - sdk/msi/pom.xml + - sdk/msi/azure-resourcemanager-msi-generated/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/msi/ci.yml + - sdk/msi/azure-resourcemanager-msi-generated/ + exclude: + - sdk/msi/pom.xml + - sdk/msi/azure-resourcemanager-msi-generated/pom.xml + +parameters: + - name: release_azureresourcemanagermsigenerated + displayName: azure-resourcemanager-msi-generated + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: msi + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-msi-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermsigenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagermsigenerated }} diff --git a/sdk/msi/pom.xml b/sdk/msi/pom.xml new file mode 100644 index 000000000000..2a5f3c2e5191 --- /dev/null +++ b/sdk/msi/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-msi-service + pom + 1.0.0 + + + azure-resourcemanager-msi-generated + +