From 5a38242601ba174f140b75a1eae330a498869e02 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 29 Jun 2021 03:20:07 +0000 Subject: [PATCH] CodeGen from PR 14881 in Azure/azure-rest-api-specs [ManagedServices] Update property descriptions before new API docs are published (#14881) * Update property descriptions before new API docs are published * ID -> identifier and specify AAD principal in principalId descriptions * Addressed feedback from Jenny * Addressed feedback from Ramu * Spell check fix * Semantic fixes --- eng/versioning/version_client.txt | 1 + pom.xml | 3 +- .../CHANGELOG.md | 5 + .../README.md | 101 ++ .../pom.xml | 86 ++ .../ManagedServicesManager.java | 279 +++++ .../fluent/ManagedServicesClient.java | 74 ++ ...ketplaceRegistrationDefinitionsClient.java | 76 ++ ...trationDefinitionsWithoutScopesClient.java | 71 ++ .../fluent/OperationsClient.java | 36 + .../fluent/RegistrationAssignmentsClient.java | 189 +++ .../fluent/RegistrationDefinitionsClient.java | 158 +++ ...arketplaceRegistrationDefinitionInner.java | 86 ++ .../fluent/models/OperationListInner.java | 44 + .../models/RegistrationAssignmentInner.java | 55 + .../models/RegistrationDefinitionInner.java | 85 ++ .../fluent/models/package-info.java | 6 + .../managedservices/fluent/package-info.java | 6 + .../ManagedServicesClientBuilder.java | 129 +++ .../ManagedServicesClientImpl.java | 335 ++++++ ...MarketplaceRegistrationDefinitionImpl.java | 51 + ...laceRegistrationDefinitionsClientImpl.java | 474 ++++++++ ...arketplaceRegistrationDefinitionsImpl.java | 73 ++ ...ionDefinitionsWithoutScopesClientImpl.java | 445 +++++++ ...istrationDefinitionsWithoutScopesImpl.java | 74 ++ .../implementation/OperationListImpl.java | 41 + .../implementation/OperationsClientImpl.java | 156 +++ .../implementation/OperationsImpl.java | 59 + .../RegistrationAssignmentImpl.java | 143 +++ .../RegistrationAssignmentsClientImpl.java | 1028 +++++++++++++++++ .../RegistrationAssignmentsImpl.java | 217 ++++ .../RegistrationDefinitionImpl.java | 151 +++ .../RegistrationDefinitionsClientImpl.java | 853 ++++++++++++++ .../RegistrationDefinitionsImpl.java | 209 ++++ .../managedservices/implementation/Utils.java | 204 ++++ .../implementation/package-info.java | 6 + .../managedservices/models/Authorization.java | 154 +++ .../models/EligibleApprover.java | 84 ++ .../models/EligibleAuthorization.java | 150 +++ .../models/JustInTimeAccessPolicy.java | 119 ++ .../MarketplaceRegistrationDefinition.java | 53 + ...MarketplaceRegistrationDefinitionList.java | 59 + ...placeRegistrationDefinitionProperties.java | 211 ++++ .../MarketplaceRegistrationDefinitions.java | 67 ++ ...eRegistrationDefinitionsWithoutScopes.java | 61 + .../models/MultiFactorAuthProvider.java | 34 + .../managedservices/models/Operation.java | 57 + .../models/OperationDisplay.java | 128 ++ .../managedservices/models/OperationList.java | 25 + .../managedservices/models/Operations.java | 31 + .../managedservices/models/Plan.java | 144 +++ .../models/ProvisioningState.java | 64 + .../models/RegistrationAssignment.java | 147 +++ .../models/RegistrationAssignmentList.java | 59 + .../RegistrationAssignmentProperties.java | 90 ++ ...nmentPropertiesRegistrationDefinition.java | 133 +++ ...rtiesRegistrationDefinitionProperties.java | 285 +++++ .../models/RegistrationAssignments.java | 143 +++ .../models/RegistrationDefinition.java | 174 +++ .../models/RegistrationDefinitionList.java | 59 + .../RegistrationDefinitionProperties.java | 213 ++++ .../models/RegistrationDefinitions.java | 137 +++ .../managedservices/models/package-info.java | 6 + .../managedservices/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/managedservices/ci.yml | 33 + sdk/managedservices/pom.xml | 53 + 67 files changed, 9006 insertions(+), 1 deletion(-) 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/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/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/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/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/ci.yml create mode 100644 sdk/managedservices/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8fd37cf545ed1..ae6b59705dcf0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -300,6 +300,7 @@ com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-managedservices;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 8a459dd59a622..f0822339c84a4 100644 --- a/pom.xml +++ b/pom.xml @@ -707,6 +707,7 @@ eng/code-quality-reports eng/jacoco-test-coverage sdk/advisor + sdk/agrifood sdk/anomalydetector sdk/apimanagement sdk/appconfiguration @@ -751,7 +752,6 @@ sdk/digitaltwins sdk/eventgrid sdk/eventhubs - sdk/agrifood sdk/formrecognizer sdk/frontdoor sdk/hanaonazure @@ -773,6 +773,7 @@ sdk/machinelearningservices sdk/maintenance sdk/managedapplications + sdk/managedservices sdk/maps sdk/mariadb sdk/marketplaceordering diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md new file mode 100644 index 0000000000000..a6d60a868d9cb --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-06-29) + +- 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-2020-02-preview. 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..3ff774abe79a5 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/README.md @@ -0,0 +1,101 @@ +# 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-2020-02-preview. 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +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 + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml b/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml new file mode 100644 index 0000000000000..ccac27f87778f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml @@ -0,0 +1,86 @@ + + 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-2020-02-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.17.0 + + + com.azure + azure-core-management + 1.3.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + 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..0f32fb25aa53c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java @@ -0,0 +1,279 @@ +// 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.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.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.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.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; + +/** 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 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); + } + + /** + * 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 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 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 default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ManagedServicesManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of RegistrationDefinitions. */ + public RegistrationDefinitions registrationDefinitions() { + if (this.registrationDefinitions == null) { + this.registrationDefinitions = + new RegistrationDefinitionsImpl(clientObject.getRegistrationDefinitions(), this); + } + return registrationDefinitions; + } + + /** @return Resource collection API of RegistrationAssignments. */ + public RegistrationAssignments registrationAssignments() { + if (this.registrationAssignments == null) { + this.registrationAssignments = + new RegistrationAssignmentsImpl(clientObject.getRegistrationAssignments(), this); + } + return registrationAssignments; + } + + /** @return Resource collection API of MarketplaceRegistrationDefinitions. */ + public MarketplaceRegistrationDefinitions marketplaceRegistrationDefinitions() { + if (this.marketplaceRegistrationDefinitions == null) { + this.marketplaceRegistrationDefinitions = + new MarketplaceRegistrationDefinitionsImpl(clientObject.getMarketplaceRegistrationDefinitions(), this); + } + return marketplaceRegistrationDefinitions; + } + + /** @return Resource collection API of MarketplaceRegistrationDefinitionsWithoutScopes. */ + public MarketplaceRegistrationDefinitionsWithoutScopes marketplaceRegistrationDefinitionsWithoutScopes() { + if (this.marketplaceRegistrationDefinitionsWithoutScopes == null) { + this.marketplaceRegistrationDefinitionsWithoutScopes = + new MarketplaceRegistrationDefinitionsWithoutScopesImpl( + clientObject.getMarketplaceRegistrationDefinitionsWithoutScopes(), this); + } + return marketplaceRegistrationDefinitionsWithoutScopes; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @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..ab22003ca7b5b --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/ManagedServicesClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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(); +} 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..0096e81afcbed --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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}). + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String marketplaceIdentifier, Context context); +} 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..1ddafa824b9b4 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/MarketplaceRegistrationDefinitionsWithoutScopesClient.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; + +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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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}). + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String marketplaceIdentifier, Context context); +} 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..4ea2b865ac428 --- /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. + * + * @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(); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} 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..708f19703746c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationAssignmentsClient.java @@ -0,0 +1,189 @@ +// 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. + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, 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. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + */ + @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String scope, Boolean expandRegistrationDefinition, 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..1528bd7eb7cf8 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/RegistrationDefinitionsClient.java @@ -0,0 +1,158 @@ +// 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. + * @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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String registrationDefinitionId, 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); + + /** + * 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String registrationDefinitionId, String scope, 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) + 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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope); + + /** + * Gets a list of the registration definitions. + * + * @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 registration definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String scope, 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..390c605872f00 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitionProperties; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The MarketplaceRegistrationDefinition model. */ +@Fluent +public final class MarketplaceRegistrationDefinitionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionInner.class); + + /* + * 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; + + /** + * 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..9d4aa0825fe0b --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of the operations. */ +@Immutable +public final class OperationListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListInner.class); + + /* + * The list of Microsoft.ManagedServices operations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * 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..df2028388cf03 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationAssignmentInner.java @@ -0,0 +1,55 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.models.RegistrationAssignmentProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration assignment. */ +@Fluent +public final class RegistrationAssignmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentInner.class); + + /* + * The properties of a registration assignment. + */ + @JsonProperty(value = "properties") + private RegistrationAssignmentProperties properties; + + /** + * 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; + } + + /** + * 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..c6c3ab7989c09 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/fluent/models/RegistrationDefinitionInner.java @@ -0,0 +1,85 @@ +// 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.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.models.Plan; +import com.azure.resourcemanager.managedservices.models.RegistrationDefinitionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration definition. */ +@Fluent +public final class RegistrationDefinitionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionInner.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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..912d90ca31e84 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientBuilder.java @@ -0,0 +1,129 @@ +// 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.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the 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 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 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 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() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ManagedServicesClientImpl client = + new ManagedServicesClientImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + 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..f3e9e05fcbe78 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/ManagedServicesClientImpl.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.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.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 java.util.Map; +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 { + private final ClientLogger logger = new ClientLogger(ManagedServicesClientImpl.class); + + /** 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; + } + + /** + * 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 = "2020-02-01-preview"; + 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); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/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..d329563e27d6a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsClientImpl.java @@ -0,0 +1,474 @@ +// 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.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.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 { + private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionsClientImpl.class); + + /** 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") + private 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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String marketplaceIdentifier) { + return getWithResponseAsync(scope, marketplaceIdentifier) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(scope, marketplaceIdentifier).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}). + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String marketplaceIdentifier, Context context) { + return getWithResponseAsync(scope, marketplaceIdentifier, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions. + */ + @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..cfa51eece09da --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsImpl.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.MarketplaceRegistrationDefinitionsClient; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinition; +import com.azure.resourcemanager.managedservices.models.MarketplaceRegistrationDefinitions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MarketplaceRegistrationDefinitionsImpl implements MarketplaceRegistrationDefinitions { + @JsonIgnore private 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 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; + } + } + + 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; + } + } + + 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..ba0155bc2c12a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.java @@ -0,0 +1,445 @@ +// 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.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.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 { + private final ClientLogger logger = + new ClientLogger(MarketplaceRegistrationDefinitionsWithoutScopesClientImpl.class); + + /** 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") + private 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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String marketplaceIdentifier) { + return getWithResponseAsync(marketplaceIdentifier) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(marketplaceIdentifier).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}). + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String marketplaceIdentifier, Context context) { + return getWithResponseAsync(marketplaceIdentifier, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of marketplace registration definitions. + */ + @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..edf663d1afb2c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/MarketplaceRegistrationDefinitionsWithoutScopesImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MarketplaceRegistrationDefinitionsWithoutScopesImpl + implements MarketplaceRegistrationDefinitionsWithoutScopes { + @JsonIgnore + private 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 MarketplaceRegistrationDefinition get(String marketplaceIdentifier) { + MarketplaceRegistrationDefinitionInner inner = this.serviceClient().get(marketplaceIdentifier); + if (inner != null) { + return new MarketplaceRegistrationDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + 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..6445ca334a3aa --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsClientImpl.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.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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** 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") + private 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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 listAsync().block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} 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..d8cc992aa5c0c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationsImpl.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.OperationsClient; +import com.azure.resourcemanager.managedservices.fluent.models.OperationListInner; +import com.azure.resourcemanager.managedservices.models.OperationList; +import com.azure.resourcemanager.managedservices.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private 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 OperationList list() { + OperationListInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + 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/RegistrationAssignmentImpl.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java new file mode 100644 index 0000000000000..3be4560f8615e --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java @@ -0,0 +1,143 @@ +// 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.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 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..7cd93f3954c7f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsClientImpl.java @@ -0,0 +1,1028 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(RegistrationAssignmentsClientImpl.class); + + /** 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") + private 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, + @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. + */ + @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. + */ + @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition) { + return getWithResponseAsync(scope, registrationAssignmentId, expandRegistrationDefinition) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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) + private Mono getAsync(String scope, String registrationAssignmentId) { + final Boolean expandRegistrationDefinition = null; + return getWithResponseAsync(scope, registrationAssignmentId, expandRegistrationDefinition) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(scope, registrationAssignmentId, expandRegistrationDefinition).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context) { + return getWithResponseAsync(scope, registrationAssignmentId, expandRegistrationDefinition, context).block(); + } + + /** + * 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 completion. + */ + @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 completion. + */ + @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, Context.NONE); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String scope, String registrationAssignmentId) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String scope, String registrationAssignmentId, Context context) { + return 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 the completion. + */ + @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 the completion. + */ + @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. + */ + @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. + */ + @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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, + Context.NONE); + } + + /** + * 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) + 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody) { + return 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody, Context context) { + return 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. + */ + @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. + */ + @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + scope, + expandRegistrationDefinition, + 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 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 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String scope, 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + scope, + expandRegistrationDefinition, + 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 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. + * @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Boolean expandRegistrationDefinition) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition), + 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + final Boolean expandRegistrationDefinition = null; + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition), + 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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String scope, Boolean expandRegistrationDefinition, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, expandRegistrationDefinition, 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + final Boolean expandRegistrationDefinition = null; + return new PagedIterable<>(listAsync(scope, expandRegistrationDefinition)); + } + + /** + * 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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String scope, Boolean expandRegistrationDefinition, Context context) { + return new PagedIterable<>(listAsync(scope, expandRegistrationDefinition, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of registration assignments. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of registration assignments. + */ + @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..da770cfbd754c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentsImpl.java @@ -0,0 +1,217 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegistrationAssignmentsImpl implements RegistrationAssignments { + @JsonIgnore private 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 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 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 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, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, expandRegistrationDefinition, 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..45d319984e347 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.java @@ -0,0 +1,151 @@ +// 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.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 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..49251c8be0808 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionsClientImpl.java @@ -0,0 +1,853 @@ +// 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(RegistrationDefinitionsClientImpl.class); + + /** 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") + private 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, + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String scope, String registrationDefinitionId) { + return getWithResponseAsync(scope, registrationDefinitionId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(scope, registrationDefinitionId).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String scope, String registrationDefinitionId, Context context) { + return getWithResponseAsync(scope, registrationDefinitionId, 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. + * @return the completion. + */ + @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 completion. + */ + @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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String registrationDefinitionId, String scope) { + return deleteWithResponseAsync(registrationDefinitionId, scope).flatMap((Response res) -> Mono.empty()); + } + + /** + * 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) { + deleteAsync(registrationDefinitionId, scope).block(); + } + + /** + * 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String registrationDefinitionId, String scope, Context context) { + return deleteWithResponseAsync(registrationDefinitionId, scope, context).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. + * @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) + 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. + */ + @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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, + 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. + * @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) + 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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody) { + return 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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody, Context context) { + return 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. + */ + @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. + */ + @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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)) + .>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 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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) + .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. + * @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope) { + return new PagedFlux<>(() -> listSinglePageAsync(scope), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of the registration definitions. + * + * @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 registration definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String scope, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(scope, 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope) { + return new PagedIterable<>(listAsync(scope)); + } + + /** + * Gets a list of the registration definitions. + * + * @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 registration definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String scope, Context context) { + return new PagedIterable<>(listAsync(scope, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of registration definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of registration definitions. + */ + @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..502262dcdbcf7 --- /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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RegistrationDefinitionsImpl implements RegistrationDefinitions { + @JsonIgnore private 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 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 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 void deleteByResourceGroup(String registrationDefinitionId, String scope) { + this.serviceClient().delete(registrationDefinitionId, scope); + } + + public Response deleteWithResponse(String registrationDefinitionId, String scope, Context context) { + return this.serviceClient().deleteWithResponse(registrationDefinitionId, scope, context); + } + + 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, Context context) { + PagedIterable inner = this.serviceClient().list(scope, 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.deleteWithResponse(registrationDefinitionId, scope, Context.NONE).getValue(); + } + + 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.deleteWithResponse(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..604a77ffd86f8 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java @@ -0,0 +1,154 @@ +// 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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Authorization.class); + + /* + * 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; + + /** + * 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")); + } + } +} 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..7b960431f96e2 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleApprover.java @@ -0,0 +1,84 @@ +// 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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EligibleApprover.class); + + /* + * 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; + + /** + * 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")); + } + } +} 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..3d097d87a52cf --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java @@ -0,0 +1,150 @@ +// 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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EligibleAuthorization.class); + + /* + * 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; + + /** + * 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(); + } + } +} 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..c29b2218bbb0f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.java @@ -0,0 +1,119 @@ +// 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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JustInTimeAccessPolicy.class); + + /* + * 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; + + /** + * 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()); + } + } +} 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..c79dc46991a06 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.fluent.models.MarketplaceRegistrationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of marketplace registration definitions. */ +@Immutable +public final class MarketplaceRegistrationDefinitionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionList.class); + + /* + * 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; + + /** + * 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..7d6904710b43a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java @@ -0,0 +1,211 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of the marketplace registration definition. */ +@Fluent +public final class MarketplaceRegistrationDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionProperties.class); + + /* + * 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; + + /** + * 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()); + } + } +} 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..fac76255b6713 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitions.java @@ -0,0 +1,67 @@ +// 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. + */ + 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 marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + 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}). + * @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); + + /** + * 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. + */ + Response getWithResponse( + String scope, String marketplaceIdentifier, Context context); +} 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..262cf97040ffd --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionsWithoutScopes.java @@ -0,0 +1,61 @@ +// 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. + */ + PagedIterable list(); + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter to filter marketplace registration definitions by plan identifier, + * publisher, version etc. + * @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. + */ + 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}). + * @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); + + /** + * 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. + */ + Response getWithResponse(String marketplaceIdentifier, Context context); +} 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..292c2558d475a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MultiFactorAuthProvider.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MultiFactorAuthProvider. */ +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 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); + } + + /** @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..95d6b450532e7 --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes a single Microsoft.ManagedServices operation. */ +@Immutable +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * 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; + + /** + * 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..c47c2332b941e --- /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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that represents the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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; + + /** + * 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..ac41c44bcbf75 --- /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. + * + * @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(); + + /** + * 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. + */ + Response listWithResponse(Context context); +} 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..a32f6d8ed158a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Plan.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details for the Managed Services offer’s plan in Azure Marketplace. */ +@Fluent +public final class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * 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; + + /** + * 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")); + } + } +} 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..7e6e48c225128 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/ProvisioningState.java @@ -0,0 +1,64 @@ +// 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; + +/** Defines values for ProvisioningState. */ +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 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); + } + + /** @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..d7bf0ad4280ae --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignment.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.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 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..b05d62acb1baf --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationAssignmentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of registration assignments. */ +@Immutable +public final class RegistrationAssignmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentList.class); + + /* + * 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; + + /** + * 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..7ae7f6f744d37 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentProperties.java @@ -0,0 +1,90 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of the registration assignment. */ +@Fluent +public final class RegistrationAssignmentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentProperties.class); + + /* + * 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; + + /** + * 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(); + } + } +} 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..9078a4bae01e8 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The registration definition associated with the registration assignment. */ +@Fluent +public final class RegistrationAssignmentPropertiesRegistrationDefinition { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RegistrationAssignmentPropertiesRegistrationDefinition.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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..c41d47c582f09 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java @@ -0,0 +1,285 @@ +// 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.JsonIgnore; +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 { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(RegistrationAssignmentPropertiesRegistrationDefinitionProperties.class); + + /* + * 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; + + /** + * 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..c1e570c47c925 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignments.java @@ -0,0 +1,143 @@ +// 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. + * @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); + + /** + * 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. + */ + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, 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. + */ + 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. + */ + 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 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. + */ + PagedIterable list(String scope, Boolean expandRegistrationDefinition, 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. + */ + 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. + */ + 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..ded0fb4667b27 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinition.java @@ -0,0 +1,174 @@ +// 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.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 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..ef284730bd770 --- /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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.managedservices.fluent.models.RegistrationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of registration definitions. */ +@Immutable +public final class RegistrationDefinitionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionList.class); + + /* + * 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; + + /** + * 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..6a5a2c6e54ba3 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java @@ -0,0 +1,213 @@ +// 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties of a registration definition. */ +@Fluent +public final class RegistrationDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionProperties.class); + + /* + * 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 name of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantName", access = JsonProperty.Access.WRITE_ONLY) + private String managedByTenantName; + + /** + * 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 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")); + } + } +} 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..099a733f9bb0a --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitions.java @@ -0,0 +1,137 @@ +// 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. + * @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); + + /** + * 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. + */ + Response getWithResponse(String scope, String registrationDefinitionId, 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); + + /** + * 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 response. + */ + Response deleteWithResponse(String registrationDefinitionId, String scope, 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. + */ + PagedIterable list(String scope); + + /** + * Gets a list of the registration definitions. + * + * @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 registration definitions. + */ + PagedIterable list(String scope, 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. + */ + 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. + */ + 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 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/ci.yml b/sdk/managedservices/ci.yml new file mode 100644 index 0000000000000..247ef6ee4f595 --- /dev/null +++ b/sdk/managedservices/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: managedservices + Artifacts: + - name: azure-resourcemanager-managedservices + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermanagedservices diff --git a/sdk/managedservices/pom.xml b/sdk/managedservices/pom.xml new file mode 100644 index 0000000000000..a3fb07b5448a2 --- /dev/null +++ b/sdk/managedservices/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-managedservices-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-managedservices + + + +