diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2ccca44bea9c9..8e506bb8b2b9a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -214,6 +214,7 @@ com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-communication;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-changeanalysis;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 7243bcc987677..d610ab35be999 100644 --- a/pom.xml +++ b/pom.xml @@ -596,6 +596,7 @@ sdk/authorization sdk/batch sdk/boms + sdk/changeanalysis sdk/cognitiveservices sdk/communication sdk/confluent diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/CHANGELOG.md b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/CHANGELOG.md new file mode 100644 index 0000000000000..4595d9985228c --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-18) + +- Azure Resource Manager AzureChangeAnalysis client library for Java. This package contains Microsoft Azure SDK for AzureChangeAnalysis Management SDK. Package tag package-2020-04-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/changeanalysis/azure-resourcemanager-changeanalysis/README.md b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/README.md new file mode 100644 index 0000000000000..e551314d7773f --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager AzureChangeAnalysis client library for Java + +Azure Resource Manager AzureChangeAnalysis client library for Java. + +This package contains Microsoft Azure SDK for AzureChangeAnalysis Management SDK. Package tag package-2020-04-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-changeanalysis;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-changeanalysis + 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(); +AzureChangeAnalysisManager manager = AzureChangeAnalysisManager + .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/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml new file mode 100644 index 0000000000000..32a9705c2282b --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/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-changeanalysis + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for AzureChangeAnalysis Management + This package contains Microsoft Azure SDK for AzureChangeAnalysis Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-04-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.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManager.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManager.java new file mode 100644 index 0000000000000..20d8548eca66b --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManager.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis; + +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.changeanalysis.fluent.AzureChangeAnalysisManagementClient; +import com.azure.resourcemanager.changeanalysis.implementation.AzureChangeAnalysisManagementClientBuilder; +import com.azure.resourcemanager.changeanalysis.implementation.ConfigurationProfilesImpl; +import com.azure.resourcemanager.changeanalysis.implementation.OperationsImpl; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfiles; +import com.azure.resourcemanager.changeanalysis.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to AzureChangeAnalysisManager. */ +public final class AzureChangeAnalysisManager { + private ConfigurationProfiles configurationProfiles; + + private Operations operations; + + private final AzureChangeAnalysisManagementClient clientObject; + + private AzureChangeAnalysisManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureChangeAnalysisManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of AzureChangeAnalysis service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureChangeAnalysis service API instance. + */ + public static AzureChangeAnalysisManager 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 AzureChangeAnalysisManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AzureChangeAnalysisManager.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 AzureChangeAnalysis service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the AzureChangeAnalysis service API instance. + */ + public AzureChangeAnalysisManager 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.changeanalysis") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AzureChangeAnalysisManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ConfigurationProfiles. */ + public ConfigurationProfiles configurationProfiles() { + if (this.configurationProfiles == null) { + this.configurationProfiles = new ConfigurationProfilesImpl(clientObject.getConfigurationProfiles(), this); + } + return configurationProfiles; + } + + /** @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 AzureChangeAnalysisManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AzureChangeAnalysisManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/AzureChangeAnalysisManagementClient.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/AzureChangeAnalysisManagementClient.java new file mode 100644 index 0000000000000..0c4937482aeca --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/AzureChangeAnalysisManagementClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureChangeAnalysisManagementClient class. */ +public interface AzureChangeAnalysisManagementClient { + /** + * Gets The ID of the target subscription. + * + * @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 ConfigurationProfilesClient object to access its operations. + * + * @return the ConfigurationProfilesClient object. + */ + ConfigurationProfilesClient getConfigurationProfiles(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ConfigurationProfilesClient.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ConfigurationProfilesClient.java new file mode 100644 index 0000000000000..0080b5ea59bfe --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ConfigurationProfilesClient.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.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.changeanalysis.fluent.models.ConfigurationProfileResourceInner; + +/** An instance of this class provides access to all the operations defined in ConfigurationProfilesClient. */ +public interface ConfigurationProfilesClient { + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationProfileResourceInner get(String profileName); + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String profileName, Context context); + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationProfileResourceInner create(String profileName); + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body Request body containing new configuration profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String profileName, ConfigurationProfileResourceInner body, Context context); + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationProfileResourceInner update(String profileName); + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body The parameters for updating a configuration store. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String profileName, ConfigurationProfileResourceInner body, Context context); + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 profileName); + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 profileName, Context context); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/OperationsClient.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c1e106f9ba9a9 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/OperationsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @throws com.azure.core.management.exception.ManagementException 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 provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String skipToken, Context context); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ConfigurationProfileResourceInner.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ConfigurationProfileResourceInner.java new file mode 100644 index 0000000000000..6be2d4f4e9df4 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ConfigurationProfileResourceInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfileResourceProperties; +import com.azure.resourcemanager.changeanalysis.models.ExtendedProxyResource; +import com.azure.resourcemanager.changeanalysis.models.ResourceIdentity; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A profile object that contains change analysis configuration, such as notification settings, for this subscription. + */ +@Fluent +public final class ConfigurationProfileResourceInner extends ExtendedProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationProfileResourceInner.class); + + /* + * The identity block returned by ARM resource that supports managed + * identity. + */ + @JsonProperty(value = "identity") + private ResourceIdentity identity; + + /* + * The properties of a configuration profile. + */ + @JsonProperty(value = "properties") + private ConfigurationProfileResourceProperties properties; + + /** + * Get the identity property: The identity block returned by ARM resource that supports managed identity. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity block returned by ARM resource that supports managed identity. + * + * @param identity the identity value to set. + * @return the ConfigurationProfileResourceInner object itself. + */ + public ConfigurationProfileResourceInner withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the properties property: The properties of a configuration profile. + * + * @return the properties value. + */ + public ConfigurationProfileResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a configuration profile. + * + * @param properties the properties value to set. + * @return the ConfigurationProfileResourceInner object itself. + */ + public ConfigurationProfileResourceInner withProperties(ConfigurationProfileResourceProperties properties) { + this.properties = properties; + return this; + } + + /** {@inheritDoc} */ + @Override + public ConfigurationProfileResourceInner withSystemData(SystemData systemData) { + super.withSystemData(systemData); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (identity() != null) { + identity().validate(); + } + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ResourceProviderOperationDefinitionInner.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ResourceProviderOperationDefinitionInner.java new file mode 100644 index 0000000000000..ed996004c874e --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ResourceProviderOperationDefinitionInner.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.changeanalysis.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.models.ResourceProviderOperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource provider operation definition. */ +@Fluent +public final class ResourceProviderOperationDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDefinitionInner.class); + + /* + * The resource provider operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The resource provider operation details. + */ + @JsonProperty(value = "display") + private ResourceProviderOperationDisplay display; + + /** + * Get the name property: The resource provider operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The resource provider operation name. + * + * @param name the name value to set. + * @return the ResourceProviderOperationDefinitionInner object itself. + */ + public ResourceProviderOperationDefinitionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The resource provider operation details. + * + * @return the display value. + */ + public ResourceProviderOperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The resource provider operation details. + * + * @param display the display value to set. + * @return the ResourceProviderOperationDefinitionInner object itself. + */ + public ResourceProviderOperationDefinitionInner withDisplay(ResourceProviderOperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/package-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/package-info.java new file mode 100644 index 0000000000000..179a96e4a2ec8 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for AzureChangeAnalysisManagementClient. null. */ +package com.azure.resourcemanager.changeanalysis.fluent.models; diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/package-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/package-info.java new file mode 100644 index 0000000000000..bd1d2e97729c2 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for AzureChangeAnalysisManagementClient. null. */ +package com.azure.resourcemanager.changeanalysis.fluent; diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientBuilder.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientBuilder.java new file mode 100644 index 0000000000000..9e6b2f8846e2a --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientBuilder.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.changeanalysis.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 AzureChangeAnalysisManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureChangeAnalysisManagementClientImpl.class}) +public final class AzureChangeAnalysisManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder 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 AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder 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 AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder 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 AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder 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 AzureChangeAnalysisManagementClientBuilder. + */ + public AzureChangeAnalysisManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureChangeAnalysisManagementClientImpl with the provided parameters. + * + * @return an instance of AzureChangeAnalysisManagementClientImpl. + */ + public AzureChangeAnalysisManagementClientImpl 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(); + } + AzureChangeAnalysisManagementClientImpl client = + new AzureChangeAnalysisManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientImpl.java new file mode 100644 index 0000000000000..1b50805363572 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.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.changeanalysis.fluent.AzureChangeAnalysisManagementClient; +import com.azure.resourcemanager.changeanalysis.fluent.ConfigurationProfilesClient; +import com.azure.resourcemanager.changeanalysis.fluent.OperationsClient; +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 AzureChangeAnalysisManagementClientImpl type. */ +@ServiceClient(builder = AzureChangeAnalysisManagementClientBuilder.class) +public final class AzureChangeAnalysisManagementClientImpl implements AzureChangeAnalysisManagementClient { + private final ClientLogger logger = new ClientLogger(AzureChangeAnalysisManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @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 ConfigurationProfilesClient object to access its operations. */ + private final ConfigurationProfilesClient configurationProfiles; + + /** + * Gets the ConfigurationProfilesClient object to access its operations. + * + * @return the ConfigurationProfilesClient object. + */ + public ConfigurationProfilesClient getConfigurationProfiles() { + return this.configurationProfiles; + } + + /** 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 AzureChangeAnalysisManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AzureChangeAnalysisManagementClientImpl( + 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 = "2020-04-01-preview"; + this.configurationProfiles = new ConfigurationProfilesClientImpl(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/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfileResourceImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfileResourceImpl.java new file mode 100644 index 0000000000000..a7bc3a9e92adb --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfileResourceImpl.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.changeanalysis.fluent.models.ConfigurationProfileResourceInner; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfileResource; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfileResourceProperties; +import com.azure.resourcemanager.changeanalysis.models.ResourceIdentity; + +public final class ConfigurationProfileResourceImpl + implements ConfigurationProfileResource, + ConfigurationProfileResource.Definition, + ConfigurationProfileResource.Update { + private ConfigurationProfileResourceInner innerObject; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceIdentity identity() { + return this.innerModel().identity(); + } + + public ConfigurationProfileResourceProperties properties() { + return this.innerModel().properties(); + } + + public ConfigurationProfileResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager manager() { + return this.serviceManager; + } + + private String profileName; + + public ConfigurationProfileResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurationProfiles() + .createWithResponse(profileName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConfigurationProfileResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurationProfiles() + .createWithResponse(profileName, this.innerModel(), context) + .getValue(); + return this; + } + + ConfigurationProfileResourceImpl( + String name, com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerObject = new ConfigurationProfileResourceInner(); + this.serviceManager = serviceManager; + this.profileName = name; + } + + public ConfigurationProfileResourceImpl update() { + return this; + } + + public ConfigurationProfileResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurationProfiles() + .updateWithResponse(profileName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ConfigurationProfileResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurationProfiles() + .updateWithResponse(profileName, this.innerModel(), context) + .getValue(); + return this; + } + + ConfigurationProfileResourceImpl( + ConfigurationProfileResourceInner innerObject, + com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.profileName = Utils.getValueFromIdByName(innerObject.id(), "profile"); + } + + public ConfigurationProfileResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurationProfiles() + .getWithResponse(profileName, Context.NONE) + .getValue(); + return this; + } + + public ConfigurationProfileResource refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getConfigurationProfiles().getWithResponse(profileName, context).getValue(); + return this; + } + + public ConfigurationProfileResourceImpl withSystemData(SystemData systemData) { + this.innerModel().withSystemData(systemData); + return this; + } + + public ConfigurationProfileResourceImpl withIdentity(ResourceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ConfigurationProfileResourceImpl withProperties(ConfigurationProfileResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesClientImpl.java new file mode 100644 index 0000000000000..005b6611e3251 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesClientImpl.java @@ -0,0 +1,759 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.changeanalysis.fluent.ConfigurationProfilesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ConfigurationProfileResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ConfigurationProfilesClient. */ +public final class ConfigurationProfilesClientImpl implements ConfigurationProfilesClient { + private final ClientLogger logger = new ClientLogger(ConfigurationProfilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ConfigurationProfilesService service; + + /** The service client containing this operation class. */ + private final AzureChangeAnalysisManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConfigurationProfilesClientImpl(AzureChangeAnalysisManagementClientImpl client) { + this.service = + RestProxy + .create(ConfigurationProfilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureChangeAnalysisManagementClientConfigurationProfiles to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureChangeAnalysisM") + private interface ConfigurationProfilesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/profile/{profileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("profileName") String profileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/profile/{profileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("profileName") String profileName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ConfigurationProfileResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/profile/{profileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("profileName") String profileName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ConfigurationProfileResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/profile/{profileName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("profileName") String profileName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String profileName) { + 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String profileName, 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName 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(), + profileName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String profileName) { + return getWithResponseAsync(profileName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationProfileResourceInner get(String profileName) { + return getAsync(profileName).block(); + } + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 configuration profile for the Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String profileName, Context context) { + return getWithResponseAsync(profileName, context).block(); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body Request body containing new configuration profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String profileName, ConfigurationProfileResourceInner body) { + 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body Request body containing new configuration profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String profileName, ConfigurationProfileResourceInner body, 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body Request body containing new configuration profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String profileName, ConfigurationProfileResourceInner body) { + return createWithResponseAsync(profileName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String profileName) { + final ConfigurationProfileResourceInner body = null; + return createWithResponseAsync(profileName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationProfileResourceInner create(String profileName) { + final ConfigurationProfileResourceInner body = null; + return createAsync(profileName, body).block(); + } + + /** + * Updates configuration profile for for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body Request body containing new configuration profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String profileName, ConfigurationProfileResourceInner body, Context context) { + return createWithResponseAsync(profileName, body, context).block(); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String profileName, ConfigurationProfileResourceInner body) { + 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + body, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body The parameters for updating a configuration store. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String profileName, ConfigurationProfileResourceInner body, 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body The parameters for updating a configuration store. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String profileName, ConfigurationProfileResourceInner body) { + return updateWithResponseAsync(profileName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String profileName) { + final ConfigurationProfileResourceInner body = null; + return updateWithResponseAsync(profileName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationProfileResourceInner update(String profileName) { + final ConfigurationProfileResourceInner body = null; + return updateAsync(profileName, body).block(); + } + + /** + * Updates a configuration profile with the specified parameters. The profile name should be always set to + * 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @param body The parameters for updating a configuration store. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a profile object that contains change analysis configuration, such as notification settings, for this + * subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String profileName, ConfigurationProfileResourceInner body, Context context) { + return updateWithResponseAsync(profileName, body, context).block(); + } + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 profileName) { + 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + profileName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 profileName, 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 (profileName == null) { + return Mono.error(new IllegalArgumentException("Parameter profileName 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(), + profileName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 profileName) { + return deleteWithResponseAsync(profileName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 profileName) { + deleteAsync(profileName).block(); + } + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 profileName, Context context) { + return deleteWithResponseAsync(profileName, context).block(); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesImpl.java new file mode 100644 index 0000000000000..febbc580c948b --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ConfigurationProfilesImpl.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.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.changeanalysis.fluent.ConfigurationProfilesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ConfigurationProfileResourceInner; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfileResource; +import com.azure.resourcemanager.changeanalysis.models.ConfigurationProfiles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ConfigurationProfilesImpl implements ConfigurationProfiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationProfilesImpl.class); + + private final ConfigurationProfilesClient innerClient; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + public ConfigurationProfilesImpl( + ConfigurationProfilesClient innerClient, + com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ConfigurationProfileResource get(String profileName) { + ConfigurationProfileResourceInner inner = this.serviceClient().get(profileName); + if (inner != null) { + return new ConfigurationProfileResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse(String profileName, Context context) { + Response inner = this.serviceClient().getWithResponse(profileName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationProfileResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String profileName) { + this.serviceClient().delete(profileName); + } + + public Response deleteWithResponse(String profileName, Context context) { + return this.serviceClient().deleteWithResponse(profileName, context); + } + + public ConfigurationProfileResource getById(String id) { + String profileName = Utils.getValueFromIdByName(id, "profile"); + if (profileName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'profile'.", id))); + } + return this.getWithResponse(profileName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String profileName = Utils.getValueFromIdByName(id, "profile"); + if (profileName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'profile'.", id))); + } + return this.getWithResponse(profileName, context); + } + + public void deleteById(String id) { + String profileName = Utils.getValueFromIdByName(id, "profile"); + if (profileName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'profile'.", id))); + } + this.deleteWithResponse(profileName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String profileName = Utils.getValueFromIdByName(id, "profile"); + if (profileName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'profile'.", id))); + } + return this.deleteWithResponse(profileName, context); + } + + private ConfigurationProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager manager() { + return this.serviceManager; + } + + public ConfigurationProfileResourceImpl define(String name) { + return new ConfigurationProfileResourceImpl(name, this.manager()); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..a40fd5b52c44a --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsClientImpl.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.fluent.OperationsClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.changeanalysis.models.ResourceProviderOperationList; +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 AzureChangeAnalysisManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureChangeAnalysisManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureChangeAnalysisManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureChangeAnalysisM") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ChangeAnalysis/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String skipToken) { + 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(), skipToken, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String skipToken, 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(), skipToken, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String skipToken) { + return new PagedFlux<>(() -> listSinglePageAsync(skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @throws ManagementException 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 provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String skipToken = null; + return new PagedFlux<>(() -> listSinglePageAsync(skipToken), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(skipToken, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @throws ManagementException 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 provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String skipToken = null; + return new PagedIterable<>(listAsync(skipToken)); + } + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String skipToken, Context context) { + return new PagedIterable<>(listAsync(skipToken, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..d7fa7f3b075a6 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsImpl.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.changeanalysis.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.fluent.OperationsClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.changeanalysis.models.Operations; +import com.azure.resourcemanager.changeanalysis.models.ResourceProviderOperationDefinition; +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.changeanalysis.AzureChangeAnalysisManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String skipToken, Context context) { + PagedIterable inner = this.serviceClient().list(skipToken, context); + return Utils.mapPage(inner, inner1 -> new ResourceProviderOperationDefinitionImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceProviderOperationDefinitionImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceProviderOperationDefinitionImpl.java new file mode 100644 index 0000000000000..7d5146a8dddfd --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceProviderOperationDefinitionImpl.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.changeanalysis.implementation; + +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; +import com.azure.resourcemanager.changeanalysis.models.ResourceProviderOperationDefinition; +import com.azure.resourcemanager.changeanalysis.models.ResourceProviderOperationDisplay; + +public final class ResourceProviderOperationDefinitionImpl implements ResourceProviderOperationDefinition { + private ResourceProviderOperationDefinitionInner innerObject; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + ResourceProviderOperationDefinitionImpl( + ResourceProviderOperationDefinitionInner innerObject, + com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public ResourceProviderOperationDisplay display() { + return this.innerModel().display(); + } + + public ResourceProviderOperationDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/Utils.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/Utils.java new file mode 100644 index 0000000000000..a0cf0540476a4 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/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.changeanalysis.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/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/package-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/package-info.java new file mode 100644 index 0000000000000..a81b3746f9cce --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for AzureChangeAnalysisManagementClient. null. */ +package com.azure.resourcemanager.changeanalysis.implementation; diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/AzureMonitorWorkspaceProperties.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/AzureMonitorWorkspaceProperties.java new file mode 100644 index 0000000000000..31aff0ab93753 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/AzureMonitorWorkspaceProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.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; + +/** Configuration properties of an Azure Monitor workspace that receives change notifications. */ +@Fluent +public final class AzureMonitorWorkspaceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureMonitorWorkspaceProperties.class); + + /* + * The Azure Monitor workspace ID - the unique identifier for the Log + * Analytics workspace. + */ + @JsonProperty(value = "workspaceId") + private String workspaceId; + + /* + * The Azure Monitor workspace ARM Resource ID. The resource ID should be + * in the following format: + * /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName} + */ + @JsonProperty(value = "workspaceResourceId") + private String workspaceResourceId; + + /** + * Get the workspaceId property: The Azure Monitor workspace ID - the unique identifier for the Log Analytics + * workspace. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: The Azure Monitor workspace ID - the unique identifier for the Log Analytics + * workspace. + * + * @param workspaceId the workspaceId value to set. + * @return the AzureMonitorWorkspaceProperties object itself. + */ + public AzureMonitorWorkspaceProperties withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the workspaceResourceId property: The Azure Monitor workspace ARM Resource ID. The resource ID should be in + * the following format: + * /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}. + * + * @return the workspaceResourceId value. + */ + public String workspaceResourceId() { + return this.workspaceResourceId; + } + + /** + * Set the workspaceResourceId property: The Azure Monitor workspace ARM Resource ID. The resource ID should be in + * the following format: + * /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}. + * + * @param workspaceResourceId the workspaceResourceId value to set. + * @return the AzureMonitorWorkspaceProperties object itself. + */ + public AzureMonitorWorkspaceProperties withWorkspaceResourceId(String workspaceResourceId) { + this.workspaceResourceId = workspaceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResource.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResource.java new file mode 100644 index 0000000000000..c2c6299d378ff --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResource.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.changeanalysis.fluent.models.ConfigurationProfileResourceInner; + +/** An immutable client-side representation of ConfigurationProfileResource. */ +public interface ConfigurationProfileResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the identity property: The identity block returned by ARM resource that supports managed identity. + * + * @return the identity value. + */ + ResourceIdentity identity(); + + /** + * Gets the properties property: The properties of a configuration profile. + * + * @return the properties value. + */ + ConfigurationProfileResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.changeanalysis.fluent.models.ConfigurationProfileResourceInner object. + * + * @return the inner object. + */ + ConfigurationProfileResourceInner innerModel(); + + /** The entirety of the ConfigurationProfileResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCreate { + } + /** The ConfigurationProfileResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ConfigurationProfileResource definition. */ + interface Blank extends WithCreate { + } + /** + * The stage of the ConfigurationProfileResource 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.WithSystemData, DefinitionStages.WithIdentity, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ConfigurationProfileResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ConfigurationProfileResource create(Context context); + } + /** The stage of the ConfigurationProfileResource definition allowing to specify systemData. */ + interface WithSystemData { + /** + * Specifies the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @param systemData Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * @return the next definition stage. + */ + WithCreate withSystemData(SystemData systemData); + } + /** The stage of the ConfigurationProfileResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity block returned by ARM resource that supports managed + * identity.. + * + * @param identity The identity block returned by ARM resource that supports managed identity. + * @return the next definition stage. + */ + WithCreate withIdentity(ResourceIdentity identity); + } + /** The stage of the ConfigurationProfileResource definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a configuration profile.. + * + * @param properties The properties of a configuration profile. + * @return the next definition stage. + */ + WithCreate withProperties(ConfigurationProfileResourceProperties properties); + } + } + /** + * Begins update for the ConfigurationProfileResource resource. + * + * @return the stage of resource update. + */ + ConfigurationProfileResource.Update update(); + + /** The template for ConfigurationProfileResource update. */ + interface Update extends UpdateStages.WithSystemData, UpdateStages.WithIdentity, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ConfigurationProfileResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ConfigurationProfileResource apply(Context context); + } + /** The ConfigurationProfileResource update stages. */ + interface UpdateStages { + /** The stage of the ConfigurationProfileResource update allowing to specify systemData. */ + interface WithSystemData { + /** + * Specifies the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @param systemData Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * @return the next definition stage. + */ + Update withSystemData(SystemData systemData); + } + /** The stage of the ConfigurationProfileResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity block returned by ARM resource that supports managed + * identity.. + * + * @param identity The identity block returned by ARM resource that supports managed identity. + * @return the next definition stage. + */ + Update withIdentity(ResourceIdentity identity); + } + /** The stage of the ConfigurationProfileResource update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a configuration profile.. + * + * @param properties The properties of a configuration profile. + * @return the next definition stage. + */ + Update withProperties(ConfigurationProfileResourceProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ConfigurationProfileResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ConfigurationProfileResource refresh(Context context); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResourceProperties.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResourceProperties.java new file mode 100644 index 0000000000000..ecc04163afd6c --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfileResourceProperties.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.changeanalysis.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 configuration profile. */ +@Fluent +public final class ConfigurationProfileResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationProfileResourceProperties.class); + + /* + * Settings of change notification configuration for a subscription. + */ + @JsonProperty(value = "notifications") + private NotificationSettings notifications; + + /** + * Get the notifications property: Settings of change notification configuration for a subscription. + * + * @return the notifications value. + */ + public NotificationSettings notifications() { + return this.notifications; + } + + /** + * Set the notifications property: Settings of change notification configuration for a subscription. + * + * @param notifications the notifications value to set. + * @return the ConfigurationProfileResourceProperties object itself. + */ + public ConfigurationProfileResourceProperties withNotifications(NotificationSettings notifications) { + this.notifications = notifications; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (notifications() != null) { + notifications().validate(); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfiles.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfiles.java new file mode 100644 index 0000000000000..5aaed476f9470 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ConfigurationProfiles.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ConfigurationProfiles. */ +public interface ConfigurationProfiles { + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the configuration profile for the Microsoft. + */ + ConfigurationProfileResource get(String profileName); + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 configuration profile for the Microsoft. + */ + Response getWithResponse(String profileName, Context context); + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 profileName); + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @param profileName The name of the configuration profile. The profile name should be set to 'default', all other + * names will be overwritten. + * @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 profileName, Context context); + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @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 configuration profile for the Microsoft. + */ + ConfigurationProfileResource getById(String id); + + /** + * Gets the configuration profile for the Microsoft.ChangeAnalysis resource provider. The profile name should be + * always set to 'default'. + * + * @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 configuration profile for the Microsoft. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes existing configuration profile. The profile name should be always set to 'default'. + * + * @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 existing configuration profile. The profile name should be always set to 'default'. + * + * @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 ConfigurationProfileResource resource. + * + * @param name resource name. + * @return the first stage of the new ConfigurationProfileResource definition. + */ + ConfigurationProfileResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ErrorAdditionalInfo.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ErrorAdditionalInfo.java new file mode 100644 index 0000000000000..6ee8f4f206cfe --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ErrorAdditionalInfo.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.changeanalysis.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ExtendedProxyResource.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ExtendedProxyResource.java new file mode 100644 index 0000000000000..c277de57ac892 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ExtendedProxyResource.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.changeanalysis.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure resource. */ +@Fluent +public class ExtendedProxyResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtendedProxyResource.class); + + /* + * Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources + */ + @JsonProperty(value = "systemData") + private SystemData systemData; + + /** + * Get the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Set the systemData property: Top level metadata + * https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + * + * @param systemData the systemData value to set. + * @return the ExtendedProxyResource object itself. + */ + public ExtendedProxyResource withSystemData(SystemData systemData) { + this.systemData = systemData; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ManagedIdentityTypes.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ManagedIdentityTypes.java new file mode 100644 index 0000000000000..7e35a54ae50e8 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ManagedIdentityTypes.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedIdentityTypes. */ +public final class ManagedIdentityTypes extends ExpandableStringEnum { + /** Static value None for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedIdentityTypes. */ + public static final ManagedIdentityTypes SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Creates or finds a ManagedIdentityTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedIdentityTypes. + */ + @JsonCreator + public static ManagedIdentityTypes fromString(String name) { + return fromString(name, ManagedIdentityTypes.class); + } + + /** @return known ManagedIdentityTypes values. */ + public static Collection values() { + return values(ManagedIdentityTypes.class); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationSettings.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationSettings.java new file mode 100644 index 0000000000000..16eb919e47864 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationSettings.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.changeanalysis.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; + +/** Settings of change notification configuration for a subscription. */ +@Fluent +public final class NotificationSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NotificationSettings.class); + + /* + * Configuration properties of an Azure Monitor workspace that receives + * change notifications. + */ + @JsonProperty(value = "azureMonitorWorkspaceProperties") + private AzureMonitorWorkspaceProperties azureMonitorWorkspaceProperties; + + /* + * The state of notifications feature. + */ + @JsonProperty(value = "activationState") + private NotificationsState activationState; + + /** + * Get the azureMonitorWorkspaceProperties property: Configuration properties of an Azure Monitor workspace that + * receives change notifications. + * + * @return the azureMonitorWorkspaceProperties value. + */ + public AzureMonitorWorkspaceProperties azureMonitorWorkspaceProperties() { + return this.azureMonitorWorkspaceProperties; + } + + /** + * Set the azureMonitorWorkspaceProperties property: Configuration properties of an Azure Monitor workspace that + * receives change notifications. + * + * @param azureMonitorWorkspaceProperties the azureMonitorWorkspaceProperties value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withAzureMonitorWorkspaceProperties( + AzureMonitorWorkspaceProperties azureMonitorWorkspaceProperties) { + this.azureMonitorWorkspaceProperties = azureMonitorWorkspaceProperties; + return this; + } + + /** + * Get the activationState property: The state of notifications feature. + * + * @return the activationState value. + */ + public NotificationsState activationState() { + return this.activationState; + } + + /** + * Set the activationState property: The state of notifications feature. + * + * @param activationState the activationState value to set. + * @return the NotificationSettings object itself. + */ + public NotificationSettings withActivationState(NotificationsState activationState) { + this.activationState = activationState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (azureMonitorWorkspaceProperties() != null) { + azureMonitorWorkspaceProperties().validate(); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationsState.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationsState.java new file mode 100644 index 0000000000000..7870c9a3d5e18 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/NotificationsState.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NotificationsState. */ +public final class NotificationsState extends ExpandableStringEnum { + /** Static value None for NotificationsState. */ + public static final NotificationsState NONE = fromString("None"); + + /** Static value Enabled for NotificationsState. */ + public static final NotificationsState ENABLED = fromString("Enabled"); + + /** Static value Disabled for NotificationsState. */ + public static final NotificationsState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a NotificationsState from its string representation. + * + * @param name a name to look for. + * @return the corresponding NotificationsState. + */ + @JsonCreator + public static NotificationsState fromString(String name) { + return fromString(name, NotificationsState.class); + } + + /** @return known NotificationsState values. */ + public static Collection values() { + return values(NotificationsState.class); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Operations.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Operations.java new file mode 100644 index 0000000000000..58ae7216a259e --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Operations.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.changeanalysis.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @throws com.azure.core.management.exception.ManagementException 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 provider operation list. + */ + PagedIterable list(); + + /** + * Lists all the supported operations by the Microsoft.ChangeAnalysis resource provider along with their + * descriptions. + * + * @param skipToken A skip token is used to continue retrieving items after an operation returns a partial result. + * If a previous response contains a nextLink element, the value of the nextLink element will include a + * skipToken parameter that specifies a starting point to use for subsequent calls. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the resource provider operation list. + */ + PagedIterable list(String skipToken, Context context); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceIdentity.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceIdentity.java new file mode 100644 index 0000000000000..3dce8ebf3632a --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.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.UUID; + +/** The identity block returned by ARM resource that supports managed identity. */ +@Fluent +public class ResourceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceIdentity.class); + + /* + * The type of managed identity used. The type 'SystemAssigned, + * UserAssigned' includes both an implicitly created identity and a set of + * user-assigned identities. The type 'None' will remove any identities. + */ + @JsonProperty(value = "type") + private ManagedIdentityTypes type; + + /* + * The principal id of the identity. This property will only be provided + * for a system-assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant id associated with the resource's identity. This property + * will only be provided for a system-assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /** + * Get the type property: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both + * an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. + * + * @return the type value. + */ + public ManagedIdentityTypes type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both + * an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. + * + * @param type the type value to set. + * @return the ResourceIdentity object itself. + */ + public ResourceIdentity withType(ManagedIdentityTypes type) { + this.type = type; + return this; + } + + /** + * Get the principalId property: The principal id of the identity. This property will only be provided for a + * system-assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id associated with the resource's identity. This property will only be + * provided for a system-assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDefinition.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDefinition.java new file mode 100644 index 0000000000000..d5eb5bb44eee4 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDefinition.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.changeanalysis.models; + +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; + +/** An immutable client-side representation of ResourceProviderOperationDefinition. */ +public interface ResourceProviderOperationDefinition { + /** + * Gets the name property: The resource provider operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The resource provider operation details. + * + * @return the display value. + */ + ResourceProviderOperationDisplay display(); + + /** + * Gets the inner com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner + * object. + * + * @return the inner object. + */ + ResourceProviderOperationDefinitionInner innerModel(); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDisplay.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDisplay.java new file mode 100644 index 0000000000000..a1ba10968aa64 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDisplay.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.changeanalysis.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 resource provider operation details. */ +@Fluent +public final class ResourceProviderOperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationDisplay.class); + + /* + * Name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Name of the resource type. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Name of the resource provider operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the resource provider operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the resource provider. + * + * @param provider the provider value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Name of the resource type. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Name of the resource type. + * + * @param resource the resource value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Name of the resource provider operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Name of the resource provider operation. + * + * @param operation the operation value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the resource provider operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the resource provider operation. + * + * @param description the description value to set. + * @return the ResourceProviderOperationDisplay object itself. + */ + public ResourceProviderOperationDisplay 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/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationList.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationList.java new file mode 100644 index 0000000000000..ea4119757c23b --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationList.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.fluent.models.ResourceProviderOperationDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The resource provider operation list. */ +@Fluent +public final class ResourceProviderOperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProviderOperationList.class); + + /* + * Resource provider operations list. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI that can be used to request the next page for list of Azure + * operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Resource provider operations list. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Resource provider operations list. + * + * @param value the value value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI that can be used to request the next page for list of Azure operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI that can be used to request the next page for list of Azure operations. + * + * @param nextLink the nextLink value to set. + * @return the ResourceProviderOperationList object itself. + */ + public ResourceProviderOperationList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/package-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/package-info.java new file mode 100644 index 0000000000000..64f0b95e8951f --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for AzureChangeAnalysisManagementClient. null. */ +package com.azure.resourcemanager.changeanalysis.models; diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/package-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/package-info.java new file mode 100644 index 0000000000000..b61c68b832307 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for AzureChangeAnalysisManagementClient. null. */ +package com.azure.resourcemanager.changeanalysis; diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/module-info.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/module-info.java new file mode 100644 index 0000000000000..a38d73fdb0b45 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/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.changeanalysis { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.changeanalysis; + exports com.azure.resourcemanager.changeanalysis.fluent; + exports com.azure.resourcemanager.changeanalysis.fluent.models; + exports com.azure.resourcemanager.changeanalysis.models; + + opens com.azure.resourcemanager.changeanalysis.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.changeanalysis.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/changeanalysis/ci.yml b/sdk/changeanalysis/ci.yml new file mode 100644 index 0000000000000..8d457461c3758 --- /dev/null +++ b/sdk/changeanalysis/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/changeanalysis/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/changeanalysis/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: changeanalysis + Artifacts: + - name: azure-resourcemanager-changeanalysis + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerchangeanalysis diff --git a/sdk/changeanalysis/pom.xml b/sdk/changeanalysis/pom.xml new file mode 100644 index 0000000000000..8a3f74d16d657 --- /dev/null +++ b/sdk/changeanalysis/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-changeanalysis-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-changeanalysis + + + +