diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b44b07684b8a..4a57074959f5 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -263,6 +263,7 @@ com.azure.resourcemanager:azure-resourcemanager-policyinsights;1.0.0-beta.1;1.0. com.azure.resourcemanager:azure-resourcemanager-support;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-subscription;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-powerbidedicated;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-deploymentmanager;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 bdb9f1ed5eb1..98313581631d 100644 --- a/pom.xml +++ b/pom.xml @@ -688,6 +688,7 @@ sdk/datafactory sdk/datamigration sdk/delegatednetwork + sdk/deploymentmanager sdk/deviceupdate sdk/devspaces sdk/devtestlabs diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/CHANGELOG.md b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/CHANGELOG.md new file mode 100644 index 000000000000..ad7ae5c3bddd --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-20) + +- Azure Resource Manager Deployment client library for Java. This package contains Microsoft Azure SDK for Deployment Management SDK. REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. Package tag package-2019-11-01-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/deploymentmanager/azure-resourcemanager-deploymentmanager/README.md b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/README.md new file mode 100644 index 000000000000..a4d3f41de25a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Deployment client library for Java + +Azure Resource Manager Deployment client library for Java. + +This package contains Microsoft Azure SDK for Deployment Management SDK. REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. Package tag package-2019-11-01-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-deploymentmanager;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-deploymentmanager + 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(); +DeploymentManager manager = DeploymentManager + .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/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml new file mode 100644 index 000000000000..bf714d5ac979 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-deploymentmanager + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Deployment Management + This package contains Microsoft Azure SDK for Deployment Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. Package tag package-2019-11-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.15.0 + + + com.azure + azure-core-management + 1.2.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/DeploymentManager.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/DeploymentManager.java new file mode 100644 index 000000000000..375add9b6ef6 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/DeploymentManager.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager; + +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.deploymentmanager.fluent.AzureDeploymentManager; +import com.azure.resourcemanager.deploymentmanager.implementation.ArtifactSourcesImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.AzureDeploymentManagerBuilder; +import com.azure.resourcemanager.deploymentmanager.implementation.OperationsImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.RolloutsImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.ServiceTopologiesImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.ServiceUnitsImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.ServicesImpl; +import com.azure.resourcemanager.deploymentmanager.implementation.StepsImpl; +import com.azure.resourcemanager.deploymentmanager.models.ArtifactSources; +import com.azure.resourcemanager.deploymentmanager.models.Operations; +import com.azure.resourcemanager.deploymentmanager.models.Rollouts; +import com.azure.resourcemanager.deploymentmanager.models.ServiceTopologies; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnits; +import com.azure.resourcemanager.deploymentmanager.models.Services; +import com.azure.resourcemanager.deploymentmanager.models.Steps; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to DeploymentManager. REST APIs for orchestrating deployments using the Azure Deployment Manager (ADM). + * See https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +public final class DeploymentManager { + private ServiceTopologies serviceTopologies; + + private Services services; + + private ServiceUnits serviceUnits; + + private Steps steps; + + private Rollouts rollouts; + + private ArtifactSources artifactSources; + + private Operations operations; + + private final AzureDeploymentManager clientObject; + + private DeploymentManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureDeploymentManagerBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Deployment service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Deployment service API instance. + */ + public static DeploymentManager 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 DeploymentManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DeploymentManager.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 Deployment service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Deployment service API instance. + */ + public DeploymentManager 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.deploymentmanager") + .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")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DeploymentManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ServiceTopologies. */ + public ServiceTopologies serviceTopologies() { + if (this.serviceTopologies == null) { + this.serviceTopologies = new ServiceTopologiesImpl(clientObject.getServiceTopologies(), this); + } + return serviceTopologies; + } + + /** @return Resource collection API of Services. */ + public Services services() { + if (this.services == null) { + this.services = new ServicesImpl(clientObject.getServices(), this); + } + return services; + } + + /** @return Resource collection API of ServiceUnits. */ + public ServiceUnits serviceUnits() { + if (this.serviceUnits == null) { + this.serviceUnits = new ServiceUnitsImpl(clientObject.getServiceUnits(), this); + } + return serviceUnits; + } + + /** @return Resource collection API of Steps. */ + public Steps steps() { + if (this.steps == null) { + this.steps = new StepsImpl(clientObject.getSteps(), this); + } + return steps; + } + + /** @return Resource collection API of Rollouts. */ + public Rollouts rollouts() { + if (this.rollouts == null) { + this.rollouts = new RolloutsImpl(clientObject.getRollouts(), this); + } + return rollouts; + } + + /** @return Resource collection API of ArtifactSources. */ + public ArtifactSources artifactSources() { + if (this.artifactSources == null) { + this.artifactSources = new ArtifactSourcesImpl(clientObject.getArtifactSources(), this); + } + return artifactSources; + } + + /** @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 AzureDeploymentManager providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public AzureDeploymentManager serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ArtifactSourcesClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ArtifactSourcesClient.java new file mode 100644 index 000000000000..fffc4183b45e --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ArtifactSourcesClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.models.ArtifactSourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ArtifactSourcesClient. */ +public interface ArtifactSourcesClient { + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactSourceInner createOrUpdate(String resourceGroupName, String artifactSourceName); + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @param artifactSourceInfo Source object that defines 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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String artifactSourceName, ArtifactSourceInner artifactSourceInfo, Context context); + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ArtifactSourceInner getByResourceGroup(String resourceGroupName, String artifactSourceName); + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String artifactSourceName, Context context); + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String artifactSourceName); + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 resourceGroupName, String artifactSourceName, Context context); + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName); + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse(String resourceGroupName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/AzureDeploymentManager.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/AzureDeploymentManager.java new file mode 100644 index 000000000000..ab24c0463baa --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/AzureDeploymentManager.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureDeploymentManager class. */ +public interface AzureDeploymentManager { + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the ServiceTopologiesClient object to access its operations. + * + * @return the ServiceTopologiesClient object. + */ + ServiceTopologiesClient getServiceTopologies(); + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + ServicesClient getServices(); + + /** + * Gets the ServiceUnitsClient object to access its operations. + * + * @return the ServiceUnitsClient object. + */ + ServiceUnitsClient getServiceUnits(); + + /** + * Gets the StepsClient object to access its operations. + * + * @return the StepsClient object. + */ + StepsClient getSteps(); + + /** + * Gets the RolloutsClient object to access its operations. + * + * @return the RolloutsClient object. + */ + RolloutsClient getRollouts(); + + /** + * Gets the ArtifactSourcesClient object to access its operations. + * + * @return the ArtifactSourcesClient object. + */ + ArtifactSourcesClient getArtifactSources(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/OperationsClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/OperationsClient.java new file mode 100644 index 000000000000..b7c13ede2daa --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/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.deploymentmanager.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.deploymentmanager.fluent.models.OperationsListInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists the supported 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 the operations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationsListInner list(); + + /** + * Lists the supported 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 the operations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/RolloutsClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/RolloutsClient.java new file mode 100644 index 000000000000..e1161735dd62 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/RolloutsClient.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.deploymentmanager.fluent.models.RolloutInner; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in RolloutsClient. */ +public interface RolloutsClient { + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RolloutRequestInner> beginCreateOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest); + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, RolloutRequestInner> beginCreateOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context); + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutRequestInner createOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest); + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutRequestInner createOrUpdate(String resourceGroupName, String rolloutName); + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutRequestInner createOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context); + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutInner getByResourceGroup(String resourceGroupName, String rolloutName); + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @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 detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String rolloutName, Integer retryAttempt, Context context); + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String rolloutName); + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 resourceGroupName, String rolloutName, Context context); + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutInner cancel(String resourceGroupName, String rolloutName); + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse(String resourceGroupName, String rolloutName, Context context); + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RolloutInner restart(String resourceGroupName, String rolloutName); + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response restartWithResponse( + String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context); + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName); + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse(String resourceGroupName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceTopologiesClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceTopologiesClient.java new file mode 100644 index 000000000000..fb658dd12aa3 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceTopologiesClient.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.models.ServiceTopologyResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ServiceTopologiesClient. */ +public interface ServiceTopologiesClient { + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 the resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceTopologyResourceInner createOrUpdate( + String resourceGroupName, String serviceTopologyName, ServiceTopologyResourceInner serviceTopologyInfo); + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serviceTopologyName, + ServiceTopologyResourceInner serviceTopologyInfo, + Context context); + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceTopologyResourceInner getByResourceGroup(String resourceGroupName, String serviceTopologyName); + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String serviceTopologyName, Context context); + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceTopologyName); + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 resourceGroupName, String serviceTopologyName, Context context); + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName); + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse(String resourceGroupName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceUnitsClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceUnitsClient.java new file mode 100644 index 000000000000..e18a0cc4ba7d --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServiceUnitsClient.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +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.deploymentmanager.fluent.models.ServiceUnitResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ServiceUnitsClient. */ +public interface ServiceUnitsClient { + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServiceUnitResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo); + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServiceUnitResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context); + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceUnitResourceInner createOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo); + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceUnitResourceInner createOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context); + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceUnitResourceInner get( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName); + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context); + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName); + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context); + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServicesClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServicesClient.java new file mode 100644 index 000000000000..130e1d34a638 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/ServicesClient.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.models.ServiceResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public interface ServicesClient { + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @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 resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner createOrUpdate( + String resourceGroupName, String serviceTopologyName, String serviceName, ServiceResourceInner serviceInfo); + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @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 resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + ServiceResourceInner serviceInfo, + Context context); + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServiceResourceInner get(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context); + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName, Context context); + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName, String serviceTopologyName); + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/StepsClient.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/StepsClient.java new file mode 100644 index 000000000000..d354d32b916a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/StepsClient.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.models.StepResourceInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in StepsClient. */ +public interface StepsClient { + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StepResourceInner createOrUpdate(String resourceGroupName, String stepName); + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @param stepInfo The step object. + * @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 resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String stepName, StepResourceInner stepInfo, Context context); + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StepResourceInner getByResourceGroup(String resourceGroupName, String stepName); + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String stepName, Context context); + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String stepName); + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 resourceGroupName, String stepName, Context context); + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + List list(String resourceGroupName); + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response> listWithResponse(String resourceGroupName, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ArtifactSourceInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ArtifactSourceInner.java new file mode 100644 index 000000000000..18bf9a1f0d75 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ArtifactSourceInner.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.Authentication; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource that defines the source location where the artifacts are located. */ +@JsonFlatten +@Fluent +public class ArtifactSourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceInner.class); + + /* + * The type of artifact source used. + */ + @JsonProperty(value = "properties.sourceType") + private String sourceType; + + /* + * The path from the location that the 'authentication' property [say, a + * SAS URI to the blob container] refers to, to the location of the + * artifacts. This can be used to differentiate different versions of the + * artifacts. Or, different types of artifacts like binaries or templates. + * The location referenced by the authentication property concatenated with + * this optional artifactRoot path forms the artifact source location where + * the artifacts are expected to be found. + */ + @JsonProperty(value = "properties.artifactRoot") + private String artifactRoot; + + /* + * The authentication method to use to access the artifact source. + */ + @JsonProperty(value = "properties.authentication") + private Authentication authentication; + + /** + * Get the sourceType property: The type of artifact source used. + * + * @return the sourceType value. + */ + public String sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: The type of artifact source used. + * + * @param sourceType the sourceType value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withSourceType(String sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the artifactRoot property: The path from the location that the 'authentication' property [say, a SAS URI to + * the blob container] refers to, to the location of the artifacts. This can be used to differentiate different + * versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced + * by the authentication property concatenated with this optional artifactRoot path forms the artifact source + * location where the artifacts are expected to be found. + * + * @return the artifactRoot value. + */ + public String artifactRoot() { + return this.artifactRoot; + } + + /** + * Set the artifactRoot property: The path from the location that the 'authentication' property [say, a SAS URI to + * the blob container] refers to, to the location of the artifacts. This can be used to differentiate different + * versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced + * by the authentication property concatenated with this optional artifactRoot path forms the artifact source + * location where the artifacts are expected to be found. + * + * @param artifactRoot the artifactRoot value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withArtifactRoot(String artifactRoot) { + this.artifactRoot = artifactRoot; + return this; + } + + /** + * Get the authentication property: The authentication method to use to access the artifact source. + * + * @return the authentication value. + */ + public Authentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: The authentication method to use to access the artifact source. + * + * @param authentication the authentication value to set. + * @return the ArtifactSourceInner object itself. + */ + public ArtifactSourceInner withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authentication() != null) { + authentication().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/OperationsListInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/OperationsListInner.java new file mode 100644 index 000000000000..61555aca17c2 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/OperationsListInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The operations response. */ +@Fluent +public final class OperationsListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsListInner.class); + + /* + * The list of supported operations + */ + @JsonProperty(value = "value") + private Operation value; + + /** + * Get the value property: The list of supported operations. + * + * @return the value value. + */ + public Operation value() { + return this.value; + } + + /** + * Set the value property: The list of supported operations. + * + * @param value the value value to set. + * @return the OperationsListInner object itself. + */ + public OperationsListInner withValue(Operation value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutInner.java new file mode 100644 index 000000000000..16bf84f5e31a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutInner.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.Identity; +import com.azure.resourcemanager.deploymentmanager.models.RolloutOperationInfo; +import com.azure.resourcemanager.deploymentmanager.models.Service; +import com.azure.resourcemanager.deploymentmanager.models.StepGroup; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Defines the rollout. */ +@JsonFlatten +@Fluent +public class RolloutInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutInner.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * The version of the build being deployed. + */ + @JsonProperty(value = "properties.buildVersion") + private String buildVersion; + + /* + * The reference to the artifact source resource Id where the payload is + * located. + */ + @JsonProperty(value = "properties.artifactSourceId") + private String artifactSourceId; + + /* + * The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + */ + @JsonProperty(value = "properties.targetServiceTopologyId") + private String targetServiceTopologyId; + + /* + * The list of step groups that define the orchestration. + */ + @JsonProperty(value = "properties.stepGroups") + private List stepGroups; + + /* + * The current status of the rollout. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The cardinal count of total number of retries performed on the rollout + * at a given time. + */ + @JsonProperty(value = "properties.totalRetryAttempts", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalRetryAttempts; + + /* + * Operational information of the rollout. + */ + @JsonProperty(value = "properties.operationInfo", access = JsonProperty.Access.WRITE_ONLY) + private RolloutOperationInfo operationInfo; + + /* + * The detailed information on the services being deployed. + */ + @JsonProperty(value = "properties.services", access = JsonProperty.Access.WRITE_ONLY) + private List services; + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the RolloutInner object itself. + */ + public RolloutInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the buildVersion property: The version of the build being deployed. + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The version of the build being deployed. + * + * @param buildVersion the buildVersion value to set. + * @return the RolloutInner object itself. + */ + public RolloutInner withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @return the artifactSourceId value. + */ + public String artifactSourceId() { + return this.artifactSourceId; + } + + /** + * Set the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @param artifactSourceId the artifactSourceId value to set. + * @return the RolloutInner object itself. + */ + public RolloutInner withArtifactSourceId(String artifactSourceId) { + this.artifactSourceId = artifactSourceId; + return this; + } + + /** + * Get the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @return the targetServiceTopologyId value. + */ + public String targetServiceTopologyId() { + return this.targetServiceTopologyId; + } + + /** + * Set the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @param targetServiceTopologyId the targetServiceTopologyId value to set. + * @return the RolloutInner object itself. + */ + public RolloutInner withTargetServiceTopologyId(String targetServiceTopologyId) { + this.targetServiceTopologyId = targetServiceTopologyId; + return this; + } + + /** + * Get the stepGroups property: The list of step groups that define the orchestration. + * + * @return the stepGroups value. + */ + public List stepGroups() { + return this.stepGroups; + } + + /** + * Set the stepGroups property: The list of step groups that define the orchestration. + * + * @param stepGroups the stepGroups value to set. + * @return the RolloutInner object itself. + */ + public RolloutInner withStepGroups(List stepGroups) { + this.stepGroups = stepGroups; + return this; + } + + /** + * Get the status property: The current status of the rollout. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the totalRetryAttempts property: The cardinal count of total number of retries performed on the rollout at a + * given time. + * + * @return the totalRetryAttempts value. + */ + public Integer totalRetryAttempts() { + return this.totalRetryAttempts; + } + + /** + * Get the operationInfo property: Operational information of the rollout. + * + * @return the operationInfo value. + */ + public RolloutOperationInfo operationInfo() { + return this.operationInfo; + } + + /** + * Get the services property: The detailed information on the services being deployed. + * + * @return the services value. + */ + public List services() { + return this.services; + } + + /** {@inheritDoc} */ + @Override + public RolloutInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (stepGroups() != null) { + stepGroups().forEach(e -> e.validate()); + } + if (operationInfo() != null) { + operationInfo().validate(); + } + if (services() != null) { + services().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutRequestInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutRequestInner.java new file mode 100644 index 000000000000..528f39e1dbe6 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/RolloutRequestInner.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.Identity; +import com.azure.resourcemanager.deploymentmanager.models.StepGroup; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Defines the PUT rollout request body. */ +@JsonFlatten +@Fluent +public class RolloutRequestInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutRequestInner.class); + + /* + * Identity for the resource. + */ + @JsonProperty(value = "identity", required = true) + private Identity identity; + + /* + * The version of the build being deployed. + */ + @JsonProperty(value = "properties.buildVersion", required = true) + private String buildVersion; + + /* + * The reference to the artifact source resource Id where the payload is + * located. + */ + @JsonProperty(value = "properties.artifactSourceId") + private String artifactSourceId; + + /* + * The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + */ + @JsonProperty(value = "properties.targetServiceTopologyId", required = true) + private String targetServiceTopologyId; + + /* + * The list of step groups that define the orchestration. + */ + @JsonProperty(value = "properties.stepGroups", required = true) + private List stepGroups; + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the RolloutRequestInner object itself. + */ + public RolloutRequestInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the buildVersion property: The version of the build being deployed. + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The version of the build being deployed. + * + * @param buildVersion the buildVersion value to set. + * @return the RolloutRequestInner object itself. + */ + public RolloutRequestInner withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @return the artifactSourceId value. + */ + public String artifactSourceId() { + return this.artifactSourceId; + } + + /** + * Set the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @param artifactSourceId the artifactSourceId value to set. + * @return the RolloutRequestInner object itself. + */ + public RolloutRequestInner withArtifactSourceId(String artifactSourceId) { + this.artifactSourceId = artifactSourceId; + return this; + } + + /** + * Get the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @return the targetServiceTopologyId value. + */ + public String targetServiceTopologyId() { + return this.targetServiceTopologyId; + } + + /** + * Set the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @param targetServiceTopologyId the targetServiceTopologyId value to set. + * @return the RolloutRequestInner object itself. + */ + public RolloutRequestInner withTargetServiceTopologyId(String targetServiceTopologyId) { + this.targetServiceTopologyId = targetServiceTopologyId; + return this; + } + + /** + * Get the stepGroups property: The list of step groups that define the orchestration. + * + * @return the stepGroups value. + */ + public List stepGroups() { + return this.stepGroups; + } + + /** + * Set the stepGroups property: The list of step groups that define the orchestration. + * + * @param stepGroups the stepGroups value to set. + * @return the RolloutRequestInner object itself. + */ + public RolloutRequestInner withStepGroups(List stepGroups) { + this.stepGroups = stepGroups; + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutRequestInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutRequestInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property identity in model RolloutRequestInner")); + } else { + identity().validate(); + } + if (buildVersion() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property buildVersion in model RolloutRequestInner")); + } + if (targetServiceTopologyId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetServiceTopologyId in model RolloutRequestInner")); + } + if (stepGroups() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property stepGroups in model RolloutRequestInner")); + } else { + stepGroups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceResourceInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceResourceInner.java new file mode 100644 index 000000000000..e79ad40f9682 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceResourceInner.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource representation of a service in a service topology. */ +@JsonFlatten +@Fluent +public class ServiceResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceInner.class); + + /* + * The Azure location to which the resources in the service belong to or + * should be deployed to. + */ + @JsonProperty(value = "properties.targetLocation", required = true) + private String targetLocation; + + /* + * The subscription to which the resources in the service belong to or + * should be deployed to. + */ + @JsonProperty(value = "properties.targetSubscriptionId", required = true) + private String targetSubscriptionId; + + /** + * Get the targetLocation property: The Azure location to which the resources in the service belong to or should be + * deployed to. + * + * @return the targetLocation value. + */ + public String targetLocation() { + return this.targetLocation; + } + + /** + * Set the targetLocation property: The Azure location to which the resources in the service belong to or should be + * deployed to. + * + * @param targetLocation the targetLocation value to set. + * @return the ServiceResourceInner object itself. + */ + public ServiceResourceInner withTargetLocation(String targetLocation) { + this.targetLocation = targetLocation; + return this; + } + + /** + * Get the targetSubscriptionId property: The subscription to which the resources in the service belong to or should + * be deployed to. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.targetSubscriptionId; + } + + /** + * Set the targetSubscriptionId property: The subscription to which the resources in the service belong to or should + * be deployed to. + * + * @param targetSubscriptionId the targetSubscriptionId value to set. + * @return the ServiceResourceInner object itself. + */ + public ServiceResourceInner withTargetSubscriptionId(String targetSubscriptionId) { + this.targetSubscriptionId = targetSubscriptionId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetLocation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetLocation in model ServiceResourceInner")); + } + if (targetSubscriptionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetSubscriptionId in model ServiceResourceInner")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceTopologyResourceInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceTopologyResourceInner.java new file mode 100644 index 000000000000..c496a72a722e --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceTopologyResourceInner.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.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource representation of a service topology. */ +@JsonFlatten +@Fluent +public class ServiceTopologyResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTopologyResourceInner.class); + + /* + * The resource Id of the artifact source that contains the artifacts that + * can be referenced in the service units. + */ + @JsonProperty(value = "properties.artifactSourceId") + private String artifactSourceId; + + /** + * Get the artifactSourceId property: The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * + * @return the artifactSourceId value. + */ + public String artifactSourceId() { + return this.artifactSourceId; + } + + /** + * Set the artifactSourceId property: The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * + * @param artifactSourceId the artifactSourceId value to set. + * @return the ServiceTopologyResourceInner object itself. + */ + public ServiceTopologyResourceInner withArtifactSourceId(String artifactSourceId) { + this.artifactSourceId = artifactSourceId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceTopologyResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceTopologyResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceUnitResourceInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceUnitResourceInner.java new file mode 100644 index 000000000000..2472e2289699 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/ServiceUnitResourceInner.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.DeploymentMode; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitArtifacts; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents the response of a service unit resource. */ +@JsonFlatten +@Fluent +public class ServiceUnitResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitResourceInner.class); + + /* + * The Azure Resource Group to which the resources in the service unit + * belong to or should be deployed to. + */ + @JsonProperty(value = "properties.targetResourceGroup", required = true) + private String targetResourceGroup; + + /* + * Describes the type of ARM deployment to be performed on the resource. + */ + @JsonProperty(value = "properties.deploymentMode", required = true) + private DeploymentMode deploymentMode; + + /* + * The artifacts for the service unit. + */ + @JsonProperty(value = "properties.artifacts") + private ServiceUnitArtifacts artifacts; + + /** + * Get the targetResourceGroup property: The Azure Resource Group to which the resources in the service unit belong + * to or should be deployed to. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The Azure Resource Group to which the resources in the service unit belong + * to or should be deployed to. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the ServiceUnitResourceInner object itself. + */ + public ServiceUnitResourceInner withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the deploymentMode property: Describes the type of ARM deployment to be performed on the resource. + * + * @return the deploymentMode value. + */ + public DeploymentMode deploymentMode() { + return this.deploymentMode; + } + + /** + * Set the deploymentMode property: Describes the type of ARM deployment to be performed on the resource. + * + * @param deploymentMode the deploymentMode value to set. + * @return the ServiceUnitResourceInner object itself. + */ + public ServiceUnitResourceInner withDeploymentMode(DeploymentMode deploymentMode) { + this.deploymentMode = deploymentMode; + return this; + } + + /** + * Get the artifacts property: The artifacts for the service unit. + * + * @return the artifacts value. + */ + public ServiceUnitArtifacts artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The artifacts for the service unit. + * + * @param artifacts the artifacts value to set. + * @return the ServiceUnitResourceInner object itself. + */ + public ServiceUnitResourceInner withArtifacts(ServiceUnitArtifacts artifacts) { + this.artifacts = artifacts; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnitResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnitResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetResourceGroup() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetResourceGroup in model ServiceUnitResourceInner")); + } + if (deploymentMode() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property deploymentMode in model ServiceUnitResourceInner")); + } + if (artifacts() != null) { + artifacts().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/StepResourceInner.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/StepResourceInner.java new file mode 100644 index 000000000000..3040041be1ef --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/StepResourceInner.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.deploymentmanager.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.deploymentmanager.models.StepProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The resource representation of a rollout step. */ +@Fluent +public final class StepResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StepResourceInner.class); + + /* + * The properties that define the step. + */ + @JsonProperty(value = "properties", required = true) + private StepProperties properties; + + /** + * Get the properties property: The properties that define the step. + * + * @return the properties value. + */ + public StepProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties that define the step. + * + * @param properties the properties value to set. + * @return the StepResourceInner object itself. + */ + public StepResourceInner withProperties(StepProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public StepResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public StepResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model StepResourceInner")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/package-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/package-info.java new file mode 100644 index 000000000000..7cc5535347d8 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for AzureDeploymentManager. REST APIs for orchestrating deployments using + * the Azure Deployment Manager (ADM). See + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +package com.azure.resourcemanager.deploymentmanager.fluent.models; diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/package-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/package-info.java new file mode 100644 index 000000000000..9230ccea9da4 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/fluent/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for AzureDeploymentManager. REST APIs for orchestrating deployments using the + * Azure Deployment Manager (ADM). See + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +package com.azure.resourcemanager.deploymentmanager.fluent; diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourceImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourceImpl.java new file mode 100644 index 000000000000..c3daf0df5962 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourceImpl.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.deploymentmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ArtifactSource; +import com.azure.resourcemanager.deploymentmanager.models.Authentication; +import java.util.Collections; +import java.util.Map; + +public final class ArtifactSourceImpl implements ArtifactSource, ArtifactSource.Definition, ArtifactSource.Update { + private ArtifactSourceInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String sourceType() { + return this.innerModel().sourceType(); + } + + public String artifactRoot() { + return this.innerModel().artifactRoot(); + } + + public Authentication authentication() { + return this.innerModel().authentication(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ArtifactSourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String artifactSourceName; + + public ArtifactSourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ArtifactSource create() { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, artifactSourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, artifactSourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ArtifactSourceImpl(String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new ArtifactSourceInner(); + this.serviceManager = serviceManager; + this.artifactSourceName = name; + } + + public ArtifactSourceImpl update() { + return this; + } + + public ArtifactSource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, artifactSourceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .createOrUpdateWithResponse(resourceGroupName, artifactSourceName, this.innerModel(), context) + .getValue(); + return this; + } + + ArtifactSourceImpl( + ArtifactSourceInner innerObject, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.artifactSourceName = Utils.getValueFromIdByName(innerObject.id(), "artifactSources"); + } + + public ArtifactSource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .getByResourceGroupWithResponse(resourceGroupName, artifactSourceName, Context.NONE) + .getValue(); + return this; + } + + public ArtifactSource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getArtifactSources() + .getByResourceGroupWithResponse(resourceGroupName, artifactSourceName, context) + .getValue(); + return this; + } + + public ArtifactSourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ArtifactSourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ArtifactSourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ArtifactSourceImpl withSourceType(String sourceType) { + this.innerModel().withSourceType(sourceType); + return this; + } + + public ArtifactSourceImpl withArtifactRoot(String artifactRoot) { + this.innerModel().withArtifactRoot(artifactRoot); + return this; + } + + public ArtifactSourceImpl withAuthentication(Authentication authentication) { + this.innerModel().withAuthentication(authentication); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesClientImpl.java new file mode 100644 index 000000000000..958dd4083f08 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesClientImpl.java @@ -0,0 +1,736 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.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.deploymentmanager.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ArtifactSourceInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ArtifactSourcesClient. */ +public final class ArtifactSourcesClientImpl implements ArtifactSourcesClient { + private final ClientLogger logger = new ClientLogger(ArtifactSourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ArtifactSourcesService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of ArtifactSourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ArtifactSourcesClientImpl(AzureDeploymentManagerImpl client) { + this.service = + RestProxy.create(ArtifactSourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerArtifactSources to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface ArtifactSourcesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/artifactSources/{artifactSourceName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("artifactSourceName") String artifactSourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ArtifactSourceInner artifactSourceInfo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/artifactSources/{artifactSourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("artifactSourceName") String artifactSourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/artifactSources/{artifactSourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("artifactSourceName") String artifactSourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/artifactSources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @param artifactSourceInfo Source object that defines 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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String artifactSourceName, ArtifactSourceInner artifactSourceInfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (artifactSourceInfo != null) { + artifactSourceInfo.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + artifactSourceInfo, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @param artifactSourceInfo Source object that defines 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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String artifactSourceName, ArtifactSourceInner artifactSourceInfo, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + if (artifactSourceInfo != null) { + artifactSourceInfo.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + artifactSourceInfo, + accept, + context); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @param artifactSourceInfo Source object that defines 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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String artifactSourceName, ArtifactSourceInner artifactSourceInfo) { + return createOrUpdateWithResponseAsync(resourceGroupName, artifactSourceName, artifactSourceInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String artifactSourceName) { + final ArtifactSourceInner artifactSourceInfo = null; + return createOrUpdateWithResponseAsync(resourceGroupName, artifactSourceName, artifactSourceInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactSourceInner createOrUpdate(String resourceGroupName, String artifactSourceName) { + final ArtifactSourceInner artifactSourceInfo = null; + return createOrUpdateAsync(resourceGroupName, artifactSourceName, artifactSourceInfo).block(); + } + + /** + * Synchronously creates a new artifact source or updates an existing artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @param artifactSourceInfo Source object that defines 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 resource that defines the source location where the artifacts are located. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String artifactSourceName, ArtifactSourceInner artifactSourceInfo, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, artifactSourceName, artifactSourceInfo, context) + .block(); + } + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String artifactSourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String artifactSourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String artifactSourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, artifactSourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ArtifactSourceInner getByResourceGroup(String resourceGroupName, String artifactSourceName) { + return getByResourceGroupAsync(resourceGroupName, artifactSourceName).block(); + } + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String artifactSourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, artifactSourceName, context).block(); + } + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String artifactSourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 resourceGroupName, String artifactSourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (artifactSourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter artifactSourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + artifactSourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String artifactSourceName) { + return deleteWithResponseAsync(resourceGroupName, artifactSourceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String artifactSourceName) { + deleteAsync(resourceGroupName, artifactSourceName).block(); + } + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 resourceGroupName, String artifactSourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, artifactSourceName, context).block(); + } + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName) { + return listWithResponseAsync(resourceGroupName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName) { + return listAsync(resourceGroupName).block(); + } + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of artifact sources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse(String resourceGroupName, Context context) { + return listWithResponseAsync(resourceGroupName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesImpl.java new file mode 100644 index 000000000000..3263cb1ee83a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ArtifactSourcesImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ArtifactSourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ArtifactSource; +import com.azure.resourcemanager.deploymentmanager.models.ArtifactSources; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ArtifactSourcesImpl implements ArtifactSources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourcesImpl.class); + + private final ArtifactSourcesClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public ArtifactSourcesImpl( + ArtifactSourcesClient innerClient, + com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ArtifactSource getByResourceGroup(String resourceGroupName, String artifactSourceName) { + ArtifactSourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, artifactSourceName); + if (inner != null) { + return new ArtifactSourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String artifactSourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, artifactSourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ArtifactSourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String artifactSourceName) { + this.serviceClient().delete(resourceGroupName, artifactSourceName); + } + + public Response deleteWithResponse(String resourceGroupName, String artifactSourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, artifactSourceName, context); + } + + public List list(String resourceGroupName) { + List inner = this.serviceClient().list(resourceGroupName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ArtifactSourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse(String resourceGroupName, Context context) { + Response> inner = this.serviceClient().listWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ArtifactSourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public ArtifactSource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String artifactSourceName = Utils.getValueFromIdByName(id, "artifactSources"); + if (artifactSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactSources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, artifactSourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String artifactSourceName = Utils.getValueFromIdByName(id, "artifactSources"); + if (artifactSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactSources'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, artifactSourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String artifactSourceName = Utils.getValueFromIdByName(id, "artifactSources"); + if (artifactSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactSources'.", id))); + } + this.deleteWithResponse(resourceGroupName, artifactSourceName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String artifactSourceName = Utils.getValueFromIdByName(id, "artifactSources"); + if (artifactSourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'artifactSources'.", id))); + } + return this.deleteWithResponse(resourceGroupName, artifactSourceName, context); + } + + private ArtifactSourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public ArtifactSourceImpl define(String name) { + return new ArtifactSourceImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerBuilder.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerBuilder.java new file mode 100644 index 000000000000..749309f9da1f --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerBuilder.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.deploymentmanager.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 AzureDeploymentManagerImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureDeploymentManagerImpl.class}) +public final class AzureDeploymentManagerBuilder { + /* + * Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder 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 AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder 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 AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder 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 AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder 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 AzureDeploymentManagerBuilder. + */ + public AzureDeploymentManagerBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureDeploymentManagerImpl with the provided parameters. + * + * @return an instance of AzureDeploymentManagerImpl. + */ + public AzureDeploymentManagerImpl 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(); + } + AzureDeploymentManagerImpl client = + new AzureDeploymentManagerImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerImpl.java new file mode 100644 index 000000000000..e4f27d4c4ae5 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/AzureDeploymentManagerImpl.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.ArtifactSourcesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.AzureDeploymentManager; +import com.azure.resourcemanager.deploymentmanager.fluent.OperationsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.RolloutsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.ServiceTopologiesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.ServiceUnitsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.ServicesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.StepsClient; +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 AzureDeploymentManagerImpl type. */ +@ServiceClient(builder = AzureDeploymentManagerBuilder.class) +public final class AzureDeploymentManagerImpl implements AzureDeploymentManager { + private final ClientLogger logger = new ClientLogger(AzureDeploymentManagerImpl.class); + + /** + * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of + * the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The ServiceTopologiesClient object to access its operations. */ + private final ServiceTopologiesClient serviceTopologies; + + /** + * Gets the ServiceTopologiesClient object to access its operations. + * + * @return the ServiceTopologiesClient object. + */ + public ServiceTopologiesClient getServiceTopologies() { + return this.serviceTopologies; + } + + /** The ServicesClient object to access its operations. */ + private final ServicesClient services; + + /** + * Gets the ServicesClient object to access its operations. + * + * @return the ServicesClient object. + */ + public ServicesClient getServices() { + return this.services; + } + + /** The ServiceUnitsClient object to access its operations. */ + private final ServiceUnitsClient serviceUnits; + + /** + * Gets the ServiceUnitsClient object to access its operations. + * + * @return the ServiceUnitsClient object. + */ + public ServiceUnitsClient getServiceUnits() { + return this.serviceUnits; + } + + /** The StepsClient object to access its operations. */ + private final StepsClient steps; + + /** + * Gets the StepsClient object to access its operations. + * + * @return the StepsClient object. + */ + public StepsClient getSteps() { + return this.steps; + } + + /** The RolloutsClient object to access its operations. */ + private final RolloutsClient rollouts; + + /** + * Gets the RolloutsClient object to access its operations. + * + * @return the RolloutsClient object. + */ + public RolloutsClient getRollouts() { + return this.rollouts; + } + + /** The ArtifactSourcesClient object to access its operations. */ + private final ArtifactSourcesClient artifactSources; + + /** + * Gets the ArtifactSourcesClient object to access its operations. + * + * @return the ArtifactSourcesClient object. + */ + public ArtifactSourcesClient getArtifactSources() { + return this.artifactSources; + } + + /** 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 AzureDeploymentManager client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + AzureDeploymentManagerImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2019-11-01-preview"; + this.serviceTopologies = new ServiceTopologiesClientImpl(this); + this.services = new ServicesClientImpl(this); + this.serviceUnits = new ServiceUnitsClientImpl(this); + this.steps = new StepsClientImpl(this); + this.rollouts = new RolloutsClientImpl(this); + this.artifactSources = new ArtifactSourcesClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..cdcd24d5683d --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/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.deploymentmanager.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.deploymentmanager.fluent.OperationsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.OperationsListInner; +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 AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureDeploymentManagerImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DeploymentManager/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the supported 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 the operations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the supported 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 the operations response. + */ + @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); + } + + /** + * Lists the supported 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 the operations response. + */ + @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(); + } + }); + } + + /** + * Lists the supported 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 the operations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationsListInner list() { + return listAsync().block(); + } + + /** + * Lists the supported 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 the operations response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsImpl.java new file mode 100644 index 000000000000..76b2529d3784 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/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.deploymentmanager.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.deploymentmanager.fluent.OperationsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.OperationsListInner; +import com.azure.resourcemanager.deploymentmanager.models.Operations; +import com.azure.resourcemanager.deploymentmanager.models.OperationsList; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationsList list() { + OperationsListInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationsListImpl(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 OperationsListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsListImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsListImpl.java new file mode 100644 index 000000000000..2d0afdcc926e --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/OperationsListImpl.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.resourcemanager.deploymentmanager.fluent.models.OperationsListInner; +import com.azure.resourcemanager.deploymentmanager.models.Operation; +import com.azure.resourcemanager.deploymentmanager.models.OperationsList; + +public final class OperationsListImpl implements OperationsList { + private OperationsListInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + OperationsListImpl( + OperationsListInner innerObject, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Operation value() { + return this.innerModel().value(); + } + + public OperationsListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutImpl.java new file mode 100644 index 000000000000..cf50254501a4 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutInner; +import com.azure.resourcemanager.deploymentmanager.models.Identity; +import com.azure.resourcemanager.deploymentmanager.models.Rollout; +import com.azure.resourcemanager.deploymentmanager.models.RolloutOperationInfo; +import com.azure.resourcemanager.deploymentmanager.models.Service; +import com.azure.resourcemanager.deploymentmanager.models.StepGroup; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class RolloutImpl implements Rollout { + private RolloutInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + RolloutImpl( + RolloutInner innerObject, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String buildVersion() { + return this.innerModel().buildVersion(); + } + + public String artifactSourceId() { + return this.innerModel().artifactSourceId(); + } + + public String targetServiceTopologyId() { + return this.innerModel().targetServiceTopologyId(); + } + + public List stepGroups() { + List inner = this.innerModel().stepGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String status() { + return this.innerModel().status(); + } + + public Integer totalRetryAttempts() { + return this.innerModel().totalRetryAttempts(); + } + + public RolloutOperationInfo operationInfo() { + return this.innerModel().operationInfo(); + } + + public List services() { + List inner = this.innerModel().services(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RolloutInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutRequestImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutRequestImpl.java new file mode 100644 index 000000000000..44e59c03bb1d --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutRequestImpl.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.deploymentmanager.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner; +import com.azure.resourcemanager.deploymentmanager.models.Identity; +import com.azure.resourcemanager.deploymentmanager.models.Rollout; +import com.azure.resourcemanager.deploymentmanager.models.RolloutRequest; +import com.azure.resourcemanager.deploymentmanager.models.StepGroup; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class RolloutRequestImpl implements RolloutRequest, RolloutRequest.Definition, RolloutRequest.Update { + private RolloutRequestInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public String buildVersion() { + return this.innerModel().buildVersion(); + } + + public String artifactSourceId() { + return this.innerModel().artifactSourceId(); + } + + public String targetServiceTopologyId() { + return this.innerModel().targetServiceTopologyId(); + } + + public List stepGroups() { + List inner = this.innerModel().stepGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public RolloutRequestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String rolloutName; + + public RolloutRequestImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public RolloutRequest create() { + this.innerObject = + serviceManager + .serviceClient() + .getRollouts() + .createOrUpdate(resourceGroupName, rolloutName, this.innerModel(), Context.NONE); + return this; + } + + public RolloutRequest create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRollouts() + .createOrUpdate(resourceGroupName, rolloutName, this.innerModel(), context); + return this; + } + + RolloutRequestImpl(String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new RolloutRequestInner(); + this.serviceManager = serviceManager; + this.rolloutName = name; + } + + public RolloutRequestImpl update() { + return this; + } + + public RolloutRequest apply() { + this.innerObject = + serviceManager + .serviceClient() + .getRollouts() + .createOrUpdate(resourceGroupName, rolloutName, this.innerModel(), Context.NONE); + return this; + } + + public RolloutRequest apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getRollouts() + .createOrUpdate(resourceGroupName, rolloutName, this.innerModel(), context); + return this; + } + + RolloutRequestImpl( + RolloutRequestInner innerObject, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.rolloutName = Utils.getValueFromIdByName(innerObject.id(), "rollouts"); + } + + public Rollout cancel() { + return serviceManager.rollouts().cancel(resourceGroupName, rolloutName); + } + + public Response cancelWithResponse(Context context) { + return serviceManager.rollouts().cancelWithResponse(resourceGroupName, rolloutName, context); + } + + public Rollout restart() { + return serviceManager.rollouts().restart(resourceGroupName, rolloutName); + } + + public Response restartWithResponse(Boolean skipSucceeded, Context context) { + return serviceManager.rollouts().restartWithResponse(resourceGroupName, rolloutName, skipSucceeded, context); + } + + public RolloutRequestImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public RolloutRequestImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public RolloutRequestImpl withIdentity(Identity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public RolloutRequestImpl withBuildVersion(String buildVersion) { + this.innerModel().withBuildVersion(buildVersion); + return this; + } + + public RolloutRequestImpl withTargetServiceTopologyId(String targetServiceTopologyId) { + this.innerModel().withTargetServiceTopologyId(targetServiceTopologyId); + return this; + } + + public RolloutRequestImpl withStepGroups(List stepGroups) { + this.innerModel().withStepGroups(stepGroups); + return this; + } + + public RolloutRequestImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public RolloutRequestImpl withArtifactSourceId(String artifactSourceId) { + this.innerModel().withArtifactSourceId(artifactSourceId); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsClientImpl.java new file mode 100644 index 000000000000..d634ec045b7b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsClientImpl.java @@ -0,0 +1,1259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.deploymentmanager.fluent.RolloutsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutInner; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RolloutsClient. */ +public final class RolloutsClientImpl implements RolloutsClient { + private final ClientLogger logger = new ClientLogger(RolloutsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RolloutsService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of RolloutsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RolloutsClientImpl(AzureDeploymentManagerImpl client) { + this.service = RestProxy.create(RolloutsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerRollouts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface RolloutsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts/{rolloutName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("rolloutName") String rolloutName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") RolloutRequestInner rolloutRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts/{rolloutName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("rolloutName") String rolloutName, + @QueryParam("api-version") String apiVersion, + @QueryParam("retryAttempt") Integer retryAttempt, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts/{rolloutName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("rolloutName") String rolloutName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts/{rolloutName}/cancel") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("rolloutName") String rolloutName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts/{rolloutName}/restart") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> restart( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("rolloutName") String rolloutName, + @QueryParam("skipSucceeded") Boolean skipSucceeded, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/rollouts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + if (rolloutRequest != null) { + rolloutRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + rolloutRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + if (rolloutRequest != null) { + rolloutRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + rolloutRequest, + accept, + context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, RolloutRequestInner> beginCreateOrUpdateAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, rolloutName, rolloutRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + RolloutRequestInner.class, + RolloutRequestInner.class, + Context.NONE); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, RolloutRequestInner> beginCreateOrUpdateAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, rolloutName, rolloutRequest, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), RolloutRequestInner.class, RolloutRequestInner.class, context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RolloutRequestInner> beginCreateOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest) { + return beginCreateOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest).getSyncPoller(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, RolloutRequestInner> beginCreateOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest, context).getSyncPoller(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest) { + return beginCreateOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String rolloutName) { + final RolloutRequestInner rolloutRequest = null; + return beginCreateOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutRequestInner createOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest) { + return createOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest).block(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutRequestInner createOrUpdate(String resourceGroupName, String rolloutName) { + final RolloutRequestInner rolloutRequest = null; + return createOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest).block(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the location header returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param rolloutRequest Source rollout request object that defines the rollout. + * @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 defines the PUT rollout request body. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutRequestInner createOrUpdate( + String resourceGroupName, String rolloutName, RolloutRequestInner rolloutRequest, Context context) { + return createOrUpdateAsync(resourceGroupName, rolloutName, rolloutRequest, context).block(); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String rolloutName, Integer retryAttempt) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + retryAttempt, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @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 detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String rolloutName, Integer retryAttempt, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + retryAttempt, + accept, + context); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String rolloutName, Integer retryAttempt) { + return getByResourceGroupWithResponseAsync(resourceGroupName, rolloutName, retryAttempt) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String rolloutName) { + final Integer retryAttempt = null; + return getByResourceGroupWithResponseAsync(resourceGroupName, rolloutName, retryAttempt) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutInner getByResourceGroup(String resourceGroupName, String rolloutName) { + final Integer retryAttempt = null; + return getByResourceGroupAsync(resourceGroupName, rolloutName, retryAttempt).block(); + } + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @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 detailed information of a rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String rolloutName, Integer retryAttempt, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, rolloutName, retryAttempt, context).block(); + } + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String rolloutName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 resourceGroupName, String rolloutName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String rolloutName) { + return deleteWithResponseAsync(resourceGroupName, rolloutName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String rolloutName) { + deleteAsync(resourceGroupName, rolloutName).block(); + } + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 resourceGroupName, String rolloutName, Context context) { + return deleteWithResponseAsync(resourceGroupName, rolloutName, context).block(); + } + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync(String resourceGroupName, String rolloutName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync( + String resourceGroupName, String rolloutName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String rolloutName) { + return cancelWithResponseAsync(resourceGroupName, rolloutName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutInner cancel(String resourceGroupName, String rolloutName) { + return cancelAsync(resourceGroupName, rolloutName).block(); + } + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse(String resourceGroupName, String rolloutName, Context context) { + return cancelWithResponseAsync(resourceGroupName, rolloutName, context).block(); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> restartWithResponseAsync( + String resourceGroupName, String rolloutName, Boolean skipSucceeded) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + skipSucceeded, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> restartWithResponseAsync( + String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (rolloutName == null) { + return Mono.error(new IllegalArgumentException("Parameter rolloutName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + rolloutName, + skipSucceeded, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String rolloutName, Boolean skipSucceeded) { + return restartWithResponseAsync(resourceGroupName, rolloutName, skipSucceeded) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String rolloutName) { + final Boolean skipSucceeded = null; + return restartWithResponseAsync(resourceGroupName, rolloutName, skipSucceeded) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RolloutInner restart(String resourceGroupName, String rolloutName) { + final Boolean skipSucceeded = null; + return restartAsync(resourceGroupName, rolloutName, skipSucceeded).block(); + } + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @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 defines the rollout. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response restartWithResponse( + String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context) { + return restartWithResponseAsync(resourceGroupName, rolloutName, skipSucceeded, context).block(); + } + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName) { + return listWithResponseAsync(resourceGroupName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName) { + return listAsync(resourceGroupName).block(); + } + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of rollouts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse(String resourceGroupName, Context context) { + return listWithResponseAsync(resourceGroupName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsImpl.java new file mode 100644 index 000000000000..f9a3262c68c8 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/RolloutsImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.RolloutsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutInner; +import com.azure.resourcemanager.deploymentmanager.models.Rollout; +import com.azure.resourcemanager.deploymentmanager.models.Rollouts; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class RolloutsImpl implements Rollouts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutsImpl.class); + + private final RolloutsClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public RolloutsImpl( + RolloutsClient innerClient, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Rollout getByResourceGroup(String resourceGroupName, String rolloutName) { + RolloutInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, rolloutName); + if (inner != null) { + return new RolloutImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String rolloutName, Integer retryAttempt, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, rolloutName, retryAttempt, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RolloutImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String rolloutName) { + this.serviceClient().delete(resourceGroupName, rolloutName); + } + + public Response deleteWithResponse(String resourceGroupName, String rolloutName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, rolloutName, context); + } + + public Rollout cancel(String resourceGroupName, String rolloutName) { + RolloutInner inner = this.serviceClient().cancel(resourceGroupName, rolloutName); + if (inner != null) { + return new RolloutImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelWithResponse(String resourceGroupName, String rolloutName, Context context) { + Response inner = this.serviceClient().cancelWithResponse(resourceGroupName, rolloutName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RolloutImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Rollout restart(String resourceGroupName, String rolloutName) { + RolloutInner inner = this.serviceClient().restart(resourceGroupName, rolloutName); + if (inner != null) { + return new RolloutImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response restartWithResponse( + String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context) { + Response inner = + this.serviceClient().restartWithResponse(resourceGroupName, rolloutName, skipSucceeded, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RolloutImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public List list(String resourceGroupName) { + List inner = this.serviceClient().list(resourceGroupName); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new RolloutImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse(String resourceGroupName, Context context) { + Response> inner = this.serviceClient().listWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new RolloutImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String rolloutName = Utils.getValueFromIdByName(id, "rollouts"); + if (rolloutName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rollouts'.", id))); + } + this.deleteWithResponse(resourceGroupName, rolloutName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String rolloutName = Utils.getValueFromIdByName(id, "rollouts"); + if (rolloutName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'rollouts'.", id))); + } + return this.deleteWithResponse(resourceGroupName, rolloutName, context); + } + + private RolloutsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public RolloutRequestImpl define(String name) { + return new RolloutRequestImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceResourceImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceResourceImpl.java new file mode 100644 index 000000000000..4f70defa2700 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceResourceImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ServiceResource; +import java.util.Collections; +import java.util.Map; + +public final class ServiceResourceImpl implements ServiceResource, ServiceResource.Definition, ServiceResource.Update { + private ServiceResourceInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String targetLocation() { + return this.innerModel().targetLocation(); + } + + public String targetSubscriptionId() { + return this.innerModel().targetSubscriptionId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServiceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceTopologyName; + + private String serviceName; + + public ServiceResourceImpl withExistingServiceTopology(String resourceGroupName, String serviceTopologyName) { + this.resourceGroupName = resourceGroupName; + this.serviceTopologyName = serviceTopologyName; + return this; + } + + public ServiceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .createOrUpdateWithResponse( + resourceGroupName, serviceTopologyName, serviceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .createOrUpdateWithResponse( + resourceGroupName, serviceTopologyName, serviceName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceResourceImpl(String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new ServiceResourceInner(); + this.serviceManager = serviceManager; + this.serviceName = name; + } + + public ServiceResourceImpl update() { + return this; + } + + public ServiceResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .createOrUpdateWithResponse( + resourceGroupName, serviceTopologyName, serviceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .createOrUpdateWithResponse( + resourceGroupName, serviceTopologyName, serviceName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceResourceImpl( + ServiceResourceInner innerObject, + com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceTopologyName = Utils.getValueFromIdByName(innerObject.id(), "serviceTopologies"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + } + + public ServiceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, Context.NONE) + .getValue(); + return this; + } + + public ServiceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServices() + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, context) + .getValue(); + return this; + } + + public ServiceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServiceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServiceResourceImpl withTargetLocation(String targetLocation) { + this.innerModel().withTargetLocation(targetLocation); + return this; + } + + public ServiceResourceImpl withTargetSubscriptionId(String targetSubscriptionId) { + this.innerModel().withTargetSubscriptionId(targetSubscriptionId); + return this; + } + + public ServiceResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesClientImpl.java new file mode 100644 index 000000000000..7e6997261bbf --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesClientImpl.java @@ -0,0 +1,727 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.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.deploymentmanager.fluent.ServiceTopologiesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceTopologyResourceInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceTopologiesClient. */ +public final class ServiceTopologiesClientImpl implements ServiceTopologiesClient { + private final ClientLogger logger = new ClientLogger(ServiceTopologiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceTopologiesService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of ServiceTopologiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceTopologiesClientImpl(AzureDeploymentManagerImpl client) { + this.service = + RestProxy.create(ServiceTopologiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerServiceTopologies to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface ServiceTopologiesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceTopologyResourceInner serviceTopologyInfo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceTopologyName, ServiceTopologyResourceInner serviceTopologyInfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceTopologyInfo == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyInfo is required and cannot be null.")); + } else { + serviceTopologyInfo.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + serviceTopologyInfo, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceTopologyName, + ServiceTopologyResourceInner serviceTopologyInfo, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceTopologyInfo == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyInfo is required and cannot be null.")); + } else { + serviceTopologyInfo.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + serviceTopologyInfo, + accept, + context); + } + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serviceTopologyName, ServiceTopologyResourceInner serviceTopologyInfo) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceTopologyName, serviceTopologyInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceTopologyResourceInner createOrUpdate( + String resourceGroupName, String serviceTopologyName, ServiceTopologyResourceInner serviceTopologyInfo) { + return createOrUpdateAsync(resourceGroupName, serviceTopologyName, serviceTopologyInfo).block(); + } + + /** + * Synchronously creates a new service topology or updates an existing service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceTopologyInfo Source topology object defines 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 resource representation of a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serviceTopologyName, + ServiceTopologyResourceInner serviceTopologyInfo, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceTopologyName, serviceTopologyInfo, context) + .block(); + } + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serviceTopologyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serviceTopologyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String serviceTopologyName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serviceTopologyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceTopologyResourceInner getByResourceGroup(String resourceGroupName, String serviceTopologyName) { + return getByResourceGroupAsync(resourceGroupName, serviceTopologyName).block(); + } + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serviceTopologyName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serviceTopologyName, context).block(); + } + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String serviceTopologyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 resourceGroupName, String serviceTopologyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String serviceTopologyName) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceTopologyName) { + deleteAsync(resourceGroupName, serviceTopologyName).block(); + } + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 resourceGroupName, String serviceTopologyName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName, context).block(); + } + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName) { + return listWithResponseAsync(resourceGroupName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName) { + return listAsync(resourceGroupName).block(); + } + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service topologies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse(String resourceGroupName, Context context) { + return listWithResponseAsync(resourceGroupName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesImpl.java new file mode 100644 index 000000000000..542858647aa0 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologiesImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.ServiceTopologiesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceTopologyResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ServiceTopologies; +import com.azure.resourcemanager.deploymentmanager.models.ServiceTopologyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServiceTopologiesImpl implements ServiceTopologies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTopologiesImpl.class); + + private final ServiceTopologiesClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public ServiceTopologiesImpl( + ServiceTopologiesClient innerClient, + com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceTopologyResource getByResourceGroup(String resourceGroupName, String serviceTopologyName) { + ServiceTopologyResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, serviceTopologyName); + if (inner != null) { + return new ServiceTopologyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serviceTopologyName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serviceTopologyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceTopologyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serviceTopologyName) { + this.serviceClient().delete(resourceGroupName, serviceTopologyName); + } + + public Response deleteWithResponse(String resourceGroupName, String serviceTopologyName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceTopologyName, context); + } + + public List list(String resourceGroupName) { + List inner = this.serviceClient().list(resourceGroupName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ServiceTopologyResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse(String resourceGroupName, Context context) { + Response> inner = + this.serviceClient().listWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ServiceTopologyResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public ServiceTopologyResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serviceTopologyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serviceTopologyName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceTopologyName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceTopologyName, context); + } + + private ServiceTopologiesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public ServiceTopologyResourceImpl define(String name) { + return new ServiceTopologyResourceImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologyResourceImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologyResourceImpl.java new file mode 100644 index 000000000000..bd6965b1127a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceTopologyResourceImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceTopologyResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ServiceTopologyResource; +import java.util.Collections; +import java.util.Map; + +public final class ServiceTopologyResourceImpl + implements ServiceTopologyResource, ServiceTopologyResource.Definition, ServiceTopologyResource.Update { + private ServiceTopologyResourceInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String artifactSourceId() { + return this.innerModel().artifactSourceId(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServiceTopologyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceTopologyName; + + public ServiceTopologyResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ServiceTopologyResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .createOrUpdateWithResponse(resourceGroupName, serviceTopologyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceTopologyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .createOrUpdateWithResponse(resourceGroupName, serviceTopologyName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceTopologyResourceImpl( + String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new ServiceTopologyResourceInner(); + this.serviceManager = serviceManager; + this.serviceTopologyName = name; + } + + public ServiceTopologyResourceImpl update() { + return this; + } + + public ServiceTopologyResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .createOrUpdateWithResponse(resourceGroupName, serviceTopologyName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ServiceTopologyResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .createOrUpdateWithResponse(resourceGroupName, serviceTopologyName, this.innerModel(), context) + .getValue(); + return this; + } + + ServiceTopologyResourceImpl( + ServiceTopologyResourceInner innerObject, + com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceTopologyName = Utils.getValueFromIdByName(innerObject.id(), "serviceTopologies"); + } + + public ServiceTopologyResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .getByResourceGroupWithResponse(resourceGroupName, serviceTopologyName, Context.NONE) + .getValue(); + return this; + } + + public ServiceTopologyResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceTopologies() + .getByResourceGroupWithResponse(resourceGroupName, serviceTopologyName, context) + .getValue(); + return this; + } + + public ServiceTopologyResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServiceTopologyResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServiceTopologyResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ServiceTopologyResourceImpl withArtifactSourceId(String artifactSourceId) { + this.innerModel().withArtifactSourceId(artifactSourceId); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitResourceImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitResourceImpl.java new file mode 100644 index 000000000000..86d869e41dda --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitResourceImpl.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.DeploymentMode; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitArtifacts; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitResource; +import java.util.Collections; +import java.util.Map; + +public final class ServiceUnitResourceImpl + implements ServiceUnitResource, ServiceUnitResource.Definition, ServiceUnitResource.Update { + private ServiceUnitResourceInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String targetResourceGroup() { + return this.innerModel().targetResourceGroup(); + } + + public DeploymentMode deploymentMode() { + return this.innerModel().deploymentMode(); + } + + public ServiceUnitArtifacts artifacts() { + return this.innerModel().artifacts(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ServiceUnitResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serviceTopologyName; + + private String serviceName; + + private String serviceUnitName; + + public ServiceUnitResourceImpl withExistingService( + String resourceGroupName, String serviceTopologyName, String serviceName) { + this.resourceGroupName = resourceGroupName; + this.serviceTopologyName = serviceTopologyName; + this.serviceName = serviceName; + return this; + } + + public ServiceUnitResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.innerModel(), + Context.NONE); + return this; + } + + public ServiceUnitResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .createOrUpdate( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, this.innerModel(), context); + return this; + } + + ServiceUnitResourceImpl(String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new ServiceUnitResourceInner(); + this.serviceManager = serviceManager; + this.serviceUnitName = name; + } + + public ServiceUnitResourceImpl update() { + return this; + } + + public ServiceUnitResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .createOrUpdate( + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.innerModel(), + Context.NONE); + return this; + } + + public ServiceUnitResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .createOrUpdate( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, this.innerModel(), context); + return this; + } + + ServiceUnitResourceImpl( + ServiceUnitResourceInner innerObject, + com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serviceTopologyName = Utils.getValueFromIdByName(innerObject.id(), "serviceTopologies"); + this.serviceName = Utils.getValueFromIdByName(innerObject.id(), "services"); + this.serviceUnitName = Utils.getValueFromIdByName(innerObject.id(), "serviceUnits"); + } + + public ServiceUnitResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, Context.NONE) + .getValue(); + return this; + } + + public ServiceUnitResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServiceUnits() + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context) + .getValue(); + return this; + } + + public ServiceUnitResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ServiceUnitResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ServiceUnitResourceImpl withTargetResourceGroup(String targetResourceGroup) { + this.innerModel().withTargetResourceGroup(targetResourceGroup); + return this; + } + + public ServiceUnitResourceImpl withDeploymentMode(DeploymentMode deploymentMode) { + this.innerModel().withDeploymentMode(deploymentMode); + return this; + } + + public ServiceUnitResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ServiceUnitResourceImpl withArtifacts(ServiceUnitArtifacts artifacts) { + this.innerModel().withArtifacts(artifacts); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsClientImpl.java new file mode 100644 index 000000000000..bec24b5cf181 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsClientImpl.java @@ -0,0 +1,1052 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.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.deploymentmanager.fluent.ServiceUnitsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner; +import java.nio.ByteBuffer; +import java.util.List; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServiceUnitsClient. */ +public final class ServiceUnitsClientImpl implements ServiceUnitsClient { + private final ClientLogger logger = new ClientLogger(ServiceUnitsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServiceUnitsService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of ServiceUnitsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServiceUnitsClientImpl(AzureDeploymentManagerImpl client) { + this.service = + RestProxy.create(ServiceUnitsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerServiceUnits to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface ServiceUnitsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @PathParam("serviceUnitName") String serviceUnitName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceUnitResourceInner serviceUnitInfo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @PathParam("serviceUnitName") String serviceUnitName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits/{serviceUnitName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @PathParam("serviceUnitName") String serviceUnitName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}/serviceUnits") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + if (serviceUnitInfo == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitInfo is required and cannot be null.")); + } else { + serviceUnitInfo.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + serviceUnitInfo, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + if (serviceUnitInfo == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitInfo is required and cannot be null.")); + } else { + serviceUnitInfo.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + serviceUnitInfo, + accept, + context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServiceUnitResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo) { + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServiceUnitResourceInner.class, + ServiceUnitResourceInner.class, + Context.NONE); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServiceUnitResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServiceUnitResourceInner.class, + ServiceUnitResourceInner.class, + context); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceUnitResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo) { + return beginCreateOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo) + .getSyncPoller(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServiceUnitResourceInner> beginCreateOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, context) + .getSyncPoller(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo) { + return beginCreateOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceUnitResourceInner createOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo) { + return createOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo) + .block(); + } + + /** + * This is an asynchronous operation and can be polled to completion using the operation resource returned by this + * operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @param serviceUnitInfo The service unit resource object. + * @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 represents the response of a service unit resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceUnitResourceInner createOrUpdate( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + ServiceUnitResourceInner serviceUnitInfo, + Context context) { + return createOrUpdateAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, serviceUnitInfo, context) + .block(); + } + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + return getWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceUnitResourceInner get( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + return getAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName).block(); + } + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + return getWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context) + .block(); + } + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceUnitName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceUnitName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + serviceUnitName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + deleteAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName).block(); + } + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context) + .block(); + } + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync( + String resourceGroupName, String serviceTopologyName, String serviceName) { + return listWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list( + String resourceGroupName, String serviceTopologyName, String serviceName) { + return listAsync(resourceGroupName, serviceTopologyName, serviceName).block(); + } + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + return listWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsImpl.java new file mode 100644 index 000000000000..f7edf2376e5b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServiceUnitsImpl.java @@ -0,0 +1,270 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.ServiceUnitsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnitResource; +import com.azure.resourcemanager.deploymentmanager.models.ServiceUnits; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServiceUnitsImpl implements ServiceUnits { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitsImpl.class); + + private final ServiceUnitsClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public ServiceUnitsImpl( + ServiceUnitsClient innerClient, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceUnitResource get( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + ServiceUnitResourceInner inner = + this.serviceClient().get(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName); + if (inner != null) { + return new ServiceUnitResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceUnitResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName) { + this.serviceClient().delete(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context); + } + + public List list(String resourceGroupName, String serviceTopologyName, String serviceName) { + List inner = + this.serviceClient().list(resourceGroupName, serviceTopologyName, serviceName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ServiceUnitResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + Response> inner = + this.serviceClient().listWithResponse(resourceGroupName, serviceTopologyName, serviceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ServiceUnitResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public ServiceUnitResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String serviceUnitName = Utils.getValueFromIdByName(id, "serviceUnits"); + if (serviceUnitName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceUnits'.", id))); + } + return this + .getWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String serviceUnitName = Utils.getValueFromIdByName(id, "serviceUnits"); + if (serviceUnitName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceUnits'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String serviceUnitName = Utils.getValueFromIdByName(id, "serviceUnits"); + if (serviceUnitName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceUnits'.", id))); + } + this + .deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + String serviceUnitName = Utils.getValueFromIdByName(id, "serviceUnits"); + if (serviceUnitName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'serviceUnits'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, serviceUnitName, context); + } + + private ServiceUnitsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public ServiceUnitResourceImpl define(String name) { + return new ServiceUnitResourceImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesClientImpl.java new file mode 100644 index 000000000000..3d7fbd708811 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesClientImpl.java @@ -0,0 +1,789 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.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.deploymentmanager.fluent.ServicesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceResourceInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServicesClient. */ +public final class ServicesClientImpl implements ServicesClient { + private final ClientLogger logger = new ClientLogger(ServicesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServicesService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of ServicesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServicesClientImpl(AzureDeploymentManagerImpl client) { + this.service = RestProxy.create(ServicesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerServices to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface ServicesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServiceResourceInner serviceInfo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services/{serviceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @PathParam("serviceName") String serviceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/serviceTopologies/{serviceTopologyName}/services") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serviceTopologyName") String serviceTopologyName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, ServiceResourceInner serviceInfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceInfo == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceInfo is required and cannot be null.")); + } else { + serviceInfo.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + serviceInfo, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @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 resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + ServiceResourceInner serviceInfo, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + if (serviceInfo == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceInfo is required and cannot be null.")); + } else { + serviceInfo.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + serviceInfo, + accept, + context); + } + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, ServiceResourceInner serviceInfo) { + return createOrUpdateWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, serviceInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner createOrUpdate( + String resourceGroupName, String serviceTopologyName, String serviceName, ServiceResourceInner serviceInfo) { + return createOrUpdateAsync(resourceGroupName, serviceTopologyName, serviceName, serviceInfo).block(); + } + + /** + * Synchronously creates a new service or updates an existing service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceInfo The service object. + * @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 resource representation of a service in a service topology. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + ServiceResourceInner serviceInfo, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, serviceTopologyName, serviceName, serviceInfo, context) + .block(); + } + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serviceTopologyName, String serviceName) { + return getWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServiceResourceInner get(String resourceGroupName, String serviceTopologyName, String serviceName) { + return getAsync(resourceGroupName, serviceTopologyName, serviceName).block(); + } + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + return getWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, context).block(); + } + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + if (serviceName == null) { + return Mono.error(new IllegalArgumentException("Parameter serviceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + serviceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serviceTopologyName, String serviceName) { + deleteAsync(resourceGroupName, serviceTopologyName, serviceName).block(); + } + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, serviceTopologyName, serviceName, context).block(); + } + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String serviceTopologyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync( + String resourceGroupName, String serviceTopologyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serviceTopologyName == null) { + return Mono + .error(new IllegalArgumentException("Parameter serviceTopologyName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + serviceTopologyName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName, String serviceTopologyName) { + return listWithResponseAsync(resourceGroupName, serviceTopologyName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName, String serviceTopologyName) { + return listAsync(resourceGroupName, serviceTopologyName).block(); + } + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of services. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, Context context) { + return listWithResponseAsync(resourceGroupName, serviceTopologyName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesImpl.java new file mode 100644 index 000000000000..c4881bf7986b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/ServicesImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.ServicesClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.ServiceResource; +import com.azure.resourcemanager.deploymentmanager.models.Services; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ServicesImpl implements Services { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServicesImpl.class); + + private final ServicesClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public ServicesImpl( + ServicesClient innerClient, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServiceResource get(String resourceGroupName, String serviceTopologyName, String serviceName) { + ServiceResourceInner inner = this.serviceClient().get(resourceGroupName, serviceTopologyName, serviceName); + if (inner != null) { + return new ServiceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serviceTopologyName, serviceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServiceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serviceTopologyName, String serviceName) { + this.serviceClient().delete(resourceGroupName, serviceTopologyName, serviceName); + } + + public Response deleteWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, context); + } + + public List list(String resourceGroupName, String serviceTopologyName) { + List inner = this.serviceClient().list(resourceGroupName, serviceTopologyName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ServiceResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, Context context) { + Response> inner = + this.serviceClient().listWithResponse(resourceGroupName, serviceTopologyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new ServiceResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public ServiceResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceTopologyName, serviceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.getWithResponse(resourceGroupName, serviceTopologyName, serviceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + this.deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serviceTopologyName = Utils.getValueFromIdByName(id, "serviceTopologies"); + if (serviceTopologyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'serviceTopologies'.", id))); + } + String serviceName = Utils.getValueFromIdByName(id, "services"); + if (serviceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'services'.", id))); + } + return this.deleteWithResponse(resourceGroupName, serviceTopologyName, serviceName, context); + } + + private ServicesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public ServiceResourceImpl define(String name) { + return new ServiceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepResourceImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepResourceImpl.java new file mode 100644 index 000000000000..0673750ca593 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepResourceImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.StepResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.StepProperties; +import com.azure.resourcemanager.deploymentmanager.models.StepResource; +import java.util.Collections; +import java.util.Map; + +public final class StepResourceImpl implements StepResource, StepResource.Definition, StepResource.Update { + private StepResourceInner innerObject; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public StepProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public StepResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String stepName; + + public StepResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public StepResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .createOrUpdateWithResponse(resourceGroupName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StepResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .createOrUpdateWithResponse(resourceGroupName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + StepResourceImpl(String name, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = new StepResourceInner(); + this.serviceManager = serviceManager; + this.stepName = name; + } + + public StepResourceImpl update() { + return this; + } + + public StepResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .createOrUpdateWithResponse(resourceGroupName, stepName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public StepResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .createOrUpdateWithResponse(resourceGroupName, stepName, this.innerModel(), context) + .getValue(); + return this; + } + + StepResourceImpl( + StepResourceInner innerObject, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.stepName = Utils.getValueFromIdByName(innerObject.id(), "steps"); + } + + public StepResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .getByResourceGroupWithResponse(resourceGroupName, stepName, Context.NONE) + .getValue(); + return this; + } + + public StepResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getSteps() + .getByResourceGroupWithResponse(resourceGroupName, stepName, context) + .getValue(); + return this; + } + + public StepResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StepResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StepResourceImpl withProperties(StepProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public StepResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsClientImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsClientImpl.java new file mode 100644 index 000000000000..b0398525b9bc --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsClientImpl.java @@ -0,0 +1,726 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.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.deploymentmanager.fluent.StepsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.StepResourceInner; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in StepsClient. */ +public final class StepsClientImpl implements StepsClient { + private final ClientLogger logger = new ClientLogger(StepsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final StepsService service; + + /** The service client containing this operation class. */ + private final AzureDeploymentManagerImpl client; + + /** + * Initializes an instance of StepsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StepsClientImpl(AzureDeploymentManagerImpl client) { + this.service = RestProxy.create(StepsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDeploymentManagerSteps to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDeploymentManag") + private interface StepsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/steps/{stepName}") + @ExpectedResponses({201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("stepName") String stepName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") StepResourceInner stepInfo, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/steps/{stepName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("stepName") String stepName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/steps/{stepName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("stepName") String stepName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeploymentManager" + + "/steps") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @param stepInfo The step object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String stepName, StepResourceInner stepInfo) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (stepInfo != null) { + stepInfo.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + stepInfo, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @param stepInfo The step object. + * @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 resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String stepName, StepResourceInner stepInfo, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + if (stepInfo != null) { + stepInfo.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + stepInfo, + accept, + context); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @param stepInfo The step object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String stepName, StepResourceInner stepInfo) { + return createOrUpdateWithResponseAsync(resourceGroupName, stepName, stepInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String stepName) { + final StepResourceInner stepInfo = null; + return createOrUpdateWithResponseAsync(resourceGroupName, stepName, stepInfo) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StepResourceInner createOrUpdate(String resourceGroupName, String stepName) { + final StepResourceInner stepInfo = null; + return createOrUpdateAsync(resourceGroupName, stepName, stepInfo).block(); + } + + /** + * Synchronously creates a new step or updates an existing step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @param stepInfo The step object. + * @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 resource representation of a rollout step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String stepName, StepResourceInner stepInfo, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, stepName, stepInfo, context).block(); + } + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String stepName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String stepName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, stepName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StepResourceInner getByResourceGroup(String resourceGroupName, String stepName) { + return getByResourceGroupAsync(resourceGroupName, stepName).block(); + } + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String stepName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, stepName, context).block(); + } + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String stepName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 resourceGroupName, String stepName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (stepName == null) { + return Mono.error(new IllegalArgumentException("Parameter stepName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + stepName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 resourceGroupName, String stepName) { + return deleteWithResponseAsync(resourceGroupName, stepName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String stepName) { + deleteAsync(resourceGroupName, stepName).block(); + } + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 resourceGroupName, String stepName, Context context) { + return deleteWithResponseAsync(resourceGroupName, stepName, context).block(); + } + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listWithResponseAsync(String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAsync(String resourceGroupName) { + return listWithResponseAsync(resourceGroupName) + .flatMap( + (Response> res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public List list(String resourceGroupName) { + return listAsync(resourceGroupName).block(); + } + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of steps. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response> listWithResponse(String resourceGroupName, Context context) { + return listWithResponseAsync(resourceGroupName, context).block(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsImpl.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsImpl.java new file mode 100644 index 000000000000..3320b4c5a951 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/StepsImpl.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.deploymentmanager.fluent.StepsClient; +import com.azure.resourcemanager.deploymentmanager.fluent.models.StepResourceInner; +import com.azure.resourcemanager.deploymentmanager.models.StepResource; +import com.azure.resourcemanager.deploymentmanager.models.Steps; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class StepsImpl implements Steps { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StepsImpl.class); + + private final StepsClient innerClient; + + private final com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager; + + public StepsImpl( + StepsClient innerClient, com.azure.resourcemanager.deploymentmanager.DeploymentManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public StepResource getByResourceGroup(String resourceGroupName, String stepName) { + StepResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, stepName); + if (inner != null) { + return new StepResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String stepName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, stepName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new StepResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String stepName) { + this.serviceClient().delete(resourceGroupName, stepName); + } + + public Response deleteWithResponse(String resourceGroupName, String stepName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, stepName, context); + } + + public List list(String resourceGroupName) { + List inner = this.serviceClient().list(resourceGroupName); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new StepResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Response> listWithResponse(String resourceGroupName, Context context) { + Response> inner = this.serviceClient().listWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + inner + .getValue() + .stream() + .map(inner1 -> new StepResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return null; + } + } + + public StepResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, stepName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, stepName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + this.deleteWithResponse(resourceGroupName, stepName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String stepName = Utils.getValueFromIdByName(id, "steps"); + if (stepName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'steps'.", id))); + } + return this.deleteWithResponse(resourceGroupName, stepName, context); + } + + private StepsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.deploymentmanager.DeploymentManager manager() { + return this.serviceManager; + } + + public StepResourceImpl define(String name) { + return new StepResourceImpl(name, this.manager()); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/Utils.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/Utils.java new file mode 100644 index 000000000000..1e1bd35938b3 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/package-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/package-info.java new file mode 100644 index 000000000000..a3e88bd1fcbe --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/implementation/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for AzureDeploymentManager. REST APIs for orchestrating deployments using the + * Azure Deployment Manager (ADM). See + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +package com.azure.resourcemanager.deploymentmanager.implementation; diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ApiKeyAuthentication.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ApiKeyAuthentication.java new file mode 100644 index 000000000000..e794f2acaa1a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ApiKeyAuthentication.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * ApiKey authentication gives a name and a value that can be included in either the request header or query parameters. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ApiKey") +@Fluent +public final class ApiKeyAuthentication extends RestRequestAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiKeyAuthentication.class); + + /* + * The key name of the authentication key/value pair. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The location of the authentication key/value pair in the request. + */ + @JsonProperty(value = "in", required = true) + private RestAuthLocation in; + + /* + * The value of the authentication key/value pair. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: The key name of the authentication key/value pair. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The key name of the authentication key/value pair. + * + * @param name the name value to set. + * @return the ApiKeyAuthentication object itself. + */ + public ApiKeyAuthentication withName(String name) { + this.name = name; + return this; + } + + /** + * Get the in property: The location of the authentication key/value pair in the request. + * + * @return the in value. + */ + public RestAuthLocation in() { + return this.in; + } + + /** + * Set the in property: The location of the authentication key/value pair in the request. + * + * @param in the in value to set. + * @return the ApiKeyAuthentication object itself. + */ + public ApiKeyAuthentication withIn(RestAuthLocation in) { + this.in = in; + return this; + } + + /** + * Get the value property: The value of the authentication key/value pair. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the authentication key/value pair. + * + * @param value the value value to set. + * @return the ApiKeyAuthentication object itself. + */ + public ApiKeyAuthentication withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ApiKeyAuthentication")); + } + if (in() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property in in model ApiKeyAuthentication")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ApiKeyAuthentication")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSource.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSource.java new file mode 100644 index 000000000000..614410889234 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSource.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ArtifactSourceInner; +import java.util.Map; + +/** An immutable client-side representation of ArtifactSource. */ +public interface ArtifactSource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sourceType property: The type of artifact source used. + * + * @return the sourceType value. + */ + String sourceType(); + + /** + * Gets the artifactRoot property: The path from the location that the 'authentication' property [say, a SAS URI to + * the blob container] refers to, to the location of the artifacts. This can be used to differentiate different + * versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced + * by the authentication property concatenated with this optional artifactRoot path forms the artifact source + * location where the artifacts are expected to be found. + * + * @return the artifactRoot value. + */ + String artifactRoot(); + + /** + * Gets the authentication property: The authentication method to use to access the artifact source. + * + * @return the authentication value. + */ + Authentication authentication(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.ArtifactSourceInner object. + * + * @return the inner object. + */ + ArtifactSourceInner innerModel(); + + /** The entirety of the ArtifactSource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ArtifactSource definition stages. */ + interface DefinitionStages { + /** The first stage of the ArtifactSource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ArtifactSource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ArtifactSource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ArtifactSource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSourceType, + DefinitionStages.WithArtifactRoot, + DefinitionStages.WithAuthentication { + /** + * Executes the create request. + * + * @return the created resource. + */ + ArtifactSource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ArtifactSource create(Context context); + } + /** The stage of the ArtifactSource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ArtifactSource definition allowing to specify sourceType. */ + interface WithSourceType { + /** + * Specifies the sourceType property: The type of artifact source used.. + * + * @param sourceType The type of artifact source used. + * @return the next definition stage. + */ + WithCreate withSourceType(String sourceType); + } + /** The stage of the ArtifactSource definition allowing to specify artifactRoot. */ + interface WithArtifactRoot { + /** + * Specifies the artifactRoot property: The path from the location that the 'authentication' property [say, + * a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to + * differentiate different versions of the artifacts. Or, different types of artifacts like binaries or + * templates. The location referenced by the authentication property concatenated with this optional + * artifactRoot path forms the artifact source location where the artifacts are expected to be found.. + * + * @param artifactRoot The path from the location that the 'authentication' property [say, a SAS URI to the + * blob container] refers to, to the location of the artifacts. This can be used to differentiate + * different versions of the artifacts. Or, different types of artifacts like binaries or templates. The + * location referenced by the authentication property concatenated with this optional artifactRoot path + * forms the artifact source location where the artifacts are expected to be found. + * @return the next definition stage. + */ + WithCreate withArtifactRoot(String artifactRoot); + } + /** The stage of the ArtifactSource definition allowing to specify authentication. */ + interface WithAuthentication { + /** + * Specifies the authentication property: The authentication method to use to access the artifact source.. + * + * @param authentication The authentication method to use to access the artifact source. + * @return the next definition stage. + */ + WithCreate withAuthentication(Authentication authentication); + } + } + /** + * Begins update for the ArtifactSource resource. + * + * @return the stage of resource update. + */ + ArtifactSource.Update update(); + + /** The template for ArtifactSource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSourceType, + UpdateStages.WithArtifactRoot, + UpdateStages.WithAuthentication { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ArtifactSource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ArtifactSource apply(Context context); + } + /** The ArtifactSource update stages. */ + interface UpdateStages { + /** The stage of the ArtifactSource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ArtifactSource update allowing to specify sourceType. */ + interface WithSourceType { + /** + * Specifies the sourceType property: The type of artifact source used.. + * + * @param sourceType The type of artifact source used. + * @return the next definition stage. + */ + Update withSourceType(String sourceType); + } + /** The stage of the ArtifactSource update allowing to specify artifactRoot. */ + interface WithArtifactRoot { + /** + * Specifies the artifactRoot property: The path from the location that the 'authentication' property [say, + * a SAS URI to the blob container] refers to, to the location of the artifacts. This can be used to + * differentiate different versions of the artifacts. Or, different types of artifacts like binaries or + * templates. The location referenced by the authentication property concatenated with this optional + * artifactRoot path forms the artifact source location where the artifacts are expected to be found.. + * + * @param artifactRoot The path from the location that the 'authentication' property [say, a SAS URI to the + * blob container] refers to, to the location of the artifacts. This can be used to differentiate + * different versions of the artifacts. Or, different types of artifacts like binaries or templates. The + * location referenced by the authentication property concatenated with this optional artifactRoot path + * forms the artifact source location where the artifacts are expected to be found. + * @return the next definition stage. + */ + Update withArtifactRoot(String artifactRoot); + } + /** The stage of the ArtifactSource update allowing to specify authentication. */ + interface WithAuthentication { + /** + * Specifies the authentication property: The authentication method to use to access the artifact source.. + * + * @param authentication The authentication method to use to access the artifact source. + * @return the next definition stage. + */ + Update withAuthentication(Authentication authentication); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ArtifactSource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ArtifactSource refresh(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourceProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourceProperties.java new file mode 100644 index 000000000000..6bc1870776d6 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourceProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The properties that define the artifact source. */ +@Immutable +public final class ArtifactSourceProperties extends ArtifactSourcePropertiesAutoGenerated { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourceProperties.class); + + /** {@inheritDoc} */ + @Override + public ArtifactSourceProperties withSourceType(String sourceType) { + super.withSourceType(sourceType); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceProperties withArtifactRoot(String artifactRoot) { + super.withArtifactRoot(artifactRoot); + return this; + } + + /** {@inheritDoc} */ + @Override + public ArtifactSourceProperties withAuthentication(Authentication authentication) { + super.withAuthentication(authentication); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourcePropertiesAutoGenerated.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourcePropertiesAutoGenerated.java new file mode 100644 index 000000000000..e3b8a2f97650 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSourcePropertiesAutoGenerated.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.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define the source location where the artifacts are located. */ +@Fluent +public class ArtifactSourcePropertiesAutoGenerated { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArtifactSourcePropertiesAutoGenerated.class); + + /* + * The type of artifact source used. + */ + @JsonProperty(value = "sourceType", required = true) + private String sourceType; + + /* + * The path from the location that the 'authentication' property [say, a + * SAS URI to the blob container] refers to, to the location of the + * artifacts. This can be used to differentiate different versions of the + * artifacts. Or, different types of artifacts like binaries or templates. + * The location referenced by the authentication property concatenated with + * this optional artifactRoot path forms the artifact source location where + * the artifacts are expected to be found. + */ + @JsonProperty(value = "artifactRoot") + private String artifactRoot; + + /* + * The authentication method to use to access the artifact source. + */ + @JsonProperty(value = "authentication", required = true) + private Authentication authentication; + + /** + * Get the sourceType property: The type of artifact source used. + * + * @return the sourceType value. + */ + public String sourceType() { + return this.sourceType; + } + + /** + * Set the sourceType property: The type of artifact source used. + * + * @param sourceType the sourceType value to set. + * @return the ArtifactSourcePropertiesAutoGenerated object itself. + */ + public ArtifactSourcePropertiesAutoGenerated withSourceType(String sourceType) { + this.sourceType = sourceType; + return this; + } + + /** + * Get the artifactRoot property: The path from the location that the 'authentication' property [say, a SAS URI to + * the blob container] refers to, to the location of the artifacts. This can be used to differentiate different + * versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced + * by the authentication property concatenated with this optional artifactRoot path forms the artifact source + * location where the artifacts are expected to be found. + * + * @return the artifactRoot value. + */ + public String artifactRoot() { + return this.artifactRoot; + } + + /** + * Set the artifactRoot property: The path from the location that the 'authentication' property [say, a SAS URI to + * the blob container] refers to, to the location of the artifacts. This can be used to differentiate different + * versions of the artifacts. Or, different types of artifacts like binaries or templates. The location referenced + * by the authentication property concatenated with this optional artifactRoot path forms the artifact source + * location where the artifacts are expected to be found. + * + * @param artifactRoot the artifactRoot value to set. + * @return the ArtifactSourcePropertiesAutoGenerated object itself. + */ + public ArtifactSourcePropertiesAutoGenerated withArtifactRoot(String artifactRoot) { + this.artifactRoot = artifactRoot; + return this; + } + + /** + * Get the authentication property: The authentication method to use to access the artifact source. + * + * @return the authentication value. + */ + public Authentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: The authentication method to use to access the artifact source. + * + * @param authentication the authentication value to set. + * @return the ArtifactSourcePropertiesAutoGenerated object itself. + */ + public ArtifactSourcePropertiesAutoGenerated withAuthentication(Authentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceType in model ArtifactSourcePropertiesAutoGenerated")); + } + if (authentication() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property authentication in model ArtifactSourcePropertiesAutoGenerated")); + } else { + authentication().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSources.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSources.java new file mode 100644 index 000000000000..8c71d51581e8 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ArtifactSources.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of ArtifactSources. */ +public interface ArtifactSources { + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + ArtifactSource getByResourceGroup(String resourceGroupName, String artifactSourceName); + + /** + * Gets an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 an artifact source. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String artifactSourceName, Context context); + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String artifactSourceName); + + /** + * Deletes an artifact source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param artifactSourceName The name of the artifact source. + * @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 resourceGroupName, String artifactSourceName, Context context); + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of artifact sources. + */ + List list(String resourceGroupName); + + /** + * Lists the artifact sources in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of artifact sources. + */ + Response> listWithResponse(String resourceGroupName, Context context); + + /** + * Gets an artifact source. + * + * @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 an artifact source. + */ + ArtifactSource getById(String id); + + /** + * Gets an artifact source. + * + * @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 an artifact source. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an artifact source. + * + * @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 an artifact source. + * + * @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 ArtifactSource resource. + * + * @param name resource name. + * @return the first stage of the new ArtifactSource definition. + */ + ArtifactSource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Authentication.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Authentication.java new file mode 100644 index 000000000000..cc6a8bafd94d --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Authentication.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Defines the authentication method and properties to access the artifacts. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = Authentication.class) +@JsonTypeName("Authentication") +@JsonSubTypes({@JsonSubTypes.Type(name = "Sas", value = SasAuthentication.class)}) +@Immutable +public class Authentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Authentication.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/DeploymentMode.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/DeploymentMode.java new file mode 100644 index 000000000000..2fe95d63eaf9 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/DeploymentMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DeploymentMode. */ +public enum DeploymentMode { + /** Enum value Incremental. */ + INCREMENTAL("Incremental"), + + /** Enum value Complete. */ + COMPLETE("Complete"); + + /** The actual serialized value for a DeploymentMode instance. */ + private final String value; + + DeploymentMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DeploymentMode instance. + * + * @param value the serialized value to parse. + * @return the parsed DeploymentMode object, or null if unable to parse. + */ + @JsonCreator + public static DeploymentMode fromString(String value) { + DeploymentMode[] items = DeploymentMode.values(); + for (DeploymentMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepAttributes.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepAttributes.java new file mode 100644 index 000000000000..3dc37da0fe9a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepAttributes.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The attributes for the health check step. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = HealthCheckStepAttributes.class) +@JsonTypeName("HealthCheckStepAttributes") +@JsonSubTypes({@JsonSubTypes.Type(name = "REST", value = RestHealthCheckStepAttributes.class)}) +@Fluent +public class HealthCheckStepAttributes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthCheckStepAttributes.class); + + /* + * The duration in ISO 8601 format for which health check waits idly + * without any checks. + */ + @JsonProperty(value = "waitDuration") + private String waitDuration; + + /* + * The duration in ISO 8601 format for which the health check waits for the + * resource to become healthy. Health check fails if it doesn't. Health + * check starts to enforce healthyStateDuration once resource becomes + * healthy. + */ + @JsonProperty(value = "maxElasticDuration") + private String maxElasticDuration; + + /* + * The duration in ISO 8601 format for which the resource is expected to be + * continuously healthy. If maxElasticDuration is specified, healthy state + * duration is enforced after the detection of first healthy signal. + */ + @JsonProperty(value = "healthyStateDuration", required = true) + private String healthyStateDuration; + + /** + * Get the waitDuration property: The duration in ISO 8601 format for which health check waits idly without any + * checks. + * + * @return the waitDuration value. + */ + public String waitDuration() { + return this.waitDuration; + } + + /** + * Set the waitDuration property: The duration in ISO 8601 format for which health check waits idly without any + * checks. + * + * @param waitDuration the waitDuration value to set. + * @return the HealthCheckStepAttributes object itself. + */ + public HealthCheckStepAttributes withWaitDuration(String waitDuration) { + this.waitDuration = waitDuration; + return this; + } + + /** + * Get the maxElasticDuration property: The duration in ISO 8601 format for which the health check waits for the + * resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration + * once resource becomes healthy. + * + * @return the maxElasticDuration value. + */ + public String maxElasticDuration() { + return this.maxElasticDuration; + } + + /** + * Set the maxElasticDuration property: The duration in ISO 8601 format for which the health check waits for the + * resource to become healthy. Health check fails if it doesn't. Health check starts to enforce healthyStateDuration + * once resource becomes healthy. + * + * @param maxElasticDuration the maxElasticDuration value to set. + * @return the HealthCheckStepAttributes object itself. + */ + public HealthCheckStepAttributes withMaxElasticDuration(String maxElasticDuration) { + this.maxElasticDuration = maxElasticDuration; + return this; + } + + /** + * Get the healthyStateDuration property: The duration in ISO 8601 format for which the resource is expected to be + * continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection + * of first healthy signal. + * + * @return the healthyStateDuration value. + */ + public String healthyStateDuration() { + return this.healthyStateDuration; + } + + /** + * Set the healthyStateDuration property: The duration in ISO 8601 format for which the resource is expected to be + * continuously healthy. If maxElasticDuration is specified, healthy state duration is enforced after the detection + * of first healthy signal. + * + * @param healthyStateDuration the healthyStateDuration value to set. + * @return the HealthCheckStepAttributes object itself. + */ + public HealthCheckStepAttributes withHealthyStateDuration(String healthyStateDuration) { + this.healthyStateDuration = healthyStateDuration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (healthyStateDuration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property healthyStateDuration in model HealthCheckStepAttributes")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepProperties.java new file mode 100644 index 000000000000..c39469b8ead7 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/HealthCheckStepProperties.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.deploymentmanager.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 com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Defines the properties of a health check step. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "stepType") +@JsonTypeName("HealthCheck") +@Fluent +public final class HealthCheckStepProperties extends StepProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthCheckStepProperties.class); + + /* + * The health check step attributes + */ + @JsonProperty(value = "attributes", required = true) + private HealthCheckStepAttributes attributes; + + /** + * Get the attributes property: The health check step attributes. + * + * @return the attributes value. + */ + public HealthCheckStepAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes property: The health check step attributes. + * + * @param attributes the attributes value to set. + * @return the HealthCheckStepProperties object itself. + */ + public HealthCheckStepProperties withAttributes(HealthCheckStepAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (attributes() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property attributes in model HealthCheckStepProperties")); + } else { + attributes().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Identity.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Identity.java new file mode 100644 index 000000000000..a0fcf60ea5ba --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Identity.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.deploymentmanager.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; + +/** Identity for the resource. */ +@Fluent +public class Identity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); + + /* + * The identity type. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * The list of identities. + */ + @JsonProperty(value = "identityIds", required = true) + private List identityIds; + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(String type) { + this.type = type; + return this; + } + + /** + * Get the identityIds property: The list of identities. + * + * @return the identityIds value. + */ + public List identityIds() { + return this.identityIds; + } + + /** + * Set the identityIds property: The list of identities. + * + * @param identityIds the identityIds value to set. + * @return the Identity object itself. + */ + public Identity withIdentityIds(List identityIds) { + this.identityIds = identityIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Identity")); + } + if (identityIds() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property identityIds in model Identity")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Message.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Message.java new file mode 100644 index 000000000000..3d64f24affed --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Message.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.deploymentmanager.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; +import java.time.OffsetDateTime; + +/** Supplementary contextual messages during a rollout. */ +@Immutable +public final class Message { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Message.class); + + /* + * Time in UTC this message was provided. + */ + @JsonProperty(value = "timeStamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime timestamp; + + /* + * The actual message text. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the timestamp property: Time in UTC this message was provided. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the message property: The actual message text. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Operation.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Operation.java new file mode 100644 index 000000000000..03804372deae --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Operation.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.deploymentmanager.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; + +/** Represents an operation that can be performed on the service. */ +@Fluent +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * The name of the operation. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The display name of the operation. + */ + @JsonProperty(value = "display") + private OperationDetail display; + + /* + * The origin of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * The properties of the operation. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the name property: The name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the operation. + * + * @param name the name value to set. + * @return the Operation object itself. + */ + public Operation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The display name of the operation. + * + * @return the display value. + */ + public OperationDetail display() { + return this.display; + } + + /** + * Set the display property: The display name of the operation. + * + * @param display the display value to set. + * @return the Operation object itself. + */ + public Operation withDisplay(OperationDetail display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The origin of the operation. + * + * @param origin the origin value to set. + * @return the Operation object itself. + */ + public Operation withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: The properties of the operation. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of the operation. + * + * @param properties the properties value to set. + * @return the Operation object itself. + */ + public Operation withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationDetail.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationDetail.java new file mode 100644 index 000000000000..ea361472b6aa --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationDetail.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 detail about an operation. */ +@Fluent +public final class OperationDetail { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDetail.class); + + /* + * The name of the provider that supports the operation. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * The resource type on which this operation can be performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The name of the operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: The name of the provider that supports the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The name of the provider that supports the operation. + * + * @param provider the provider value to set. + * @return the OperationDetail object itself. + */ + public OperationDetail withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: The resource type on which this operation can be performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The resource type on which this operation can be performed. + * + * @param resource the resource value to set. + * @return the OperationDetail object itself. + */ + public OperationDetail withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: The name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The name of the operation. + * + * @param operation the operation value to set. + * @return the OperationDetail object itself. + */ + public OperationDetail withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the operation. + * + * @param description the description value to set. + * @return the OperationDetail object itself. + */ + public OperationDetail 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/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Operations.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Operations.java new file mode 100644 index 000000000000..99aa63c197f0 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/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.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists the supported 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 the operations response. + */ + OperationsList list(); + + /** + * Lists the supported 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 the operations response. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationsList.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationsList.java new file mode 100644 index 000000000000..3249c41126fb --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/OperationsList.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.resourcemanager.deploymentmanager.fluent.models.OperationsListInner; + +/** An immutable client-side representation of OperationsList. */ +public interface OperationsList { + /** + * Gets the value property: The list of supported operations. + * + * @return the value value. + */ + Operation value(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.OperationsListInner object. + * + * @return the inner object. + */ + OperationsListInner innerModel(); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/PrePostStep.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/PrePostStep.java new file mode 100644 index 000000000000..88263b297c49 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/PrePostStep.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.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that define a step. */ +@Fluent +public final class PrePostStep { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrePostStep.class); + + /* + * The resource Id of the step to be run. + */ + @JsonProperty(value = "stepId", required = true) + private String stepId; + + /** + * Get the stepId property: The resource Id of the step to be run. + * + * @return the stepId value. + */ + public String stepId() { + return this.stepId; + } + + /** + * Set the stepId property: The resource Id of the step to be run. + * + * @param stepId the stepId value to set. + * @return the PrePostStep object itself. + */ + public PrePostStep withStepId(String stepId) { + this.stepId = stepId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (stepId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property stepId in model PrePostStep")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ResourceOperation.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ResourceOperation.java new file mode 100644 index 000000000000..967696257e4d --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ResourceOperation.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; + +/** Individual resource operation information. */ +@Fluent +public final class ResourceOperation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceOperation.class); + + /* + * Name of the resource as specified in the artifacts. For ARM resources, + * this is the name of the resource specified in the template. + */ + @JsonProperty(value = "resourceName") + private String resourceName; + + /* + * Unique identifier of the operation. For ARM resources, this is the + * operationId obtained from ARM service. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /* + * Type of the resource as specified in the artifacts. For ARM resources, + * this is the type of the resource specified in the template. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * State of the resource deployment. For ARM resources, this is the current + * provisioning state of the resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * Descriptive information of the resource operation. + */ + @JsonProperty(value = "statusMessage", access = JsonProperty.Access.WRITE_ONLY) + private String statusMessage; + + /* + * Http status code of the operation. + */ + @JsonProperty(value = "statusCode", access = JsonProperty.Access.WRITE_ONLY) + private String statusCode; + + /** + * Get the resourceName property: Name of the resource as specified in the artifacts. For ARM resources, this is the + * name of the resource specified in the template. + * + * @return the resourceName value. + */ + public String resourceName() { + return this.resourceName; + } + + /** + * Set the resourceName property: Name of the resource as specified in the artifacts. For ARM resources, this is the + * name of the resource specified in the template. + * + * @param resourceName the resourceName value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + /** + * Get the operationId property: Unique identifier of the operation. For ARM resources, this is the operationId + * obtained from ARM service. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the resourceType property: Type of the resource as specified in the artifacts. For ARM resources, this is the + * type of the resource specified in the template. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: Type of the resource as specified in the artifacts. For ARM resources, this is the + * type of the resource specified in the template. + * + * @param resourceType the resourceType value to set. + * @return the ResourceOperation object itself. + */ + public ResourceOperation withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the provisioningState property: State of the resource deployment. For ARM resources, this is the current + * provisioning state of the resource. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the statusMessage property: Descriptive information of the resource operation. + * + * @return the statusMessage value. + */ + public String statusMessage() { + return this.statusMessage; + } + + /** + * Get the statusCode property: Http status code of the operation. + * + * @return the statusCode value. + */ + public String statusCode() { + return this.statusCode; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthLocation.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthLocation.java new file mode 100644 index 000000000000..69a5649722aa --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthLocation.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RestAuthLocation. */ +public enum RestAuthLocation { + /** Enum value Query. */ + QUERY("Query"), + + /** Enum value Header. */ + HEADER("Header"); + + /** The actual serialized value for a RestAuthLocation instance. */ + private final String value; + + RestAuthLocation(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestAuthLocation instance. + * + * @param value the serialized value to parse. + * @return the parsed RestAuthLocation object, or null if unable to parse. + */ + @JsonCreator + public static RestAuthLocation fromString(String value) { + RestAuthLocation[] items = RestAuthLocation.values(); + for (RestAuthLocation item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthType.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthType.java new file mode 100644 index 000000000000..26203576c440 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestAuthType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RestAuthType. */ +public enum RestAuthType { + /** Enum value ApiKey. */ + API_KEY("ApiKey"), + + /** Enum value RolloutIdentity. */ + ROLLOUT_IDENTITY("RolloutIdentity"); + + /** The actual serialized value for a RestAuthType instance. */ + private final String value; + + RestAuthType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestAuthType instance. + * + * @param value the serialized value to parse. + * @return the parsed RestAuthType object, or null if unable to parse. + */ + @JsonCreator + public static RestAuthType fromString(String value) { + RestAuthType[] items = RestAuthType.values(); + for (RestAuthType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheck.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheck.java new file mode 100644 index 000000000000..f20fab51a908 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheck.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; + +/** A REST based health check. */ +@Fluent +public final class RestHealthCheck { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestHealthCheck.class); + + /* + * A unique name for this check. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The request to the health provider. + */ + @JsonProperty(value = "request", required = true) + private RestRequest request; + + /* + * The expected response from the health provider. If no expected response + * is provided, the default is to expect the received response to have an + * HTTP status code of 200 OK. + */ + @JsonProperty(value = "response") + private RestResponse response; + + /** + * Get the name property: A unique name for this check. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A unique name for this check. + * + * @param name the name value to set. + * @return the RestHealthCheck object itself. + */ + public RestHealthCheck withName(String name) { + this.name = name; + return this; + } + + /** + * Get the request property: The request to the health provider. + * + * @return the request value. + */ + public RestRequest request() { + return this.request; + } + + /** + * Set the request property: The request to the health provider. + * + * @param request the request value to set. + * @return the RestHealthCheck object itself. + */ + public RestHealthCheck withRequest(RestRequest request) { + this.request = request; + return this; + } + + /** + * Get the response property: The expected response from the health provider. If no expected response is provided, + * the default is to expect the received response to have an HTTP status code of 200 OK. + * + * @return the response value. + */ + public RestResponse response() { + return this.response; + } + + /** + * Set the response property: The expected response from the health provider. If no expected response is provided, + * the default is to expect the received response to have an HTTP status code of 200 OK. + * + * @param response the response value to set. + * @return the RestHealthCheck object itself. + */ + public RestHealthCheck withResponse(RestResponse response) { + this.response = response; + 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 RestHealthCheck")); + } + if (request() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property request in model RestHealthCheck")); + } else { + request().validate(); + } + if (response() != null) { + response().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheckStepAttributes.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheckStepAttributes.java new file mode 100644 index 000000000000..347c3b25ef2b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestHealthCheckStepAttributes.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Defines the REST health check step properties. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("REST") +@JsonFlatten +@Fluent +public class RestHealthCheckStepAttributes extends HealthCheckStepAttributes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestHealthCheckStepAttributes.class); + + /* + * The list of checks that form the health check step. + */ + @JsonProperty(value = "properties.healthChecks") + private List healthChecks; + + /** + * Get the healthChecks property: The list of checks that form the health check step. + * + * @return the healthChecks value. + */ + public List healthChecks() { + return this.healthChecks; + } + + /** + * Set the healthChecks property: The list of checks that form the health check step. + * + * @param healthChecks the healthChecks value to set. + * @return the RestHealthCheckStepAttributes object itself. + */ + public RestHealthCheckStepAttributes withHealthChecks(List healthChecks) { + this.healthChecks = healthChecks; + return this; + } + + /** {@inheritDoc} */ + @Override + public RestHealthCheckStepAttributes withWaitDuration(String waitDuration) { + super.withWaitDuration(waitDuration); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestHealthCheckStepAttributes withMaxElasticDuration(String maxElasticDuration) { + super.withMaxElasticDuration(maxElasticDuration); + return this; + } + + /** {@inheritDoc} */ + @Override + public RestHealthCheckStepAttributes withHealthyStateDuration(String healthyStateDuration) { + super.withHealthyStateDuration(healthyStateDuration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (healthChecks() != null) { + healthChecks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestMatchQuantifier.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestMatchQuantifier.java new file mode 100644 index 000000000000..1985d4d73225 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestMatchQuantifier.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RestMatchQuantifier. */ +public enum RestMatchQuantifier { + /** Enum value All. */ + ALL("All"), + + /** Enum value Any. */ + ANY("Any"); + + /** The actual serialized value for a RestMatchQuantifier instance. */ + private final String value; + + RestMatchQuantifier(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestMatchQuantifier instance. + * + * @param value the serialized value to parse. + * @return the parsed RestMatchQuantifier object, or null if unable to parse. + */ + @JsonCreator + public static RestMatchQuantifier fromString(String value) { + RestMatchQuantifier[] items = RestMatchQuantifier.values(); + for (RestMatchQuantifier item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequest.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequest.java new file mode 100644 index 000000000000..fcd31987911c --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequest.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties that make up a REST request. */ +@Fluent +public final class RestRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestRequest.class); + + /* + * The HTTP method to use for the request. + */ + @JsonProperty(value = "method", required = true) + private RestRequestMethod method; + + /* + * The HTTP URI to use for the request. + */ + @JsonProperty(value = "uri", required = true) + private String uri; + + /* + * The authentication information required in the request to the health + * provider. + */ + @JsonProperty(value = "authentication", required = true) + private RestRequestAuthentication authentication; + + /** + * Get the method property: The HTTP method to use for the request. + * + * @return the method value. + */ + public RestRequestMethod method() { + return this.method; + } + + /** + * Set the method property: The HTTP method to use for the request. + * + * @param method the method value to set. + * @return the RestRequest object itself. + */ + public RestRequest withMethod(RestRequestMethod method) { + this.method = method; + return this; + } + + /** + * Get the uri property: The HTTP URI to use for the request. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The HTTP URI to use for the request. + * + * @param uri the uri value to set. + * @return the RestRequest object itself. + */ + public RestRequest withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the authentication property: The authentication information required in the request to the health provider. + * + * @return the authentication value. + */ + public RestRequestAuthentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: The authentication information required in the request to the health provider. + * + * @param authentication the authentication value to set. + * @return the RestRequest object itself. + */ + public RestRequest withAuthentication(RestRequestAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (method() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property method in model RestRequest")); + } + if (uri() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property uri in model RestRequest")); + } + if (authentication() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property authentication in model RestRequest")); + } else { + authentication().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestAuthentication.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestAuthentication.java new file mode 100644 index 000000000000..fc5ed87c1c2b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestAuthentication.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.deploymentmanager.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The authentication information required in the REST health check request to the health provider. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = RestRequestAuthentication.class) +@JsonTypeName("RestRequestAuthentication") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "RolloutIdentity", value = RolloutIdentityAuthentication.class), + @JsonSubTypes.Type(name = "ApiKey", value = ApiKeyAuthentication.class) +}) +@Immutable +public class RestRequestAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestRequestAuthentication.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestMethod.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestMethod.java new file mode 100644 index 000000000000..9a98114afd23 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestRequestMethod.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RestRequestMethod. */ +public enum RestRequestMethod { + /** Enum value GET. */ + GET("GET"), + + /** Enum value POST. */ + POST("POST"); + + /** The actual serialized value for a RestRequestMethod instance. */ + private final String value; + + RestRequestMethod(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RestRequestMethod instance. + * + * @param value the serialized value to parse. + * @return the parsed RestRequestMethod object, or null if unable to parse. + */ + @JsonCreator + public static RestRequestMethod fromString(String value) { + RestRequestMethod[] items = RestRequestMethod.values(); + for (RestRequestMethod item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponse.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponse.java new file mode 100644 index 000000000000..5d07fe367913 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponse.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that make up the expected REST response. */ +@Fluent +public final class RestResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestResponse.class); + + /* + * The HTTP status codes expected in a successful health check response. + * The response is expected to match one of the given status codes. If no + * expected status codes are provided, default expected status code is 200 + * OK. + */ + @JsonProperty(value = "successStatusCodes") + private List successStatusCodes; + + /* + * The regular expressions to match the response content with. + */ + @JsonProperty(value = "regex") + private RestResponseRegex regex; + + /** + * Get the successStatusCodes property: The HTTP status codes expected in a successful health check response. The + * response is expected to match one of the given status codes. If no expected status codes are provided, default + * expected status code is 200 OK. + * + * @return the successStatusCodes value. + */ + public List successStatusCodes() { + return this.successStatusCodes; + } + + /** + * Set the successStatusCodes property: The HTTP status codes expected in a successful health check response. The + * response is expected to match one of the given status codes. If no expected status codes are provided, default + * expected status code is 200 OK. + * + * @param successStatusCodes the successStatusCodes value to set. + * @return the RestResponse object itself. + */ + public RestResponse withSuccessStatusCodes(List successStatusCodes) { + this.successStatusCodes = successStatusCodes; + return this; + } + + /** + * Get the regex property: The regular expressions to match the response content with. + * + * @return the regex value. + */ + public RestResponseRegex regex() { + return this.regex; + } + + /** + * Set the regex property: The regular expressions to match the response content with. + * + * @param regex the regex value to set. + * @return the RestResponse object itself. + */ + public RestResponse withRegex(RestResponseRegex regex) { + this.regex = regex; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (regex() != null) { + regex().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponseRegex.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponseRegex.java new file mode 100644 index 000000000000..024d88eb17ec --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RestResponseRegex.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The regular expressions to match the response content with. */ +@Fluent +public final class RestResponseRegex { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RestResponseRegex.class); + + /* + * The list of regular expressions. + */ + @JsonProperty(value = "matches") + private List matches; + + /* + * Indicates whether any or all of the expressions should match with the + * response content. + */ + @JsonProperty(value = "matchQuantifier") + private RestMatchQuantifier matchQuantifier; + + /** + * Get the matches property: The list of regular expressions. + * + * @return the matches value. + */ + public List matches() { + return this.matches; + } + + /** + * Set the matches property: The list of regular expressions. + * + * @param matches the matches value to set. + * @return the RestResponseRegex object itself. + */ + public RestResponseRegex withMatches(List matches) { + this.matches = matches; + return this; + } + + /** + * Get the matchQuantifier property: Indicates whether any or all of the expressions should match with the response + * content. + * + * @return the matchQuantifier value. + */ + public RestMatchQuantifier matchQuantifier() { + return this.matchQuantifier; + } + + /** + * Set the matchQuantifier property: Indicates whether any or all of the expressions should match with the response + * content. + * + * @param matchQuantifier the matchQuantifier value to set. + * @return the RestResponseRegex object itself. + */ + public RestResponseRegex withMatchQuantifier(RestMatchQuantifier matchQuantifier) { + this.matchQuantifier = matchQuantifier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollout.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollout.java new file mode 100644 index 000000000000..e5de7943187b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollout.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Rollout. */ +public interface Rollout { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the buildVersion property: The version of the build being deployed. + * + * @return the buildVersion value. + */ + String buildVersion(); + + /** + * Gets the artifactSourceId property: The reference to the artifact source resource Id where the payload is + * located. + * + * @return the artifactSourceId value. + */ + String artifactSourceId(); + + /** + * Gets the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @return the targetServiceTopologyId value. + */ + String targetServiceTopologyId(); + + /** + * Gets the stepGroups property: The list of step groups that define the orchestration. + * + * @return the stepGroups value. + */ + List stepGroups(); + + /** + * Gets the status property: The current status of the rollout. + * + * @return the status value. + */ + String status(); + + /** + * Gets the totalRetryAttempts property: The cardinal count of total number of retries performed on the rollout at a + * given time. + * + * @return the totalRetryAttempts value. + */ + Integer totalRetryAttempts(); + + /** + * Gets the operationInfo property: Operational information of the rollout. + * + * @return the operationInfo value. + */ + RolloutOperationInfo operationInfo(); + + /** + * Gets the services property: The detailed information on the services being deployed. + * + * @return the services value. + */ + List services(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutInner object. + * + * @return the inner object. + */ + RolloutInner innerModel(); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutIdentityAuthentication.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutIdentityAuthentication.java new file mode 100644 index 000000000000..2bffd7b840d1 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutIdentityAuthentication.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * RolloutIdentity uses the user-assigned managed identity authentication context specified in the Identity property + * during rollout creation. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("RolloutIdentity") +@Immutable +public final class RolloutIdentityAuthentication extends RestRequestAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutIdentityAuthentication.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutOperationInfo.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutOperationInfo.java new file mode 100644 index 000000000000..b3a6e2418c9b --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutOperationInfo.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Detailed runtime information of the rollout. */ +@Immutable +public final class RolloutOperationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutOperationInfo.class); + + /* + * The ordinal count of the number of retry attempts on a rollout. 0 if no + * retries of the rollout have been performed. If the rollout is updated + * with a PUT, this count is reset to 0. + */ + @JsonProperty(value = "retryAttempt", access = JsonProperty.Access.WRITE_ONLY) + private Integer retryAttempt; + + /* + * True, if all steps that succeeded on the previous run/attempt were + * chosen to be skipped in this retry attempt. False, otherwise. + */ + @JsonProperty(value = "skipSucceededOnRetry", access = JsonProperty.Access.WRITE_ONLY) + private Boolean skipSucceededOnRetry; + + /* + * The start time of the rollout in UTC. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The start time of the rollout in UTC. This property will not be set if + * the rollout has not completed yet. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * The detailed error information for any failure. + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private ManagementError error; + + /** + * Get the retryAttempt property: The ordinal count of the number of retry attempts on a rollout. 0 if no retries of + * the rollout have been performed. If the rollout is updated with a PUT, this count is reset to 0. + * + * @return the retryAttempt value. + */ + public Integer retryAttempt() { + return this.retryAttempt; + } + + /** + * Get the skipSucceededOnRetry property: True, if all steps that succeeded on the previous run/attempt were chosen + * to be skipped in this retry attempt. False, otherwise. + * + * @return the skipSucceededOnRetry value. + */ + public Boolean skipSucceededOnRetry() { + return this.skipSucceededOnRetry; + } + + /** + * Get the startTime property: The start time of the rollout in UTC. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: The start time of the rollout in UTC. This property will not be set if the rollout has + * not completed yet. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the error property: The detailed error information for any failure. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutProperties.java new file mode 100644 index 000000000000..b93f35bd0be1 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutProperties.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; +import java.util.List; + +/** The properties that define a rollout. */ +@Immutable +public final class RolloutProperties extends RolloutRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutProperties.class); + + /* + * The current status of the rollout. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The cardinal count of total number of retries performed on the rollout + * at a given time. + */ + @JsonProperty(value = "totalRetryAttempts", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalRetryAttempts; + + /* + * Operational information of the rollout. + */ + @JsonProperty(value = "operationInfo", access = JsonProperty.Access.WRITE_ONLY) + private RolloutOperationInfo operationInfo; + + /* + * The detailed information on the services being deployed. + */ + @JsonProperty(value = "services", access = JsonProperty.Access.WRITE_ONLY) + private List services; + + /** + * Get the status property: The current status of the rollout. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the totalRetryAttempts property: The cardinal count of total number of retries performed on the rollout at a + * given time. + * + * @return the totalRetryAttempts value. + */ + public Integer totalRetryAttempts() { + return this.totalRetryAttempts; + } + + /** + * Get the operationInfo property: Operational information of the rollout. + * + * @return the operationInfo value. + */ + public RolloutOperationInfo operationInfo() { + return this.operationInfo; + } + + /** + * Get the services property: The detailed information on the services being deployed. + * + * @return the services value. + */ + public List services() { + return this.services; + } + + /** {@inheritDoc} */ + @Override + public RolloutProperties withBuildVersion(String buildVersion) { + super.withBuildVersion(buildVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutProperties withArtifactSourceId(String artifactSourceId) { + super.withArtifactSourceId(artifactSourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutProperties withTargetServiceTopologyId(String targetServiceTopologyId) { + super.withTargetServiceTopologyId(targetServiceTopologyId); + return this; + } + + /** {@inheritDoc} */ + @Override + public RolloutProperties withStepGroups(List stepGroups) { + super.withStepGroups(stepGroups); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (operationInfo() != null) { + operationInfo().validate(); + } + if (services() != null) { + services().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutPropertiesAutoGenerated.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutPropertiesAutoGenerated.java new file mode 100644 index 000000000000..820652c8d9c5 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutPropertiesAutoGenerated.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; +import java.util.List; + +/** Defines the properties of a rollout. */ +@Immutable +public class RolloutPropertiesAutoGenerated { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutPropertiesAutoGenerated.class); + + /* + * The current status of the rollout. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The cardinal count of total number of retries performed on the rollout + * at a given time. + */ + @JsonProperty(value = "totalRetryAttempts", access = JsonProperty.Access.WRITE_ONLY) + private Integer totalRetryAttempts; + + /* + * Operational information of the rollout. + */ + @JsonProperty(value = "operationInfo", access = JsonProperty.Access.WRITE_ONLY) + private RolloutOperationInfo operationInfo; + + /* + * The detailed information on the services being deployed. + */ + @JsonProperty(value = "services", access = JsonProperty.Access.WRITE_ONLY) + private List services; + + /** + * Get the status property: The current status of the rollout. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the totalRetryAttempts property: The cardinal count of total number of retries performed on the rollout at a + * given time. + * + * @return the totalRetryAttempts value. + */ + public Integer totalRetryAttempts() { + return this.totalRetryAttempts; + } + + /** + * Get the operationInfo property: Operational information of the rollout. + * + * @return the operationInfo value. + */ + public RolloutOperationInfo operationInfo() { + return this.operationInfo; + } + + /** + * Get the services property: The detailed information on the services being deployed. + * + * @return the services value. + */ + public List services() { + return this.services; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operationInfo() != null) { + operationInfo().validate(); + } + if (services() != null) { + services().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequest.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequest.java new file mode 100644 index 000000000000..881b171b68da --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequest.java @@ -0,0 +1,375 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of RolloutRequest. */ +public interface RolloutRequest { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the buildVersion property: The version of the build being deployed. + * + * @return the buildVersion value. + */ + String buildVersion(); + + /** + * Gets the artifactSourceId property: The reference to the artifact source resource Id where the payload is + * located. + * + * @return the artifactSourceId value. + */ + String artifactSourceId(); + + /** + * Gets the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @return the targetServiceTopologyId value. + */ + String targetServiceTopologyId(); + + /** + * Gets the stepGroups property: The list of step groups that define the orchestration. + * + * @return the stepGroups value. + */ + List stepGroups(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner object. + * + * @return the inner object. + */ + RolloutRequestInner innerModel(); + + /** The entirety of the RolloutRequest definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithIdentity, + DefinitionStages.WithBuildVersion, + DefinitionStages.WithTargetServiceTopologyId, + DefinitionStages.WithStepGroups, + DefinitionStages.WithCreate { + } + /** The RolloutRequest definition stages. */ + interface DefinitionStages { + /** The first stage of the RolloutRequest definition. */ + interface Blank extends WithLocation { + } + /** The stage of the RolloutRequest definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the RolloutRequest definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithIdentity withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the RolloutRequest definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithBuildVersion withIdentity(Identity identity); + } + /** The stage of the RolloutRequest definition allowing to specify buildVersion. */ + interface WithBuildVersion { + /** + * Specifies the buildVersion property: The version of the build being deployed.. + * + * @param buildVersion The version of the build being deployed. + * @return the next definition stage. + */ + WithTargetServiceTopologyId withBuildVersion(String buildVersion); + } + /** The stage of the RolloutRequest definition allowing to specify targetServiceTopologyId. */ + interface WithTargetServiceTopologyId { + /** + * Specifies the targetServiceTopologyId property: The resource Id of the service topology from which + * service units are being referenced in step groups to be deployed.. + * + * @param targetServiceTopologyId The resource Id of the service topology from which service units are being + * referenced in step groups to be deployed. + * @return the next definition stage. + */ + WithStepGroups withTargetServiceTopologyId(String targetServiceTopologyId); + } + /** The stage of the RolloutRequest definition allowing to specify stepGroups. */ + interface WithStepGroups { + /** + * Specifies the stepGroups property: The list of step groups that define the orchestration.. + * + * @param stepGroups The list of step groups that define the orchestration. + * @return the next definition stage. + */ + WithCreate withStepGroups(List stepGroups); + } + /** + * The stage of the RolloutRequest definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithArtifactSourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + RolloutRequest create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + RolloutRequest create(Context context); + } + /** The stage of the RolloutRequest definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the RolloutRequest definition allowing to specify artifactSourceId. */ + interface WithArtifactSourceId { + /** + * Specifies the artifactSourceId property: The reference to the artifact source resource Id where the + * payload is located.. + * + * @param artifactSourceId The reference to the artifact source resource Id where the payload is located. + * @return the next definition stage. + */ + WithCreate withArtifactSourceId(String artifactSourceId); + } + } + /** + * Begins update for the RolloutRequest resource. + * + * @return the stage of resource update. + */ + RolloutRequest.Update update(); + + /** The template for RolloutRequest update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithBuildVersion, + UpdateStages.WithArtifactSourceId, + UpdateStages.WithTargetServiceTopologyId, + UpdateStages.WithStepGroups { + /** + * Executes the update request. + * + * @return the updated resource. + */ + RolloutRequest apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + RolloutRequest apply(Context context); + } + /** The RolloutRequest update stages. */ + interface UpdateStages { + /** The stage of the RolloutRequest update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the RolloutRequest update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + /** The stage of the RolloutRequest update allowing to specify buildVersion. */ + interface WithBuildVersion { + /** + * Specifies the buildVersion property: The version of the build being deployed.. + * + * @param buildVersion The version of the build being deployed. + * @return the next definition stage. + */ + Update withBuildVersion(String buildVersion); + } + /** The stage of the RolloutRequest update allowing to specify artifactSourceId. */ + interface WithArtifactSourceId { + /** + * Specifies the artifactSourceId property: The reference to the artifact source resource Id where the + * payload is located.. + * + * @param artifactSourceId The reference to the artifact source resource Id where the payload is located. + * @return the next definition stage. + */ + Update withArtifactSourceId(String artifactSourceId); + } + /** The stage of the RolloutRequest update allowing to specify targetServiceTopologyId. */ + interface WithTargetServiceTopologyId { + /** + * Specifies the targetServiceTopologyId property: The resource Id of the service topology from which + * service units are being referenced in step groups to be deployed.. + * + * @param targetServiceTopologyId The resource Id of the service topology from which service units are being + * referenced in step groups to be deployed. + * @return the next definition stage. + */ + Update withTargetServiceTopologyId(String targetServiceTopologyId); + } + /** The stage of the RolloutRequest update allowing to specify stepGroups. */ + interface WithStepGroups { + /** + * Specifies the stepGroups property: The list of step groups that define the orchestration.. + * + * @param stepGroups The list of step groups that define the orchestration. + * @return the next definition stage. + */ + Update withStepGroups(List stepGroups); + } + } + /** + * Only running rollouts can be canceled. + * + * @throws com.azure.core.management.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 defines the rollout. + */ + Rollout cancel(); + + /** + * Only running rollouts can be canceled. + * + * @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 defines the rollout. + */ + Response cancelWithResponse(Context context); + + /** + * Only failed rollouts can be restarted. + * + * @throws com.azure.core.management.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 defines the rollout. + */ + Rollout restart(); + + /** + * Only failed rollouts can be restarted. + * + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @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 defines the rollout. + */ + Response restartWithResponse(Boolean skipSucceeded, Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequestProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequestProperties.java new file mode 100644 index 000000000000..439bcc519eb9 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutRequestProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties for defining a rollout. */ +@Fluent +public class RolloutRequestProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutRequestProperties.class); + + /* + * The version of the build being deployed. + */ + @JsonProperty(value = "buildVersion", required = true) + private String buildVersion; + + /* + * The reference to the artifact source resource Id where the payload is + * located. + */ + @JsonProperty(value = "artifactSourceId") + private String artifactSourceId; + + /* + * The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + */ + @JsonProperty(value = "targetServiceTopologyId", required = true) + private String targetServiceTopologyId; + + /* + * The list of step groups that define the orchestration. + */ + @JsonProperty(value = "stepGroups", required = true) + private List stepGroups; + + /** + * Get the buildVersion property: The version of the build being deployed. + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The version of the build being deployed. + * + * @param buildVersion the buildVersion value to set. + * @return the RolloutRequestProperties object itself. + */ + public RolloutRequestProperties withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @return the artifactSourceId value. + */ + public String artifactSourceId() { + return this.artifactSourceId; + } + + /** + * Set the artifactSourceId property: The reference to the artifact source resource Id where the payload is located. + * + * @param artifactSourceId the artifactSourceId value to set. + * @return the RolloutRequestProperties object itself. + */ + public RolloutRequestProperties withArtifactSourceId(String artifactSourceId) { + this.artifactSourceId = artifactSourceId; + return this; + } + + /** + * Get the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @return the targetServiceTopologyId value. + */ + public String targetServiceTopologyId() { + return this.targetServiceTopologyId; + } + + /** + * Set the targetServiceTopologyId property: The resource Id of the service topology from which service units are + * being referenced in step groups to be deployed. + * + * @param targetServiceTopologyId the targetServiceTopologyId value to set. + * @return the RolloutRequestProperties object itself. + */ + public RolloutRequestProperties withTargetServiceTopologyId(String targetServiceTopologyId) { + this.targetServiceTopologyId = targetServiceTopologyId; + return this; + } + + /** + * Get the stepGroups property: The list of step groups that define the orchestration. + * + * @return the stepGroups value. + */ + public List stepGroups() { + return this.stepGroups; + } + + /** + * Set the stepGroups property: The list of step groups that define the orchestration. + * + * @param stepGroups the stepGroups value to set. + * @return the RolloutRequestProperties object itself. + */ + public RolloutRequestProperties withStepGroups(List stepGroups) { + this.stepGroups = stepGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (buildVersion() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property buildVersion in model RolloutRequestProperties")); + } + if (targetServiceTopologyId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetServiceTopologyId in model RolloutRequestProperties")); + } + if (stepGroups() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property stepGroups in model RolloutRequestProperties")); + } else { + stepGroups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutStep.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutStep.java new file mode 100644 index 000000000000..37fe580af228 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutStep.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; + +/** Defines a specific step on a target service unit. */ +@Fluent +public final class RolloutStep { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutStep.class); + + /* + * Name of the step. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Current state of the step. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private String status; + + /* + * The step group the current step is part of. + */ + @JsonProperty(value = "stepGroup") + private String stepGroup; + + /* + * Detailed information of specific action execution. + */ + @JsonProperty(value = "operationInfo", access = JsonProperty.Access.WRITE_ONLY) + private StepOperationInfo operationInfo; + + /* + * Set of resource operations that were performed, if any, on an Azure + * resource. + */ + @JsonProperty(value = "resourceOperations", access = JsonProperty.Access.WRITE_ONLY) + private List resourceOperations; + + /* + * Supplementary informative messages during rollout. + */ + @JsonProperty(value = "messages", access = JsonProperty.Access.WRITE_ONLY) + private List messages; + + /** + * Get the name property: Name of the step. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the step. + * + * @param name the name value to set. + * @return the RolloutStep object itself. + */ + public RolloutStep withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: Current state of the step. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the stepGroup property: The step group the current step is part of. + * + * @return the stepGroup value. + */ + public String stepGroup() { + return this.stepGroup; + } + + /** + * Set the stepGroup property: The step group the current step is part of. + * + * @param stepGroup the stepGroup value to set. + * @return the RolloutStep object itself. + */ + public RolloutStep withStepGroup(String stepGroup) { + this.stepGroup = stepGroup; + return this; + } + + /** + * Get the operationInfo property: Detailed information of specific action execution. + * + * @return the operationInfo value. + */ + public StepOperationInfo operationInfo() { + return this.operationInfo; + } + + /** + * Get the resourceOperations property: Set of resource operations that were performed, if any, on an Azure + * resource. + * + * @return the resourceOperations value. + */ + public List resourceOperations() { + return this.resourceOperations; + } + + /** + * Get the messages property: Supplementary informative messages during rollout. + * + * @return the messages value. + */ + public List messages() { + return this.messages; + } + + /** + * 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 RolloutStep")); + } + if (operationInfo() != null) { + operationInfo().validate(); + } + if (resourceOperations() != null) { + resourceOperations().forEach(e -> e.validate()); + } + if (messages() != null) { + messages().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollouts.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollouts.java new file mode 100644 index 000000000000..e08cf5bc7239 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Rollouts.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of Rollouts. */ +public interface Rollouts { + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 detailed information of a rollout. + */ + Rollout getByResourceGroup(String resourceGroupName, String rolloutName); + + /** + * Gets detailed information of a rollout. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param retryAttempt Rollout retry attempt ordinal to get the result of. If not specified, result of the latest + * attempt will be returned. + * @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 detailed information of a rollout. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String rolloutName, Integer retryAttempt, Context context); + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String rolloutName); + + /** + * Only rollouts in terminal state can be deleted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 resourceGroupName, String rolloutName, Context context); + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + Rollout cancel(String resourceGroupName, String rolloutName); + + /** + * Only running rollouts can be canceled. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + Response cancelWithResponse(String resourceGroupName, String rolloutName, Context context); + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @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 defines the rollout. + */ + Rollout restart(String resourceGroupName, String rolloutName); + + /** + * Only failed rollouts can be restarted. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param rolloutName The rollout name. + * @param skipSucceeded If true, will skip all succeeded steps so far in the rollout. If false, will execute the + * entire rollout again regardless of the current state of individual resources. Defaults to false if not + * specified. + * @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 defines the rollout. + */ + Response restartWithResponse( + String resourceGroupName, String rolloutName, Boolean skipSucceeded, Context context); + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of rollouts. + */ + List list(String resourceGroupName); + + /** + * Lists the rollouts in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of rollouts. + */ + Response> listWithResponse(String resourceGroupName, Context context); + + /** + * Only rollouts in terminal state can be deleted. + * + * @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); + + /** + * Only rollouts in terminal state can be deleted. + * + * @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 RolloutRequest resource. + * + * @param name resource name. + * @return the first stage of the new RolloutRequest definition. + */ + RolloutRequest.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateHeaders.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateHeaders.java new file mode 100644 index 000000000000..1dde087d8ca5 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 RolloutsCreateOrUpdateHeaders model. */ +@Fluent +public final class RolloutsCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RolloutsCreateOrUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the RolloutsCreateOrUpdateHeaders object itself. + */ + public RolloutsCreateOrUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateResponse.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateResponse.java new file mode 100644 index 000000000000..8fa6545ca3c9 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/RolloutsCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.deploymentmanager.fluent.models.RolloutRequestInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class RolloutsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of RolloutsCreateOrUpdateResponse. + * + * @param request the request which resulted in this RolloutsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public RolloutsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + RolloutRequestInner value, + RolloutsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public RolloutRequestInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/SasAuthentication.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/SasAuthentication.java new file mode 100644 index 000000000000..ca5163f5a388 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/SasAuthentication.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Defines the properties to access the artifacts using an Azure Storage SAS URI. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Sas") +@JsonFlatten +@Fluent +public class SasAuthentication extends Authentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SasAuthentication.class); + + /* + * The SAS URI to the Azure Storage blob container. Any offset from the + * root of the container to where the artifacts are located can be defined + * in the artifactRoot. + */ + @JsonProperty(value = "properties.sasUri") + private String sasUri; + + /** + * Get the sasUri property: The SAS URI to the Azure Storage blob container. Any offset from the root of the + * container to where the artifacts are located can be defined in the artifactRoot. + * + * @return the sasUri value. + */ + public String sasUri() { + return this.sasUri; + } + + /** + * Set the sasUri property: The SAS URI to the Azure Storage blob container. Any offset from the root of the + * container to where the artifacts are located can be defined in the artifactRoot. + * + * @param sasUri the sasUri value to set. + * @return the SasAuthentication object itself. + */ + public SasAuthentication withSasUri(String sasUri) { + this.sasUri = sasUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Service.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Service.java new file mode 100644 index 000000000000..668ba91d7ad9 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Service.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; + +/** Defines a service. */ +@Fluent +public final class Service extends ServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Service.class); + + /* + * Name of the service. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The detailed information about the units that make up the service. + */ + @JsonProperty(value = "serviceUnits") + private List serviceUnits; + + /** + * Get the name property: Name of the service. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the service. + * + * @param name the name value to set. + * @return the Service object itself. + */ + public Service withName(String name) { + this.name = name; + return this; + } + + /** + * Get the serviceUnits property: The detailed information about the units that make up the service. + * + * @return the serviceUnits value. + */ + public List serviceUnits() { + return this.serviceUnits; + } + + /** + * Set the serviceUnits property: The detailed information about the units that make up the service. + * + * @param serviceUnits the serviceUnits value to set. + * @return the Service object itself. + */ + public Service withServiceUnits(List serviceUnits) { + this.serviceUnits = serviceUnits; + return this; + } + + /** {@inheritDoc} */ + @Override + public Service withTargetLocation(String targetLocation) { + super.withTargetLocation(targetLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public Service withTargetSubscriptionId(String targetSubscriptionId) { + super.withTargetSubscriptionId(targetSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (serviceUnits() != null) { + serviceUnits().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceProperties.java new file mode 100644 index 000000000000..2240440f1eee --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceProperties.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a service. */ +@Fluent +public class ServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceProperties.class); + + /* + * The Azure location to which the resources in the service belong to or + * should be deployed to. + */ + @JsonProperty(value = "targetLocation", required = true) + private String targetLocation; + + /* + * The subscription to which the resources in the service belong to or + * should be deployed to. + */ + @JsonProperty(value = "targetSubscriptionId", required = true) + private String targetSubscriptionId; + + /** + * Get the targetLocation property: The Azure location to which the resources in the service belong to or should be + * deployed to. + * + * @return the targetLocation value. + */ + public String targetLocation() { + return this.targetLocation; + } + + /** + * Set the targetLocation property: The Azure location to which the resources in the service belong to or should be + * deployed to. + * + * @param targetLocation the targetLocation value to set. + * @return the ServiceProperties object itself. + */ + public ServiceProperties withTargetLocation(String targetLocation) { + this.targetLocation = targetLocation; + return this; + } + + /** + * Get the targetSubscriptionId property: The subscription to which the resources in the service belong to or should + * be deployed to. + * + * @return the targetSubscriptionId value. + */ + public String targetSubscriptionId() { + return this.targetSubscriptionId; + } + + /** + * Set the targetSubscriptionId property: The subscription to which the resources in the service belong to or should + * be deployed to. + * + * @param targetSubscriptionId the targetSubscriptionId value to set. + * @return the ServiceProperties object itself. + */ + public ServiceProperties withTargetSubscriptionId(String targetSubscriptionId) { + this.targetSubscriptionId = targetSubscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetLocation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetLocation in model ServiceProperties")); + } + if (targetSubscriptionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetSubscriptionId in model ServiceProperties")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResource.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResource.java new file mode 100644 index 000000000000..1f16428ff04a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResource.java @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ServiceResource. */ +public interface ServiceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the targetLocation property: The Azure location to which the resources in the service belong to or should be + * deployed to. + * + * @return the targetLocation value. + */ + String targetLocation(); + + /** + * Gets the targetSubscriptionId property: The subscription to which the resources in the service belong to or + * should be deployed to. + * + * @return the targetSubscriptionId value. + */ + String targetSubscriptionId(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceResourceInner object. + * + * @return the inner object. + */ + ServiceResourceInner innerModel(); + + /** The entirety of the ServiceResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithTargetLocation, + DefinitionStages.WithTargetSubscriptionId, + DefinitionStages.WithCreate { + } + /** The ServiceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServiceResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ServiceResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceTopologyName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @return the next definition stage. + */ + WithTargetLocation withExistingServiceTopology(String resourceGroupName, String serviceTopologyName); + } + /** The stage of the ServiceResource definition allowing to specify targetLocation. */ + interface WithTargetLocation { + /** + * Specifies the targetLocation property: The Azure location to which the resources in the service belong to + * or should be deployed to.. + * + * @param targetLocation The Azure location to which the resources in the service belong to or should be + * deployed to. + * @return the next definition stage. + */ + WithTargetSubscriptionId withTargetLocation(String targetLocation); + } + /** The stage of the ServiceResource definition allowing to specify targetSubscriptionId. */ + interface WithTargetSubscriptionId { + /** + * Specifies the targetSubscriptionId property: The subscription to which the resources in the service + * belong to or should be deployed to.. + * + * @param targetSubscriptionId The subscription to which the resources in the service belong to or should be + * deployed to. + * @return the next definition stage. + */ + WithCreate withTargetSubscriptionId(String targetSubscriptionId); + } + /** + * The stage of the ServiceResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceResource create(Context context); + } + /** The stage of the ServiceResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the ServiceResource resource. + * + * @return the stage of resource update. + */ + ServiceResource.Update update(); + + /** The template for ServiceResource update. */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithTargetLocation, UpdateStages.WithTargetSubscriptionId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceResource apply(Context context); + } + /** The ServiceResource update stages. */ + interface UpdateStages { + /** The stage of the ServiceResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ServiceResource update allowing to specify targetLocation. */ + interface WithTargetLocation { + /** + * Specifies the targetLocation property: The Azure location to which the resources in the service belong to + * or should be deployed to.. + * + * @param targetLocation The Azure location to which the resources in the service belong to or should be + * deployed to. + * @return the next definition stage. + */ + Update withTargetLocation(String targetLocation); + } + /** The stage of the ServiceResource update allowing to specify targetSubscriptionId. */ + interface WithTargetSubscriptionId { + /** + * Specifies the targetSubscriptionId property: The subscription to which the resources in the service + * belong to or should be deployed to.. + * + * @param targetSubscriptionId The subscription to which the resources in the service belong to or should be + * deployed to. + * @return the next definition stage. + */ + Update withTargetSubscriptionId(String targetSubscriptionId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceResource refresh(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResourceProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResourceProperties.java new file mode 100644 index 000000000000..c846a0ecd9af --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceResourceProperties.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The properties that define a service in a service topology. */ +@Immutable +public final class ServiceResourceProperties extends ServiceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceResourceProperties.class); + + /** {@inheritDoc} */ + @Override + public ServiceResourceProperties withTargetLocation(String targetLocation) { + super.withTargetLocation(targetLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceResourceProperties withTargetSubscriptionId(String targetSubscriptionId) { + super.withTargetSubscriptionId(targetSubscriptionId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologies.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologies.java new file mode 100644 index 000000000000..2e99e470f13f --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologies.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of ServiceTopologies. */ +public interface ServiceTopologies { + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + ServiceTopologyResource getByResourceGroup(String resourceGroupName, String serviceTopologyName); + + /** + * Gets the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 service topology. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String serviceTopologyName, Context context); + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String serviceTopologyName); + + /** + * Deletes the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 resourceGroupName, String serviceTopologyName, Context context); + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of service topologies. + */ + List list(String resourceGroupName); + + /** + * Lists the service topologies in the resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of service topologies. + */ + Response> listWithResponse(String resourceGroupName, Context context); + + /** + * Gets the service topology. + * + * @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 service topology. + */ + ServiceTopologyResource getById(String id); + + /** + * Gets the service topology. + * + * @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 service topology. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the service topology. + * + * @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 service topology. + * + * @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 ServiceTopologyResource resource. + * + * @param name resource name. + * @return the first stage of the new ServiceTopologyResource definition. + */ + ServiceTopologyResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyProperties.java new file mode 100644 index 000000000000..c0e39172abe3 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyProperties.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.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The properties of a service topology. */ +@Fluent +public class ServiceTopologyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTopologyProperties.class); + + /* + * The resource Id of the artifact source that contains the artifacts that + * can be referenced in the service units. + */ + @JsonProperty(value = "artifactSourceId") + private String artifactSourceId; + + /** + * Get the artifactSourceId property: The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * + * @return the artifactSourceId value. + */ + public String artifactSourceId() { + return this.artifactSourceId; + } + + /** + * Set the artifactSourceId property: The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * + * @param artifactSourceId the artifactSourceId value to set. + * @return the ServiceTopologyProperties object itself. + */ + public ServiceTopologyProperties withArtifactSourceId(String artifactSourceId) { + this.artifactSourceId = artifactSourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResource.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResource.java new file mode 100644 index 000000000000..e276ca5a86d4 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResource.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceTopologyResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ServiceTopologyResource. */ +public interface ServiceTopologyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the artifactSourceId property: The resource Id of the artifact source that contains the artifacts that can + * be referenced in the service units. + * + * @return the artifactSourceId value. + */ + String artifactSourceId(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceTopologyResourceInner object. + * + * @return the inner object. + */ + ServiceTopologyResourceInner innerModel(); + + /** The entirety of the ServiceTopologyResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ServiceTopologyResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceTopologyResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServiceTopologyResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ServiceTopologyResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ServiceTopologyResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithArtifactSourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceTopologyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceTopologyResource create(Context context); + } + /** The stage of the ServiceTopologyResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ServiceTopologyResource definition allowing to specify artifactSourceId. */ + interface WithArtifactSourceId { + /** + * Specifies the artifactSourceId property: The resource Id of the artifact source that contains the + * artifacts that can be referenced in the service units.. + * + * @param artifactSourceId The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * @return the next definition stage. + */ + WithCreate withArtifactSourceId(String artifactSourceId); + } + } + /** + * Begins update for the ServiceTopologyResource resource. + * + * @return the stage of resource update. + */ + ServiceTopologyResource.Update update(); + + /** The template for ServiceTopologyResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithArtifactSourceId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceTopologyResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceTopologyResource apply(Context context); + } + /** The ServiceTopologyResource update stages. */ + interface UpdateStages { + /** The stage of the ServiceTopologyResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ServiceTopologyResource update allowing to specify artifactSourceId. */ + interface WithArtifactSourceId { + /** + * Specifies the artifactSourceId property: The resource Id of the artifact source that contains the + * artifacts that can be referenced in the service units.. + * + * @param artifactSourceId The resource Id of the artifact source that contains the artifacts that can be + * referenced in the service units. + * @return the next definition stage. + */ + Update withArtifactSourceId(String artifactSourceId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceTopologyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceTopologyResource refresh(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResourceProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResourceProperties.java new file mode 100644 index 000000000000..e2874a346f75 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceTopologyResourceProperties.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The properties that define the service topology. */ +@Immutable +public final class ServiceTopologyResourceProperties extends ServiceTopologyProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceTopologyResourceProperties.class); + + /** {@inheritDoc} */ + @Override + public ServiceTopologyResourceProperties withArtifactSourceId(String artifactSourceId) { + super.withArtifactSourceId(artifactSourceId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnit.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnit.java new file mode 100644 index 000000000000..00b5623af29a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnit.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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; + +/** Defines a service unit. */ +@Fluent +public final class ServiceUnit extends ServiceUnitProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnit.class); + + /* + * Name of the service unit. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Detailed step information, if present. + */ + @JsonProperty(value = "steps") + private List steps; + + /** + * Get the name property: Name of the service unit. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the service unit. + * + * @param name the name value to set. + * @return the ServiceUnit object itself. + */ + public ServiceUnit withName(String name) { + this.name = name; + return this; + } + + /** + * Get the steps property: Detailed step information, if present. + * + * @return the steps value. + */ + public List steps() { + return this.steps; + } + + /** + * Set the steps property: Detailed step information, if present. + * + * @param steps the steps value to set. + * @return the ServiceUnit object itself. + */ + public ServiceUnit withSteps(List steps) { + this.steps = steps; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnit withTargetResourceGroup(String targetResourceGroup) { + super.withTargetResourceGroup(targetResourceGroup); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnit withDeploymentMode(DeploymentMode deploymentMode) { + super.withDeploymentMode(deploymentMode); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnit withArtifacts(ServiceUnitArtifacts artifacts) { + super.withArtifacts(artifacts); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (steps() != null) { + steps().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitArtifacts.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitArtifacts.java new file mode 100644 index 000000000000..a62f7b8671f7 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitArtifacts.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the artifacts of a service unit. */ +@Fluent +public final class ServiceUnitArtifacts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitArtifacts.class); + + /* + * The full URI of the ARM template file with the SAS token. + */ + @JsonProperty(value = "templateUri") + private String templateUri; + + /* + * The full URI of the ARM parameters file with the SAS token. + */ + @JsonProperty(value = "parametersUri") + private String parametersUri; + + /* + * The path to the ARM template file relative to the artifact source. + */ + @JsonProperty(value = "templateArtifactSourceRelativePath") + private String templateArtifactSourceRelativePath; + + /* + * The path to the ARM parameters file relative to the artifact source. + */ + @JsonProperty(value = "parametersArtifactSourceRelativePath") + private String parametersArtifactSourceRelativePath; + + /** + * Get the templateUri property: The full URI of the ARM template file with the SAS token. + * + * @return the templateUri value. + */ + public String templateUri() { + return this.templateUri; + } + + /** + * Set the templateUri property: The full URI of the ARM template file with the SAS token. + * + * @param templateUri the templateUri value to set. + * @return the ServiceUnitArtifacts object itself. + */ + public ServiceUnitArtifacts withTemplateUri(String templateUri) { + this.templateUri = templateUri; + return this; + } + + /** + * Get the parametersUri property: The full URI of the ARM parameters file with the SAS token. + * + * @return the parametersUri value. + */ + public String parametersUri() { + return this.parametersUri; + } + + /** + * Set the parametersUri property: The full URI of the ARM parameters file with the SAS token. + * + * @param parametersUri the parametersUri value to set. + * @return the ServiceUnitArtifacts object itself. + */ + public ServiceUnitArtifacts withParametersUri(String parametersUri) { + this.parametersUri = parametersUri; + return this; + } + + /** + * Get the templateArtifactSourceRelativePath property: The path to the ARM template file relative to the artifact + * source. + * + * @return the templateArtifactSourceRelativePath value. + */ + public String templateArtifactSourceRelativePath() { + return this.templateArtifactSourceRelativePath; + } + + /** + * Set the templateArtifactSourceRelativePath property: The path to the ARM template file relative to the artifact + * source. + * + * @param templateArtifactSourceRelativePath the templateArtifactSourceRelativePath value to set. + * @return the ServiceUnitArtifacts object itself. + */ + public ServiceUnitArtifacts withTemplateArtifactSourceRelativePath(String templateArtifactSourceRelativePath) { + this.templateArtifactSourceRelativePath = templateArtifactSourceRelativePath; + return this; + } + + /** + * Get the parametersArtifactSourceRelativePath property: The path to the ARM parameters file relative to the + * artifact source. + * + * @return the parametersArtifactSourceRelativePath value. + */ + public String parametersArtifactSourceRelativePath() { + return this.parametersArtifactSourceRelativePath; + } + + /** + * Set the parametersArtifactSourceRelativePath property: The path to the ARM parameters file relative to the + * artifact source. + * + * @param parametersArtifactSourceRelativePath the parametersArtifactSourceRelativePath value to set. + * @return the ServiceUnitArtifacts object itself. + */ + public ServiceUnitArtifacts withParametersArtifactSourceRelativePath(String parametersArtifactSourceRelativePath) { + this.parametersArtifactSourceRelativePath = parametersArtifactSourceRelativePath; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitProperties.java new file mode 100644 index 000000000000..0880bf08be18 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitProperties.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines the properties of a service unit. */ +@Fluent +public class ServiceUnitProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitProperties.class); + + /* + * The Azure Resource Group to which the resources in the service unit + * belong to or should be deployed to. + */ + @JsonProperty(value = "targetResourceGroup", required = true) + private String targetResourceGroup; + + /* + * Describes the type of ARM deployment to be performed on the resource. + */ + @JsonProperty(value = "deploymentMode", required = true) + private DeploymentMode deploymentMode; + + /* + * The artifacts for the service unit. + */ + @JsonProperty(value = "artifacts") + private ServiceUnitArtifacts artifacts; + + /** + * Get the targetResourceGroup property: The Azure Resource Group to which the resources in the service unit belong + * to or should be deployed to. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: The Azure Resource Group to which the resources in the service unit belong + * to or should be deployed to. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the ServiceUnitProperties object itself. + */ + public ServiceUnitProperties withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the deploymentMode property: Describes the type of ARM deployment to be performed on the resource. + * + * @return the deploymentMode value. + */ + public DeploymentMode deploymentMode() { + return this.deploymentMode; + } + + /** + * Set the deploymentMode property: Describes the type of ARM deployment to be performed on the resource. + * + * @param deploymentMode the deploymentMode value to set. + * @return the ServiceUnitProperties object itself. + */ + public ServiceUnitProperties withDeploymentMode(DeploymentMode deploymentMode) { + this.deploymentMode = deploymentMode; + return this; + } + + /** + * Get the artifacts property: The artifacts for the service unit. + * + * @return the artifacts value. + */ + public ServiceUnitArtifacts artifacts() { + return this.artifacts; + } + + /** + * Set the artifacts property: The artifacts for the service unit. + * + * @param artifacts the artifacts value to set. + * @return the ServiceUnitProperties object itself. + */ + public ServiceUnitProperties withArtifacts(ServiceUnitArtifacts artifacts) { + this.artifacts = artifacts; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetResourceGroup() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property targetResourceGroup in model ServiceUnitProperties")); + } + if (deploymentMode() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property deploymentMode in model ServiceUnitProperties")); + } + if (artifacts() != null) { + artifacts().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResource.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResource.java new file mode 100644 index 000000000000..e9868cf93014 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResource.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner; +import java.util.Map; + +/** An immutable client-side representation of ServiceUnitResource. */ +public interface ServiceUnitResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the targetResourceGroup property: The Azure Resource Group to which the resources in the service unit belong + * to or should be deployed to. + * + * @return the targetResourceGroup value. + */ + String targetResourceGroup(); + + /** + * Gets the deploymentMode property: Describes the type of ARM deployment to be performed on the resource. + * + * @return the deploymentMode value. + */ + DeploymentMode deploymentMode(); + + /** + * Gets the artifacts property: The artifacts for the service unit. + * + * @return the artifacts value. + */ + ServiceUnitArtifacts artifacts(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner object. + * + * @return the inner object. + */ + ServiceUnitResourceInner innerModel(); + + /** The entirety of the ServiceUnitResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithTargetResourceGroup, + DefinitionStages.WithDeploymentMode, + DefinitionStages.WithCreate { + } + /** The ServiceUnitResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ServiceUnitResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ServiceUnitResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the ServiceUnitResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serviceTopologyName, serviceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @return the next definition stage. + */ + WithTargetResourceGroup withExistingService( + String resourceGroupName, String serviceTopologyName, String serviceName); + } + /** The stage of the ServiceUnitResource definition allowing to specify targetResourceGroup. */ + interface WithTargetResourceGroup { + /** + * Specifies the targetResourceGroup property: The Azure Resource Group to which the resources in the + * service unit belong to or should be deployed to.. + * + * @param targetResourceGroup The Azure Resource Group to which the resources in the service unit belong to + * or should be deployed to. + * @return the next definition stage. + */ + WithDeploymentMode withTargetResourceGroup(String targetResourceGroup); + } + /** The stage of the ServiceUnitResource definition allowing to specify deploymentMode. */ + interface WithDeploymentMode { + /** + * Specifies the deploymentMode property: Describes the type of ARM deployment to be performed on the + * resource.. + * + * @param deploymentMode Describes the type of ARM deployment to be performed on the resource. + * @return the next definition stage. + */ + WithCreate withDeploymentMode(DeploymentMode deploymentMode); + } + /** + * The stage of the ServiceUnitResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithArtifacts { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServiceUnitResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServiceUnitResource create(Context context); + } + /** The stage of the ServiceUnitResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ServiceUnitResource definition allowing to specify artifacts. */ + interface WithArtifacts { + /** + * Specifies the artifacts property: The artifacts for the service unit.. + * + * @param artifacts The artifacts for the service unit. + * @return the next definition stage. + */ + WithCreate withArtifacts(ServiceUnitArtifacts artifacts); + } + } + /** + * Begins update for the ServiceUnitResource resource. + * + * @return the stage of resource update. + */ + ServiceUnitResource.Update update(); + + /** The template for ServiceUnitResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithTargetResourceGroup, + UpdateStages.WithDeploymentMode, + UpdateStages.WithArtifacts { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServiceUnitResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServiceUnitResource apply(Context context); + } + /** The ServiceUnitResource update stages. */ + interface UpdateStages { + /** The stage of the ServiceUnitResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ServiceUnitResource update allowing to specify targetResourceGroup. */ + interface WithTargetResourceGroup { + /** + * Specifies the targetResourceGroup property: The Azure Resource Group to which the resources in the + * service unit belong to or should be deployed to.. + * + * @param targetResourceGroup The Azure Resource Group to which the resources in the service unit belong to + * or should be deployed to. + * @return the next definition stage. + */ + Update withTargetResourceGroup(String targetResourceGroup); + } + /** The stage of the ServiceUnitResource update allowing to specify deploymentMode. */ + interface WithDeploymentMode { + /** + * Specifies the deploymentMode property: Describes the type of ARM deployment to be performed on the + * resource.. + * + * @param deploymentMode Describes the type of ARM deployment to be performed on the resource. + * @return the next definition stage. + */ + Update withDeploymentMode(DeploymentMode deploymentMode); + } + /** The stage of the ServiceUnitResource update allowing to specify artifacts. */ + interface WithArtifacts { + /** + * Specifies the artifacts property: The artifacts for the service unit.. + * + * @param artifacts The artifacts for the service unit. + * @return the next definition stage. + */ + Update withArtifacts(ServiceUnitArtifacts artifacts); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServiceUnitResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServiceUnitResource refresh(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResourceProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResourceProperties.java new file mode 100644 index 000000000000..a0635d1451d6 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitResourceProperties.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The properties that define the service unit. */ +@Immutable +public final class ServiceUnitResourceProperties extends ServiceUnitProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitResourceProperties.class); + + /** {@inheritDoc} */ + @Override + public ServiceUnitResourceProperties withTargetResourceGroup(String targetResourceGroup) { + super.withTargetResourceGroup(targetResourceGroup); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnitResourceProperties withDeploymentMode(DeploymentMode deploymentMode) { + super.withDeploymentMode(deploymentMode); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceUnitResourceProperties withArtifacts(ServiceUnitArtifacts artifacts) { + super.withArtifacts(artifacts); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnits.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnits.java new file mode 100644 index 000000000000..66c8ec578541 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnits.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of ServiceUnits. */ +public interface ServiceUnits { + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service unit. + */ + ServiceUnitResource get( + String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName); + + /** + * Gets the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 service unit. + */ + Response getWithResponse( + String resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context); + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceTopologyName, String serviceName, String serviceUnitName); + + /** + * Deletes the service unit. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @param serviceUnitName The name of the service unit 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 resourceGroupName, + String serviceTopologyName, + String serviceName, + String serviceUnitName, + Context context); + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of service units. + */ + List list(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Lists the service units under a service in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 list of service units. + */ + Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context); + + /** + * Gets the service unit. + * + * @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 service unit. + */ + ServiceUnitResource getById(String id); + + /** + * Gets the service unit. + * + * @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 service unit. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the service unit. + * + * @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 service unit. + * + * @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 ServiceUnitResource resource. + * + * @param name resource name. + * @return the first stage of the new ServiceUnitResource definition. + */ + ServiceUnitResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateHeaders.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateHeaders.java new file mode 100644 index 000000000000..c9463db34d83 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateHeaders.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 ServiceUnitsCreateOrUpdateHeaders model. */ +@Fluent +public final class ServiceUnitsCreateOrUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceUnitsCreateOrUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the ServiceUnitsCreateOrUpdateHeaders object itself. + */ + public ServiceUnitsCreateOrUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateResponse.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateResponse.java new file mode 100644 index 000000000000..9d0354490d34 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/ServiceUnitsCreateOrUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.deploymentmanager.fluent.models.ServiceUnitResourceInner; + +/** Contains all response data for the createOrUpdate operation. */ +public final class ServiceUnitsCreateOrUpdateResponse + extends ResponseBase { + /** + * Creates an instance of ServiceUnitsCreateOrUpdateResponse. + * + * @param request the request which resulted in this ServiceUnitsCreateOrUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public ServiceUnitsCreateOrUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + ServiceUnitResourceInner value, + ServiceUnitsCreateOrUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public ServiceUnitResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Services.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Services.java new file mode 100644 index 000000000000..34d5d7fb6184 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Services.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of Services. */ +public interface Services { + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the service. + */ + ServiceResource get(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Gets the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 service. + */ + Response getWithResponse( + String resourceGroupName, String serviceTopologyName, String serviceName, Context context); + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serviceTopologyName, String serviceName); + + /** + * Deletes the service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @param serviceName The name of the service 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 resourceGroupName, String serviceTopologyName, String serviceName, Context context); + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 list of services. + */ + List list(String resourceGroupName, String serviceTopologyName); + + /** + * Lists the services in the service topology. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceTopologyName The name of the service topology . + * @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 list of services. + */ + Response> listWithResponse( + String resourceGroupName, String serviceTopologyName, Context context); + + /** + * Gets the service. + * + * @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 service. + */ + ServiceResource getById(String id); + + /** + * Gets the service. + * + * @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 service. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the service. + * + * @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 service. + * + * @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 ServiceResource resource. + * + * @param name resource name. + * @return the first stage of the new ServiceResource definition. + */ + ServiceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepGroup.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepGroup.java new file mode 100644 index 000000000000..c7d66423686a --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepGroup.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The properties that define a Step group in a rollout. */ +@Fluent +public final class StepGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StepGroup.class); + + /* + * The name of the step group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The list of step group names on which this step group depends on. + */ + @JsonProperty(value = "dependsOnStepGroups") + private List dependsOnStepGroups; + + /* + * The list of steps to be run before deploying the target. + */ + @JsonProperty(value = "preDeploymentSteps") + private List preDeploymentSteps; + + /* + * The resource Id of service unit to be deployed. The service unit should + * be from the service topology referenced in targetServiceTopologyId + */ + @JsonProperty(value = "deploymentTargetId", required = true) + private String deploymentTargetId; + + /* + * The list of steps to be run after deploying the target. + */ + @JsonProperty(value = "postDeploymentSteps") + private List postDeploymentSteps; + + /** + * Get the name property: The name of the step group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the step group. + * + * @param name the name value to set. + * @return the StepGroup object itself. + */ + public StepGroup withName(String name) { + this.name = name; + return this; + } + + /** + * Get the dependsOnStepGroups property: The list of step group names on which this step group depends on. + * + * @return the dependsOnStepGroups value. + */ + public List dependsOnStepGroups() { + return this.dependsOnStepGroups; + } + + /** + * Set the dependsOnStepGroups property: The list of step group names on which this step group depends on. + * + * @param dependsOnStepGroups the dependsOnStepGroups value to set. + * @return the StepGroup object itself. + */ + public StepGroup withDependsOnStepGroups(List dependsOnStepGroups) { + this.dependsOnStepGroups = dependsOnStepGroups; + return this; + } + + /** + * Get the preDeploymentSteps property: The list of steps to be run before deploying the target. + * + * @return the preDeploymentSteps value. + */ + public List preDeploymentSteps() { + return this.preDeploymentSteps; + } + + /** + * Set the preDeploymentSteps property: The list of steps to be run before deploying the target. + * + * @param preDeploymentSteps the preDeploymentSteps value to set. + * @return the StepGroup object itself. + */ + public StepGroup withPreDeploymentSteps(List preDeploymentSteps) { + this.preDeploymentSteps = preDeploymentSteps; + return this; + } + + /** + * Get the deploymentTargetId property: The resource Id of service unit to be deployed. The service unit should be + * from the service topology referenced in targetServiceTopologyId. + * + * @return the deploymentTargetId value. + */ + public String deploymentTargetId() { + return this.deploymentTargetId; + } + + /** + * Set the deploymentTargetId property: The resource Id of service unit to be deployed. The service unit should be + * from the service topology referenced in targetServiceTopologyId. + * + * @param deploymentTargetId the deploymentTargetId value to set. + * @return the StepGroup object itself. + */ + public StepGroup withDeploymentTargetId(String deploymentTargetId) { + this.deploymentTargetId = deploymentTargetId; + return this; + } + + /** + * Get the postDeploymentSteps property: The list of steps to be run after deploying the target. + * + * @return the postDeploymentSteps value. + */ + public List postDeploymentSteps() { + return this.postDeploymentSteps; + } + + /** + * Set the postDeploymentSteps property: The list of steps to be run after deploying the target. + * + * @param postDeploymentSteps the postDeploymentSteps value to set. + * @return the StepGroup object itself. + */ + public StepGroup withPostDeploymentSteps(List postDeploymentSteps) { + this.postDeploymentSteps = postDeploymentSteps; + 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 StepGroup")); + } + if (preDeploymentSteps() != null) { + preDeploymentSteps().forEach(e -> e.validate()); + } + if (deploymentTargetId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property deploymentTargetId in model StepGroup")); + } + if (postDeploymentSteps() != null) { + postDeploymentSteps().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepOperationInfo.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepOperationInfo.java new file mode 100644 index 000000000000..0d92f38b7c9c --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepOperationInfo.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Detailed information of a specific step run. */ +@Fluent +public final class StepOperationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StepOperationInfo.class); + + /* + * The name of the ARM deployment initiated as part of the step. + */ + @JsonProperty(value = "deploymentName", access = JsonProperty.Access.WRITE_ONLY) + private String deploymentName; + + /* + * Unique identifier to track the request for ARM-based resources. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /* + * Start time of the action in UTC. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * End time of the action in UTC. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Last time in UTC this operation was updated. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * The errors, if any, for the action. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** + * Get the deploymentName property: The name of the ARM deployment initiated as part of the step. + * + * @return the deploymentName value. + */ + public String deploymentName() { + return this.deploymentName; + } + + /** + * Get the correlationId property: Unique identifier to track the request for ARM-based resources. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the startTime property: Start time of the action in UTC. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: End time of the action in UTC. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the lastUpdatedTime property: Last time in UTC this operation was updated. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the error property: The errors, if any, for the action. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: The errors, if any, for the action. + * + * @param error the error value to set. + * @return the StepOperationInfo object itself. + */ + public StepOperationInfo withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepProperties.java new file mode 100644 index 000000000000..56abecc20fb4 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepProperties.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.deploymentmanager.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties of a step resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "stepType", + defaultImpl = StepProperties.class) +@JsonTypeName("StepProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "HealthCheck", value = HealthCheckStepProperties.class), + @JsonSubTypes.Type(name = "Wait", value = WaitStepProperties.class) +}) +@Immutable +public class StepProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StepProperties.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepResource.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepResource.java new file mode 100644 index 000000000000..c38b16bf2c74 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepResource.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.deploymentmanager.fluent.models.StepResourceInner; +import java.util.Map; + +/** An immutable client-side representation of StepResource. */ +public interface StepResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The properties that define the step. + * + * @return the properties value. + */ + StepProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.deploymentmanager.fluent.models.StepResourceInner object. + * + * @return the inner object. + */ + StepResourceInner innerModel(); + + /** The entirety of the StepResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The StepResource definition stages. */ + interface DefinitionStages { + /** The first stage of the StepResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the StepResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the StepResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the StepResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties that define the step.. + * + * @param properties The properties that define the step. + * @return the next definition stage. + */ + WithCreate withProperties(StepProperties properties); + } + /** + * The stage of the StepResource definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + StepResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StepResource create(Context context); + } + /** The stage of the StepResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the StepResource resource. + * + * @return the stage of resource update. + */ + StepResource.Update update(); + + /** The template for StepResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StepResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StepResource apply(Context context); + } + /** The StepResource update stages. */ + interface UpdateStages { + /** The stage of the StepResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the StepResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties that define the step.. + * + * @param properties The properties that define the step. + * @return the next definition stage. + */ + Update withProperties(StepProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StepResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StepResource refresh(Context context); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepType.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepType.java new file mode 100644 index 000000000000..432dfeb966dc --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/StepType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for StepType. */ +public enum StepType { + /** Enum value Wait. */ + WAIT("Wait"), + + /** Enum value HealthCheck. */ + HEALTH_CHECK("HealthCheck"); + + /** The actual serialized value for a StepType instance. */ + private final String value; + + StepType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a StepType instance. + * + * @param value the serialized value to parse. + * @return the parsed StepType object, or null if unable to parse. + */ + @JsonCreator + public static StepType fromString(String value) { + StepType[] items = StepType.values(); + for (StepType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Steps.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Steps.java new file mode 100644 index 000000000000..2002aec7d2f8 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/Steps.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.deploymentmanager.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of Steps. */ +public interface Steps { + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + StepResource getByResourceGroup(String resourceGroupName, String stepName); + + /** + * Gets the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 step. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String stepName, Context context); + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String stepName); + + /** + * Deletes the step. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param stepName The name of the deployment step. + * @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 resourceGroupName, String stepName, Context context); + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of steps. + */ + List list(String resourceGroupName); + + /** + * Lists the steps in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 list of steps. + */ + Response> listWithResponse(String resourceGroupName, Context context); + + /** + * Gets the step. + * + * @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 step. + */ + StepResource getById(String id); + + /** + * Gets the step. + * + * @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 step. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the step. + * + * @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 step. + * + * @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 StepResource resource. + * + * @param name resource name. + * @return the first stage of the new StepResource definition. + */ + StepResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepAttributes.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepAttributes.java new file mode 100644 index 000000000000..966e38fe4ee3 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepAttributes.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.deploymentmanager.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 parameters for the wait step. */ +@Fluent +public final class WaitStepAttributes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStepAttributes.class); + + /* + * The duration in ISO 8601 format of how long the wait should be. + */ + @JsonProperty(value = "duration", required = true) + private String duration; + + /** + * Get the duration property: The duration in ISO 8601 format of how long the wait should be. + * + * @return the duration value. + */ + public String duration() { + return this.duration; + } + + /** + * Set the duration property: The duration in ISO 8601 format of how long the wait should be. + * + * @param duration the duration value to set. + * @return the WaitStepAttributes object itself. + */ + public WaitStepAttributes withDuration(String duration) { + this.duration = duration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (duration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property duration in model WaitStepAttributes")); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepProperties.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepProperties.java new file mode 100644 index 000000000000..368298e06364 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/WaitStepProperties.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.deploymentmanager.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 com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Defines the properties of a Wait step. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "stepType") +@JsonTypeName("Wait") +@Fluent +public final class WaitStepProperties extends StepProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStepProperties.class); + + /* + * The Wait attributes + */ + @JsonProperty(value = "attributes", required = true) + private WaitStepAttributes attributes; + + /** + * Get the attributes property: The Wait attributes. + * + * @return the attributes value. + */ + public WaitStepAttributes attributes() { + return this.attributes; + } + + /** + * Set the attributes property: The Wait attributes. + * + * @param attributes the attributes value to set. + * @return the WaitStepProperties object itself. + */ + public WaitStepProperties withAttributes(WaitStepAttributes attributes) { + this.attributes = attributes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (attributes() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property attributes in model WaitStepProperties")); + } else { + attributes().validate(); + } + } +} diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/package-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/package-info.java new file mode 100644 index 000000000000..872d676f8139 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/models/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for AzureDeploymentManager. REST APIs for orchestrating deployments using the + * Azure Deployment Manager (ADM). See + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +package com.azure.resourcemanager.deploymentmanager.models; diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/package-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/package-info.java new file mode 100644 index 000000000000..75f6aa5bb928 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/com/azure/resourcemanager/deploymentmanager/package-info.java @@ -0,0 +1,10 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for AzureDeploymentManager. REST APIs for orchestrating deployments using the Azure + * Deployment Manager (ADM). See + * https://docs.microsoft.com/en-us/azure/azure-resource-manager/deployment-manager-overview for more information. + */ +package com.azure.resourcemanager.deploymentmanager; diff --git a/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/module-info.java b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/src/main/java/module-info.java new file mode 100644 index 000000000000..ceb8d36ca846 --- /dev/null +++ b/sdk/deploymentmanager/azure-resourcemanager-deploymentmanager/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.deploymentmanager { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.deploymentmanager; + exports com.azure.resourcemanager.deploymentmanager.fluent; + exports com.azure.resourcemanager.deploymentmanager.fluent.models; + exports com.azure.resourcemanager.deploymentmanager.models; + + opens com.azure.resourcemanager.deploymentmanager.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.deploymentmanager.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/deploymentmanager/ci.yml b/sdk/deploymentmanager/ci.yml new file mode 100644 index 000000000000..ae472ac34def --- /dev/null +++ b/sdk/deploymentmanager/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/deploymentmanager/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/deploymentmanager/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: deploymentmanager + Artifacts: + - name: azure-resourcemanager-deploymentmanager + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdeploymentmanager diff --git a/sdk/deploymentmanager/pom.xml b/sdk/deploymentmanager/pom.xml new file mode 100644 index 000000000000..9fedcaa947de --- /dev/null +++ b/sdk/deploymentmanager/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-deploymentmanager-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-deploymentmanager + + + +