diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index d1b2a167a7b4e..a60235334b117 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -199,6 +199,7 @@ com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0- com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-healthbot;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-confluent;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-managedservices;1.0.0-beta.1;1.0.0-beta.1 # 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 3d84dd84ceb34..02f9aebf046f4 100644 --- a/pom.xml +++ b/pom.xml @@ -578,6 +578,7 @@ sdk/keyvault sdk/kusto sdk/loganalytics + sdk/managedservices sdk/mediaservices sdk/metricsadvisor sdk/monitor diff --git a/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md new file mode 100644 index 0000000000000..2a22a88c3552c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-02-08) + +- Azure Resource Manager ManagedServices client library for Java. This package contains Microsoft Azure SDK for ManagedServices Management SDK. 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..a5c2d78d14eb1 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/README.md @@ -0,0 +1,99 @@ +# 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. 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..712778a307c5d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/pom.xml @@ -0,0 +1,62 @@ + + 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. Specification for ManagedServices. Package tag package-2020-02-preview. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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-management + 1.1.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + 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..c136977ce2a2e --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/ManagedServicesManager.java @@ -0,0 +1,266 @@ +// 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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.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. 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 RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of 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 (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + 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..ff87a68d8ddb7 --- /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 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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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..90b9989ef034f --- /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. Might be used to filter marketplace registration definition 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 Market place identifer. 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 Market place identifer. 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..c87d83fa4d7bb --- /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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 specified registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationAssignmentInner get(String scope, String registrationAssignmentId); + + /** + * Gets the details of specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 specified registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context); + + /** + * Deletes the specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RegistrationAssignmentInner> beginCreateOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody); + + /** + * Creates or updates a registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 registration assignment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationAssignmentInner createOrUpdate( + String scope, String registrationAssignmentId, RegistrationAssignmentInner requestBody); + + /** + * Creates or updates a registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 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 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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..b6b5596561009 --- /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 Scope of the resource. + * @param registrationDefinitionId 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 Scope of the resource. + * @param registrationDefinitionId 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RegistrationDefinitionInner> beginCreateOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 registration definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RegistrationDefinitionInner createOrUpdate( + String registrationDefinitionId, String scope, RegistrationDefinitionInner requestBody); + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 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 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..3f621b32100c7 --- /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); + + /* + * Properties of a marketplace registration definition. + */ + @JsonProperty(value = "properties") + private MarketplaceRegistrationDefinitionProperties properties; + + /* + * Plan details for the managed services. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * Get the properties property: Properties of a marketplace registration definition. + * + * @return the properties value. + */ + public MarketplaceRegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of a 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: Plan details for the managed services. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Plan details for the managed services. + * + * @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..ef3c3bfc974e7 --- /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; + +/** List of the operations. */ +@Immutable +public final class OperationListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListInner.class); + + /* + * List of Microsoft.ManagedServices operations. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: 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..33729a8a0dfe1 --- /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; + +/** Registration assignment. */ +@Fluent +public final class RegistrationAssignmentInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentInner.class); + + /* + * Properties of a registration assignment. + */ + @JsonProperty(value = "properties") + private RegistrationAssignmentProperties properties; + + /** + * Get the properties property: Properties of a registration assignment. + * + * @return the properties value. + */ + public RegistrationAssignmentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: 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..474ba4bcbac83 --- /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; + +/** Registration definition. */ +@Fluent +public final class RegistrationDefinitionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionInner.class); + + /* + * Properties of a registration definition. + */ + @JsonProperty(value = "properties") + private RegistrationDefinitionProperties properties; + + /* + * Plan details for the managed services. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /** + * Get the properties property: Properties of a registration definition. + * + * @return the properties value. + */ + public RegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: 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: Plan details for the managed services. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Plan details for the managed services. + * + * @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..8f5a11b3cb626 --- /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. 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..2383c26c69fd2 --- /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. 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..ca6283fc5626d --- /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 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.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..29983e6132bd1 --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + MarketplaceRegistrationDefinitionImpl( + MarketplaceRegistrationDefinitionInner innerObject, 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 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..29a56f720c99e --- /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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param scope Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param scope Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 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..71984fc5e52a0 --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + public MarketplaceRegistrationDefinitionsImpl( + MarketplaceRegistrationDefinitionsClient innerClient, ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String scope) { + PagedIterable inner = this.serviceClient().list(scope); + return inner.mapPage(inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, String filter, Context context) { + PagedIterable inner = this.serviceClient().list(scope, filter, context); + return inner.mapPage(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 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..435d4962ad528 --- /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. Might be used to filter marketplace registration definition 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of the marketplace registration definitions for the marketplace identifier. + * + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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. Might be used to filter marketplace registration definition 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. Might be used to filter marketplace registration definition 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. Might be used to filter marketplace registration definition 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 Market place identifer. 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the marketplace registration definition for the marketplace identifier. + * + * @param marketplaceIdentifier Market place identifer. 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 Market place identifer. 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 Market place identifer. 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 Market place identifer. 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 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..ff71180638f44 --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + public MarketplaceRegistrationDefinitionsWithoutScopesImpl( + MarketplaceRegistrationDefinitionsWithoutScopesClient innerClient, ManagedServicesManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new MarketplaceRegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return inner.mapPage(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 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..60d1d2e7aec4b --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/OperationListImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.implementation; + +import com.azure.resourcemanager.managedservices.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + OperationListImpl(OperationListInner innerObject, 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 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..b11483a268e78 --- /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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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..4750803a5a19e --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, 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 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..65260523e8f86 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationAssignmentImpl.java @@ -0,0 +1,141 @@ +// 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.ManagedServicesManager; +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 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 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, 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, 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..79a22d675d1fc --- /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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the details of specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 Scope of the resource. + * @param registrationAssignmentId 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of the registration assignments. + * + * @param scope Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 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..bbc50d2eac8a6 --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + public RegistrationAssignmentsImpl( + RegistrationAssignmentsClient innerClient, 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 inner.mapPage(inner1 -> new RegistrationAssignmentImpl(inner1, this.manager())); + } + + public PagedIterable list( + String scope, Boolean expandRegistrationDefinition, Context context) { + PagedIterable inner = + this.serviceClient().list(scope, expandRegistrationDefinition, context); + return inner.mapPage(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 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..fd8375b845ff5 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/RegistrationDefinitionImpl.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.managedservices.ManagedServicesManager; +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 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 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, 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, 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..f419449727c3a --- /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 Scope of the resource. + * @param registrationDefinitionId 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the registration definition details. + * + * @param scope Scope of the resource. + * @param registrationDefinitionId 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 Scope of the resource. + * @param registrationDefinitionId 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 Scope of the resource. + * @param registrationDefinitionId 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 Scope of the resource. + * @param registrationDefinitionId 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 Guid of the registration definition. + * @param scope 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the registration definition. + * + * @param registrationDefinitionId Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a registration definition. + * + * @param registrationDefinitionId Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 Guid of the registration definition. + * @param scope Scope of the resource. + * @param requestBody The parameters required to create 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 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of the registration definitions. + * + * @param scope 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 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 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 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 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 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 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..342a0a45aaa06 --- /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.ManagedServicesManager; +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 ManagedServicesManager serviceManager; + + public RegistrationDefinitionsImpl( + RegistrationDefinitionsClient innerClient, 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 inner.mapPage(inner1 -> new RegistrationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String scope, Context context) { + PagedIterable inner = this.serviceClient().list(scope, context); + return inner.mapPage(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 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..6cf3fd14ef7e5 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/implementation/Utils.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.implementation; + +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; + +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; + } +} 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..858d5be9f8619 --- /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. 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..3a68940cd07ed --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/Authorization.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.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; + +/** Authorization tuple containing principal Id (of user/service principal/security group) and role definition id. */ +@Fluent +public final class Authorization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Authorization.class); + + /* + * Principal Id of the security group/service principal/user that would be + * assigned permissions to the projected subscription + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * Display name of the principal Id. + */ + @JsonProperty(value = "principalIdDisplayName") + private String principalIdDisplayName; + + /* + * The role definition identifier. This role will define all the + * permissions that the security group/service principal/user must have on + * the projected subscription. This role cannot be an owner role. + */ + @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 security groups/service + * principals/users. + */ + @JsonProperty(value = "delegatedRoleDefinitionIds") + private List delegatedRoleDefinitionIds; + + /** + * Get the principalId property: Principal Id of the security group/service principal/user that would be assigned + * permissions to the projected subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Principal Id of the security group/service principal/user that would be assigned + * permissions to the projected subscription. + * + * @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: Display name of the principal Id. + * + * @return the principalIdDisplayName value. + */ + public String principalIdDisplayName() { + return this.principalIdDisplayName; + } + + /** + * Set the principalIdDisplayName property: Display name of the principal Id. + * + * @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 role definition identifier. This role will define all the permissions that + * the security group/service principal/user must have on the projected subscription. This role cannot be an owner + * role. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The role definition identifier. This role will define all the permissions that + * the security group/service principal/user must have on the projected subscription. This role cannot be an owner + * role. + * + * @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 security groups/service + * principals/users. + * + * @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 security groups/service + * principals/users. + * + * @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/EligibleAuthorization.java b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java new file mode 100644 index 0000000000000..92493535efe2f --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/EligibleAuthorization.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.managedservices.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Eligible authorization tuple containing principle Id (of user/service principal/security group), role definition id, + * and the just-in-time access setting. + */ +@Fluent +public final class EligibleAuthorization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EligibleAuthorization.class); + + /* + * Principal Id of the security group/service principal/user that would be + * delegated permissions to the projected subscription + */ + @JsonProperty(value = "principalId", required = true) + private String principalId; + + /* + * Display name of the principal Id. + */ + @JsonProperty(value = "principalIdDisplayName") + private String principalIdDisplayName; + + /* + * The role definition identifier. This role will delegate all the + * permissions that the security group/service principal/user must have on + * the projected subscription. This role cannot be an owner role. + */ + @JsonProperty(value = "roleDefinitionId", required = true) + private String roleDefinitionId; + + /* + * Just-in-time access policy setting. + */ + @JsonProperty(value = "justInTimeAccessPolicy") + private JustInTimeAccessPolicy justInTimeAccessPolicy; + + /** + * Get the principalId property: Principal Id of the security group/service principal/user that would be delegated + * permissions to the projected subscription. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Set the principalId property: Principal Id of the security group/service principal/user that would be delegated + * permissions to the projected subscription. + * + * @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: Display name of the principal Id. + * + * @return the principalIdDisplayName value. + */ + public String principalIdDisplayName() { + return this.principalIdDisplayName; + } + + /** + * Set the principalIdDisplayName property: Display name of the principal Id. + * + * @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 role definition identifier. This role will delegate all the permissions + * that the security group/service principal/user must have on the projected subscription. This role cannot be an + * owner role. + * + * @return the roleDefinitionId value. + */ + public String roleDefinitionId() { + return this.roleDefinitionId; + } + + /** + * Set the roleDefinitionId property: The role definition identifier. This role will delegate all the permissions + * that the security group/service principal/user must have on the projected subscription. This role cannot be an + * owner role. + * + * @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: Just-in-time access policy setting. + * + * @return the justInTimeAccessPolicy value. + */ + public JustInTimeAccessPolicy justInTimeAccessPolicy() { + return this.justInTimeAccessPolicy; + } + + /** + * Set the justInTimeAccessPolicy property: 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..6fda1b8d2e70d --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/JustInTimeAccessPolicy.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.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; + +/** Just-in-time access policy setting. */ +@Fluent +public final class JustInTimeAccessPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JustInTimeAccessPolicy.class); + + /* + * MFA provider. + */ + @JsonProperty(value = "multiFactorAuthProvider", required = true) + private MultiFactorAuthProvider multiFactorAuthProvider; + + /* + * Maximum access duration in ISO 8601 format. The default value is + * "PT8H". + */ + @JsonProperty(value = "maximumActivationDuration") + private Duration maximumActivationDuration; + + /** + * Get the multiFactorAuthProvider property: MFA provider. + * + * @return the multiFactorAuthProvider value. + */ + public MultiFactorAuthProvider multiFactorAuthProvider() { + return this.multiFactorAuthProvider; + } + + /** + * Set the multiFactorAuthProvider property: MFA provider. + * + * @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: Maximum access duration in ISO 8601 format. The default value is + * "PT8H". + * + * @return the maximumActivationDuration value. + */ + public Duration maximumActivationDuration() { + return this.maximumActivationDuration; + } + + /** + * Set the maximumActivationDuration property: Maximum access duration in ISO 8601 format. The default value is + * "PT8H". + * + * @param maximumActivationDuration the maximumActivationDuration value to set. + * @return the JustInTimeAccessPolicy object itself. + */ + public JustInTimeAccessPolicy withMaximumActivationDuration(Duration maximumActivationDuration) { + this.maximumActivationDuration = maximumActivationDuration; + 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")); + } + } +} 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..47d95a0f98f0c --- /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: Properties of a marketplace registration definition. + * + * @return the properties value. + */ + MarketplaceRegistrationDefinitionProperties properties(); + + /** + * Gets the plan property: Plan details for the managed services. + * + * @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..e33580badbd56 --- /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; + +/** List of marketplace registration definitions. */ +@Immutable +public final class MarketplaceRegistrationDefinitionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionList.class); + + /* + * List of marketplace registration definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to next page of marketplace registration definitions. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of marketplace registration definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to 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..61360b32cac1e --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/MarketplaceRegistrationDefinitionProperties.java @@ -0,0 +1,208 @@ +// 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; + +/** Properties of a marketplace registration definition. */ +@Fluent +public final class MarketplaceRegistrationDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MarketplaceRegistrationDefinitionProperties.class); + + /* + * Id of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId", required = true) + private String managedByTenantId; + + /* + * Authorization tuple containing principal id of the user/security group + * or service principal and id of the build-in role. + */ + @JsonProperty(value = "authorizations", required = true) + private List authorizations; + + /* + * Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and + * just-in-time access policy setting + */ + @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: Id of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: Id 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: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @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: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @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..38684b20dc93b --- /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 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 Scope of the resource. + * @param filter The filter query parameter. Might be used to filter marketplace registration definition 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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 Scope of the resource. + * @param marketplaceIdentifier Market place identifer. 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..2f5eacc9f892e --- /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. Might be used to filter marketplace registration definition 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 Market place identifer. 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 Market place identifer. 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..3ac3ee4267ce4 --- /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; + +/** Object that describes a single Microsoft.ManagedServices operation. */ +@Immutable +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * Operation name: {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: Operation name: {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..5389b796fa727 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/OperationDisplay.java @@ -0,0 +1,131 @@ +// 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); + + /* + * Service provider: Microsoft.ManagedServices + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed: Registration definition, + * registration assignment etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Service provider: Microsoft.ManagedServices. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.ManagedServices. + * + * @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: Resource on which the operation is performed: Registration definition, registration + * assignment etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: Registration definition, registration + * assignment etc. + * + * @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: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @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: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: 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..a4b1951e4ac7a --- /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: 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..75f07bf1fb5f4 --- /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; + +/** Plan details for the managed services. */ +@Fluent +public final class Plan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Plan.class); + + /* + * The plan name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The publisher ID. + */ + @JsonProperty(value = "publisher", required = true) + private String publisher; + + /* + * The product code. + */ + @JsonProperty(value = "product", required = true) + private String product; + + /* + * The plan's version. + */ + @JsonProperty(value = "version", required = true) + private String version; + + /** + * Get the name property: The plan name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The 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: The publisher ID. + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: The 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: The product code. + * + * @return the product value. + */ + public String product() { + return this.product; + } + + /** + * Set the product property: The 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: The plan's version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The 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..a2338e5dad1a5 --- /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: 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 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: Properties of a registration assignment.. + * + * @param properties 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: Properties of a registration assignment.. + * + * @param properties 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..8d8d39114e161 --- /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; + +/** List of registration assignments. */ +@Immutable +public final class RegistrationAssignmentList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentList.class); + + /* + * List of registration assignments. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to next page of registration assignments. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of registration assignments. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to 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..8f174dea0f524 --- /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; + +/** Properties of a registration assignment. */ +@Fluent +public final class RegistrationAssignmentProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationAssignmentProperties.class); + + /* + * Fully qualified path of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionId", required = true) + private String registrationDefinitionId; + + /* + * Current state of the registration assignment. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Registration definition inside registration assignment. + */ + @JsonProperty(value = "registrationDefinition", access = JsonProperty.Access.WRITE_ONLY) + private RegistrationAssignmentPropertiesRegistrationDefinition registrationDefinition; + + /** + * Get the registrationDefinitionId property: Fully qualified path of the registration definition. + * + * @return the registrationDefinitionId value. + */ + public String registrationDefinitionId() { + return this.registrationDefinitionId; + } + + /** + * Set the registrationDefinitionId property: 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: Current state of the registration assignment. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the registrationDefinition property: Registration definition inside 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..e2c230c1a658c --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinition.java @@ -0,0 +1,130 @@ +// 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; + +/** Registration definition inside registration assignment. */ +@Fluent +public final class RegistrationAssignmentPropertiesRegistrationDefinition { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RegistrationAssignmentPropertiesRegistrationDefinition.class); + + /* + * Properties of registration definition inside registration assignment. + */ + @JsonProperty(value = "properties") + private RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties; + + /* + * Plan details for the managed services. + */ + @JsonProperty(value = "plan") + private Plan plan; + + /* + * Fully qualified path of the registration definition. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Type of the resource + * (Microsoft.ManagedServices/registrationDefinitions). + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Name of the registration definition. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * Get the properties property: Properties of registration definition inside registration assignment. + * + * @return the properties value. + */ + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of registration definition inside 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: Plan details for the managed services. + * + * @return the plan value. + */ + public Plan plan() { + return this.plan; + } + + /** + * Set the plan property: Plan details for the managed services. + * + * @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: Fully qualified path of the registration definition. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Type of the resource (Microsoft.ManagedServices/registrationDefinitions). + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: 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..a71163160d7ee --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.java @@ -0,0 +1,282 @@ +// 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; + +/** Properties of registration definition inside registration assignment. */ +@Fluent +public final class RegistrationAssignmentPropertiesRegistrationDefinitionProperties { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(RegistrationAssignmentPropertiesRegistrationDefinitionProperties.class); + + /* + * Description of the registration definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Authorization tuple containing principal id of the user/security group + * or service principal and id of the build-in role. + */ + @JsonProperty(value = "authorizations") + private List authorizations; + + /* + * Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and + * just-in-time access policy setting + */ + @JsonProperty(value = "eligibleAuthorizations") + private List eligibleAuthorizations; + + /* + * Name of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionName") + private String registrationDefinitionName; + + /* + * Current state of the registration definition. + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /* + * Id of the home tenant. + */ + @JsonProperty(value = "manageeTenantId") + private String manageeTenantId; + + /* + * Name of the home tenant. + */ + @JsonProperty(value = "manageeTenantName") + private String manageeTenantName; + + /* + * Id of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId") + private String managedByTenantId; + + /* + * Name of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantName") + private String managedByTenantName; + + /** + * Get the description property: Description of the registration definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: 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: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @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: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @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: Name of the registration definition. + * + * @return the registrationDefinitionName value. + */ + public String registrationDefinitionName() { + return this.registrationDefinitionName; + } + + /** + * Set the registrationDefinitionName property: 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: Current state of the registration definition. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Current 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: Id of the home tenant. + * + * @return the manageeTenantId value. + */ + public String manageeTenantId() { + return this.manageeTenantId; + } + + /** + * Set the manageeTenantId property: Id of the home 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: Name of the home tenant. + * + * @return the manageeTenantName value. + */ + public String manageeTenantName() { + return this.manageeTenantName; + } + + /** + * Set the manageeTenantName property: Name of the home 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: Id of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: Id 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: Name of the managedBy tenant. + * + * @return the managedByTenantName value. + */ + public String managedByTenantName() { + return this.managedByTenantName; + } + + /** + * Set the managedByTenantName property: 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..d7bfd5a5cff7d --- /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 specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 specified registration assignment. + */ + RegistrationAssignment get(String scope, String registrationAssignmentId); + + /** + * Gets the details of specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId Guid of the registration assignment. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 specified registration assignment. + */ + Response getWithResponse( + String scope, String registrationAssignmentId, Boolean expandRegistrationDefinition, Context context); + + /** + * Deletes the specified registration assignment. + * + * @param scope Scope of the resource. + * @param registrationAssignmentId 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 Scope of the resource. + * @param registrationAssignmentId 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 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 Scope of the resource. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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 specified registration assignment. + */ + RegistrationAssignment getById(String id); + + /** + * Gets the details of specified registration assignment. + * + * @param id the resource ID. + * @param expandRegistrationDefinition Tells whether to return registration definition details also along with + * 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 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..35af9df959e00 --- /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: Properties of a registration definition. + * + * @return the properties value. + */ + RegistrationDefinitionProperties properties(); + + /** + * Gets the plan property: Plan details for the managed services. + * + * @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 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: Properties of a registration definition.. + * + * @param properties 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: Plan details for the managed services.. + * + * @param plan Plan details for the managed services. + * @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: Properties of a registration definition.. + * + * @param properties 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: Plan details for the managed services.. + * + * @param plan Plan details for the managed services. + * @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..ce42157bc4a82 --- /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; + +/** List of registration definitions. */ +@Immutable +public final class RegistrationDefinitionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionList.class); + + /* + * List of registration definitions. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to next page of registration definitions. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of registration definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to 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..f3ed848031731 --- /dev/null +++ b/sdk/managedservices/azure-resourcemanager-managedservices/src/main/java/com/azure/resourcemanager/managedservices/models/RegistrationDefinitionProperties.java @@ -0,0 +1,210 @@ +// 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; + +/** Properties of a registration definition. */ +@Fluent +public final class RegistrationDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegistrationDefinitionProperties.class); + + /* + * Description of the registration definition. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Authorization tuple containing principal id of the user/security group + * or service principal and id of the build-in role. + */ + @JsonProperty(value = "authorizations", required = true) + private List authorizations; + + /* + * Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and + * just-in-time access policy setting + */ + @JsonProperty(value = "eligibleAuthorizations") + private List eligibleAuthorizations; + + /* + * Name of the registration definition. + */ + @JsonProperty(value = "registrationDefinitionName") + private String registrationDefinitionName; + + /* + * Id of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantId", required = true) + private String managedByTenantId; + + /* + * Current state of the registration definition. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Name of the managedBy tenant. + */ + @JsonProperty(value = "managedByTenantName", access = JsonProperty.Access.WRITE_ONLY) + private String managedByTenantName; + + /** + * Get the description property: Description of the registration definition. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: 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: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @return the authorizations value. + */ + public List authorizations() { + return this.authorizations; + } + + /** + * Set the authorizations property: Authorization tuple containing principal id of the user/security group or + * service principal and id of the build-in role. + * + * @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: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @return the eligibleAuthorizations value. + */ + public List eligibleAuthorizations() { + return this.eligibleAuthorizations; + } + + /** + * Set the eligibleAuthorizations property: Eligible PIM authorization tuple containing principal id of the + * user/security group or service principal, id of the built-in role, and just-in-time access policy setting. + * + * @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: Name of the registration definition. + * + * @return the registrationDefinitionName value. + */ + public String registrationDefinitionName() { + return this.registrationDefinitionName; + } + + /** + * Set the registrationDefinitionName property: 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: Id of the managedBy tenant. + * + * @return the managedByTenantId value. + */ + public String managedByTenantId() { + return this.managedByTenantId; + } + + /** + * Set the managedByTenantId property: Id 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: Current state of the registration definition. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the managedByTenantName property: 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..099d8c32655b3 --- /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 Scope of the resource. + * @param registrationDefinitionId 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 Scope of the resource. + * @param registrationDefinitionId 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 Guid of the registration definition. + * @param scope 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 Guid of the registration definition. + * @param scope 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 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 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..3faf2dbd106f1 --- /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. 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..545281a425dfc --- /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. 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..95ee759e64ccb --- /dev/null +++ b/sdk/managedservices/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/managedservices/ + +pr: + branches: + include: + - master + - 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 + + + +