From 70b81ae6b7ff827c30d39ba92e1cb2bac9da3c15 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Thu, 25 Mar 2021 18:59:58 -0700 Subject: [PATCH] [Automation] Generate Fluent Lite from changeanalysis# (#20109) * [Automation] External Change * [Automation] Generate Fluent Lite from changeanalysis# * Update pom.xml Co-authored-by: Weidong Xu --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 +++ .../pom.xml | 67 ++ .../AzureChangeAnalysisManager.java | 238 ++++++ .../AzureChangeAnalysisManagementClient.java | 67 ++ .../changeanalysis/fluent/ChangesClient.java | 80 ++ .../fluent/OperationsClient.java | 41 + .../fluent/ResourceChangesClient.java | 50 ++ .../fluent/models/ChangeInner.java | 55 ++ ...ourceProviderOperationDefinitionInner.java | 80 ++ .../fluent/models/package-info.java | 6 + .../changeanalysis/fluent/package-info.java | 6 + ...ChangeAnalysisManagementClientBuilder.java | 146 ++++ ...ureChangeAnalysisManagementClientImpl.java | 321 ++++++++ .../implementation/ChangeImpl.java | 45 ++ .../implementation/ChangesClientImpl.java | 707 ++++++++++++++++++ .../implementation/ChangesImpl.java | 62 ++ .../implementation/OperationsClientImpl.java | 311 ++++++++ .../implementation/OperationsImpl.java | 47 ++ .../ResourceChangesClientImpl.java | 382 ++++++++++ .../implementation/ResourceChangesImpl.java | 50 ++ ...sourceProviderOperationDefinitionImpl.java | 38 + .../changeanalysis/implementation/Utils.java | 204 +++++ .../implementation/package-info.java | 6 + .../changeanalysis/models/Change.java | 45 ++ .../changeanalysis/models/ChangeCategory.java | 47 ++ .../changeanalysis/models/ChangeList.java | 81 ++ .../models/ChangeProperties.java | 163 ++++ .../changeanalysis/models/ChangeType.java | 37 + .../changeanalysis/models/Changes.java | 72 ++ .../models/ErrorAdditionalInfo.java | 54 ++ .../changeanalysis/models/Level.java | 37 + .../changeanalysis/models/Operations.java | 36 + .../changeanalysis/models/PropertyChange.java | 266 +++++++ .../models/ResourceChanges.java | 45 ++ .../ResourceProviderOperationDefinition.java | 32 + .../ResourceProviderOperationDisplay.java | 128 ++++ .../models/ResourceProviderOperationList.java | 82 ++ .../changeanalysis/models/package-info.java | 6 + .../changeanalysis/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/changeanalysis/ci.yml | 33 + sdk/changeanalysis/pom.xml | 53 ++ 45 files changed, 4357 insertions(+) create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/CHANGELOG.md create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/README.md create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/pom.xml create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManager.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/AzureChangeAnalysisManagementClient.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ChangesClient.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/OperationsClient.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ResourceChangesClient.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ChangeInner.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ResourceProviderOperationDefinitionInner.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/package-info.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/package-info.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientBuilder.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangeImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesClientImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsClientImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesClientImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceProviderOperationDefinitionImpl.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/Utils.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/package-info.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Change.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeCategory.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeList.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeProperties.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeType.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Changes.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ErrorAdditionalInfo.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Level.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Operations.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/PropertyChange.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceChanges.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDefinition.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationDisplay.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceProviderOperationList.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/package-info.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/package-info.java create mode 100644 sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/module-info.java create mode 100644 sdk/changeanalysis/ci.yml create mode 100644 sdk/changeanalysis/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9b725aaed9434..1b2a976246ff0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -216,6 +216,7 @@ com.azure.resourcemanager:azure-resourcemanager-communication;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-resourcegraph;1.0.0-beta.1;1.0.0-beta.2 +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 dd8093ff05783..b20d6f839a1d7 100644 --- a/pom.xml +++ b/pom.xml @@ -658,6 +658,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..091f388bfb6d5 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-25) + +- Azure Resource Manager AzureChangeAnalysis client library for Java. This package contains Microsoft Azure SDK for AzureChangeAnalysis Management SDK. Package tag package-2021-04-01. 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..ff1170508a2b5 --- /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-2021-04-01. 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..b62397ed3d097 --- /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-2021-04-01. + 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.1 + + + 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..dd66ff066d10f --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/AzureChangeAnalysisManager.java @@ -0,0 +1,238 @@ +// 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.ChangesImpl; +import com.azure.resourcemanager.changeanalysis.implementation.OperationsImpl; +import com.azure.resourcemanager.changeanalysis.implementation.ResourceChangesImpl; +import com.azure.resourcemanager.changeanalysis.models.Changes; +import com.azure.resourcemanager.changeanalysis.models.Operations; +import com.azure.resourcemanager.changeanalysis.models.ResourceChanges; +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 Operations operations; + + private ResourceChanges resourceChanges; + + private Changes changes; + + 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 Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of ResourceChanges. */ + public ResourceChanges resourceChanges() { + if (this.resourceChanges == null) { + this.resourceChanges = new ResourceChangesImpl(clientObject.getResourceChanges(), this); + } + return resourceChanges; + } + + /** @return Resource collection API of Changes. */ + public Changes changes() { + if (this.changes == null) { + this.changes = new ChangesImpl(clientObject.getChanges(), this); + } + return changes; + } + + /** + * @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..e401082b8d938 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/AzureChangeAnalysisManagementClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the ResourceChangesClient object to access its operations. + * + * @return the ResourceChangesClient object. + */ + ResourceChangesClient getResourceChanges(); + + /** + * Gets the ChangesClient object to access its operations. + * + * @return the ChangesClient object. + */ + ChangesClient getChanges(); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ChangesClient.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ChangesClient.java new file mode 100644 index 0000000000000..706d7f68a46c4 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ChangesClient.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; + +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.ChangeInner; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in ChangesClient. */ +public interface ChangesClient { + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context); + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, 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/ResourceChangesClient.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ResourceChangesClient.java new file mode 100644 index 0000000000000..745da6ec8d07b --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/ResourceChangesClient.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ChangeInner; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in ResourceChangesClient. */ +public interface ResourceChangesClient { + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceId, OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ChangeInner.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ChangeInner.java new file mode 100644 index 0000000000000..057bea4b03d80 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/fluent/models/ChangeInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.models.ChangeProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The detected change. */ +@Fluent +public final class ChangeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChangeInner.class); + + /* + * The properties of a change. + */ + @JsonProperty(value = "properties") + private ChangeProperties properties; + + /** + * Get the properties property: The properties of a change. + * + * @return the properties value. + */ + public ChangeProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a change. + * + * @param properties the properties value to set. + * @return the ChangeInner object itself. + */ + public ChangeInner withProperties(ChangeProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/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..94d6028ded31f --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/AzureChangeAnalysisManagementClientImpl.java @@ -0,0 +1,321 @@ +// 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.ChangesClient; +import com.azure.resourcemanager.changeanalysis.fluent.OperationsClient; +import com.azure.resourcemanager.changeanalysis.fluent.ResourceChangesClient; +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 OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The ResourceChangesClient object to access its operations. */ + private final ResourceChangesClient resourceChanges; + + /** + * Gets the ResourceChangesClient object to access its operations. + * + * @return the ResourceChangesClient object. + */ + public ResourceChangesClient getResourceChanges() { + return this.resourceChanges; + } + + /** The ChangesClient object to access its operations. */ + private final ChangesClient changes; + + /** + * Gets the ChangesClient object to access its operations. + * + * @return the ChangesClient object. + */ + public ChangesClient getChanges() { + return this.changes; + } + + /** + * 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 = "2021-04-01"; + this.operations = new OperationsClientImpl(this); + this.resourceChanges = new ResourceChangesClientImpl(this); + this.changes = new ChangesClientImpl(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/ChangeImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangeImpl.java new file mode 100644 index 0000000000000..95e99262a281e --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangeImpl.java @@ -0,0 +1,45 @@ +// 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.ChangeInner; +import com.azure.resourcemanager.changeanalysis.models.Change; +import com.azure.resourcemanager.changeanalysis.models.ChangeProperties; + +public final class ChangeImpl implements Change { + private ChangeInner innerObject; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + ChangeImpl( + ChangeInner innerObject, com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ChangeProperties properties() { + return this.innerModel().properties(); + } + + public ChangeInner 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/ChangesClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesClientImpl.java new file mode 100644 index 0000000000000..7f8c0ce74d389 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesClientImpl.java @@ -0,0 +1,707 @@ +// 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.ChangesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner; +import com.azure.resourcemanager.changeanalysis.models.ChangeList; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ChangesClient. */ +public final class ChangesClientImpl implements ChangesClient { + private final ClientLogger logger = new ClientLogger(ChangesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ChangesService service; + + /** The service client containing this operation class. */ + private final AzureChangeAnalysisManagementClientImpl client; + + /** + * Initializes an instance of ChangesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChangesClientImpl(AzureChangeAnalysisManagementClientImpl client) { + this.service = RestProxy.create(ChangesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureChangeAnalysisManagementClientChanges to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureChangeAnalysisM") + private interface ChangesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ChangeAnalysis" + + "/changes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("$startTime") OffsetDateTime startTime, + @QueryParam("$endTime") OffsetDateTime endTime, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ChangeAnalysis/changes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$startTime") OffsetDateTime startTime, + @QueryParam("$endTime") OffsetDateTime endTime, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listChangesByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listChangesBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + startTime, + endTime, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + startTime, + endTime, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, startTime, endTime, skipToken), + nextLink -> listChangesByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, startTime, endTime, skipToken), + nextLink -> listChangesByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, startTime, endTime, skipToken, context), + nextLink -> listChangesByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, startTime, endTime, skipToken)); + } + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, startTime, endTime, skipToken, context)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + 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 (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + startTime, + endTime, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, 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 (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime 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(), + this.client.getSubscriptionId(), + startTime, + endTime, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(startTime, endTime, skipToken), + nextLink -> listChangesBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(startTime, endTime, skipToken), + nextLink -> listChangesBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(startTime, endTime, skipToken, context), + nextLink -> listChangesBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedIterable<>(listAsync(startTime, endTime, skipToken)); + } + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedIterable<>(listAsync(startTime, endTime, 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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listChangesByResourceGroupNextSinglePageAsync(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.listChangesByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listChangesByResourceGroupNextSinglePageAsync( + 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 + .listChangesByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listChangesBySubscriptionNextSinglePageAsync(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.listChangesBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listChangesBySubscriptionNextSinglePageAsync( + 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 + .listChangesBySubscriptionNext(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/ChangesImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesImpl.java new file mode 100644 index 0000000000000..756f13d6d266e --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ChangesImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ChangesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner; +import com.azure.resourcemanager.changeanalysis.models.Change; +import com.azure.resourcemanager.changeanalysis.models.Changes; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class ChangesImpl implements Changes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChangesImpl.class); + + private final ChangesClient innerClient; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + public ChangesImpl( + ChangesClient innerClient, com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, startTime, endTime); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, startTime, endTime, skipToken, context); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + public PagedIterable list(OffsetDateTime startTime, OffsetDateTime endTime) { + PagedIterable inner = this.serviceClient().list(startTime, endTime); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + public PagedIterable list( + OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + PagedIterable inner = this.serviceClient().list(startTime, endTime, skipToken, context); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + private ChangesClient 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/OperationsClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..0b7037028fd45 --- /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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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/ResourceChangesClientImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesClientImpl.java new file mode 100644 index 0000000000000..60dd6ef17c084 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesClientImpl.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.Post; +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.ResourceChangesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner; +import com.azure.resourcemanager.changeanalysis.models.ChangeList; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceChangesClient. */ +public final class ResourceChangesClientImpl implements ResourceChangesClient { + private final ClientLogger logger = new ClientLogger(ResourceChangesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceChangesService service; + + /** The service client containing this operation class. */ + private final AzureChangeAnalysisManagementClientImpl client; + + /** + * Initializes an instance of ResourceChangesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceChangesClientImpl(AzureChangeAnalysisManagementClientImpl client) { + this.service = + RestProxy.create(ResourceChangesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureChangeAnalysisManagementClientResourceChanges to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureChangeAnalysisM") + private interface ResourceChangesService { + @Headers({"Content-Type: application/json"}) + @Post("/{resourceId}/providers/Microsoft.ChangeAnalysis/resourceChanges") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceId") String resourceId, + @QueryParam("$startTime") OffsetDateTime startTime, + @QueryParam("$endTime") OffsetDateTime endTime, + @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); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceId, + startTime, + endTime, + skipToken, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceId == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null.")); + } + if (startTime == null) { + return Mono.error(new IllegalArgumentException("Parameter startTime is required and cannot be null.")); + } + if (endTime == null) { + return Mono.error(new IllegalArgumentException("Parameter endTime 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(), + resourceId, + startTime, + endTime, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, startTime, endTime, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceId, OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, startTime, endTime, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceId, startTime, endTime, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceId, OffsetDateTime startTime, OffsetDateTime endTime) { + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceId, startTime, endTime, skipToken)); + } + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + return new PagedIterable<>(listAsync(resourceId, startTime, endTime, 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 list of detected changes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + @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/ResourceChangesImpl.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesImpl.java new file mode 100644 index 0000000000000..b6be54feea08f --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/implementation/ResourceChangesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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.ResourceChangesClient; +import com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner; +import com.azure.resourcemanager.changeanalysis.models.Change; +import com.azure.resourcemanager.changeanalysis.models.ResourceChanges; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class ResourceChangesImpl implements ResourceChanges { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceChangesImpl.class); + + private final ResourceChangesClient innerClient; + + private final com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager; + + public ResourceChangesImpl( + ResourceChangesClient innerClient, + com.azure.resourcemanager.changeanalysis.AzureChangeAnalysisManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceId, OffsetDateTime startTime, OffsetDateTime endTime) { + PagedIterable inner = this.serviceClient().list(resourceId, startTime, endTime); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceId, startTime, endTime, skipToken, context); + return Utils.mapPage(inner, inner1 -> new ChangeImpl(inner1, this.manager())); + } + + private ResourceChangesClient 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/Change.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Change.java new file mode 100644 index 0000000000000..5183dbe01e9b0 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Change.java @@ -0,0 +1,45 @@ +// 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.ChangeInner; + +/** An immutable client-side representation of Change. */ +public interface Change { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The properties of a change. + * + * @return the properties value. + */ + ChangeProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner object. + * + * @return the inner object. + */ + ChangeInner innerModel(); +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeCategory.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeCategory.java new file mode 100644 index 0000000000000..d4e7aedf7356c --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeCategory.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.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ChangeCategory. */ +public enum ChangeCategory { + /** Enum value User. */ + USER("User"), + + /** Enum value System. */ + SYSTEM("System"); + + /** The actual serialized value for a ChangeCategory instance. */ + private final String value; + + ChangeCategory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ChangeCategory instance. + * + * @param value the serialized value to parse. + * @return the parsed ChangeCategory object, or null if unable to parse. + */ + @JsonCreator + public static ChangeCategory fromString(String value) { + ChangeCategory[] items = ChangeCategory.values(); + for (ChangeCategory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeList.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeList.java new file mode 100644 index 0000000000000..8a3bd917801c9 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.changeanalysis.fluent.models.ChangeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The list of detected changes. */ +@Fluent +public final class ChangeList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChangeList.class); + + /* + * The list of changes. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI that can be used to request the next page of changes. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of changes. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of changes. + * + * @param value the value value to set. + * @return the ChangeList object itself. + */ + public ChangeList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI that can be used to request the next page of changes. + * + * @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 of changes. + * + * @param nextLink the nextLink value to set. + * @return the ChangeList object itself. + */ + public ChangeList 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/ChangeProperties.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeProperties.java new file mode 100644 index 0000000000000..a28ae192640de --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeProperties.java @@ -0,0 +1,163 @@ +// 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.time.OffsetDateTime; +import java.util.List; + +/** The properties of a change. */ +@Fluent +public final class ChangeProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ChangeProperties.class); + + /* + * The resource id that the change is attached to. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * The time when the change is detected. + */ + @JsonProperty(value = "timeStamp") + private OffsetDateTime timestamp; + + /* + * The list of identities who might initiated the change. + * The identity could be user name (email address) or the object ID of the + * Service Principal. + */ + @JsonProperty(value = "initiatedByList") + private List initiatedByList; + + /* + * The type of the change. + */ + @JsonProperty(value = "changeType") + private ChangeType changeType; + + /* + * The list of detailed changes at json property level. + */ + @JsonProperty(value = "propertyChanges") + private List propertyChanges; + + /** + * Get the resourceId property: The resource id that the change is attached to. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The resource id that the change is attached to. + * + * @param resourceId the resourceId value to set. + * @return the ChangeProperties object itself. + */ + public ChangeProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the timestamp property: The time when the change is detected. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The time when the change is detected. + * + * @param timestamp the timestamp value to set. + * @return the ChangeProperties object itself. + */ + public ChangeProperties withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the initiatedByList property: The list of identities who might initiated the change. The identity could be + * user name (email address) or the object ID of the Service Principal. + * + * @return the initiatedByList value. + */ + public List initiatedByList() { + return this.initiatedByList; + } + + /** + * Set the initiatedByList property: The list of identities who might initiated the change. The identity could be + * user name (email address) or the object ID of the Service Principal. + * + * @param initiatedByList the initiatedByList value to set. + * @return the ChangeProperties object itself. + */ + public ChangeProperties withInitiatedByList(List initiatedByList) { + this.initiatedByList = initiatedByList; + return this; + } + + /** + * Get the changeType property: The type of the change. + * + * @return the changeType value. + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set the changeType property: The type of the change. + * + * @param changeType the changeType value to set. + * @return the ChangeProperties object itself. + */ + public ChangeProperties withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the propertyChanges property: The list of detailed changes at json property level. + * + * @return the propertyChanges value. + */ + public List propertyChanges() { + return this.propertyChanges; + } + + /** + * Set the propertyChanges property: The list of detailed changes at json property level. + * + * @param propertyChanges the propertyChanges value to set. + * @return the ChangeProperties object itself. + */ + public ChangeProperties withPropertyChanges(List propertyChanges) { + this.propertyChanges = propertyChanges; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (propertyChanges() != null) { + propertyChanges().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeType.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeType.java new file mode 100644 index 0000000000000..be94e94eb23ea --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ChangeType.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 ChangeType. */ +public final class ChangeType extends ExpandableStringEnum { + /** Static value Add for ChangeType. */ + public static final ChangeType ADD = fromString("Add"); + + /** Static value Remove for ChangeType. */ + public static final ChangeType REMOVE = fromString("Remove"); + + /** Static value Update for ChangeType. */ + public static final ChangeType UPDATE = fromString("Update"); + + /** + * Creates or finds a ChangeType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChangeType. + */ + @JsonCreator + public static ChangeType fromString(String name) { + return fromString(name, ChangeType.class); + } + + /** @return known ChangeType values. */ + public static Collection values() { + return values(ChangeType.class); + } +} diff --git a/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Changes.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Changes.java new file mode 100644 index 0000000000000..f749cbe284abe --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Changes.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.changeanalysis.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of Changes. */ +public interface Changes { + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a resource group within the specified time range. Customer data will always be masked. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context); + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + PagedIterable list(OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a subscription within the specified time range. Customer data will always be masked. + * + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + PagedIterable list(OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context); +} 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/Level.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Level.java new file mode 100644 index 0000000000000..185f60b03b6f1 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/Level.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 Level. */ +public final class Level extends ExpandableStringEnum { + /** Static value Noisy for Level. */ + public static final Level NOISY = fromString("Noisy"); + + /** Static value Normal for Level. */ + public static final Level NORMAL = fromString("Normal"); + + /** Static value Important for Level. */ + public static final Level IMPORTANT = fromString("Important"); + + /** + * Creates or finds a Level from its string representation. + * + * @param name a name to look for. + * @return the corresponding Level. + */ + @JsonCreator + public static Level fromString(String name) { + return fromString(name, Level.class); + } + + /** @return known Level values. */ + public static Collection values() { + return values(Level.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/PropertyChange.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/PropertyChange.java new file mode 100644 index 0000000000000..13365fa1e1132 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/PropertyChange.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** Data of a property change. */ +@Fluent +public final class PropertyChange { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PropertyChange.class); + + /* + * The type of the change. + */ + @JsonProperty(value = "changeType") + private ChangeType changeType; + + /* + * The change category. + */ + @JsonProperty(value = "changeCategory") + private ChangeCategory changeCategory; + + /* + * The json path of the changed property. + */ + @JsonProperty(value = "jsonPath") + private String jsonPath; + + /* + * The enhanced display name of the json path. E.g., the json path + * value[0].properties will be translated to something meaningful like + * slots["Staging"].properties. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The level property. + */ + @JsonProperty(value = "level") + private Level level; + + /* + * The description of the changed property. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The value of the property before the change. + */ + @JsonProperty(value = "oldValue") + private String oldValue; + + /* + * The value of the property after the change. + */ + @JsonProperty(value = "newValue") + private String newValue; + + /* + * The boolean indicating whether the oldValue and newValue are masked. The + * values are masked if it contains sensitive information that the user + * doesn't have access to. + */ + @JsonProperty(value = "isDataMasked") + private Boolean isDataMasked; + + /** + * Get the changeType property: The type of the change. + * + * @return the changeType value. + */ + public ChangeType changeType() { + return this.changeType; + } + + /** + * Set the changeType property: The type of the change. + * + * @param changeType the changeType value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withChangeType(ChangeType changeType) { + this.changeType = changeType; + return this; + } + + /** + * Get the changeCategory property: The change category. + * + * @return the changeCategory value. + */ + public ChangeCategory changeCategory() { + return this.changeCategory; + } + + /** + * Set the changeCategory property: The change category. + * + * @param changeCategory the changeCategory value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withChangeCategory(ChangeCategory changeCategory) { + this.changeCategory = changeCategory; + return this; + } + + /** + * Get the jsonPath property: The json path of the changed property. + * + * @return the jsonPath value. + */ + public String jsonPath() { + return this.jsonPath; + } + + /** + * Set the jsonPath property: The json path of the changed property. + * + * @param jsonPath the jsonPath value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withJsonPath(String jsonPath) { + this.jsonPath = jsonPath; + return this; + } + + /** + * Get the displayName property: The enhanced display name of the json path. E.g., the json path value[0].properties + * will be translated to something meaningful like slots["Staging"].properties. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The enhanced display name of the json path. E.g., the json path value[0].properties + * will be translated to something meaningful like slots["Staging"].properties. + * + * @param displayName the displayName value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the level property: The level property. + * + * @return the level value. + */ + public Level level() { + return this.level; + } + + /** + * Set the level property: The level property. + * + * @param level the level value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withLevel(Level level) { + this.level = level; + return this; + } + + /** + * Get the description property: The description of the changed property. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the changed property. + * + * @param description the description value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the oldValue property: The value of the property before the change. + * + * @return the oldValue value. + */ + public String oldValue() { + return this.oldValue; + } + + /** + * Set the oldValue property: The value of the property before the change. + * + * @param oldValue the oldValue value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withOldValue(String oldValue) { + this.oldValue = oldValue; + return this; + } + + /** + * Get the newValue property: The value of the property after the change. + * + * @return the newValue value. + */ + public String newValue() { + return this.newValue; + } + + /** + * Set the newValue property: The value of the property after the change. + * + * @param newValue the newValue value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withNewValue(String newValue) { + this.newValue = newValue; + return this; + } + + /** + * Get the isDataMasked property: The boolean indicating whether the oldValue and newValue are masked. The values + * are masked if it contains sensitive information that the user doesn't have access to. + * + * @return the isDataMasked value. + */ + public Boolean isDataMasked() { + return this.isDataMasked; + } + + /** + * Set the isDataMasked property: The boolean indicating whether the oldValue and newValue are masked. The values + * are masked if it contains sensitive information that the user doesn't have access to. + * + * @param isDataMasked the isDataMasked value to set. + * @return the PropertyChange object itself. + */ + public PropertyChange withIsDataMasked(Boolean isDataMasked) { + this.isDataMasked = isDataMasked; + 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/ResourceChanges.java b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceChanges.java new file mode 100644 index 0000000000000..5cdb06a99a8a2 --- /dev/null +++ b/sdk/changeanalysis/azure-resourcemanager-changeanalysis/src/main/java/com/azure/resourcemanager/changeanalysis/models/ResourceChanges.java @@ -0,0 +1,45 @@ +// 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; +import java.time.OffsetDateTime; + +/** Resource collection API of ResourceChanges. */ +public interface ResourceChanges { + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of detected changes. + */ + PagedIterable list(String resourceId, OffsetDateTime startTime, OffsetDateTime endTime); + + /** + * List the changes of a resource within the specified time range. Customer data will be masked if the user doesn't + * have access. + * + * @param resourceId The identifier of the resource. + * @param startTime Specifies the start time of the changes request. + * @param endTime Specifies the end time of the changes request. + * @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 list of detected changes. + */ + PagedIterable list( + String resourceId, OffsetDateTime startTime, OffsetDateTime endTime, String skipToken, Context context); +} 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 + + + +