From 74d1c25d5cad4554ef0b4186a8d25685628d9c79 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 27 Jun 2023 00:40:15 +0000 Subject: [PATCH] CodeGen from PR 24578 in Azure/azure-rest-api-specs Merge 20fd9229df2f2693d4154daf6df9dba6fc9bbb42 into baab681702af69fd815cd7dc9310ed1438bd0ef7 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 ++ .../SAMPLE.md | 497 ++++++++ .../pom.xml | 61 + .../ManagedServicesManager.java | 366 ++++++ .../fluent/ManagedServicesClient.java | 81 ++ ...ketplaceRegistrationDefinitionsClient.java | 77 ++ ...trationDefinitionsWithoutScopesClient.java | 72 ++ .../fluent/OperationsClient.java | 36 + .../fluent/OperationsWithScopesClient.java | 39 + .../fluent/RegistrationAssignmentsClient.java | 190 ++++ .../fluent/RegistrationDefinitionsClient.java | 159 +++ ...arketplaceRegistrationDefinitionInner.java | 86 ++ .../fluent/models/OperationListInner.java | 44 + .../models/RegistrationAssignmentInner.java | 71 ++ .../models/RegistrationDefinitionInner.java | 101 ++ .../fluent/models/package-info.java | 6 + .../managedservices/fluent/package-info.java | 6 + .../ManagedServicesClientBuilder.java | 123 ++ .../ManagedServicesClientImpl.java | 346 ++++++ ...MarketplaceRegistrationDefinitionImpl.java | 51 + ...laceRegistrationDefinitionsClientImpl.java | 472 ++++++++ ...arketplaceRegistrationDefinitionsImpl.java | 72 ++ ...ionDefinitionsWithoutScopesClientImpl.java | 442 +++++++ ...istrationDefinitionsWithoutScopesImpl.java | 73 ++ .../implementation/OperationListImpl.java | 41 + .../implementation/OperationsClientImpl.java | 145 +++ .../implementation/OperationsImpl.java | 58 + .../OperationsWithScopesClientImpl.java | 164 +++ .../OperationsWithScopesImpl.java | 59 + .../RegistrationAssignmentImpl.java | 148 +++ .../RegistrationAssignmentsClientImpl.java | 1012 +++++++++++++++++ .../RegistrationAssignmentsImpl.java | 216 ++++ .../RegistrationDefinitionImpl.java | 156 +++ .../RegistrationDefinitionsClientImpl.java | 873 ++++++++++++++ .../RegistrationDefinitionsImpl.java | 209 ++++ .../managedservices/implementation/Utils.java | 204 ++++ .../implementation/package-info.java | 6 + .../managedservices/models/Authorization.java | 155 +++ .../models/EligibleApprover.java | 87 ++ .../models/EligibleAuthorization.java | 152 +++ .../models/JustInTimeAccessPolicy.java | 120 ++ .../MarketplaceRegistrationDefinition.java | 53 + ...MarketplaceRegistrationDefinitionList.java | 59 + ...placeRegistrationDefinitionProperties.java | 212 ++++ .../MarketplaceRegistrationDefinitions.java | 68 ++ ...eRegistrationDefinitionsWithoutScopes.java | 62 + .../models/MultiFactorAuthProvider.java | 47 + .../managedservices/models/Operation.java | 57 + .../models/OperationDisplay.java | 128 +++ .../managedservices/models/OperationList.java | 25 + .../managedservices/models/Operations.java | 31 + .../models/OperationsWithScopes.java | 34 + .../managedservices/models/Plan.java | 147 +++ .../models/ProvisioningState.java | 77 ++ .../models/RegistrationAssignment.java | 155 +++ .../models/RegistrationAssignmentList.java | 59 + .../RegistrationAssignmentProperties.java | 93 ++ ...nmentPropertiesRegistrationDefinition.java | 146 +++ ...rtiesRegistrationDefinitionProperties.java | 281 +++++ .../models/RegistrationAssignments.java | 145 +++ .../models/RegistrationDefinition.java | 182 +++ .../models/RegistrationDefinitionList.java | 59 + .../RegistrationDefinitionProperties.java | 244 ++++ .../models/RegistrationDefinitions.java | 138 +++ .../managedservices/models/package-info.java | 6 + .../managedservices/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...laceRegistrationDefinitionsGetSamples.java | 26 + ...aceRegistrationDefinitionsListSamples.java | 26 + ...tionDefinitionsWithoutScopeGetSamples.java | 23 + ...ionDefinitionsWithoutScopeListSamples.java | 23 + .../generated/OperationsListSamples.java | 21 + .../OperationsWithScopeListSamples.java | 23 + ...ationAssignmentsCreateOrUpdateSamples.java | 31 + .../RegistrationAssignmentsDeleteSamples.java | 26 + .../RegistrationAssignmentsGetSamples.java | 27 + .../RegistrationAssignmentsListSamples.java | 62 + ...ationDefinitionsCreateOrUpdateSamples.java | 77 ++ .../RegistrationDefinitionsDeleteSamples.java | 26 + .../RegistrationDefinitionsGetSamples.java | 26 + .../RegistrationDefinitionsListSamples.java | 60 + sdk/managedservices/ci.yml | 47 + sdk/managedservices/pom.xml | 15 + 86 files changed, 10460 insertions(+) create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/README.md create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/SAMPLE.md create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/pom.xml create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/ManagedServicesClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsWithoutScopesClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsWithScopesClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationAssignmentsClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationDefinitionsClient.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/MarketplaceRegistrationDefinitionInner.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/OperationListInner.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationAssignmentInner.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationDefinitionInner.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/package-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/package-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientBuilder.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationListImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsClientImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsImpl.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/Utils.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/package-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleApprover.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinition.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionList.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitions.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionsWithoutScopes.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MultiFactorAuthProvider.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operation.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationDisplay.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationList.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operations.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationsWithScopes.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Plan.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/ProvisioningState.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignment.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentList.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentProperties.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignments.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinition.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionList.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitions.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/package-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/package-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/module-info.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsGetSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsListSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeGetSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeListSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsListSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsWithScopeListSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsCreateOrUpdateSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsDeleteSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsGetSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsListSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsCreateOrUpdateSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsDeleteSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsGetSamples.java create mode 100644 sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsListSamples.java create mode 100644 sdk/managedservices/ci.yml create mode 100644 sdk/managedservices/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 4dc0eb33a0cb9..e4de81511d94a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -415,6 +415,7 @@ com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-cosmosdbforpostgresql;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-managementgroups;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-managedservices;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 37598e3eaecbf..257138b6a2163 100644 --- a/pom.xml +++ b/pom.xml @@ -111,6 +111,7 @@ sdk/machinelearningservices sdk/maintenance sdk/managedapplications + sdk/managedservices sdk/managementgroups sdk/maps sdk/mariadb diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md new file mode 100644 index 0000000000000..fcd9d65363054 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-06-27) + +- Azure Resource Manager ManagedServices client library for Java. This package contains Microsoft Azure SDK for ManagedServices Management SDK. The specification for ManagedServices. Package tag package-2022-10. 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/managedservices/azure-resourcemanager-managedservices/README.md b/sdk/managedservices/azure-resourcemanager-managedservices/README.md new file mode 100644 index 0000000000000..86049304c8650 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager ManagedServices client library for Java + +Azure Resource Manager ManagedServices client library for Java. + +This package contains Microsoft Azure SDK for ManagedServices Management SDK. The specification for ManagedServices. Package tag package-2022-10. 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-managedservices;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-managedservices + 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(); +ManagedServicesManager manager = ManagedServicesManager + .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/managedservices/azure-resourcemanager-managedservices/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/managedservices/azure-resourcemanager-managedservices/SAMPLE.md b/sdk/managedservices/azure-resourcemanager-managedservices/SAMPLE.md new file mode 100644 index 0000000000000..1a654365d1430 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/SAMPLE.md @@ -0,0 +1,497 @@ +# Code snippets and samples + + +## MarketplaceRegistrationDefinitions + +- [Get](#marketplaceregistrationdefinitions_get) +- [List](#marketplaceregistrationdefinitions_list) + +## MarketplaceRegistrationDefinitionsWithoutScope + +- [Get](#marketplaceregistrationdefinitionswithoutscope_get) +- [List](#marketplaceregistrationdefinitionswithoutscope_list) + +## Operations + +- [List](#operations_list) + +## OperationsWithScope + +- [List](#operationswithscope_list) + +## RegistrationAssignments + +- [CreateOrUpdate](#registrationassignments_createorupdate) +- [Delete](#registrationassignments_delete) +- [Get](#registrationassignments_get) +- [List](#registrationassignments_list) + +## RegistrationDefinitions + +- [CreateOrUpdate](#registrationdefinitions_createorupdate) +- [Delete](#registrationdefinitions_delete) +- [Get](#registrationdefinitions_get) +- [List](#registrationdefinitions_list) +### MarketplaceRegistrationDefinitions_Get + +```java +/** Samples for MarketplaceRegistrationDefinitions Get. */ +public final class MarketplaceRegistrationDefinitionsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinition.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitions() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "publisher.product.planName.version", + com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceRegistrationDefinitions_List + +```java +/** Samples for MarketplaceRegistrationDefinitions List. */ +public final class MarketplaceRegistrationDefinitionsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitions.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "planIdentifier eq 'publisher.offerIdentifier.planName.version'", + com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceRegistrationDefinitionsWithoutScope_Get + +```java +/** Samples for MarketplaceRegistrationDefinitionsWithoutScope Get. */ +public final class MarketplaceRegistrationDefinitionsWithoutScopeGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitionAtTenantScope.json + */ + /** + * Sample code: Get Marketplace Registration Definition At Tenant Scope. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getMarketplaceRegistrationDefinitionAtTenantScope( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitionsWithoutScopes() + .getWithResponse("publisher.product.planName.version", com.azure.core.util.Context.NONE); + } +} +``` + +### MarketplaceRegistrationDefinitionsWithoutScope_List + +```java +/** Samples for MarketplaceRegistrationDefinitionsWithoutScope List. */ +public final class MarketplaceRegistrationDefinitionsWithoutScopeListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitionsAtTenantScope.json + */ + /** + * Sample code: Get Marketplace Registration Definitions At Tenant Scope. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getMarketplaceRegistrationDefinitionsAtTenantScope( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitionsWithoutScopes() + .list("planIdentifier eq 'publisher.offerIdentifier.planName.version'", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetOperations.json + */ + /** + * Sample code: Get Registration Operations. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationOperations( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### OperationsWithScope_List + +```java +/** Samples for OperationsWithScope List. */ +public final class OperationsWithScopeListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetOperationsWithScope.json + */ + /** + * Sample code: Get Registration Operations. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationOperations( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .operationsWithScopes() + .listWithResponse("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationAssignments_CreateOrUpdate + +```java +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentProperties; + +/** Samples for RegistrationAssignments CreateOrUpdate. */ +public final class RegistrationAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/PutRegistrationAssignment.json + */ + /** + * Sample code: Put Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void putRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .define("26c128c2-fefa-4340-9bb1-6e081c90ada2") + .withExistingScope("subscription/0afefe50-734e-4610-8a82-a144ahf49dea") + .withProperties( + new RegistrationAssignmentProperties() + .withRegistrationDefinitionId( + "/subscriptions/0afefe50-734e-4610-8a82-a144ahf49dea/providers/Microsoft.ManagedServices/registrationDefinitions/26c128c2-fefa-4340-9bb1-6e081c90ada2")) + .create(); + } +} +``` + +### RegistrationAssignments_Delete + +```java +/** Samples for RegistrationAssignments Delete. */ +public final class RegistrationAssignmentsDeleteSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/DeleteRegistrationAssignment.json + */ + /** + * Sample code: Delete Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void deleteRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .delete( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationAssignments_Get + +```java +/** Samples for RegistrationAssignments Get. */ +public final class RegistrationAssignmentsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignment.json + */ + /** + * Sample code: Get Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationAssignments_List + +```java +/** Samples for RegistrationAssignments List. */ +public final class RegistrationAssignmentsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignmentsWithManagedByTenantIdEqFilter.json + */ + /** + * Sample code: Get Registration Assignments with ManagedByTenantId eq filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignmentsWithManagedByTenantIdEqFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + null, + "$filter=managedByTenantId eq '83abe5cd-bcc3-441a-bd86-e6a75360cecc'", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignments.json + */ + /** + * Sample code: Get Registration Assignments. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignments( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignmentsWithManagedByTenantIdInFilter.json + */ + /** + * Sample code: Get Registration Assignments with ManagedByTenantId in filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignmentsWithManagedByTenantIdInFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + null, + "$filter=managedByTenantId in ('83abe5cd-bcc3-441a-bd86-e6a75360cec'," + + " 'de83f4a9-a76a-4025-a91a-91171923eac7')", + com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationDefinitions_CreateOrUpdate + +```java +import com.azure.resourcemanager.managedservices.models.Authorization; +import com.azure.resourcemanager.managedservices.models.EligibleApprover; +import com.azure.resourcemanager.managedservices.models.EligibleAuthorization; +import com.azure.resourcemanager.managedservices.models.JustInTimeAccessPolicy; +import com.azure.resourcemanager.managedservices.models.MultiFactorAuthProvider; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionProperties; +import java.time.Duration; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for RegistrationDefinitions CreateOrUpdate. */ +public final class RegistrationDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/PutRegistrationDefinition.json + */ + /** + * Sample code: Put Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void putRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .define("26c128c2-fefa-4340-9bb1-6e081c90ada2") + .withExistingScope("subscription/0afefe50-734e-4610-8a82-a144ahf49dea") + .withProperties( + new RegistrationDefinitionProperties() + .withDescription("Tes1t") + .withAuthorizations( + Arrays + .asList( + new Authorization() + .withPrincipalId("f98d86a2-4cc4-4e9d-ad47-b3e80a1bcdfc") + .withPrincipalIdDisplayName("Support User") + .withRoleDefinitionId("acdd72a7-3385-48ef-bd42-f606fba81ae7"), + new Authorization() + .withPrincipalId("f98d86a2-4cc4-4e9d-ad47-b3e80a1bcdfc") + .withPrincipalIdDisplayName("User Access Administrator") + .withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withDelegatedRoleDefinitionIds( + Arrays.asList(UUID.fromString("b24988ac-6180-42a0-ab88-20f7382dd24c"))))) + .withEligibleAuthorizations( + Arrays + .asList( + new EligibleAuthorization() + .withPrincipalId("3e0ed8c6-e902-4fc5-863c-e3ddbb2ae2a2") + .withPrincipalIdDisplayName("Support User") + .withRoleDefinitionId("ae349356-3a1b-4a5e-921d-050484c6347e") + .withJustInTimeAccessPolicy( + new JustInTimeAccessPolicy() + .withMultiFactorAuthProvider(MultiFactorAuthProvider.AZURE) + .withMaximumActivationDuration(Duration.parse("PT8H")) + .withManagedByTenantApprovers( + Arrays + .asList( + new EligibleApprover() + .withPrincipalId("d9b22cd6-6407-43cc-8c60-07c56df0b51a") + .withPrincipalIdDisplayName("Approver Group")))))) + .withRegistrationDefinitionName("DefinitionName") + .withManagedByTenantId("83abe5cd-bcc3-441a-bd86-e6a75360cecc")) + .withPlan( + new Plan() + .withName("addesai-plan") + .withPublisher("marketplace-test") + .withProduct("test") + .withVersion("1.0.0")) + .create(); + } +} +``` + +### RegistrationDefinitions_Delete + +```java +/** Samples for RegistrationDefinitions Delete. */ +public final class RegistrationDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/DeleteRegistrationDefinition.json + */ + /** + * Sample code: Delete Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void deleteRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .deleteByResourceGroupWithResponse( + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationDefinitions_Get + +```java +/** Samples for RegistrationDefinitions Get. */ +public final class RegistrationDefinitionsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinition.json + */ + /** + * Sample code: Get Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + com.azure.core.util.Context.NONE); + } +} +``` + +### RegistrationDefinitions_List + +```java +/** Samples for RegistrationDefinitions List. */ +public final class RegistrationDefinitionsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitionsWithManagedByTenantIdEqFilter.json + */ + /** + * Sample code: Get Registration Definitions with ManagedByTenantId eq filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitionsWithManagedByTenantIdEqFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "$filter=managedByTenantId eq '83ace5cd-bcc3-441a-hd86-e6a75360cecc'", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitions.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitionsWithManagedByTenantIdInFilter.json + */ + /** + * Sample code: Get Registration Definitions with ManagedByTenantId in filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitionsWithManagedByTenantIdInFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "$filter=managedByTenantId in ('83ace5cd-bcc3-441a-hd86-e6a75360cecc'," + + " 'de83f4a9-a76a-4025-a91a-91171923eac7')", + com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml b/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml new file mode 100644 index 0000000000000..c1d8121721a0f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-managedservices + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ManagedServices Management + This package contains Microsoft Azure SDK for ManagedServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The specification for ManagedServices. Package tag package-2022-10. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.40.0 + + + com.azure + azure-core-management + 1.11.2 + + + diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java new file mode 100644 index 0000000000000..02e729ba36602 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices; + +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.managedservices.fluent.ManagedServicesClient; +import com.azure.resourcemanager.managedservices.implementation.ManagedServicesClientBuilder; +import com.azure.resourcemanager.managedservices.implementation.MarketplaceRegistrationDefinitionsImpl; +import com.azure.resourcemanager.managedservices.implementation.MarketplaceRegistrationDefinitionsWithoutScopesImpl; +import com.azure.resourcemanager.managedservices.implementation.OperationsImpl; +import com.azure.resourcemanager.managedservices.implementation.OperationsWithScopesImpl; +import com.azure.resourcemanager.managedservices.implementation.RegistrationAssignmentsImpl; +import com.azure.resourcemanager.managedservices.implementation.RegistrationDefinitionsImpl; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitions; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionsWithoutScopes; +import com.azure.resourcemanager.managedservices.models.Operations; +import com.azure.resourcemanager.managedservices.models.OperationsWithScopes; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignments; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitions; +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 ManagedServicesManager. The specification for ManagedServices. */ +public final class ManagedServicesManager { + private RegistrationDefinitions registrationDefinitions; + + private RegistrationAssignments registrationAssignments; + + private MarketplaceRegistrationDefinitions marketplaceRegistrationDefinitions; + + private MarketplaceRegistrationDefinitionsWithoutScopes marketplaceRegistrationDefinitionsWithoutScopes; + + private Operations operations; + + private OperationsWithScopes operationsWithScopes; + + private final ManagedServicesClient clientObject; + + private ManagedServicesManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ManagedServicesClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ManagedServices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedServices service API instance. + */ + public static ManagedServicesManager 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 ManagedServices service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the ManagedServices service API instance. + */ + public static ManagedServicesManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ManagedServicesManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ManagedServicesManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ManagedServicesManager.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 ManagedServices service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ManagedServices service API instance. + */ + public ManagedServicesManager 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.managedservices") + .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 ManagedServicesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of RegistrationDefinitions. It manages RegistrationDefinition. + * + * @return Resource collection API of RegistrationDefinitions. + */ + public RegistrationDefinitions registrationDefinitions() { + if (this.registrationDefinitions == null) { + this.registrationDefinitions = + new RegistrationDefinitionsImpl(clientObject.getRegistrationDefinitions(), this); + } + return registrationDefinitions; + } + + /** + * Gets the resource collection API of RegistrationAssignments. It manages RegistrationAssignment. + * + * @return Resource collection API of RegistrationAssignments. + */ + public RegistrationAssignments registrationAssignments() { + if (this.registrationAssignments == null) { + this.registrationAssignments = + new RegistrationAssignmentsImpl(clientObject.getRegistrationAssignments(), this); + } + return registrationAssignments; + } + + /** + * Gets the resource collection API of MarketplaceRegistrationDefinitions. + * + * @return Resource collection API of MarketplaceRegistrationDefinitions. + */ + public MarketplaceRegistrationDefinitions marketplaceRegistrationDefinitions() { + if (this.marketplaceRegistrationDefinitions == null) { + this.marketplaceRegistrationDefinitions = + new MarketplaceRegistrationDefinitionsImpl(clientObject.getMarketplaceRegistrationDefinitions(), this); + } + return marketplaceRegistrationDefinitions; + } + + /** + * Gets the resource collection API of MarketplaceRegistrationDefinitionsWithoutScopes. + * + * @return Resource collection API of MarketplaceRegistrationDefinitionsWithoutScopes. + */ + public MarketplaceRegistrationDefinitionsWithoutScopes marketplaceRegistrationDefinitionsWithoutScopes() { + if (this.marketplaceRegistrationDefinitionsWithoutScopes == null) { + this.marketplaceRegistrationDefinitionsWithoutScopes = + new MarketplaceRegistrationDefinitionsWithoutScopesImpl( + clientObject.getMarketplaceRegistrationDefinitionsWithoutScopes(), this); + } + return marketplaceRegistrationDefinitionsWithoutScopes; + } + + /** + * 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 OperationsWithScopes. + * + * @return Resource collection API of OperationsWithScopes. + */ + public OperationsWithScopes operationsWithScopes() { + if (this.operationsWithScopes == null) { + this.operationsWithScopes = new OperationsWithScopesImpl(clientObject.getOperationsWithScopes(), this); + } + return operationsWithScopes; + } + + /** + * @return Wrapped service client ManagedServicesClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ManagedServicesClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/ManagedServicesClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/ManagedServicesClient.java new file mode 100644 index 0000000000000..0fde0e809f0a2 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/ManagedServicesClient.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.managedservices.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ManagedServicesClient class. */ +public interface ManagedServicesClient { + /** + * 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 RegistrationDefinitionsClient object to access its operations. + * + * @return the RegistrationDefinitionsClient object. + */ + RegistrationDefinitionsClient getRegistrationDefinitions(); + + /** + * Gets the RegistrationAssignmentsClient object to access its operations. + * + * @return the RegistrationAssignmentsClient object. + */ + RegistrationAssignmentsClient getRegistrationAssignments(); + + /** + * Gets the MarketplaceRegistrationDefinitionsClient object to access its operations. + * + * @return the MarketplaceRegistrationDefinitionsClient object. + */ + MarketplaceRegistrationDefinitionsClient getMarketplaceRegistrationDefinitions(); + + /** + * Gets the MarketplaceRegistrationDefinitionsWithoutScopesClient object to access its operations. + * + * @return the MarketplaceRegistrationDefinitionsWithoutScopesClient object. + */ + MarketplaceRegistrationDefinitionsWithoutScopesClient getMarketplaceRegistrationDefinitionsWithoutScopes(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the OperationsWithScopesClient object to access its operations. + * + * @return the OperationsWithScopesClient object. + */ + OperationsWithScopesClient getOperationsWithScopes(); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsClient.java new file mode 100644 index 0000000000000..83068330d7acc --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; + +/** + * An instance of this class provides access to all the operations defined in MarketplaceRegistrationDefinitionsClient. + */ +public interface MarketplaceRegistrationDefinitionsClient { + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the 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 a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String filter, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String marketplaceIdentifier, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceRegistrationDefinitionInner get(String scope, String marketplaceIdentifier); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsWithoutScopesClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsWithoutScopesClient.java new file mode 100644 index 0000000000000..90b3fdb97a056 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsWithoutScopesClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; + +/** + * An instance of this class provides access to all the operations defined in + * MarketplaceRegistrationDefinitionsWithoutScopesClient. + */ +public interface MarketplaceRegistrationDefinitionsWithoutScopesClient { + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String marketplaceIdentifier, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MarketplaceRegistrationDefinitionInner get(String marketplaceIdentifier); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsClient.java new file mode 100644 index 0000000000000..58610c3ef3ad0 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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.managedservices.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.managedservices.fluent.models.OperationListInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Gets a list of the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Gets a list of the operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListInner list(); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsWithScopesClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsWithScopesClient.java new file mode 100644 index 0000000000000..75b5216a500fe --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/OperationsWithScopesClient.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.managedservices.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.managedservices.fluent.models.OperationListInner; + +/** An instance of this class provides access to all the operations defined in OperationsWithScopesClient. */ +public interface OperationsWithScopesClient { + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(String scope, Context context); + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListInner list(String scope); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationAssignmentsClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationAssignmentsClient.java new file mode 100644 index 0000000000000..42f1d1885e8e0 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationAssignmentsClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; + +/** An instance of this class provides access to all the operations defined in RegistrationAssignmentsClient. */ +public interface RegistrationAssignmentsClient { + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context); + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the specified registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationAssignmentInner get(String scope, String registrationAssignmentId); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String scope, String registrationAssignmentId); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String scope, String registrationAssignmentId, Context context); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String registrationAssignmentId); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String scope, String registrationAssignmentId, Context context); + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody); + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context); + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationAssignmentInner createOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody); + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationAssignmentInner createOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context); + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the 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 a list of the registration assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, Boolean expandRegistrationDefinition, String filter, Context context); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationDefinitionsClient.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationDefinitionsClient.java new file mode 100644 index 0000000000000..87ca4c11eb3b3 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationDefinitionsClient.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; + +/** An instance of this class provides access to all the operations defined in RegistrationDefinitionsClient. */ +public interface RegistrationDefinitionsClient { + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String registrationDefinitionId, Context context); + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationDefinitionInner get(String scope, String registrationDefinitionId); + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope, Context context); + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 SyncPoller} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 SyncPoller} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationDefinitionInner createOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationDefinitionInner createOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context); + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the 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 a list of the registration definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, String filter, Context context); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/MarketplaceRegistrationDefinitionInner.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/MarketplaceRegistrationDefinitionInner.java new file mode 100644 index 0000000000000..f2545dd767c48 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/MarketplaceRegistrationDefinitionInner.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionProperties; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MarketplaceRegistrationDefinition model. */ +@Fluent +public final class MarketplaceRegistrationDefinitionInner extends ProxyResource { + /* + * The properties of the marketplace registration definition. + */ + @JsonProperty(value = "properties") + private MarketplaceRegistrationDefinitionProperties properties; + + /* + * The details for the Managed Services offer’s plan in Azure Marketplace. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** Creates an instance of MarketplaceRegistrationDefinitionInner class. */ + public MarketplaceRegistrationDefinitionInner() { + } + + /** + * Get the properties property: The properties of the marketplace registration definition. + * + * @return the properties value. + */ + public MarketplaceRegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of the marketplace registration definition. + * + * @param properties the properties value to set. + * @return the MarketplaceRegistrationDefinitionInner object itself. + */ + public MarketplaceRegistrationDefinitionInner withProperties( + MarketplaceRegistrationDefinitionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @param plan the plan value to set. + * @return the MarketplaceRegistrationDefinitionInner object itself. + */ + public MarketplaceRegistrationDefinitionInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (plan() != null) { + plan().validate(); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/OperationListInner.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/OperationListInner.java new file mode 100644 index 0000000000000..044a956613211 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/OperationListInner.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managedservices.models.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of the operations. */ +@Immutable +public final class OperationListInner { + /* + * The list of Microsoft.ManagedServices operations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** Creates an instance of OperationListInner class. */ + public OperationListInner() { + } + + /** + * Get the value property: The list of Microsoft.ManagedServices operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationAssignmentInner.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationAssignmentInner.java new file mode 100644 index 0000000000000..534e81c426b35 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationAssignmentInner.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration assignment. */ +@Fluent +public final class RegistrationAssignmentInner extends ProxyResource { + /* + * The properties of a registration assignment. + */ + @JsonProperty(value = "properties") + private RegistrationAssignmentProperties properties; + + /* + * The metadata for the registration assignment resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of RegistrationAssignmentInner class. */ + public RegistrationAssignmentInner() { + } + + /** + * Get the properties property: The properties of a registration assignment. + * + * @return the properties value. + */ + public RegistrationAssignmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a registration assignment. + * + * @param properties the properties value to set. + * @return the RegistrationAssignmentInner object itself. + */ + public RegistrationAssignmentInner withProperties(RegistrationAssignmentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: The metadata for the registration assignment resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationDefinitionInner.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationDefinitionInner.java new file mode 100644 index 0000000000000..ae12ca8a79582 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationDefinitionInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration definition. */ +@Fluent +public final class RegistrationDefinitionInner extends ProxyResource { + /* + * The properties of a registration definition. + */ + @JsonProperty(value = "properties") + private RegistrationDefinitionProperties properties; + + /* + * The details for the Managed Services offer’s plan in Azure Marketplace. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * The metadata for the registration assignment resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of RegistrationDefinitionInner class. */ + public RegistrationDefinitionInner() { + } + + /** + * Get the properties property: The properties of a registration definition. + * + * @return the properties value. + */ + public RegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a registration definition. + * + * @param properties the properties value to set. + * @return the RegistrationDefinitionInner object itself. + */ + public RegistrationDefinitionInner withProperties(RegistrationDefinitionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @param plan the plan value to set. + * @return the RegistrationDefinitionInner object itself. + */ + public RegistrationDefinitionInner withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the systemData property: The metadata for the registration assignment resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (plan() != null) { + plan().validate(); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/package-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/package-info.java new file mode 100644 index 0000000000000..de64906447bd7 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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 ManagedServicesClient. The specification for ManagedServices. */ +package com.azure.resourcemanager.managedservices.fluent.models; diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/package-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/package-info.java new file mode 100644 index 0000000000000..af4a9b5447c8d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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 ManagedServicesClient. The specification for ManagedServices. */ +package com.azure.resourcemanager.managedservices.fluent; diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientBuilder.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientBuilder.java new file mode 100644 index 0000000000000..3fdc4986250f2 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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 ManagedServicesClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ManagedServicesClientImpl.class}) +public final class ManagedServicesClientBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ManagedServicesClientBuilder. + */ + public ManagedServicesClientBuilder 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 ManagedServicesClientBuilder. + */ + public ManagedServicesClientBuilder 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 ManagedServicesClientBuilder. + */ + public ManagedServicesClientBuilder 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 ManagedServicesClientBuilder. + */ + public ManagedServicesClientBuilder 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 ManagedServicesClientBuilder. + */ + public ManagedServicesClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ManagedServicesClientImpl with the provided parameters. + * + * @return an instance of ManagedServicesClientImpl. + */ + public ManagedServicesClientImpl 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(); + ManagedServicesClientImpl client = + new ManagedServicesClientImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientImpl.java new file mode 100644 index 0000000000000..cdbaaac12d96d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientImpl.java @@ -0,0 +1,346 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.ManagedServicesClient; +import com.azure.resourcemanager.managedservices.fluent.MarketplaceRegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.MarketplaceRegistrationDefinitionsWithoutScopesClient; +import com.azure.resourcemanager.managedservices.fluent.OperationsClient; +import com.azure.resourcemanager.managedservices.fluent.OperationsWithScopesClient; +import com.azure.resourcemanager.managedservices.fluent.RegistrationAssignmentsClient; +import com.azure.resourcemanager.managedservices.fluent.RegistrationDefinitionsClient; +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 ManagedServicesClientImpl type. */ +@ServiceClient(builder = ManagedServicesClientBuilder.class) +public final class ManagedServicesClientImpl implements ManagedServicesClient { + /** 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 RegistrationDefinitionsClient object to access its operations. */ + private final RegistrationDefinitionsClient registrationDefinitions; + + /** + * Gets the RegistrationDefinitionsClient object to access its operations. + * + * @return the RegistrationDefinitionsClient object. + */ + public RegistrationDefinitionsClient getRegistrationDefinitions() { + return this.registrationDefinitions; + } + + /** The RegistrationAssignmentsClient object to access its operations. */ + private final RegistrationAssignmentsClient registrationAssignments; + + /** + * Gets the RegistrationAssignmentsClient object to access its operations. + * + * @return the RegistrationAssignmentsClient object. + */ + public RegistrationAssignmentsClient getRegistrationAssignments() { + return this.registrationAssignments; + } + + /** The MarketplaceRegistrationDefinitionsClient object to access its operations. */ + private final MarketplaceRegistrationDefinitionsClient marketplaceRegistrationDefinitions; + + /** + * Gets the MarketplaceRegistrationDefinitionsClient object to access its operations. + * + * @return the MarketplaceRegistrationDefinitionsClient object. + */ + public MarketplaceRegistrationDefinitionsClient getMarketplaceRegistrationDefinitions() { + return this.marketplaceRegistrationDefinitions; + } + + /** The MarketplaceRegistrationDefinitionsWithoutScopesClient object to access its operations. */ + private final MarketplaceRegistrationDefinitionsWithoutScopesClient marketplaceRegistrationDefinitionsWithoutScopes; + + /** + * Gets the MarketplaceRegistrationDefinitionsWithoutScopesClient object to access its operations. + * + * @return the MarketplaceRegistrationDefinitionsWithoutScopesClient object. + */ + public MarketplaceRegistrationDefinitionsWithoutScopesClient getMarketplaceRegistrationDefinitionsWithoutScopes() { + return this.marketplaceRegistrationDefinitionsWithoutScopes; + } + + /** 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 OperationsWithScopesClient object to access its operations. */ + private final OperationsWithScopesClient operationsWithScopes; + + /** + * Gets the OperationsWithScopesClient object to access its operations. + * + * @return the OperationsWithScopesClient object. + */ + public OperationsWithScopesClient getOperationsWithScopes() { + return this.operationsWithScopes; + } + + /** + * Initializes an instance of ManagedServicesClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint server parameter. + */ + ManagedServicesClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2022-10-01"; + this.registrationDefinitions = new RegistrationDefinitionsClientImpl(this); + this.registrationAssignments = new RegistrationAssignmentsClientImpl(this); + this.marketplaceRegistrationDefinitions = new MarketplaceRegistrationDefinitionsClientImpl(this); + this.marketplaceRegistrationDefinitionsWithoutScopes = + new MarketplaceRegistrationDefinitionsWithoutScopesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.operationsWithScopes = new OperationsWithScopesClientImpl(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(ManagedServicesClientImpl.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionImpl.java new file mode 100644 index 0000000000000..9d0e3a57cdaa0 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.implementation; + +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionProperties; +import com.azure.resourcemanager.managedservices.models.Plan; + +public final class MarketplaceRegistrationDefinitionImpl implements MarketplaceRegistrationDefinition { + private MarketplaceRegistrationDefinitionInner innerObject; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + MarketplaceRegistrationDefinitionImpl( + MarketplaceRegistrationDefinitionInner innerObject, + com.azure.resourcemanager.managedservices.ManagedServicesManager 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 MarketplaceRegistrationDefinitionProperties properties() { + return this.innerModel().properties(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public MarketplaceRegistrationDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsClientImpl.java new file mode 100644 index 0000000000000..e34287ec1fe2d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsClientImpl.java @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.MarketplaceRegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MarketplaceRegistrationDefinitionsClient. + */ +public final class MarketplaceRegistrationDefinitionsClientImpl implements MarketplaceRegistrationDefinitionsClient { + /** The proxy service used to perform REST calls. */ + private final MarketplaceRegistrationDefinitionsService service; + + /** The service client containing this operation class. */ + private final ManagedServicesClientImpl client; + + /** + * Initializes an instance of MarketplaceRegistrationDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MarketplaceRegistrationDefinitionsClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy + .create( + MarketplaceRegistrationDefinitionsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientMarketplaceRegistrationDefinitions to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface MarketplaceRegistrationDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("marketplaceIdentifier") String marketplaceIdentifier, + @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); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the marketplace registration definitions for the marketplace identifier along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), scope, filter, this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), scope, filter, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the 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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the 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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String filter = null; + return new PagedIterable<>(listAsync(scope, filter)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String filter, Context context) { + return new PagedIterable<>(listAsync(scope, filter, context)); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String marketplaceIdentifier) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (marketplaceIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter marketplaceIdentifier is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + marketplaceIdentifier, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String marketplaceIdentifier, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (marketplaceIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter marketplaceIdentifier is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), scope, marketplaceIdentifier, this.client.getApiVersion(), accept, context); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String marketplaceIdentifier) { + return getWithResponseAsync(scope, marketplaceIdentifier).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String marketplaceIdentifier, Context context) { + return getWithResponseAsync(scope, marketplaceIdentifier, context).block(); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceRegistrationDefinitionInner get(String scope, String marketplaceIdentifier) { + return getWithResponse(scope, marketplaceIdentifier, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions 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 the list of marketplace registration definitions 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsImpl.java new file mode 100644 index 0000000000000..09b2256250084 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.MarketplaceRegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitions; + +public final class MarketplaceRegistrationDefinitionsImpl implements MarketplaceRegistrationDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceRegistrationDefinitionsImpl.class); + + private final MarketplaceRegistrationDefinitionsClient innerClient; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public MarketplaceRegistrationDefinitionsImpl( + MarketplaceRegistrationDefinitionsClient innerClient, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(scope, filter, context); + return Utils.mapPage(inner, inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String scope, String marketplaceIdentifier, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, marketplaceIdentifier, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MarketplaceRegistrationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MarketplaceRegistrationDefinition get(String scope, String marketplaceIdentifier) { + MarketplaceRegistrationDefinitionInner inner = this.serviceClient().get(scope, marketplaceIdentifier); + if (inner != null) { + return new MarketplaceRegistrationDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + private MarketplaceRegistrationDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.java new file mode 100644 index 0000000000000..51f7da6e94254 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.java @@ -0,0 +1,442 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.MarketplaceRegistrationDefinitionsWithoutScopesClient; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * MarketplaceRegistrationDefinitionsWithoutScopesClient. + */ +public final class MarketplaceRegistrationDefinitionsWithoutScopesClientImpl + implements MarketplaceRegistrationDefinitionsWithoutScopesClient { + /** The proxy service used to perform REST calls. */ + private final MarketplaceRegistrationDefinitionsWithoutScopesService service; + + /** The service client containing this operation class. */ + private final ManagedServicesClientImpl client; + + /** + * Initializes an instance of MarketplaceRegistrationDefinitionsWithoutScopesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MarketplaceRegistrationDefinitionsWithoutScopesClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy + .create( + MarketplaceRegistrationDefinitionsWithoutScopesService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientMarketplaceRegistrationDefinitionsWithoutScopes + * to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface MarketplaceRegistrationDefinitionsWithoutScopesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("marketplaceIdentifier") String marketplaceIdentifier, + @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); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the marketplace registration definitions for the marketplace identifier along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), filter, this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier along with {@link + * PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), filter, this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @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 list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String marketplaceIdentifier) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (marketplaceIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter marketplaceIdentifier is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + marketplaceIdentifier, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String marketplaceIdentifier, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (marketplaceIdentifier == null) { + return Mono + .error(new IllegalArgumentException("Parameter marketplaceIdentifier is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), marketplaceIdentifier, this.client.getApiVersion(), accept, context); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String marketplaceIdentifier) { + return getWithResponseAsync(marketplaceIdentifier).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String marketplaceIdentifier, Context context) { + return getWithResponseAsync(marketplaceIdentifier, context).block(); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MarketplaceRegistrationDefinitionInner get(String marketplaceIdentifier) { + return getWithResponse(marketplaceIdentifier, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions 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 the list of marketplace registration definitions 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesImpl.java new file mode 100644 index 0000000000000..a7cc1a43f0166 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.MarketplaceRegistrationDefinitionsWithoutScopesClient; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionsWithoutScopes; + +public final class MarketplaceRegistrationDefinitionsWithoutScopesImpl + implements MarketplaceRegistrationDefinitionsWithoutScopes { + private static final ClientLogger LOGGER = + new ClientLogger(MarketplaceRegistrationDefinitionsWithoutScopesImpl.class); + + private final MarketplaceRegistrationDefinitionsWithoutScopesClient innerClient; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public MarketplaceRegistrationDefinitionsWithoutScopesImpl( + MarketplaceRegistrationDefinitionsWithoutScopesClient innerClient, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public Response getWithResponse(String marketplaceIdentifier, Context context) { + Response inner = + this.serviceClient().getWithResponse(marketplaceIdentifier, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MarketplaceRegistrationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MarketplaceRegistrationDefinition get(String marketplaceIdentifier) { + MarketplaceRegistrationDefinitionInner inner = this.serviceClient().get(marketplaceIdentifier); + if (inner != null) { + return new MarketplaceRegistrationDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + private MarketplaceRegistrationDefinitionsWithoutScopesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationListImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationListImpl.java new file mode 100644 index 0000000000000..80f3864047d38 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationListImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.implementation; + +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import com.azure.resourcemanager.managedservices.models.Operation; +import com.azure.resourcemanager.managedservices.models.OperationList; +import java.util.Collections; +import java.util.List; + +public final class OperationListImpl implements OperationList { + private OperationListInner innerObject; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + OperationListImpl( + OperationListInner innerObject, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OperationListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..7790355a09b39 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsClientImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.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.managedservices.fluent.OperationsClient; +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +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 ManagedServicesClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ManagedServices/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of the operations. + * + * @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 list of the operations along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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); + } + + /** + * Gets a list of the operations. + * + * @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 list of the operations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Gets a list of the operations. + * + * @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 list of the operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListInner list() { + return listWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..c0c5a33bde7e7 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.OperationsClient; +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import com.azure.resourcemanager.managedservices.models.OperationList; +import com.azure.resourcemanager.managedservices.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.managedservices.ManagedServicesManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationList list() { + OperationListInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesClientImpl.java new file mode 100644 index 0000000000000..63f65c68a49e3 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesClientImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.OperationsWithScopesClient; +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsWithScopesClient. */ +public final class OperationsWithScopesClientImpl implements OperationsWithScopesClient { + /** The proxy service used to perform REST calls. */ + private final OperationsWithScopesService service; + + /** The service client containing this operation class. */ + private final ManagedServicesClientImpl client; + + /** + * Initializes an instance of OperationsWithScopesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsWithScopesClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy + .create(OperationsWithScopesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientOperationsWithScopes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface OperationsWithScopesService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 list of the operations with the scope along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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.list(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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.list(this.client.getEndpoint(), scope, this.client.getApiVersion(), accept, context); + } + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 list of the operations with the scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String scope) { + return listWithResponseAsync(scope).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String scope, Context context) { + return listWithResponseAsync(scope, context).block(); + } + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 list of the operations with the scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListInner list(String scope) { + return listWithResponse(scope, Context.NONE).getValue(); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesImpl.java new file mode 100644 index 0000000000000..f586241cc0f56 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsWithScopesImpl.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.managedservices.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.managedservices.fluent.OperationsWithScopesClient; +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import com.azure.resourcemanager.managedservices.models.OperationList; +import com.azure.resourcemanager.managedservices.models.OperationsWithScopes; + +public final class OperationsWithScopesImpl implements OperationsWithScopes { + private static final ClientLogger LOGGER = new ClientLogger(OperationsWithScopesImpl.class); + + private final OperationsWithScopesClient innerClient; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public OperationsWithScopesImpl( + OperationsWithScopesClient innerClient, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(String scope, Context context) { + Response inner = this.serviceClient().listWithResponse(scope, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationList list(String scope) { + OperationListInner inner = this.serviceClient().list(scope); + if (inner != null) { + return new OperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationsWithScopesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java new file mode 100644 index 0000000000000..f910e8441b578 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.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.managedservices.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignment; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentProperties; + +public final class RegistrationAssignmentImpl + implements RegistrationAssignment, RegistrationAssignment.Definition, RegistrationAssignment.Update { + private RegistrationAssignmentInner innerObject; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RegistrationAssignmentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RegistrationAssignmentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } + + private String scope; + + private String registrationAssignmentId; + + public RegistrationAssignmentImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public RegistrationAssignment create() { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .createOrUpdate(scope, registrationAssignmentId, this.innerModel(), Context.NONE); + return this; + } + + public RegistrationAssignment create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .createOrUpdate(scope, registrationAssignmentId, this.innerModel(), context); + return this; + } + + RegistrationAssignmentImpl( + String name, com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerObject = new RegistrationAssignmentInner(); + this.serviceManager = serviceManager; + this.registrationAssignmentId = name; + } + + public RegistrationAssignmentImpl update() { + return this; + } + + public RegistrationAssignment apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .createOrUpdate(scope, registrationAssignmentId, this.innerModel(), Context.NONE); + return this; + } + + public RegistrationAssignment apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .createOrUpdate(scope, registrationAssignmentId, this.innerModel(), context); + return this; + } + + RegistrationAssignmentImpl( + RegistrationAssignmentInner innerObject, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "scope"); + this.registrationAssignmentId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "registrationAssignmentId"); + } + + public RegistrationAssignment refresh() { + Boolean localExpandRegistrationDefinition = null; + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .getWithResponse(scope, registrationAssignmentId, localExpandRegistrationDefinition, Context.NONE) + .getValue(); + return this; + } + + public RegistrationAssignment refresh(Context context) { + Boolean localExpandRegistrationDefinition = null; + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationAssignments() + .getWithResponse(scope, registrationAssignmentId, localExpandRegistrationDefinition, context) + .getValue(); + return this; + } + + public RegistrationAssignmentImpl withProperties(RegistrationAssignmentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsClientImpl.java new file mode 100644 index 0000000000000..5cd3579d90adc --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsClientImpl.java @@ -0,0 +1,1012 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedservices.fluent.RegistrationAssignmentsClient; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegistrationAssignmentsClient. */ +public final class RegistrationAssignmentsClientImpl implements RegistrationAssignmentsClient { + /** The proxy service used to perform REST calls. */ + private final RegistrationAssignmentsService service; + + /** The service client containing this operation class. */ + private final ManagedServicesClientImpl client; + + /** + * Initializes an instance of RegistrationAssignmentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegistrationAssignmentsClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy + .create(RegistrationAssignmentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientRegistrationAssignments to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface RegistrationAssignmentsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("registrationAssignmentId") String registrationAssignmentId, + @QueryParam("$expandRegistrationDefinition") Boolean expandRegistrationDefinition, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("registrationAssignmentId") String registrationAssignmentId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("registrationAssignmentId") String registrationAssignmentId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RegistrationAssignmentInner requestBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/registrationAssignments") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("$expandRegistrationDefinition") Boolean expandRegistrationDefinition, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @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); + } + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + expandRegistrationDefinition, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + expandRegistrationDefinition, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the specified registration assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String registrationAssignmentId) { + final Boolean expandRegistrationDefinition = null; + return getWithResponseAsync(scope, registrationAssignmentId, expandRegistrationDefinition) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context) { + return getWithResponseAsync(scope, registrationAssignmentId, expandRegistrationDefinition, context).block(); + } + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the specified registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationAssignmentInner get(String scope, String registrationAssignmentId) { + final Boolean expandRegistrationDefinition = null; + return getWithResponse(scope, registrationAssignmentId, expandRegistrationDefinition, Context.NONE).getValue(); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String scope, String registrationAssignmentId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String scope, String registrationAssignmentId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String scope, String registrationAssignmentId) { + Mono>> mono = deleteWithResponseAsync(scope, registrationAssignmentId); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String scope, String registrationAssignmentId, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(scope, registrationAssignmentId, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String scope, String registrationAssignmentId) { + return this.beginDeleteAsync(scope, registrationAssignmentId).getSyncPoller(); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String scope, String registrationAssignmentId, Context context) { + return this.beginDeleteAsync(scope, registrationAssignmentId, context).getSyncPoller(); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String registrationAssignmentId) { + return beginDeleteAsync(scope, registrationAssignmentId).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String scope, String registrationAssignmentId, Context context) { + return beginDeleteAsync(scope, registrationAssignmentId, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String registrationAssignmentId) { + deleteAsync(scope, registrationAssignmentId).block(); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String scope, String registrationAssignmentId, Context context) { + deleteAsync(scope, registrationAssignmentId, context).block(); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + this.client.getApiVersion(), + requestBody, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationAssignmentId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationAssignmentId is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + scope, + registrationAssignmentId, + this.client.getApiVersion(), + requestBody, + accept, + context); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RegistrationAssignmentInner> beginCreateOrUpdateAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + Mono>> mono = + createOrUpdateWithResponseAsync(scope, registrationAssignmentId, requestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RegistrationAssignmentInner.class, + RegistrationAssignmentInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RegistrationAssignmentInner> beginCreateOrUpdateAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(scope, registrationAssignmentId, requestBody, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RegistrationAssignmentInner.class, + RegistrationAssignmentInner.class, + context); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + return this.beginCreateOrUpdateAsync(scope, registrationAssignmentId, requestBody).getSyncPoller(); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the registration assignment. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + return this.beginCreateOrUpdateAsync(scope, registrationAssignmentId, requestBody, context).getSyncPoller(); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + return beginCreateOrUpdateAsync(scope, registrationAssignmentId, requestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + return beginCreateOrUpdateAsync(scope, registrationAssignmentId, requestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationAssignmentInner createOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + return createOrUpdateAsync(scope, registrationAssignmentId, requestBody).block(); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param requestBody The parameters required to create new registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationAssignmentInner createOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + return createOrUpdateAsync(scope, registrationAssignmentId, requestBody, context).block(); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the registration assignments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, Boolean expandRegistrationDefinition, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + expandRegistrationDefinition, + this.client.getApiVersion(), + filter, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration assignments along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, Boolean expandRegistrationDefinition, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + expandRegistrationDefinition, + this.client.getApiVersion(), + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the registration assignments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, Boolean expandRegistrationDefinition, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the 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 list of the registration assignments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final Boolean expandRegistrationDefinition = null; + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration assignments as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, Boolean expandRegistrationDefinition, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the 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 list of the registration assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final Boolean expandRegistrationDefinition = null; + final String filter = null; + return new PagedIterable<>(listAsync(scope, expandRegistrationDefinition, filter)); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration assignments as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, Boolean expandRegistrationDefinition, String filter, Context context) { + return new PagedIterable<>(listAsync(scope, expandRegistrationDefinition, filter, 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 the list of registration assignments 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 the list of registration assignments 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsImpl.java new file mode 100644 index 0000000000000..af1bffa8941b2 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.RegistrationAssignmentsClient; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignment; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignments; + +public final class RegistrationAssignmentsImpl implements RegistrationAssignments { + private static final ClientLogger LOGGER = new ClientLogger(RegistrationAssignmentsImpl.class); + + private final RegistrationAssignmentsClient innerClient; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public RegistrationAssignmentsImpl( + RegistrationAssignmentsClient innerClient, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(scope, registrationAssignmentId, expandRegistrationDefinition, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegistrationAssignmentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RegistrationAssignment get(String scope, String registrationAssignmentId) { + RegistrationAssignmentInner inner = this.serviceClient().get(scope, registrationAssignmentId); + if (inner != null) { + return new RegistrationAssignmentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String scope, String registrationAssignmentId) { + this.serviceClient().delete(scope, registrationAssignmentId); + } + + public void delete(String scope, String registrationAssignmentId, Context context) { + this.serviceClient().delete(scope, registrationAssignmentId, context); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new RegistrationAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, Boolean expandRegistrationDefinition, String filter, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, expandRegistrationDefinition, filter, context); + return Utils.mapPage(inner, inner1 -> new RegistrationAssignmentImpl(inner1, this.manager())); + } + + public RegistrationAssignment getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationAssignmentId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "registrationAssignmentId"); + if (registrationAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationAssignments'.", + id))); + } + Boolean localExpandRegistrationDefinition = null; + return this + .getWithResponse(scope, registrationAssignmentId, localExpandRegistrationDefinition, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse( + String id, Boolean expandRegistrationDefinition, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationAssignmentId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "registrationAssignmentId"); + if (registrationAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationAssignments'.", + id))); + } + return this.getWithResponse(scope, registrationAssignmentId, expandRegistrationDefinition, context); + } + + public void deleteById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationAssignmentId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "registrationAssignmentId"); + if (registrationAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationAssignments'.", + id))); + } + this.delete(scope, registrationAssignmentId, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationAssignmentId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationAssignments/{registrationAssignmentId}", + "registrationAssignmentId"); + if (registrationAssignmentId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationAssignments'.", + id))); + } + this.delete(scope, registrationAssignmentId, context); + } + + private RegistrationAssignmentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } + + public RegistrationAssignmentImpl define(String name) { + return new RegistrationAssignmentImpl(name, this.manager()); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.java new file mode 100644 index 0000000000000..1a4c24642ace7 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.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.managedservices.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionProperties; + +public final class RegistrationDefinitionImpl + implements RegistrationDefinition, RegistrationDefinition.Definition, RegistrationDefinition.Update { + private RegistrationDefinitionInner innerObject; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RegistrationDefinitionProperties properties() { + return this.innerModel().properties(); + } + + public Plan plan() { + return this.innerModel().plan(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RegistrationDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } + + private String registrationDefinitionId; + + private String scope; + + public RegistrationDefinitionImpl withExistingScope(String scope) { + this.scope = scope; + return this; + } + + public RegistrationDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .createOrUpdate(registrationDefinitionId, scope, this.innerModel(), Context.NONE); + return this; + } + + public RegistrationDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .createOrUpdate(registrationDefinitionId, scope, this.innerModel(), context); + return this; + } + + RegistrationDefinitionImpl( + String name, com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerObject = new RegistrationDefinitionInner(); + this.serviceManager = serviceManager; + this.registrationDefinitionId = name; + } + + public RegistrationDefinitionImpl update() { + return this; + } + + public RegistrationDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .createOrUpdate(registrationDefinitionId, scope, this.innerModel(), Context.NONE); + return this; + } + + public RegistrationDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .createOrUpdate(registrationDefinitionId, scope, this.innerModel(), context); + return this; + } + + RegistrationDefinitionImpl( + RegistrationDefinitionInner innerObject, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.registrationDefinitionId = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "registrationDefinitionId"); + this.scope = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "scope"); + } + + public RegistrationDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .getWithResponse(scope, registrationDefinitionId, Context.NONE) + .getValue(); + return this; + } + + public RegistrationDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRegistrationDefinitions() + .getWithResponse(scope, registrationDefinitionId, context) + .getValue(); + return this; + } + + public RegistrationDefinitionImpl withProperties(RegistrationDefinitionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public RegistrationDefinitionImpl withPlan(Plan plan) { + this.innerModel().withPlan(plan); + return this; + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsClientImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsClientImpl.java new file mode 100644 index 0000000000000..000559f97dc69 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsClientImpl.java @@ -0,0 +1,873 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.managedservices.fluent.RegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RegistrationDefinitionsClient. */ +public final class RegistrationDefinitionsClientImpl implements RegistrationDefinitionsClient { + /** The proxy service used to perform REST calls. */ + private final RegistrationDefinitionsService service; + + /** The service client containing this operation class. */ + private final ManagedServicesClientImpl client; + + /** + * Initializes an instance of RegistrationDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegistrationDefinitionsClientImpl(ManagedServicesClientImpl client) { + this.service = + RestProxy + .create(RegistrationDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ManagedServicesClientRegistrationDefinitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ManagedServicesClien") + public interface RegistrationDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @PathParam("registrationDefinitionId") String registrationDefinitionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("registrationDefinitionId") String registrationDefinitionId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("registrationDefinitionId") String registrationDefinitionId, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "scope", encoded = true) String scope, + @BodyParam("application/json") RegistrationDefinitionInner requestBody, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "scope", encoded = true) String scope, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @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); + } + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String registrationDefinitionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + scope, + registrationDefinitionId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String scope, String registrationDefinitionId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + scope, + registrationDefinitionId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String registrationDefinitionId) { + return getWithResponseAsync(scope, registrationDefinitionId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String registrationDefinitionId, Context context) { + return getWithResponseAsync(scope, registrationDefinitionId, context).block(); + } + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationDefinitionInner get(String scope, String registrationDefinitionId) { + return getWithResponse(scope, registrationDefinitionId, Context.NONE).getValue(); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId 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 + .delete( + this.client.getEndpoint(), + registrationDefinitionId, + this.client.getApiVersion(), + scope, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, 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 (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId 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 + .delete( + this.client.getEndpoint(), + registrationDefinitionId, + this.client.getApiVersion(), + scope, + accept, + context); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope) { + return deleteWithResponseAsync(registrationDefinitionId, scope).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope, Context context) { + return deleteWithResponseAsync(registrationDefinitionId, scope, context).block(); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope) { + deleteWithResponse(registrationDefinitionId, scope, Context.NONE); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + registrationDefinitionId, + this.client.getApiVersion(), + scope, + requestBody, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (registrationDefinitionId == null) { + return Mono + .error( + new IllegalArgumentException("Parameter registrationDefinitionId is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + if (requestBody == null) { + return Mono.error(new IllegalArgumentException("Parameter requestBody is required and cannot be null.")); + } else { + requestBody.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + registrationDefinitionId, + this.client.getApiVersion(), + scope, + requestBody, + accept, + context); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 PollerFlux} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RegistrationDefinitionInner> beginCreateOrUpdateAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + Mono>> mono = + createOrUpdateWithResponseAsync(registrationDefinitionId, scope, requestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RegistrationDefinitionInner.class, + RegistrationDefinitionInner.class, + this.client.getContext()); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 PollerFlux} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, RegistrationDefinitionInner> beginCreateOrUpdateAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(registrationDefinitionId, scope, requestBody, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RegistrationDefinitionInner.class, + RegistrationDefinitionInner.class, + context); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 SyncPoller} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + return this.beginCreateOrUpdateAsync(registrationDefinitionId, scope, requestBody).getSyncPoller(); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 SyncPoller} for polling of the registration definition. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + return this.beginCreateOrUpdateAsync(registrationDefinitionId, scope, requestBody, context).getSyncPoller(); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + return beginCreateOrUpdateAsync(registrationDefinitionId, scope, requestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + return beginCreateOrUpdateAsync(registrationDefinitionId, scope, requestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationDefinitionInner createOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + return createOrUpdateAsync(registrationDefinitionId, scope, requestBody).block(); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the resource. + * @param requestBody The parameters required to create a new registration definition. + * @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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RegistrationDefinitionInner createOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + return createOrUpdateAsync(registrationDefinitionId, scope, requestBody, context).block(); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the registration definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String scope, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), scope, this.client.getApiVersion(), filter, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (scope == null) { + return Mono.error(new IllegalArgumentException("Parameter scope is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), scope, this.client.getApiVersion(), filter, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @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 list of the registration definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the 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 list of the registration definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(scope, filter), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, filter, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the 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 list of the registration definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final String filter = null; + return new PagedIterable<>(listAsync(scope, filter)); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, String filter, Context context) { + return new PagedIterable<>(listAsync(scope, filter, 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 the list of registration definitions 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 the list of registration definitions 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsImpl.java new file mode 100644 index 0000000000000..667ac28798408 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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.managedservices.fluent.RegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitions; + +public final class RegistrationDefinitionsImpl implements RegistrationDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(RegistrationDefinitionsImpl.class); + + private final RegistrationDefinitionsClient innerClient; + + private final com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager; + + public RegistrationDefinitionsImpl( + RegistrationDefinitionsClient innerClient, + com.azure.resourcemanager.managedservices.ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String scope, String registrationDefinitionId, Context context) { + Response inner = + this.serviceClient().getWithResponse(scope, registrationDefinitionId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RegistrationDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RegistrationDefinition get(String scope, String registrationDefinitionId) { + RegistrationDefinitionInner inner = this.serviceClient().get(scope, registrationDefinitionId); + if (inner != null) { + return new RegistrationDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String registrationDefinitionId, String scope, Context context) { + return this.serviceClient().deleteWithResponse(registrationDefinitionId, scope, context); + } + + public void deleteByResourceGroup(String registrationDefinitionId, String scope) { + this.serviceClient().delete(registrationDefinitionId, scope); + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return Utils.mapPage(inner, inner1 -> new RegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(scope, filter, context); + return Utils.mapPage(inner, inner1 -> new RegistrationDefinitionImpl(inner1, this.manager())); + } + + public RegistrationDefinition getById(String id) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationDefinitionId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "registrationDefinitionId"); + if (registrationDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationDefinitions'.", + id))); + } + return this.getWithResponse(scope, registrationDefinitionId, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + String registrationDefinitionId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "registrationDefinitionId"); + if (registrationDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationDefinitions'.", + id))); + } + return this.getWithResponse(scope, registrationDefinitionId, context); + } + + public void deleteById(String id) { + String registrationDefinitionId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "registrationDefinitionId"); + if (registrationDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationDefinitions'.", + id))); + } + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + this.deleteByResourceGroupWithResponse(registrationDefinitionId, scope, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String registrationDefinitionId = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "registrationDefinitionId"); + if (registrationDefinitionId == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'registrationDefinitions'.", + id))); + } + String scope = + Utils + .getValueFromIdByParameterName( + id, + "/{scope}/providers/Microsoft.ManagedServices/registrationDefinitions/{registrationDefinitionId}", + "scope"); + if (scope == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'scope'.", id))); + } + return this.deleteByResourceGroupWithResponse(registrationDefinitionId, scope, context); + } + + private RegistrationDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.managedservices.ManagedServicesManager manager() { + return this.serviceManager; + } + + public RegistrationDefinitionImpl define(String name) { + return new RegistrationDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/Utils.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/Utils.java new file mode 100644 index 0000000000000..19955d654bc8c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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.managedservices.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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/package-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/package-info.java new file mode 100644 index 0000000000000..ece7925187f26 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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 ManagedServicesClient. The specification for ManagedServices. */ +package com.azure.resourcemanager.managedservices.implementation; diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java new file mode 100644 index 0000000000000..b56518f5cae27 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.UUID; + +/** + * The Azure Active Directory principal identifier and Azure built-in role that describes the access the principal will + * receive on the delegated resource in the managed tenant. + */ +@Fluent +public final class Authorization { + /* + * The identifier of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The display name of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalIdDisplayName") + private String principalIdDisplayName; + + /* + * The identifier of the Azure built-in role that defines the permissions that the Azure Active Directory principal + * will have on the projected scope. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /* + * The delegatedRoleDefinitionIds field is required when the roleDefinitionId refers to the User Access + * Administrator Role. It is the list of role definition ids which define all the permissions that the user in the + * authorization can assign to other principals. + */ + @JsonProperty(value = "delegatedRoleDefinitionIds") + private List delegatedRoleDefinitionIds; + + /** Creates an instance of Authorization class. */ + public Authorization() { + } + + /** + * Get the principalId property: The identifier of the Azure Active Directory principal. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The identifier of the Azure Active Directory principal. + * + * @param principalId the principalId value to set. + * @return the Authorization object itself. + */ + public Authorization withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @return the principalIdDisplayName value. + */ + public String principalIdDisplayName() { + return this.principalIdDisplayName; + } + + /** + * Set the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @param principalIdDisplayName the principalIdDisplayName value to set. + * @return the Authorization object itself. + */ + public Authorization withPrincipalIdDisplayName(String principalIdDisplayName) { + this.principalIdDisplayName = principalIdDisplayName; + return this; + } + + /** + * Get the roleDefinitionId property: The identifier of the Azure built-in role that defines the permissions that + * the Azure Active Directory principal will have on the projected scope. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The identifier of the Azure built-in role that defines the permissions that + * the Azure Active Directory principal will have on the projected scope. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the Authorization object itself. + */ + public Authorization withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the delegatedRoleDefinitionIds property: The delegatedRoleDefinitionIds field is required when the + * roleDefinitionId refers to the User Access Administrator Role. It is the list of role definition ids which define + * all the permissions that the user in the authorization can assign to other principals. + * + * @return the delegatedRoleDefinitionIds value. + */ + public List delegatedRoleDefinitionIds() { + return this.delegatedRoleDefinitionIds; + } + + /** + * Set the delegatedRoleDefinitionIds property: The delegatedRoleDefinitionIds field is required when the + * roleDefinitionId refers to the User Access Administrator Role. It is the list of role definition ids which define + * all the permissions that the user in the authorization can assign to other principals. + * + * @param delegatedRoleDefinitionIds the delegatedRoleDefinitionIds value to set. + * @return the Authorization object itself. + */ + public Authorization withDelegatedRoleDefinitionIds(List delegatedRoleDefinitionIds) { + this.delegatedRoleDefinitionIds = delegatedRoleDefinitionIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property principalId in model Authorization")); + } + if (roleDefinitionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property roleDefinitionId in model Authorization")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Authorization.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleApprover.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleApprover.java new file mode 100644 index 0000000000000..a2675fdbec275 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleApprover.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines the Azure Active Directory principal that can approve any just-in-time access requests by the principal + * defined in the EligibleAuthorization. + */ +@Fluent +public final class EligibleApprover { + /* + * The identifier of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The display name of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalIdDisplayName") + private String principalIdDisplayName; + + /** Creates an instance of EligibleApprover class. */ + public EligibleApprover() { + } + + /** + * Get the principalId property: The identifier of the Azure Active Directory principal. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The identifier of the Azure Active Directory principal. + * + * @param principalId the principalId value to set. + * @return the EligibleApprover object itself. + */ + public EligibleApprover withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @return the principalIdDisplayName value. + */ + public String principalIdDisplayName() { + return this.principalIdDisplayName; + } + + /** + * Set the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @param principalIdDisplayName the principalIdDisplayName value to set. + * @return the EligibleApprover object itself. + */ + public EligibleApprover withPrincipalIdDisplayName(String principalIdDisplayName) { + this.principalIdDisplayName = principalIdDisplayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property principalId in model EligibleApprover")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EligibleApprover.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java new file mode 100644 index 0000000000000..fe7982f3eeb05 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Azure Active Directory principal identifier, Azure built-in role, and just-in-time access policy that describes + * the just-in-time access the principal will receive on the delegated resource in the managed tenant. + */ +@Fluent +public final class EligibleAuthorization { + /* + * The identifier of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * The display name of the Azure Active Directory principal. + */ + @JsonProperty(value = "principalIdDisplayName") + private String principalIdDisplayName; + + /* + * The identifier of the Azure built-in role that defines the permissions that the Azure Active Directory principal + * will have on the projected scope. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /* + * The just-in-time access policy setting. + */ + @JsonProperty(value = "justInTimeAccessPolicy") + private JustInTimeAccessPolicy justInTimeAccessPolicy; + + /** Creates an instance of EligibleAuthorization class. */ + public EligibleAuthorization() { + } + + /** + * Get the principalId property: The identifier of the Azure Active Directory principal. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: The identifier of the Azure Active Directory principal. + * + * @param principalId the principalId value to set. + * @return the EligibleAuthorization object itself. + */ + public EligibleAuthorization withPrincipalId(String principalId) { + this.principalId = principalId; + return this; + } + + /** + * Get the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @return the principalIdDisplayName value. + */ + public String principalIdDisplayName() { + return this.principalIdDisplayName; + } + + /** + * Set the principalIdDisplayName property: The display name of the Azure Active Directory principal. + * + * @param principalIdDisplayName the principalIdDisplayName value to set. + * @return the EligibleAuthorization object itself. + */ + public EligibleAuthorization withPrincipalIdDisplayName(String principalIdDisplayName) { + this.principalIdDisplayName = principalIdDisplayName; + return this; + } + + /** + * Get the roleDefinitionId property: The identifier of the Azure built-in role that defines the permissions that + * the Azure Active Directory principal will have on the projected scope. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The identifier of the Azure built-in role that defines the permissions that + * the Azure Active Directory principal will have on the projected scope. + * + * @param roleDefinitionId the roleDefinitionId value to set. + * @return the EligibleAuthorization object itself. + */ + public EligibleAuthorization withRoleDefinitionId(String roleDefinitionId) { + this.roleDefinitionId = roleDefinitionId; + return this; + } + + /** + * Get the justInTimeAccessPolicy property: The just-in-time access policy setting. + * + * @return the justInTimeAccessPolicy value. + */ + public JustInTimeAccessPolicy justInTimeAccessPolicy() { + return this.justInTimeAccessPolicy; + } + + /** + * Set the justInTimeAccessPolicy property: The just-in-time access policy setting. + * + * @param justInTimeAccessPolicy the justInTimeAccessPolicy value to set. + * @return the EligibleAuthorization object itself. + */ + public EligibleAuthorization withJustInTimeAccessPolicy(JustInTimeAccessPolicy justInTimeAccessPolicy) { + this.justInTimeAccessPolicy = justInTimeAccessPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (principalId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property principalId in model EligibleAuthorization")); + } + if (roleDefinitionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property roleDefinitionId in model EligibleAuthorization")); + } + if (justInTimeAccessPolicy() != null) { + justInTimeAccessPolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EligibleAuthorization.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.java new file mode 100644 index 0000000000000..112d6e6cbc1c7 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** Just-in-time access policy setting. */ +@Fluent +public final class JustInTimeAccessPolicy { + /* + * The multi-factor authorization provider to be used for just-in-time access requests. + */ + @JsonProperty(value = "multiFactorAuthProvider", required = true) + private MultiFactorAuthProvider multiFactorAuthProvider; + + /* + * The maximum access duration in ISO 8601 format for just-in-time access requests. + */ + @JsonProperty(value = "maximumActivationDuration") + private Duration maximumActivationDuration; + + /* + * The list of managedByTenant approvers for the eligible authorization. + */ + @JsonProperty(value = "managedByTenantApprovers") + private List managedByTenantApprovers; + + /** Creates an instance of JustInTimeAccessPolicy class. */ + public JustInTimeAccessPolicy() { + } + + /** + * Get the multiFactorAuthProvider property: The multi-factor authorization provider to be used for just-in-time + * access requests. + * + * @return the multiFactorAuthProvider value. + */ + public MultiFactorAuthProvider multiFactorAuthProvider() { + return this.multiFactorAuthProvider; + } + + /** + * Set the multiFactorAuthProvider property: The multi-factor authorization provider to be used for just-in-time + * access requests. + * + * @param multiFactorAuthProvider the multiFactorAuthProvider value to set. + * @return the JustInTimeAccessPolicy object itself. + */ + public JustInTimeAccessPolicy withMultiFactorAuthProvider(MultiFactorAuthProvider multiFactorAuthProvider) { + this.multiFactorAuthProvider = multiFactorAuthProvider; + return this; + } + + /** + * Get the maximumActivationDuration property: The maximum access duration in ISO 8601 format for just-in-time + * access requests. + * + * @return the maximumActivationDuration value. + */ + public Duration maximumActivationDuration() { + return this.maximumActivationDuration; + } + + /** + * Set the maximumActivationDuration property: The maximum access duration in ISO 8601 format for just-in-time + * access requests. + * + * @param maximumActivationDuration the maximumActivationDuration value to set. + * @return the JustInTimeAccessPolicy object itself. + */ + public JustInTimeAccessPolicy withMaximumActivationDuration(Duration maximumActivationDuration) { + this.maximumActivationDuration = maximumActivationDuration; + return this; + } + + /** + * Get the managedByTenantApprovers property: The list of managedByTenant approvers for the eligible authorization. + * + * @return the managedByTenantApprovers value. + */ + public List managedByTenantApprovers() { + return this.managedByTenantApprovers; + } + + /** + * Set the managedByTenantApprovers property: The list of managedByTenant approvers for the eligible authorization. + * + * @param managedByTenantApprovers the managedByTenantApprovers value to set. + * @return the JustInTimeAccessPolicy object itself. + */ + public JustInTimeAccessPolicy withManagedByTenantApprovers(List managedByTenantApprovers) { + this.managedByTenantApprovers = managedByTenantApprovers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (multiFactorAuthProvider() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property multiFactorAuthProvider in model JustInTimeAccessPolicy")); + } + if (managedByTenantApprovers() != null) { + managedByTenantApprovers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(JustInTimeAccessPolicy.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinition.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinition.java new file mode 100644 index 0000000000000..c6cf8dc714ceb --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; + +/** An immutable client-side representation of MarketplaceRegistrationDefinition. */ +public interface MarketplaceRegistrationDefinition { + /** + * 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 properties property: The properties of the marketplace registration definition. + * + * @return the properties value. + */ + MarketplaceRegistrationDefinitionProperties properties(); + + /** + * Gets the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the inner com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner + * object. + * + * @return the inner object. + */ + MarketplaceRegistrationDefinitionInner innerModel(); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionList.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionList.java new file mode 100644 index 0000000000000..ff5cb02aa678a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionList.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.managedservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of marketplace registration definitions. */ +@Immutable +public final class MarketplaceRegistrationDefinitionList { + /* + * The list of marketplace registration definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of marketplace registration definitions. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of MarketplaceRegistrationDefinitionList class. */ + public MarketplaceRegistrationDefinitionList() { + } + + /** + * Get the value property: The list of marketplace registration definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of marketplace registration definitions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java new file mode 100644 index 0000000000000..a7851f7b04486 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of the marketplace registration definition. */ +@Fluent +public final class MarketplaceRegistrationDefinitionProperties { + /* + * The identifier of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId", required = true) + private String managedByTenantId; + + /* + * The collection of authorization objects describing the access Azure Active Directory principals in the managedBy + * tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "authorizations", required = true) + private List authorizations; + + /* + * The collection of eligible authorization objects describing the just-in-time access Azure Active Directory + * principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "eligibleAuthorizations") + private List eligibleAuthorizations; + + /* + * The marketplace offer display name. + */ + @JsonProperty(value = "offerDisplayName") + private String offerDisplayName; + + /* + * The marketplace publisher display name. + */ + @JsonProperty(value = "publisherDisplayName") + private String publisherDisplayName; + + /* + * The marketplace plan display name. + */ + @JsonProperty(value = "planDisplayName") + private String planDisplayName; + + /** Creates an instance of MarketplaceRegistrationDefinitionProperties class. */ + public MarketplaceRegistrationDefinitionProperties() { + } + + /** + * Get the managedByTenantId property: The identifier of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: The identifier of the managedBy tenant. + * + * @param managedByTenantId the managedByTenantId value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withManagedByTenantId(String managedByTenantId) { + this.managedByTenantId = managedByTenantId; + return this; + } + + /** + * Get the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @param authorizations the authorizations value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withAuthorizations(List authorizations) { + this.authorizations = authorizations; + return this; + } + + /** + * Get the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @param eligibleAuthorizations the eligibleAuthorizations value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withEligibleAuthorizations( + List eligibleAuthorizations) { + this.eligibleAuthorizations = eligibleAuthorizations; + return this; + } + + /** + * Get the offerDisplayName property: The marketplace offer display name. + * + * @return the offerDisplayName value. + */ + public String offerDisplayName() { + return this.offerDisplayName; + } + + /** + * Set the offerDisplayName property: The marketplace offer display name. + * + * @param offerDisplayName the offerDisplayName value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withOfferDisplayName(String offerDisplayName) { + this.offerDisplayName = offerDisplayName; + return this; + } + + /** + * Get the publisherDisplayName property: The marketplace publisher display name. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * Set the publisherDisplayName property: The marketplace publisher display name. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withPublisherDisplayName(String publisherDisplayName) { + this.publisherDisplayName = publisherDisplayName; + return this; + } + + /** + * Get the planDisplayName property: The marketplace plan display name. + * + * @return the planDisplayName value. + */ + public String planDisplayName() { + return this.planDisplayName; + } + + /** + * Set the planDisplayName property: The marketplace plan display name. + * + * @param planDisplayName the planDisplayName value to set. + * @return the MarketplaceRegistrationDefinitionProperties object itself. + */ + public MarketplaceRegistrationDefinitionProperties withPlanDisplayName(String planDisplayName) { + this.planDisplayName = planDisplayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (managedByTenantId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property managedByTenantId in model" + + " MarketplaceRegistrationDefinitionProperties")); + } + if (authorizations() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property authorizations in model" + + " MarketplaceRegistrationDefinitionProperties")); + } else { + authorizations().forEach(e -> e.validate()); + } + if (eligibleAuthorizations() != null) { + eligibleAuthorizations().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceRegistrationDefinitionProperties.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitions.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitions.java new file mode 100644 index 0000000000000..01158c44eba11 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitions.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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 MarketplaceRegistrationDefinitions. */ +public interface MarketplaceRegistrationDefinitions { + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the 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 a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String scope, String filter, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + Response getWithResponse( + String scope, String marketplaceIdentifier, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope The scope of the resource. + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + MarketplaceRegistrationDefinition get(String scope, String marketplaceIdentifier); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionsWithoutScopes.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionsWithoutScopes.java new file mode 100644 index 0000000000000..02c4ff3936b61 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionsWithoutScopes.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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 MarketplaceRegistrationDefinitionsWithoutScopes. */ +public interface MarketplaceRegistrationDefinitionsWithoutScopes { + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the marketplace registration definitions for the marketplace identifier as paginated response + * with {@link PagedIterable}. + */ + PagedIterable list(String filter, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier along with {@link Response}. + */ + Response getWithResponse(String marketplaceIdentifier, Context context); + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier The Azure Marketplace identifier. Expected formats: + * {publisher}.{product[-preview]}.{planName}.{version} or {publisher}.{product[-preview]}.{planName} or + * {publisher}.{product[-preview]} or {publisher}). + * @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 marketplace registration definition for the marketplace identifier. + */ + MarketplaceRegistrationDefinition get(String marketplaceIdentifier); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MultiFactorAuthProvider.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MultiFactorAuthProvider.java new file mode 100644 index 0000000000000..4af1dfd1a0d5c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MultiFactorAuthProvider.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The multi-factor authorization provider to be used for just-in-time access requests. */ +public final class MultiFactorAuthProvider extends ExpandableStringEnum { + /** Static value Azure for MultiFactorAuthProvider. */ + public static final MultiFactorAuthProvider AZURE = fromString("Azure"); + + /** Static value None for MultiFactorAuthProvider. */ + public static final MultiFactorAuthProvider NONE = fromString("None"); + + /** + * Creates a new instance of MultiFactorAuthProvider value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MultiFactorAuthProvider() { + } + + /** + * Creates or finds a MultiFactorAuthProvider from its string representation. + * + * @param name a name to look for. + * @return the corresponding MultiFactorAuthProvider. + */ + @JsonCreator + public static MultiFactorAuthProvider fromString(String name) { + return fromString(name, MultiFactorAuthProvider.class); + } + + /** + * Gets known MultiFactorAuthProvider values. + * + * @return known MultiFactorAuthProvider values. + */ + public static Collection values() { + return values(MultiFactorAuthProvider.class); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operation.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operation.java new file mode 100644 index 0000000000000..c064f8b9a8fce --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operation.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes a single Microsoft.ManagedServices operation. */ +@Immutable +public final class Operation { + /* + * The operation name with the format: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The object that represents the operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /** Creates an instance of Operation class. */ + public Operation() { + } + + /** + * Get the name property: The operation name with the format: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The object that represents the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationDisplay.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationDisplay.java new file mode 100644 index 0000000000000..996156a339e90 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationDisplay.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.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + /* + * The service provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * The resource on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The operation type. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The service provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The service 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 resource property: The resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The resource 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 operation property: The operation type. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The operation type. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationList.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationList.java new file mode 100644 index 0000000000000..b0c9ba7de5d2b --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import java.util.List; + +/** An immutable client-side representation of OperationList. */ +public interface OperationList { + /** + * Gets the value property: The list of Microsoft.ManagedServices operations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.managedservices.fluent.models.OperationListInner object. + * + * @return the inner object. + */ + OperationListInner innerModel(); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operations.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Operations.java new file mode 100644 index 0000000000000..fcf46b881bd3b --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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.managedservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Gets a list of the operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations along with {@link Response}. + */ + Response listWithResponse(Context context); + + /** + * Gets a list of the operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the operations. + */ + OperationList list(); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationsWithScopes.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationsWithScopes.java new file mode 100644 index 0000000000000..0e5110918ccf6 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationsWithScopes.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.managedservices.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OperationsWithScopes. */ +public interface OperationsWithScopes { + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope along with {@link Response}. + */ + Response listWithResponse(String scope, Context context); + + /** + * Gets a list of the operations with the scope. + * + * @param scope The scope of the 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 a list of the operations with the scope. + */ + OperationList list(String scope); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Plan.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Plan.java new file mode 100644 index 0000000000000..461ef0b971c7a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Plan.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details for the Managed Services offer’s plan in Azure Marketplace. */ +@Fluent +public final class Plan { + /* + * Azure Marketplace plan name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Azure Marketplace publisher ID. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * Azure Marketplace product code. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * Azure Marketplace plan's version. + */ + @JsonProperty(value = "version", required = true) + private String version; + + /** Creates an instance of Plan class. */ + public Plan() { + } + + /** + * Get the name property: Azure Marketplace plan name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Azure Marketplace plan name. + * + * @param name the name value to set. + * @return the Plan object itself. + */ + public Plan withName(String name) { + this.name = name; + return this; + } + + /** + * Get the publisher property: Azure Marketplace publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Azure Marketplace publisher ID. + * + * @param publisher the publisher value to set. + * @return the Plan object itself. + */ + public Plan withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the product property: Azure Marketplace product code. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: Azure Marketplace product code. + * + * @param product the product value to set. + * @return the Plan object itself. + */ + public Plan withProduct(String product) { + this.product = product; + return this; + } + + /** + * Get the version property: Azure Marketplace plan's version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Azure Marketplace plan's version. + * + * @param version the version value to set. + * @return the Plan object itself. + */ + public Plan withVersion(String version) { + this.version = version; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Plan")); + } + if (publisher() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property publisher in model Plan")); + } + if (product() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property product in model Plan")); + } + if (version() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property version in model Plan")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Plan.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/ProvisioningState.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/ProvisioningState.java new file mode 100644 index 0000000000000..4aec27c854b08 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/ProvisioningState.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The current provisioning state of the registration definition. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Running for ProvisioningState. */ + public static final ProvisioningState RUNNING = fromString("Running"); + + /** Static value Ready for ProvisioningState. */ + public static final ProvisioningState READY = fromString("Ready"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Created for ProvisioningState. */ + public static final ProvisioningState CREATED = fromString("Created"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignment.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignment.java new file mode 100644 index 0000000000000..c4d594fff2110 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignment.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; + +/** An immutable client-side representation of RegistrationAssignment. */ +public interface RegistrationAssignment { + /** + * 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 properties property: The properties of a registration assignment. + * + * @return the properties value. + */ + RegistrationAssignmentProperties properties(); + + /** + * Gets the systemData property: The metadata for the registration assignment resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner object. + * + * @return the inner object. + */ + RegistrationAssignmentInner innerModel(); + + /** The entirety of the RegistrationAssignment definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The RegistrationAssignment definition stages. */ + interface DefinitionStages { + /** The first stage of the RegistrationAssignment definition. */ + interface Blank extends WithScope { + } + /** The stage of the RegistrationAssignment definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope of the resource. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the RegistrationAssignment 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + RegistrationAssignment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RegistrationAssignment create(Context context); + } + /** The stage of the RegistrationAssignment definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a registration assignment.. + * + * @param properties The properties of a registration assignment. + * @return the next definition stage. + */ + WithCreate withProperties(RegistrationAssignmentProperties properties); + } + } + /** + * Begins update for the RegistrationAssignment resource. + * + * @return the stage of resource update. + */ + RegistrationAssignment.Update update(); + + /** The template for RegistrationAssignment update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RegistrationAssignment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RegistrationAssignment apply(Context context); + } + /** The RegistrationAssignment update stages. */ + interface UpdateStages { + /** The stage of the RegistrationAssignment update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a registration assignment.. + * + * @param properties The properties of a registration assignment. + * @return the next definition stage. + */ + Update withProperties(RegistrationAssignmentProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RegistrationAssignment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RegistrationAssignment refresh(Context context); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentList.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentList.java new file mode 100644 index 0000000000000..a9914f38e9712 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentList.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.managedservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of registration assignments. */ +@Immutable +public final class RegistrationAssignmentList { + /* + * The list of registration assignments. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of registration assignments. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RegistrationAssignmentList class. */ + public RegistrationAssignmentList() { + } + + /** + * Get the value property: The list of registration assignments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of registration assignments. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentProperties.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentProperties.java new file mode 100644 index 0000000000000..368d565edd9e8 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentProperties.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the registration assignment. */ +@Fluent +public final class RegistrationAssignmentProperties { + /* + * The fully qualified path of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionId", required = true) + private String registrationDefinitionId; + + /* + * The current provisioning state of the registration assignment. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The registration definition associated with the registration assignment. + */ + @JsonProperty(value = "registrationDefinition", access = JsonProperty.Access.WRITE_ONLY) + private RegistrationAssignmentPropertiesRegistrationDefinition registrationDefinition; + + /** Creates an instance of RegistrationAssignmentProperties class. */ + public RegistrationAssignmentProperties() { + } + + /** + * Get the registrationDefinitionId property: The fully qualified path of the registration definition. + * + * @return the registrationDefinitionId value. + */ + public String registrationDefinitionId() { + return this.registrationDefinitionId; + } + + /** + * Set the registrationDefinitionId property: The fully qualified path of the registration definition. + * + * @param registrationDefinitionId the registrationDefinitionId value to set. + * @return the RegistrationAssignmentProperties object itself. + */ + public RegistrationAssignmentProperties withRegistrationDefinitionId(String registrationDefinitionId) { + this.registrationDefinitionId = registrationDefinitionId; + return this; + } + + /** + * Get the provisioningState property: The current provisioning state of the registration assignment. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the registrationDefinition property: The registration definition associated with the registration assignment. + * + * @return the registrationDefinition value. + */ + public RegistrationAssignmentPropertiesRegistrationDefinition registrationDefinition() { + return this.registrationDefinition; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (registrationDefinitionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property registrationDefinitionId in model" + + " RegistrationAssignmentProperties")); + } + if (registrationDefinition() != null) { + registrationDefinition().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegistrationAssignmentProperties.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java new file mode 100644 index 0000000000000..299cf7fac2e15 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration definition associated with the registration assignment. */ +@Fluent +public final class RegistrationAssignmentPropertiesRegistrationDefinition { + /* + * The properties of the registration definition associated with the registration assignment. + */ + @JsonProperty(value = "properties") + private RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties; + + /* + * The details for the Managed Services offer’s plan in Azure Marketplace. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * The fully qualified path of the registration definition. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * The type of the Azure resource (Microsoft.ManagedServices/registrationDefinitions). + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The name of the registration definition. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The metadata for the registration definition resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of RegistrationAssignmentPropertiesRegistrationDefinition class. */ + public RegistrationAssignmentPropertiesRegistrationDefinition() { + } + + /** + * Get the properties property: The properties of the registration definition associated with the registration + * assignment. + * + * @return the properties value. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of the registration definition associated with the registration + * assignment. + * + * @param properties the properties value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinition object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinition withProperties( + RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @param plan the plan value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinition object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinition withPlan(Plan plan) { + this.plan = plan; + return this; + } + + /** + * Get the id property: The fully qualified path of the registration definition. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the Azure resource (Microsoft.ManagedServices/registrationDefinitions). + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the registration definition. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the systemData property: The metadata for the registration definition resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (plan() != null) { + plan().validate(); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java new file mode 100644 index 0000000000000..ce0c860b14387 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of the registration definition associated with the registration assignment. */ +@Fluent +public final class RegistrationAssignmentPropertiesRegistrationDefinitionProperties { + /* + * The description of the registration definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The collection of authorization objects describing the access Azure Active Directory principals in the managedBy + * tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "authorizations") + private List authorizations; + + /* + * The collection of eligible authorization objects describing the just-in-time access Azure Active Directory + * principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "eligibleAuthorizations") + private List eligibleAuthorizations; + + /* + * The name of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionName") + private String registrationDefinitionName; + + /* + * The current provisioning state of the registration definition. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * The identifier of the managed tenant. + */ + @JsonProperty(value = "manageeTenantId") + private String manageeTenantId; + + /* + * The name of the managed tenant. + */ + @JsonProperty(value = "manageeTenantName") + private String manageeTenantName; + + /* + * The identifier of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId") + private String managedByTenantId; + + /* + * The name of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantName") + private String managedByTenantName; + + /** Creates an instance of RegistrationAssignmentPropertiesRegistrationDefinitionProperties class. */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties() { + } + + /** + * Get the description property: The description of the registration definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the registration definition. + * + * @param description the description value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @param authorizations the authorizations value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withAuthorizations( + List authorizations) { + this.authorizations = authorizations; + return this; + } + + /** + * Get the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @param eligibleAuthorizations the eligibleAuthorizations value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withEligibleAuthorizations( + List eligibleAuthorizations) { + this.eligibleAuthorizations = eligibleAuthorizations; + return this; + } + + /** + * Get the registrationDefinitionName property: The name of the registration definition. + * + * @return the registrationDefinitionName value. + */ + public String registrationDefinitionName() { + return this.registrationDefinitionName; + } + + /** + * Set the registrationDefinitionName property: The name of the registration definition. + * + * @param registrationDefinitionName the registrationDefinitionName value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withRegistrationDefinitionName( + String registrationDefinitionName) { + this.registrationDefinitionName = registrationDefinitionName; + return this; + } + + /** + * Get the provisioningState property: The current provisioning state of the registration definition. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The current provisioning state of the registration definition. + * + * @param provisioningState the provisioningState value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withProvisioningState( + ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the manageeTenantId property: The identifier of the managed tenant. + * + * @return the manageeTenantId value. + */ + public String manageeTenantId() { + return this.manageeTenantId; + } + + /** + * Set the manageeTenantId property: The identifier of the managed tenant. + * + * @param manageeTenantId the manageeTenantId value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withManageeTenantId( + String manageeTenantId) { + this.manageeTenantId = manageeTenantId; + return this; + } + + /** + * Get the manageeTenantName property: The name of the managed tenant. + * + * @return the manageeTenantName value. + */ + public String manageeTenantName() { + return this.manageeTenantName; + } + + /** + * Set the manageeTenantName property: The name of the managed tenant. + * + * @param manageeTenantName the manageeTenantName value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withManageeTenantName( + String manageeTenantName) { + this.manageeTenantName = manageeTenantName; + return this; + } + + /** + * Get the managedByTenantId property: The identifier of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: The identifier of the managedBy tenant. + * + * @param managedByTenantId the managedByTenantId value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withManagedByTenantId( + String managedByTenantId) { + this.managedByTenantId = managedByTenantId; + return this; + } + + /** + * Get the managedByTenantName property: The name of the managedBy tenant. + * + * @return the managedByTenantName value. + */ + public String managedByTenantName() { + return this.managedByTenantName; + } + + /** + * Set the managedByTenantName property: The name of the managedBy tenant. + * + * @param managedByTenantName the managedByTenantName value to set. + * @return the RegistrationAssignmentPropertiesRegistrationDefinitionProperties object itself. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties withManagedByTenantName( + String managedByTenantName) { + this.managedByTenantName = managedByTenantName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorizations() != null) { + authorizations().forEach(e -> e.validate()); + } + if (eligibleAuthorizations() != null) { + eligibleAuthorizations().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignments.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignments.java new file mode 100644 index 0000000000000..d22a0690c91a4 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignments.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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 RegistrationAssignments. */ +public interface RegistrationAssignments { + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response}. + */ + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context); + + /** + * Gets the details of the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the specified registration assignment. + */ + RegistrationAssignment get(String scope, String registrationAssignmentId); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String scope, String registrationAssignmentId); + + /** + * Deletes the specified registration assignment. + * + * @param scope The scope of the resource. + * @param registrationAssignmentId The GUID of the registration assignment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String scope, String registrationAssignmentId, Context context); + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the 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 a list of the registration assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Gets a list of the registration assignments. + * + * @param scope The scope of the resource. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration assignments as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String scope, Boolean expandRegistrationDefinition, String filter, Context context); + + /** + * Gets the details of the specified registration assignment. + * + * @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 details of the specified registration assignment along with {@link Response}. + */ + RegistrationAssignment getById(String id); + + /** + * Gets the details of the specified registration assignment. + * + * @param id the resource ID. + * @param expandRegistrationDefinition The flag indicating whether to return the registration definition details + * along with the registration assignment details. + * @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 details of the specified registration assignment along with {@link Response}. + */ + Response getByIdWithResponse( + String id, Boolean expandRegistrationDefinition, Context context); + + /** + * Deletes the specified registration assignment. + * + * @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 specified registration assignment. + * + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new RegistrationAssignment resource. + * + * @param name resource name. + * @return the first stage of the new RegistrationAssignment definition. + */ + RegistrationAssignment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinition.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinition.java new file mode 100644 index 0000000000000..2ef27a6efac1f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinition.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; + +/** An immutable client-side representation of RegistrationDefinition. */ +public interface RegistrationDefinition { + /** + * 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 properties property: The properties of a registration definition. + * + * @return the properties value. + */ + RegistrationDefinitionProperties properties(); + + /** + * Gets the plan property: The details for the Managed Services offer’s plan in Azure Marketplace. + * + * @return the plan value. + */ + Plan plan(); + + /** + * Gets the systemData property: The metadata for the registration assignment resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner object. + * + * @return the inner object. + */ + RegistrationDefinitionInner innerModel(); + + /** The entirety of the RegistrationDefinition definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The RegistrationDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the RegistrationDefinition definition. */ + interface Blank extends WithScope { + } + /** The stage of the RegistrationDefinition definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies scope. + * + * @param scope The scope of the resource. + * @return the next definition stage. + */ + WithCreate withExistingScope(String scope); + } + /** + * The stage of the RegistrationDefinition 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.WithProperties, DefinitionStages.WithPlan { + /** + * Executes the create request. + * + * @return the created resource. + */ + RegistrationDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RegistrationDefinition create(Context context); + } + /** The stage of the RegistrationDefinition definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a registration definition.. + * + * @param properties The properties of a registration definition. + * @return the next definition stage. + */ + WithCreate withProperties(RegistrationDefinitionProperties properties); + } + /** The stage of the RegistrationDefinition definition allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The details for the Managed Services offer’s plan in Azure Marketplace.. + * + * @param plan The details for the Managed Services offer’s plan in Azure Marketplace. + * @return the next definition stage. + */ + WithCreate withPlan(Plan plan); + } + } + /** + * Begins update for the RegistrationDefinition resource. + * + * @return the stage of resource update. + */ + RegistrationDefinition.Update update(); + + /** The template for RegistrationDefinition update. */ + interface Update extends UpdateStages.WithProperties, UpdateStages.WithPlan { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RegistrationDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RegistrationDefinition apply(Context context); + } + /** The RegistrationDefinition update stages. */ + interface UpdateStages { + /** The stage of the RegistrationDefinition update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a registration definition.. + * + * @param properties The properties of a registration definition. + * @return the next definition stage. + */ + Update withProperties(RegistrationDefinitionProperties properties); + } + /** The stage of the RegistrationDefinition update allowing to specify plan. */ + interface WithPlan { + /** + * Specifies the plan property: The details for the Managed Services offer’s plan in Azure Marketplace.. + * + * @param plan The details for the Managed Services offer’s plan in Azure Marketplace. + * @return the next definition stage. + */ + Update withPlan(Plan plan); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + RegistrationDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + RegistrationDefinition refresh(Context context); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionList.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionList.java new file mode 100644 index 0000000000000..a12fa5bd5ca49 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionList.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.managedservices.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of registration definitions. */ +@Immutable +public final class RegistrationDefinitionList { + /* + * The list of registration definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The link to the next page of registration definitions. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of RegistrationDefinitionList class. */ + public RegistrationDefinitionList() { + } + + /** + * Get the value property: The list of registration definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of registration definitions. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java new file mode 100644 index 0000000000000..1f02bb3f4112f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of a registration definition. */ +@Fluent +public final class RegistrationDefinitionProperties { + /* + * The description of the registration definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The collection of authorization objects describing the access Azure Active Directory principals in the managedBy + * tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "authorizations", required = true) + private List authorizations; + + /* + * The collection of eligible authorization objects describing the just-in-time access Azure Active Directory + * principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + */ + @JsonProperty(value = "eligibleAuthorizations") + private List eligibleAuthorizations; + + /* + * The name of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionName") + private String registrationDefinitionName; + + /* + * The identifier of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId", required = true) + private String managedByTenantId; + + /* + * The current provisioning state of the registration definition. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The identifier of the managed tenant. + */ + @JsonProperty(value = "manageeTenantId", access = JsonProperty.Access.WRITE_ONLY) + private String manageeTenantId; + + /* + * The name of the managed tenant. + */ + @JsonProperty(value = "manageeTenantName", access = JsonProperty.Access.WRITE_ONLY) + private String manageeTenantName; + + /* + * The name of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantName", access = JsonProperty.Access.WRITE_ONLY) + private String managedByTenantName; + + /** Creates an instance of RegistrationDefinitionProperties class. */ + public RegistrationDefinitionProperties() { + } + + /** + * Get the description property: The description of the registration definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the registration definition. + * + * @param description the description value to set. + * @return the RegistrationDefinitionProperties object itself. + */ + public RegistrationDefinitionProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: The collection of authorization objects describing the access Azure Active + * Directory principals in the managedBy tenant will receive on the delegated resource in the managed tenant. + * + * @param authorizations the authorizations value to set. + * @return the RegistrationDefinitionProperties object itself. + */ + public RegistrationDefinitionProperties withAuthorizations(List authorizations) { + this.authorizations = authorizations; + return this; + } + + /** + * Get the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: The collection of eligible authorization objects describing the + * just-in-time access Azure Active Directory principals in the managedBy tenant will receive on the delegated + * resource in the managed tenant. + * + * @param eligibleAuthorizations the eligibleAuthorizations value to set. + * @return the RegistrationDefinitionProperties object itself. + */ + public RegistrationDefinitionProperties withEligibleAuthorizations( + List eligibleAuthorizations) { + this.eligibleAuthorizations = eligibleAuthorizations; + return this; + } + + /** + * Get the registrationDefinitionName property: The name of the registration definition. + * + * @return the registrationDefinitionName value. + */ + public String registrationDefinitionName() { + return this.registrationDefinitionName; + } + + /** + * Set the registrationDefinitionName property: The name of the registration definition. + * + * @param registrationDefinitionName the registrationDefinitionName value to set. + * @return the RegistrationDefinitionProperties object itself. + */ + public RegistrationDefinitionProperties withRegistrationDefinitionName(String registrationDefinitionName) { + this.registrationDefinitionName = registrationDefinitionName; + return this; + } + + /** + * Get the managedByTenantId property: The identifier of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: The identifier of the managedBy tenant. + * + * @param managedByTenantId the managedByTenantId value to set. + * @return the RegistrationDefinitionProperties object itself. + */ + public RegistrationDefinitionProperties withManagedByTenantId(String managedByTenantId) { + this.managedByTenantId = managedByTenantId; + return this; + } + + /** + * Get the provisioningState property: The current provisioning state of the registration definition. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the manageeTenantId property: The identifier of the managed tenant. + * + * @return the manageeTenantId value. + */ + public String manageeTenantId() { + return this.manageeTenantId; + } + + /** + * Get the manageeTenantName property: The name of the managed tenant. + * + * @return the manageeTenantName value. + */ + public String manageeTenantName() { + return this.manageeTenantName; + } + + /** + * Get the managedByTenantName property: The name of the managedBy tenant. + * + * @return the managedByTenantName value. + */ + public String managedByTenantName() { + return this.managedByTenantName; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorizations() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property authorizations in model RegistrationDefinitionProperties")); + } else { + authorizations().forEach(e -> e.validate()); + } + if (eligibleAuthorizations() != null) { + eligibleAuthorizations().forEach(e -> e.validate()); + } + if (managedByTenantId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property managedByTenantId in model RegistrationDefinitionProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RegistrationDefinitionProperties.class); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitions.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitions.java new file mode 100644 index 0000000000000..66da4ac0da448 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitions.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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 RegistrationDefinitions. */ +public interface RegistrationDefinitions { + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details along with {@link Response}. + */ + Response getWithResponse(String scope, String registrationDefinitionId, Context context); + + /** + * Gets the registration definition details. + * + * @param scope The scope of the resource. + * @param registrationDefinitionId The GUID of the registration definition. + * @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 registration definition details. + */ + RegistrationDefinition get(String scope, String registrationDefinitionId); + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope, Context context); + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId The GUID of the registration definition. + * @param scope The scope of the 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 registrationDefinitionId, String scope); + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the 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 a list of the registration definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope); + + /** + * Gets a list of the registration definitions. + * + * @param scope The scope of the resource. + * @param filter The filter query parameter to filter managed services resources by. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the registration definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String scope, String filter, Context context); + + /** + * Gets the registration definition details. + * + * @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 registration definition details along with {@link Response}. + */ + RegistrationDefinition getById(String id); + + /** + * Gets the registration definition details. + * + * @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 registration definition details along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the registration definition. + * + * @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 registration definition. + * + * @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 RegistrationDefinition resource. + * + * @param name resource name. + * @return the first stage of the new RegistrationDefinition definition. + */ + RegistrationDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/package-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/package-info.java new file mode 100644 index 0000000000000..78fe2bcf76057 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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 ManagedServicesClient. The specification for ManagedServices. */ +package com.azure.resourcemanager.managedservices.models; diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/package-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/package-info.java new file mode 100644 index 0000000000000..3581325216418 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/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 ManagedServicesClient. The specification for ManagedServices. */ +package com.azure.resourcemanager.managedservices; diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/module-info.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/module-info.java new file mode 100644 index 0000000000000..72c07c551be3d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/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.managedservices { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.managedservices; + exports com.azure.resourcemanager.managedservices.fluent; + exports com.azure.resourcemanager.managedservices.fluent.models; + exports com.azure.resourcemanager.managedservices.models; + + opens com.azure.resourcemanager.managedservices.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.managedservices.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsGetSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsGetSamples.java new file mode 100644 index 0000000000000..8a020aa05daf4 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for MarketplaceRegistrationDefinitions Get. */ +public final class MarketplaceRegistrationDefinitionsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinition.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitions() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "publisher.product.planName.version", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsListSamples.java new file mode 100644 index 0000000000000..d52ae6162dbab --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for MarketplaceRegistrationDefinitions List. */ +public final class MarketplaceRegistrationDefinitionsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitions.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "planIdentifier eq 'publisher.offerIdentifier.planName.version'", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeGetSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeGetSamples.java new file mode 100644 index 0000000000000..64710569ac3da --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeGetSamples.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.managedservices.generated; + +/** Samples for MarketplaceRegistrationDefinitionsWithoutScope Get. */ +public final class MarketplaceRegistrationDefinitionsWithoutScopeGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitionAtTenantScope.json + */ + /** + * Sample code: Get Marketplace Registration Definition At Tenant Scope. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getMarketplaceRegistrationDefinitionAtTenantScope( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitionsWithoutScopes() + .getWithResponse("publisher.product.planName.version", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeListSamples.java new file mode 100644 index 0000000000000..3e939565c8f55 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/MarketplaceRegistrationDefinitionsWithoutScopeListSamples.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.managedservices.generated; + +/** Samples for MarketplaceRegistrationDefinitionsWithoutScope List. */ +public final class MarketplaceRegistrationDefinitionsWithoutScopeListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetMarketplaceRegistrationDefinitionsAtTenantScope.json + */ + /** + * Sample code: Get Marketplace Registration Definitions At Tenant Scope. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getMarketplaceRegistrationDefinitionsAtTenantScope( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .marketplaceRegistrationDefinitionsWithoutScopes() + .list("planIdentifier eq 'publisher.offerIdentifier.planName.version'", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..b27c55c9d4d57 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/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.managedservices.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetOperations.json + */ + /** + * Sample code: Get Registration Operations. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationOperations( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsWithScopeListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsWithScopeListSamples.java new file mode 100644 index 0000000000000..f82e248a87653 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/OperationsWithScopeListSamples.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.managedservices.generated; + +/** Samples for OperationsWithScope List. */ +public final class OperationsWithScopeListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetOperationsWithScope.json + */ + /** + * Sample code: Get Registration Operations. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationOperations( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .operationsWithScopes() + .listWithResponse("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsCreateOrUpdateSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..4e31ce5dd52c8 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsCreateOrUpdateSamples.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.managedservices.generated; + +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentProperties; + +/** Samples for RegistrationAssignments CreateOrUpdate. */ +public final class RegistrationAssignmentsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/PutRegistrationAssignment.json + */ + /** + * Sample code: Put Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void putRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .define("26c128c2-fefa-4340-9bb1-6e081c90ada2") + .withExistingScope("subscription/0afefe50-734e-4610-8a82-a144ahf49dea") + .withProperties( + new RegistrationAssignmentProperties() + .withRegistrationDefinitionId( + "/subscriptions/0afefe50-734e-4610-8a82-a144ahf49dea/providers/Microsoft.ManagedServices/registrationDefinitions/26c128c2-fefa-4340-9bb1-6e081c90ada2")) + .create(); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsDeleteSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsDeleteSamples.java new file mode 100644 index 0000000000000..7b9628d2ab4c1 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationAssignments Delete. */ +public final class RegistrationAssignmentsDeleteSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/DeleteRegistrationAssignment.json + */ + /** + * Sample code: Delete Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void deleteRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .delete( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsGetSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsGetSamples.java new file mode 100644 index 0000000000000..0a7d2dc743f87 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationAssignments Get. */ +public final class RegistrationAssignmentsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignment.json + */ + /** + * Sample code: Get Registration Assignment. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignment( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsListSamples.java new file mode 100644 index 0000000000000..27dfcaec64926 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationAssignmentsListSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationAssignments List. */ +public final class RegistrationAssignmentsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignmentsWithManagedByTenantIdEqFilter.json + */ + /** + * Sample code: Get Registration Assignments with ManagedByTenantId eq filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignmentsWithManagedByTenantIdEqFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + null, + "$filter=managedByTenantId eq '83abe5cd-bcc3-441a-bd86-e6a75360cecc'", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignments.json + */ + /** + * Sample code: Get Registration Assignments. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignments( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", null, null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationAssignmentsWithManagedByTenantIdInFilter.json + */ + /** + * Sample code: Get Registration Assignments with ManagedByTenantId in filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationAssignmentsWithManagedByTenantIdInFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationAssignments() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + null, + "$filter=managedByTenantId in ('83abe5cd-bcc3-441a-bd86-e6a75360cec'," + + " 'de83f4a9-a76a-4025-a91a-91171923eac7')", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsCreateOrUpdateSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..d34b2f5673462 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsCreateOrUpdateSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +import com.azure.resourcemanager.managedservices.models.Authorization; +import com.azure.resourcemanager.managedservices.models.EligibleApprover; +import com.azure.resourcemanager.managedservices.models.EligibleAuthorization; +import com.azure.resourcemanager.managedservices.models.JustInTimeAccessPolicy; +import com.azure.resourcemanager.managedservices.models.MultiFactorAuthProvider; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionProperties; +import java.time.Duration; +import java.util.Arrays; +import java.util.UUID; + +/** Samples for RegistrationDefinitions CreateOrUpdate. */ +public final class RegistrationDefinitionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/PutRegistrationDefinition.json + */ + /** + * Sample code: Put Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void putRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .define("26c128c2-fefa-4340-9bb1-6e081c90ada2") + .withExistingScope("subscription/0afefe50-734e-4610-8a82-a144ahf49dea") + .withProperties( + new RegistrationDefinitionProperties() + .withDescription("Tes1t") + .withAuthorizations( + Arrays + .asList( + new Authorization() + .withPrincipalId("f98d86a2-4cc4-4e9d-ad47-b3e80a1bcdfc") + .withPrincipalIdDisplayName("Support User") + .withRoleDefinitionId("acdd72a7-3385-48ef-bd42-f606fba81ae7"), + new Authorization() + .withPrincipalId("f98d86a2-4cc4-4e9d-ad47-b3e80a1bcdfc") + .withPrincipalIdDisplayName("User Access Administrator") + .withRoleDefinitionId("18d7d88d-d35e-4fb5-a5c3-7773c20a72d9") + .withDelegatedRoleDefinitionIds( + Arrays.asList(UUID.fromString("b24988ac-6180-42a0-ab88-20f7382dd24c"))))) + .withEligibleAuthorizations( + Arrays + .asList( + new EligibleAuthorization() + .withPrincipalId("3e0ed8c6-e902-4fc5-863c-e3ddbb2ae2a2") + .withPrincipalIdDisplayName("Support User") + .withRoleDefinitionId("ae349356-3a1b-4a5e-921d-050484c6347e") + .withJustInTimeAccessPolicy( + new JustInTimeAccessPolicy() + .withMultiFactorAuthProvider(MultiFactorAuthProvider.AZURE) + .withMaximumActivationDuration(Duration.parse("PT8H")) + .withManagedByTenantApprovers( + Arrays + .asList( + new EligibleApprover() + .withPrincipalId("d9b22cd6-6407-43cc-8c60-07c56df0b51a") + .withPrincipalIdDisplayName("Approver Group")))))) + .withRegistrationDefinitionName("DefinitionName") + .withManagedByTenantId("83abe5cd-bcc3-441a-bd86-e6a75360cecc")) + .withPlan( + new Plan() + .withName("addesai-plan") + .withPublisher("marketplace-test") + .withProduct("test") + .withVersion("1.0.0")) + .create(); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsDeleteSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsDeleteSamples.java new file mode 100644 index 0000000000000..0a1a92a5020e7 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationDefinitions Delete. */ +public final class RegistrationDefinitionsDeleteSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/DeleteRegistrationDefinition.json + */ + /** + * Sample code: Delete Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void deleteRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .deleteByResourceGroupWithResponse( + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsGetSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsGetSamples.java new file mode 100644 index 0000000000000..b45374592460b --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationDefinitions Get. */ +public final class RegistrationDefinitionsGetSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinition.json + */ + /** + * Sample code: Get Registration Definition. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinition( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .getWithResponse( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "26c128c2-fefa-4340-9bb1-6e081c90ada2", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsListSamples.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsListSamples.java new file mode 100644 index 0000000000000..4f16e279fba0d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/samples/java/com/azure/resourcemanager/managedservices/generated/RegistrationDefinitionsListSamples.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.generated; + +/** Samples for RegistrationDefinitions List. */ +public final class RegistrationDefinitionsListSamples { + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitionsWithManagedByTenantIdEqFilter.json + */ + /** + * Sample code: Get Registration Definitions with ManagedByTenantId eq filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitionsWithManagedByTenantIdEqFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "$filter=managedByTenantId eq '83ace5cd-bcc3-441a-hd86-e6a75360cecc'", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitions.json + */ + /** + * Sample code: Get Registration Definitions. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitions( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list("subscription/0afefe50-734e-4610-8a82-a144ahf49dea", null, com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/managedservices/resource-manager/Microsoft.ManagedServices/stable/2022-10-01/examples/GetRegistrationDefinitionsWithManagedByTenantIdInFilter.json + */ + /** + * Sample code: Get Registration Definitions with ManagedByTenantId in filter. + * + * @param manager Entry point to ManagedServicesManager. + */ + public static void getRegistrationDefinitionsWithManagedByTenantIdInFilter( + com.azure.resourcemanager.managedservices.ManagedServicesManager manager) { + manager + .registrationDefinitions() + .list( + "subscription/0afefe50-734e-4610-8a82-a144ahf49dea", + "$filter=managedByTenantId in ('83ace5cd-bcc3-441a-hd86-e6a75360cecc'," + + " 'de83f4a9-a76a-4025-a91a-91171923eac7')", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/managedservices/ci.yml b/sdk/managedservices/ci.yml new file mode 100644 index 0000000000000..c0eb579fa3826 --- /dev/null +++ b/sdk/managedservices/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/managedservices/ci.yml + - sdk/managedservices/azure-resourcemanager-managedservices/ + exclude: + - sdk/managedservices/pom.xml + - sdk/managedservices/azure-resourcemanager-managedservices/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ci.yml + - sdk/managedservices/azure-resourcemanager-managedservices/ + exclude: + - sdk/managedservices/pom.xml + - sdk/managedservices/azure-resourcemanager-managedservices/pom.xml + +parameters: + - name: release_azureresourcemanagermanagedservices + displayName: azure-resourcemanager-managedservices + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedservices + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-managedservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagedservices + releaseInBatch: ${{ parameters.release_azureresourcemanagermanagedservices }} diff --git a/sdk/managedservices/pom.xml b/sdk/managedservices/pom.xml new file mode 100644 index 0000000000000..005e880880fed --- /dev/null +++ b/sdk/managedservices/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-managedservices-service + pom + 1.0.0 + + + azure-resourcemanager-managedservices + +