From e2dc639ab0e8b90e346e2f6c257fd8c2fb7c2b11 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 2 Apr 2021 03:27:40 +0000 Subject: [PATCH] CodeGen from PR 13524 in Azure/azure-rest-api-specs Merge d187dd4fc3d8064504d93335efb63e5c706a36b5 into 45a043b5b8f191f59c079a9d9a5e84dfee3a1c81 --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 ++ .../pom.xml | 67 + .../ApplicationInsightsManager.java | 226 +++ .../ApplicationInsightsManagementClient.java | 60 + .../fluent/OperationsClient.java | 36 + .../fluent/WebTestsClient.java | 206 +++ .../fluent/models/OperationInner.java | 132 ++ .../fluent/models/WebTestInner.java | 539 ++++++ .../fluent/models/package-info.java | 9 + .../fluent/package-info.java | 9 + ...cationInsightsManagementClientBuilder.java | 146 ++ ...plicationInsightsManagementClientImpl.java | 307 ++++ .../implementation/OperationImpl.java | 46 + .../implementation/OperationsClientImpl.java | 269 +++ .../implementation/OperationsImpl.java | 47 + .../implementation/Utils.java | 204 +++ .../implementation/WebTestImpl.java | 344 ++++ .../implementation/WebTestsClientImpl.java | 1515 +++++++++++++++++ .../implementation/WebTestsImpl.java | 182 ++ .../implementation/package-info.java | 9 + .../models/HeaderField.java | 76 + .../applicationinsights/models/Operation.java | 45 + .../models/OperationInfo.java | 128 ++ .../models/Operations.java | 31 + .../models/OperationsListResult.java | 81 + .../models/TagsResource.java | 51 + .../applicationinsights/models/WebTest.java | 522 ++++++ .../models/WebTestGeolocation.java | 50 + .../models/WebTestKind.java | 47 + .../models/WebTestKindEnum.java | 53 + .../models/WebTestListResult.java | 88 + .../WebTestPropertiesConfiguration.java | 50 + .../WebTestPropertiesContentValidation.java | 105 ++ .../models/WebTestPropertiesRequest.java | 184 ++ .../applicationinsights/models/WebTests.java | 182 ++ .../models/WebtestsResource.java | 39 + .../models/package-info.java | 9 + .../applicationinsights/package-info.java | 9 + .../src/main/java/module-info.java | 19 + sdk/applicationinsights/ci.yml | 33 + sdk/applicationinsights/pom.xml | 53 + 44 files changed, 6314 insertions(+) create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/CHANGELOG.md create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/README.md create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManager.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/ApplicationInsightsManagementClient.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/OperationsClient.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/WebTestsClient.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/OperationInner.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/WebTestInner.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/package-info.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/package-info.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientBuilder.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsClientImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/Utils.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsClientImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsImpl.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/package-info.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/HeaderField.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operation.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationInfo.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operations.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationsListResult.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/TagsResource.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTest.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestGeolocation.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKind.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKindEnum.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestListResult.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesConfiguration.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesContentValidation.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesRequest.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTests.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebtestsResource.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/package-info.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/package-info.java create mode 100644 sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/module-info.java create mode 100644 sdk/applicationinsights/ci.yml create mode 100644 sdk/applicationinsights/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1ac029424f0ea..e92bec278dfdc 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -221,6 +221,7 @@ com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.0.0-be 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.2 com.azure.resourcemanager:azure-resourcemanager-delegatednetwork;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-applicationinsights;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 5c5f884ed3871..3354de4f0be8f 100644 --- a/pom.xml +++ b/pom.xml @@ -654,6 +654,7 @@ sdk/anomalydetector sdk/apimanagement sdk/appconfiguration + sdk/applicationinsights sdk/attestation sdk/authorization sdk/batch diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/CHANGELOG.md b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/CHANGELOG.md new file mode 100644 index 0000000000000..c46ab1eab62b6 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-02) + +- Azure Resource Manager ApplicationInsights client library for Java. This package contains Microsoft Azure SDK for ApplicationInsights Management SDK. Composite Swagger for Application Insights Management Client. Package tag package-preview-2020-10. 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/applicationinsights/azure-resourcemanager-applicationinsights/README.md b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/README.md new file mode 100644 index 0000000000000..3bbb2f0968d74 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager ApplicationInsights client library for Java + +Azure Resource Manager ApplicationInsights client library for Java. + +This package contains Microsoft Azure SDK for ApplicationInsights Management SDK. Composite Swagger for Application Insights Management Client. Package tag package-preview-2020-10. 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-applicationinsights;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-applicationinsights + 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(); +ApplicationInsightsManager manager = ApplicationInsightsManager + .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/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/pom.xml new file mode 100644 index 0000000000000..8d67693ec0f31 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/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-applicationinsights + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ApplicationInsights Management + This package contains Microsoft Azure SDK for ApplicationInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Composite Swagger for Application Insights Management Client. Package tag package-preview-2020-10. + 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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManager.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManager.java new file mode 100644 index 0000000000000..dfec65dfcebac --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/ApplicationInsightsManager.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights; + +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.applicationinsights.fluent.ApplicationInsightsManagementClient; +import com.azure.resourcemanager.applicationinsights.implementation.ApplicationInsightsManagementClientBuilder; +import com.azure.resourcemanager.applicationinsights.implementation.OperationsImpl; +import com.azure.resourcemanager.applicationinsights.implementation.WebTestsImpl; +import com.azure.resourcemanager.applicationinsights.models.Operations; +import com.azure.resourcemanager.applicationinsights.models.WebTests; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to ApplicationInsightsManager. Composite Swagger for Application Insights Management Client. */ +public final class ApplicationInsightsManager { + private Operations operations; + + private WebTests webTests; + + private final ApplicationInsightsManagementClient clientObject; + + private ApplicationInsightsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ApplicationInsightsManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ApplicationInsights service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ApplicationInsights service API instance. + */ + public static ApplicationInsightsManager 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 ApplicationInsightsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ApplicationInsightsManager.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 ApplicationInsights service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ApplicationInsights service API instance. + */ + public ApplicationInsightsManager 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.applicationinsights") + .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 ApplicationInsightsManager(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 WebTests. */ + public WebTests webTests() { + if (this.webTests == null) { + this.webTests = new WebTestsImpl(clientObject.getWebTests(), this); + } + return webTests; + } + + /** + * @return Wrapped service client ApplicationInsightsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ApplicationInsightsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/ApplicationInsightsManagementClient.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/ApplicationInsightsManagementClient.java new file mode 100644 index 0000000000000..87361f36e0881 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/ApplicationInsightsManagementClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ApplicationInsightsManagementClient class. */ +public interface ApplicationInsightsManagementClient { + /** + * 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 WebTestsClient object to access its operations. + * + * @return the WebTestsClient object. + */ + WebTestsClient getWebTests(); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/OperationsClient.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/OperationsClient.java new file mode 100644 index 0000000000000..7d5d59bd065e0 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.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.applicationinsights.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @throws com.azure.core.management.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 result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @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 result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/WebTestsClient.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/WebTestsClient.java new file mode 100644 index 0000000000000..6c34fdb8b6178 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/WebTestsClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import com.azure.resourcemanager.applicationinsights.models.TagsResource; + +/** An instance of this class provides access to all the operations defined in WebTestsClient. */ +public interface WebTestsClient { + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WebTestInner getByResourceGroup(String resourceGroupName, String webTestName); + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String webTestName, Context context); + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WebTestInner createOrUpdate(String resourceGroupName, String webTestName, WebTestInner webTestDefinition); + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String webTestName, WebTestInner webTestDefinition, Context context); + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WebTestInner updateTags(String resourceGroupName, String webTestName, TagsResource webTestTags); + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse( + String resourceGroupName, String webTestName, TagsResource webTestTags, Context context); + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String webTestName); + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String webTestName, Context context); + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @throws com.azure.core.management.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 all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @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 all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByComponent(String componentName, String resourceGroupName); + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByComponent(String componentName, String resourceGroupName, Context context); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/OperationInner.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..40e5247ab025c --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/OperationInner.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.applicationinsights.models.OperationInfo; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents an operation returned by the GetOperations request. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Name of the operation + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display name of the operation + */ + @JsonProperty(value = "display") + private OperationInfo display; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Properties of the operation + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display name of the operation. + * + * @return the display value. + */ + public OperationInfo display() { + return this.display; + } + + /** + * Set the display property: Display name of the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationInfo display) { + this.display = display; + return this; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: Origin of the operation. + * + * @param origin the origin value to set. + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Properties of the operation. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the operation. + * + * @param properties the properties value to set. + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/WebTestInner.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/WebTestInner.java new file mode 100644 index 0000000000000..dbf6ca7019c9a --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/WebTestInner.java @@ -0,0 +1,539 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.applicationinsights.models.WebTestGeolocation; +import com.azure.resourcemanager.applicationinsights.models.WebTestKind; +import com.azure.resourcemanager.applicationinsights.models.WebTestKindEnum; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesConfiguration; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesContentValidation; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesRequest; +import com.azure.resourcemanager.applicationinsights.models.WebtestsResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Application Insights WebTest definition. */ +@JsonFlatten +@Fluent +public class WebTestInner extends WebtestsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestInner.class); + + /* + * The kind of WebTest that this web test watches. Choices are ping and + * multistep. + */ + @JsonProperty(value = "kind") + private WebTestKind kind; + + /* + * Unique ID of this WebTest. This is typically the same value as the Name + * field. + */ + @JsonProperty(value = "properties.SyntheticMonitorId") + private String syntheticMonitorId; + + /* + * User defined name if this WebTest. + */ + @JsonProperty(value = "properties.Name") + private String webTestName; + + /* + * User defined description for this WebTest. + */ + @JsonProperty(value = "properties.Description") + private String description; + + /* + * Is the test actively being monitored. + */ + @JsonProperty(value = "properties.Enabled") + private Boolean enabled; + + /* + * Interval in seconds between test runs for this WebTest. Default value is + * 300. + */ + @JsonProperty(value = "properties.Frequency") + private Integer frequency; + + /* + * Seconds until this WebTest will timeout and fail. Default value is 30. + */ + @JsonProperty(value = "properties.Timeout") + private Integer timeout; + + /* + * The kind of web test this is, valid choices are ping, multistep, basic, + * and standard. + */ + @JsonProperty(value = "properties.Kind") + private WebTestKindEnum webTestKind; + + /* + * Allow for retries should this WebTest fail. + */ + @JsonProperty(value = "properties.RetryEnabled") + private Boolean retryEnabled; + + /* + * A list of where to physically run the tests from to give global coverage + * for accessibility of your application. + */ + @JsonProperty(value = "properties.Locations") + private List locations; + + /* + * An XML configuration specification for a WebTest. + */ + @JsonProperty(value = "properties.Configuration") + private WebTestPropertiesConfiguration configuration; + + /* + * Current state of this component, whether or not is has been provisioned + * within the resource group it is defined. Users cannot change this value + * but are able to read from it. Values will include Succeeded, Deploying, + * Canceled, and Failed. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The collection of request properties + */ + @JsonProperty(value = "properties.Request") + private WebTestPropertiesRequest request; + + /* + * The collection of content validation properties + */ + @JsonProperty(value = "properties.ContentValidation") + private WebTestPropertiesContentValidation contentValidation; + + /* + * Checks to see if the SSL cert is still valid. + */ + @JsonProperty(value = "properties.SSLCheck") + private Boolean sslCheck; + + /* + * A number of days to check still remain before the the existing SSL cert + * expires. + */ + @JsonProperty(value = "properties.SSLCertRemainingLifetimeCheck") + private Integer sslCertRemainingLifetimeCheck; + + /* + * Validate that the WebTest returns the http status code provided. + */ + @JsonProperty(value = "properties.ExpectedHttpStatusCode") + private Integer expectedHttpStatusCode; + + /* + * When set, validation will ignore the status code. + */ + @JsonProperty(value = "properties.IgnoreHttpsStatusCode") + private Boolean ignoreHttpsStatusCode; + + /** + * Get the kind property: The kind of WebTest that this web test watches. Choices are ping and multistep. + * + * @return the kind value. + */ + public WebTestKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of WebTest that this web test watches. Choices are ping and multistep. + * + * @param kind the kind value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withKind(WebTestKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the syntheticMonitorId property: Unique ID of this WebTest. This is typically the same value as the Name + * field. + * + * @return the syntheticMonitorId value. + */ + public String syntheticMonitorId() { + return this.syntheticMonitorId; + } + + /** + * Set the syntheticMonitorId property: Unique ID of this WebTest. This is typically the same value as the Name + * field. + * + * @param syntheticMonitorId the syntheticMonitorId value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withSyntheticMonitorId(String syntheticMonitorId) { + this.syntheticMonitorId = syntheticMonitorId; + return this; + } + + /** + * Get the webTestName property: User defined name if this WebTest. + * + * @return the webTestName value. + */ + public String webTestName() { + return this.webTestName; + } + + /** + * Set the webTestName property: User defined name if this WebTest. + * + * @param webTestName the webTestName value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withWebTestName(String webTestName) { + this.webTestName = webTestName; + return this; + } + + /** + * Get the description property: User defined description for this WebTest. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: User defined description for this WebTest. + * + * @param description the description value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the enabled property: Is the test actively being monitored. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Is the test actively being monitored. + * + * @param enabled the enabled value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the frequency property: Interval in seconds between test runs for this WebTest. Default value is 300. + * + * @return the frequency value. + */ + public Integer frequency() { + return this.frequency; + } + + /** + * Set the frequency property: Interval in seconds between test runs for this WebTest. Default value is 300. + * + * @param frequency the frequency value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withFrequency(Integer frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the timeout property: Seconds until this WebTest will timeout and fail. Default value is 30. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Seconds until this WebTest will timeout and fail. Default value is 30. + * + * @param timeout the timeout value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the webTestKind property: The kind of web test this is, valid choices are ping, multistep, basic, and + * standard. + * + * @return the webTestKind value. + */ + public WebTestKindEnum webTestKind() { + return this.webTestKind; + } + + /** + * Set the webTestKind property: The kind of web test this is, valid choices are ping, multistep, basic, and + * standard. + * + * @param webTestKind the webTestKind value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withWebTestKind(WebTestKindEnum webTestKind) { + this.webTestKind = webTestKind; + return this; + } + + /** + * Get the retryEnabled property: Allow for retries should this WebTest fail. + * + * @return the retryEnabled value. + */ + public Boolean retryEnabled() { + return this.retryEnabled; + } + + /** + * Set the retryEnabled property: Allow for retries should this WebTest fail. + * + * @param retryEnabled the retryEnabled value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withRetryEnabled(Boolean retryEnabled) { + this.retryEnabled = retryEnabled; + return this; + } + + /** + * Get the locations property: A list of where to physically run the tests from to give global coverage for + * accessibility of your application. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: A list of where to physically run the tests from to give global coverage for + * accessibility of your application. + * + * @param locations the locations value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the configuration property: An XML configuration specification for a WebTest. + * + * @return the configuration value. + */ + public WebTestPropertiesConfiguration configuration() { + return this.configuration; + } + + /** + * Set the configuration property: An XML configuration specification for a WebTest. + * + * @param configuration the configuration value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withConfiguration(WebTestPropertiesConfiguration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Get the provisioningState property: Current state of this component, whether or not is has been provisioned + * within the resource group it is defined. Users cannot change this value but are able to read from it. Values will + * include Succeeded, Deploying, Canceled, and Failed. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the request property: The collection of request properties. + * + * @return the request value. + */ + public WebTestPropertiesRequest request() { + return this.request; + } + + /** + * Set the request property: The collection of request properties. + * + * @param request the request value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withRequest(WebTestPropertiesRequest request) { + this.request = request; + return this; + } + + /** + * Get the contentValidation property: The collection of content validation properties. + * + * @return the contentValidation value. + */ + public WebTestPropertiesContentValidation contentValidation() { + return this.contentValidation; + } + + /** + * Set the contentValidation property: The collection of content validation properties. + * + * @param contentValidation the contentValidation value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withContentValidation(WebTestPropertiesContentValidation contentValidation) { + this.contentValidation = contentValidation; + return this; + } + + /** + * Get the sslCheck property: Checks to see if the SSL cert is still valid. + * + * @return the sslCheck value. + */ + public Boolean sslCheck() { + return this.sslCheck; + } + + /** + * Set the sslCheck property: Checks to see if the SSL cert is still valid. + * + * @param sslCheck the sslCheck value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withSslCheck(Boolean sslCheck) { + this.sslCheck = sslCheck; + return this; + } + + /** + * Get the sslCertRemainingLifetimeCheck property: A number of days to check still remain before the the existing + * SSL cert expires. + * + * @return the sslCertRemainingLifetimeCheck value. + */ + public Integer sslCertRemainingLifetimeCheck() { + return this.sslCertRemainingLifetimeCheck; + } + + /** + * Set the sslCertRemainingLifetimeCheck property: A number of days to check still remain before the the existing + * SSL cert expires. + * + * @param sslCertRemainingLifetimeCheck the sslCertRemainingLifetimeCheck value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withSslCertRemainingLifetimeCheck(Integer sslCertRemainingLifetimeCheck) { + this.sslCertRemainingLifetimeCheck = sslCertRemainingLifetimeCheck; + return this; + } + + /** + * Get the expectedHttpStatusCode property: Validate that the WebTest returns the http status code provided. + * + * @return the expectedHttpStatusCode value. + */ + public Integer expectedHttpStatusCode() { + return this.expectedHttpStatusCode; + } + + /** + * Set the expectedHttpStatusCode property: Validate that the WebTest returns the http status code provided. + * + * @param expectedHttpStatusCode the expectedHttpStatusCode value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withExpectedHttpStatusCode(Integer expectedHttpStatusCode) { + this.expectedHttpStatusCode = expectedHttpStatusCode; + return this; + } + + /** + * Get the ignoreHttpsStatusCode property: When set, validation will ignore the status code. + * + * @return the ignoreHttpsStatusCode value. + */ + public Boolean ignoreHttpsStatusCode() { + return this.ignoreHttpsStatusCode; + } + + /** + * Set the ignoreHttpsStatusCode property: When set, validation will ignore the status code. + * + * @param ignoreHttpsStatusCode the ignoreHttpsStatusCode value to set. + * @return the WebTestInner object itself. + */ + public WebTestInner withIgnoreHttpsStatusCode(Boolean ignoreHttpsStatusCode) { + this.ignoreHttpsStatusCode = ignoreHttpsStatusCode; + return this; + } + + /** {@inheritDoc} */ + @Override + public WebTestInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public WebTestInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (locations() != null) { + locations().forEach(e -> e.validate()); + } + if (configuration() != null) { + configuration().validate(); + } + if (request() != null) { + request().validate(); + } + if (contentValidation() != null) { + contentValidation().validate(); + } + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/package-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/package-info.java new file mode 100644 index 0000000000000..397d1c84bbde9 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ApplicationInsightsManagementClient. Composite Swagger for Application + * Insights Management Client. + */ +package com.azure.resourcemanager.applicationinsights.fluent.models; diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/package-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/package-info.java new file mode 100644 index 0000000000000..9476e4ce65f79 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 ApplicationInsightsManagementClient. Composite Swagger for Application + * Insights Management Client. + */ +package com.azure.resourcemanager.applicationinsights.fluent; diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientBuilder.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientBuilder.java new file mode 100644 index 0000000000000..e3c0b1f4af9ee --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientBuilder.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.applicationinsights.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 ApplicationInsightsManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ApplicationInsightsManagementClientImpl.class}) +public final class ApplicationInsightsManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder 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 ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder 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 ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder 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 ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder 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 ApplicationInsightsManagementClientBuilder. + */ + public ApplicationInsightsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ApplicationInsightsManagementClientImpl with the provided parameters. + * + * @return an instance of ApplicationInsightsManagementClientImpl. + */ + public ApplicationInsightsManagementClientImpl 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(); + } + ApplicationInsightsManagementClientImpl client = + new ApplicationInsightsManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientImpl.java new file mode 100644 index 0000000000000..40e3c4832748c --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/ApplicationInsightsManagementClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.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.applicationinsights.fluent.ApplicationInsightsManagementClient; +import com.azure.resourcemanager.applicationinsights.fluent.OperationsClient; +import com.azure.resourcemanager.applicationinsights.fluent.WebTestsClient; +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 ApplicationInsightsManagementClientImpl type. */ +@ServiceClient(builder = ApplicationInsightsManagementClientBuilder.class) +public final class ApplicationInsightsManagementClientImpl implements ApplicationInsightsManagementClient { + private final ClientLogger logger = new ClientLogger(ApplicationInsightsManagementClientImpl.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 WebTestsClient object to access its operations. */ + private final WebTestsClient webTests; + + /** + * Gets the WebTestsClient object to access its operations. + * + * @return the WebTestsClient object. + */ + public WebTestsClient getWebTests() { + return this.webTests; + } + + /** + * Initializes an instance of ApplicationInsightsManagementClient 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. + */ + ApplicationInsightsManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-10-05-preview"; + this.operations = new OperationsClientImpl(this); + this.webTests = new WebTestsClientImpl(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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationImpl.java new file mode 100644 index 0000000000000..ef22ae8ec96fd --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.implementation; + +import com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner; +import com.azure.resourcemanager.applicationinsights.models.Operation; +import com.azure.resourcemanager.applicationinsights.models.OperationInfo; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationInfo display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsClientImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..e607b0c37587a --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.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.applicationinsights.fluent.OperationsClient; +import com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner; +import com.azure.resourcemanager.applicationinsights.models.OperationsListResult; +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 ApplicationInsightsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ApplicationInsightsManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ApplicationInsightsManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ApplicationInsightsM") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Insights/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>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 available operations supported by the Microsoft.EventGrid resource provider. + * + * @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 result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @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 result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @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 result of the List Operations operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(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 result of the List Operations operation. + */ + @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 result of the List Operations operation. + */ + @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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..38dc6c14deda5 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/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.applicationinsights.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.applicationinsights.fluent.OperationsClient; +import com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner; +import com.azure.resourcemanager.applicationinsights.models.Operation; +import com.azure.resourcemanager.applicationinsights.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/Utils.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/Utils.java new file mode 100644 index 0000000000000..fa60202e7a37e --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/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.applicationinsights.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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestImpl.java new file mode 100644 index 0000000000000..d37bed8b07172 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestImpl.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import com.azure.resourcemanager.applicationinsights.models.TagsResource; +import com.azure.resourcemanager.applicationinsights.models.WebTest; +import com.azure.resourcemanager.applicationinsights.models.WebTestGeolocation; +import com.azure.resourcemanager.applicationinsights.models.WebTestKind; +import com.azure.resourcemanager.applicationinsights.models.WebTestKindEnum; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesConfiguration; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesContentValidation; +import com.azure.resourcemanager.applicationinsights.models.WebTestPropertiesRequest; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class WebTestImpl implements WebTest, WebTest.Definition, WebTest.Update { + private WebTestInner innerObject; + + private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public WebTestKind kind() { + return this.innerModel().kind(); + } + + public String syntheticMonitorId() { + return this.innerModel().syntheticMonitorId(); + } + + public String webTestName() { + return this.innerModel().webTestName(); + } + + public String description() { + return this.innerModel().description(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public Integer frequency() { + return this.innerModel().frequency(); + } + + public Integer timeout() { + return this.innerModel().timeout(); + } + + public WebTestKindEnum webTestKind() { + return this.innerModel().webTestKind(); + } + + public Boolean retryEnabled() { + return this.innerModel().retryEnabled(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public WebTestPropertiesConfiguration configuration() { + return this.innerModel().configuration(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public WebTestPropertiesRequest request() { + return this.innerModel().request(); + } + + public WebTestPropertiesContentValidation contentValidation() { + return this.innerModel().contentValidation(); + } + + public Boolean sslCheck() { + return this.innerModel().sslCheck(); + } + + public Integer sslCertRemainingLifetimeCheck() { + return this.innerModel().sslCertRemainingLifetimeCheck(); + } + + public Integer expectedHttpStatusCode() { + return this.innerModel().expectedHttpStatusCode(); + } + + public Boolean ignoreHttpsStatusCode() { + return this.innerModel().ignoreHttpsStatusCode(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public WebTestInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String webTestName; + + private TagsResource updateWebTestTags; + + public WebTestImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public WebTest create() { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .createOrUpdateWithResponse(resourceGroupName, webTestName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public WebTest create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .createOrUpdateWithResponse(resourceGroupName, webTestName, this.innerModel(), context) + .getValue(); + return this; + } + + WebTestImpl(String name, com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) { + this.innerObject = new WebTestInner(); + this.serviceManager = serviceManager; + this.webTestName = name; + } + + public WebTestImpl update() { + this.updateWebTestTags = new TagsResource(); + return this; + } + + public WebTest apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .updateTagsWithResponse(resourceGroupName, webTestName, updateWebTestTags, Context.NONE) + .getValue(); + return this; + } + + public WebTest apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .updateTagsWithResponse(resourceGroupName, webTestName, updateWebTestTags, context) + .getValue(); + return this; + } + + WebTestImpl( + WebTestInner innerObject, + com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.webTestName = Utils.getValueFromIdByName(innerObject.id(), "webtests"); + } + + public WebTest refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .getByResourceGroupWithResponse(resourceGroupName, webTestName, Context.NONE) + .getValue(); + return this; + } + + public WebTest refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWebTests() + .getByResourceGroupWithResponse(resourceGroupName, webTestName, context) + .getValue(); + return this; + } + + public WebTestImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WebTestImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WebTestImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateWebTestTags.withTags(tags); + return this; + } + } + + public WebTestImpl withKind(WebTestKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public WebTestImpl withSyntheticMonitorId(String syntheticMonitorId) { + this.innerModel().withSyntheticMonitorId(syntheticMonitorId); + return this; + } + + public WebTestImpl withWebTestName(String webTestName) { + this.innerModel().withWebTestName(webTestName); + return this; + } + + public WebTestImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public WebTestImpl withEnabled(Boolean enabled) { + this.innerModel().withEnabled(enabled); + return this; + } + + public WebTestImpl withFrequency(Integer frequency) { + this.innerModel().withFrequency(frequency); + return this; + } + + public WebTestImpl withTimeout(Integer timeout) { + this.innerModel().withTimeout(timeout); + return this; + } + + public WebTestImpl withWebTestKind(WebTestKindEnum webTestKind) { + this.innerModel().withWebTestKind(webTestKind); + return this; + } + + public WebTestImpl withRetryEnabled(Boolean retryEnabled) { + this.innerModel().withRetryEnabled(retryEnabled); + return this; + } + + public WebTestImpl withLocations(List locations) { + this.innerModel().withLocations(locations); + return this; + } + + public WebTestImpl withConfiguration(WebTestPropertiesConfiguration configuration) { + this.innerModel().withConfiguration(configuration); + return this; + } + + public WebTestImpl withRequest(WebTestPropertiesRequest request) { + this.innerModel().withRequest(request); + return this; + } + + public WebTestImpl withContentValidation(WebTestPropertiesContentValidation contentValidation) { + this.innerModel().withContentValidation(contentValidation); + return this; + } + + public WebTestImpl withSslCheck(Boolean sslCheck) { + this.innerModel().withSslCheck(sslCheck); + return this; + } + + public WebTestImpl withSslCertRemainingLifetimeCheck(Integer sslCertRemainingLifetimeCheck) { + this.innerModel().withSslCertRemainingLifetimeCheck(sslCertRemainingLifetimeCheck); + return this; + } + + public WebTestImpl withExpectedHttpStatusCode(Integer expectedHttpStatusCode) { + this.innerModel().withExpectedHttpStatusCode(expectedHttpStatusCode); + return this; + } + + public WebTestImpl withIgnoreHttpsStatusCode(Boolean ignoreHttpsStatusCode) { + this.innerModel().withIgnoreHttpsStatusCode(ignoreHttpsStatusCode); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsClientImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsClientImpl.java new file mode 100644 index 0000000000000..7dd65d15a0f79 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsClientImpl.java @@ -0,0 +1,1515 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.applicationinsights.fluent.WebTestsClient; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import com.azure.resourcemanager.applicationinsights.models.TagsResource; +import com.azure.resourcemanager.applicationinsights.models.WebTestListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WebTestsClient. */ +public final class WebTestsClientImpl implements WebTestsClient { + private final ClientLogger logger = new ClientLogger(WebTestsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WebTestsService service; + + /** The service client containing this operation class. */ + private final ApplicationInsightsManagementClientImpl client; + + /** + * Initializes an instance of WebTestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WebTestsClientImpl(ApplicationInsightsManagementClientImpl client) { + this.service = RestProxy.create(WebTestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ApplicationInsightsManagementClientWebTests to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ApplicationInsightsM") + private interface WebTestsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests" + + "/{webTestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("webTestName") String webTestName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests" + + "/{webTestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("webTestName") String webTestName, + @BodyParam("application/json") WebTestInner webTestDefinition, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests" + + "/{webTestName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("webTestName") String webTestName, + @BodyParam("application/json") TagsResource webTestTags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/webtests" + + "/{webTestName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("webTestName") String webTestName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/webtests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/components" + + "/{componentName}/webtests") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByComponent( + @HostParam("$host") String endpoint, + @PathParam("componentName") String componentName, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @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> listNext( + @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> listByComponentNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String webTestName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String webTestName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + accept, + context); + } + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String webTestName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, webTestName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WebTestInner getByResourceGroup(String resourceGroupName, String webTestName) { + return getByResourceGroupAsync(resourceGroupName, webTestName).block(); + } + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String webTestName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, webTestName, context).block(); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String webTestName, WebTestInner webTestDefinition) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + if (webTestDefinition == null) { + return Mono + .error(new IllegalArgumentException("Parameter webTestDefinition is required and cannot be null.")); + } else { + webTestDefinition.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + webTestDefinition, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String webTestName, WebTestInner webTestDefinition, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + if (webTestDefinition == null) { + return Mono + .error(new IllegalArgumentException("Parameter webTestDefinition is required and cannot be null.")); + } else { + webTestDefinition.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + webTestDefinition, + accept, + context); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String webTestName, WebTestInner webTestDefinition) { + return createOrUpdateWithResponseAsync(resourceGroupName, webTestName, webTestDefinition) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WebTestInner createOrUpdate(String resourceGroupName, String webTestName, WebTestInner webTestDefinition) { + return createOrUpdateAsync(resourceGroupName, webTestName, webTestDefinition).block(); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestDefinition Properties that need to be specified to create or update an Application Insights web + * test definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String webTestName, WebTestInner webTestDefinition, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, webTestName, webTestDefinition, context).block(); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String webTestName, TagsResource webTestTags) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + if (webTestTags == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestTags is required and cannot be null.")); + } else { + webTestTags.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + webTestTags, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String webTestName, TagsResource webTestTags, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + if (webTestTags == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestTags is required and cannot be null.")); + } else { + webTestTags.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + webTestName, + webTestTags, + accept, + context); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync(String resourceGroupName, String webTestName, TagsResource webTestTags) { + return updateTagsWithResponseAsync(resourceGroupName, webTestName, webTestTags) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WebTestInner updateTags(String resourceGroupName, String webTestName, TagsResource webTestTags) { + return updateTagsAsync(resourceGroupName, webTestName, webTestTags).block(); + } + + /** + * Creates or updates an Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param webTestTags Updated tag information to set into the web test instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Application Insights WebTest definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse( + String resourceGroupName, String webTestName, TagsResource webTestTags, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, webTestName, webTestTags, context).block(); + } + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String webTestName) { + 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + webTestName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String webTestName, 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 (webTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter webTestName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + webTestName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String webTestName) { + return deleteWithResponseAsync(resourceGroupName, webTestName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String webTestName) { + deleteAsync(resourceGroupName, webTestName).block(); + } + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String webTestName, Context context) { + return deleteWithResponseAsync(resourceGroupName, webTestName, context).block(); + } + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 all Application Insights web test alerts definitions within a subscription. + * + * @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 all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @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 all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @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 all Application Insights web test alerts definitions within a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByComponentSinglePageAsync( + String componentName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (componentName == null) { + return Mono.error(new IllegalArgumentException("Parameter componentName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByComponent( + this.client.getEndpoint(), + componentName, + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + 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 all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByComponentSinglePageAsync( + String componentName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (componentName == null) { + return Mono.error(new IllegalArgumentException("Parameter componentName is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByComponent( + this.client.getEndpoint(), + componentName, + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByComponentAsync(String componentName, String resourceGroupName) { + return new PagedFlux<>( + () -> listByComponentSinglePageAsync(componentName, resourceGroupName), + nextLink -> listByComponentNextSinglePageAsync(nextLink)); + } + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByComponentAsync( + String componentName, String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByComponentSinglePageAsync(componentName, resourceGroupName, context), + nextLink -> listByComponentNextSinglePageAsync(nextLink, context)); + } + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByComponent(String componentName, String resourceGroupName) { + return new PagedIterable<>(listByComponentAsync(componentName, resourceGroupName)); + } + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByComponent( + String componentName, String resourceGroupName, Context context) { + return new PagedIterable<>(listByComponentAsync(componentName, resourceGroupName, 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 a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(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 a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(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 + .listByResourceGroupNext(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 a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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 a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByComponentNextSinglePageAsync(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.listByComponentNext(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 a list of 0 or more Application Insights WebTest definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByComponentNextSinglePageAsync(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 + .listByComponentNext(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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsImpl.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsImpl.java new file mode 100644 index 0000000000000..9e8423640e25f --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/WebTestsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.applicationinsights.fluent.WebTestsClient; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import com.azure.resourcemanager.applicationinsights.models.WebTest; +import com.azure.resourcemanager.applicationinsights.models.WebTests; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WebTestsImpl implements WebTests { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestsImpl.class); + + private final WebTestsClient innerClient; + + private final com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager; + + public WebTestsImpl( + WebTestsClient innerClient, + com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public WebTest getByResourceGroup(String resourceGroupName, String webTestName) { + WebTestInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, webTestName); + if (inner != null) { + return new WebTestImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String webTestName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, webTestName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WebTestImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String webTestName) { + this.serviceClient().delete(resourceGroupName, webTestName); + } + + public Response deleteWithResponse(String resourceGroupName, String webTestName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, webTestName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public PagedIterable listByComponent(String componentName, String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByComponent(componentName, resourceGroupName); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public PagedIterable listByComponent(String componentName, String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByComponent(componentName, resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new WebTestImpl(inner1, this.manager())); + } + + public WebTest getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String webTestName = Utils.getValueFromIdByName(id, "webtests"); + if (webTestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'webtests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, webTestName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String webTestName = Utils.getValueFromIdByName(id, "webtests"); + if (webTestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'webtests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, webTestName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String webTestName = Utils.getValueFromIdByName(id, "webtests"); + if (webTestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'webtests'.", id))); + } + this.deleteWithResponse(resourceGroupName, webTestName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String webTestName = Utils.getValueFromIdByName(id, "webtests"); + if (webTestName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'webtests'.", id))); + } + return this.deleteWithResponse(resourceGroupName, webTestName, context); + } + + private WebTestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.applicationinsights.ApplicationInsightsManager manager() { + return this.serviceManager; + } + + public WebTestImpl define(String name) { + return new WebTestImpl(name, this.manager()); + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/package-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/package-info.java new file mode 100644 index 0000000000000..12e77002d4163 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 ApplicationInsightsManagementClient. Composite Swagger for Application + * Insights Management Client. + */ +package com.azure.resourcemanager.applicationinsights.implementation; diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/HeaderField.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/HeaderField.java new file mode 100644 index 0000000000000..8c2c889ac347c --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/HeaderField.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A header to add to the WebTest. */ +@Fluent +public final class HeaderField { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HeaderField.class); + + /* + * The name of the header. + */ + @JsonProperty(value = "key") + private String headerFieldName; + + /* + * The value of the header. + */ + @JsonProperty(value = "value") + private String headerFieldValue; + + /** + * Get the headerFieldName property: The name of the header. + * + * @return the headerFieldName value. + */ + public String headerFieldName() { + return this.headerFieldName; + } + + /** + * Set the headerFieldName property: The name of the header. + * + * @param headerFieldName the headerFieldName value to set. + * @return the HeaderField object itself. + */ + public HeaderField withHeaderFieldName(String headerFieldName) { + this.headerFieldName = headerFieldName; + return this; + } + + /** + * Get the headerFieldValue property: The value of the header. + * + * @return the headerFieldValue value. + */ + public String headerFieldValue() { + return this.headerFieldValue; + } + + /** + * Set the headerFieldValue property: The value of the header. + * + * @param headerFieldValue the headerFieldValue value to set. + * @return the HeaderField object itself. + */ + public HeaderField withHeaderFieldValue(String headerFieldValue) { + this.headerFieldValue = headerFieldValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operation.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operation.java new file mode 100644 index 0000000000000..3b6ec093c08f2 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operation.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.applicationinsights.models; + +import com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Display name of the operation. + * + * @return the display value. + */ + OperationInfo display(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Properties of the operation. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationInfo.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationInfo.java new file mode 100644 index 0000000000000..56f66943c92fc --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationInfo.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.applicationinsights.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; + +/** Information about an operation. */ +@Fluent +public final class OperationInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInfo.class); + + /* + * Name of the provider + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Name of the resource type + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Name of the operation + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Name of the provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Name of the provider. + * + * @param provider the provider value to set. + * @return the OperationInfo object itself. + */ + public OperationInfo 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 OperationInfo object itself. + */ + public OperationInfo withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Name of the operation. + * + * @param operation the operation value to set. + * @return the OperationInfo object itself. + */ + public OperationInfo withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation. + * + * @param description the description value to set. + * @return the OperationInfo object itself. + */ + public OperationInfo 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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operations.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operations.java new file mode 100644 index 0000000000000..b441b89359551 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @throws com.azure.core.management.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 result of the List Operations operation. + */ + PagedIterable list(); + + /** + * List the available operations supported by the Microsoft.EventGrid resource provider. + * + * @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 result of the List Operations operation. + */ + PagedIterable list(Context context); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationsListResult.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationsListResult.java new file mode 100644 index 0000000000000..27ec9acb9d231 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/OperationsListResult.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.applicationinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.applicationinsights.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of the List Operations operation. */ +@Fluent +public final class OperationsListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsListResult.class); + + /* + * A collection of operations + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: A collection of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A collection of operations. + * + * @param value the value value to set. + * @return the OperationsListResult object itself. + */ + public OperationsListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationsListResult object itself. + */ + public OperationsListResult 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/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/TagsResource.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/TagsResource.java new file mode 100644 index 0000000000000..2aee8ea3d38ad --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/TagsResource.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A container holding only the Tags for a resource, allowing the user to update the tags on a WebTest instance. */ +@Fluent +public final class TagsResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTest.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTest.java new file mode 100644 index 0000000000000..8cee3c8c60543 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTest.java @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of WebTest. */ +public interface WebTest { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the kind property: The kind of WebTest that this web test watches. Choices are ping and multistep. + * + * @return the kind value. + */ + WebTestKind kind(); + + /** + * Gets the syntheticMonitorId property: Unique ID of this WebTest. This is typically the same value as the Name + * field. + * + * @return the syntheticMonitorId value. + */ + String syntheticMonitorId(); + + /** + * Gets the webTestName property: User defined name if this WebTest. + * + * @return the webTestName value. + */ + String webTestName(); + + /** + * Gets the description property: User defined description for this WebTest. + * + * @return the description value. + */ + String description(); + + /** + * Gets the enabled property: Is the test actively being monitored. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the frequency property: Interval in seconds between test runs for this WebTest. Default value is 300. + * + * @return the frequency value. + */ + Integer frequency(); + + /** + * Gets the timeout property: Seconds until this WebTest will timeout and fail. Default value is 30. + * + * @return the timeout value. + */ + Integer timeout(); + + /** + * Gets the webTestKind property: The kind of web test this is, valid choices are ping, multistep, basic, and + * standard. + * + * @return the webTestKind value. + */ + WebTestKindEnum webTestKind(); + + /** + * Gets the retryEnabled property: Allow for retries should this WebTest fail. + * + * @return the retryEnabled value. + */ + Boolean retryEnabled(); + + /** + * Gets the locations property: A list of where to physically run the tests from to give global coverage for + * accessibility of your application. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the configuration property: An XML configuration specification for a WebTest. + * + * @return the configuration value. + */ + WebTestPropertiesConfiguration configuration(); + + /** + * Gets the provisioningState property: Current state of this component, whether or not is has been provisioned + * within the resource group it is defined. Users cannot change this value but are able to read from it. Values will + * include Succeeded, Deploying, Canceled, and Failed. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the request property: The collection of request properties. + * + * @return the request value. + */ + WebTestPropertiesRequest request(); + + /** + * Gets the contentValidation property: The collection of content validation properties. + * + * @return the contentValidation value. + */ + WebTestPropertiesContentValidation contentValidation(); + + /** + * Gets the sslCheck property: Checks to see if the SSL cert is still valid. + * + * @return the sslCheck value. + */ + Boolean sslCheck(); + + /** + * Gets the sslCertRemainingLifetimeCheck property: A number of days to check still remain before the the existing + * SSL cert expires. + * + * @return the sslCertRemainingLifetimeCheck value. + */ + Integer sslCertRemainingLifetimeCheck(); + + /** + * Gets the expectedHttpStatusCode property: Validate that the WebTest returns the http status code provided. + * + * @return the expectedHttpStatusCode value. + */ + Integer expectedHttpStatusCode(); + + /** + * Gets the ignoreHttpsStatusCode property: When set, validation will ignore the status code. + * + * @return the ignoreHttpsStatusCode value. + */ + Boolean ignoreHttpsStatusCode(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner object. + * + * @return the inner object. + */ + WebTestInner innerModel(); + + /** The entirety of the WebTest definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The WebTest definition stages. */ + interface DefinitionStages { + /** The first stage of the WebTest definition. */ + interface Blank extends WithLocation { + } + /** The stage of the WebTest definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the WebTest definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the WebTest definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithKind, + DefinitionStages.WithSyntheticMonitorId, + DefinitionStages.WithWebTestName, + DefinitionStages.WithDescription, + DefinitionStages.WithEnabled, + DefinitionStages.WithFrequency, + DefinitionStages.WithTimeout, + DefinitionStages.WithWebTestKind, + DefinitionStages.WithRetryEnabled, + DefinitionStages.WithLocations, + DefinitionStages.WithConfiguration, + DefinitionStages.WithRequest, + DefinitionStages.WithContentValidation, + DefinitionStages.WithSslCheck, + DefinitionStages.WithSslCertRemainingLifetimeCheck, + DefinitionStages.WithExpectedHttpStatusCode, + DefinitionStages.WithIgnoreHttpsStatusCode { + /** + * Executes the create request. + * + * @return the created resource. + */ + WebTest create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WebTest create(Context context); + } + /** The stage of the WebTest definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the WebTest definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of WebTest that this web test watches. Choices are ping and + * multistep.. + * + * @param kind The kind of WebTest that this web test watches. Choices are ping and multistep. + * @return the next definition stage. + */ + WithCreate withKind(WebTestKind kind); + } + /** The stage of the WebTest definition allowing to specify syntheticMonitorId. */ + interface WithSyntheticMonitorId { + /** + * Specifies the syntheticMonitorId property: Unique ID of this WebTest. This is typically the same value as + * the Name field.. + * + * @param syntheticMonitorId Unique ID of this WebTest. This is typically the same value as the Name field. + * @return the next definition stage. + */ + WithCreate withSyntheticMonitorId(String syntheticMonitorId); + } + /** The stage of the WebTest definition allowing to specify webTestName. */ + interface WithWebTestName { + /** + * Specifies the webTestName property: User defined name if this WebTest.. + * + * @param webTestName User defined name if this WebTest. + * @return the next definition stage. + */ + WithCreate withWebTestName(String webTestName); + } + /** The stage of the WebTest definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: User defined description for this WebTest.. + * + * @param description User defined description for this WebTest. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the WebTest definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Is the test actively being monitored.. + * + * @param enabled Is the test actively being monitored. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** The stage of the WebTest definition allowing to specify frequency. */ + interface WithFrequency { + /** + * Specifies the frequency property: Interval in seconds between test runs for this WebTest. Default value + * is 300.. + * + * @param frequency Interval in seconds between test runs for this WebTest. Default value is 300. + * @return the next definition stage. + */ + WithCreate withFrequency(Integer frequency); + } + /** The stage of the WebTest definition allowing to specify timeout. */ + interface WithTimeout { + /** + * Specifies the timeout property: Seconds until this WebTest will timeout and fail. Default value is 30.. + * + * @param timeout Seconds until this WebTest will timeout and fail. Default value is 30. + * @return the next definition stage. + */ + WithCreate withTimeout(Integer timeout); + } + /** The stage of the WebTest definition allowing to specify webTestKind. */ + interface WithWebTestKind { + /** + * Specifies the webTestKind property: The kind of web test this is, valid choices are ping, multistep, + * basic, and standard.. + * + * @param webTestKind The kind of web test this is, valid choices are ping, multistep, basic, and standard. + * @return the next definition stage. + */ + WithCreate withWebTestKind(WebTestKindEnum webTestKind); + } + /** The stage of the WebTest definition allowing to specify retryEnabled. */ + interface WithRetryEnabled { + /** + * Specifies the retryEnabled property: Allow for retries should this WebTest fail.. + * + * @param retryEnabled Allow for retries should this WebTest fail. + * @return the next definition stage. + */ + WithCreate withRetryEnabled(Boolean retryEnabled); + } + /** The stage of the WebTest definition allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: A list of where to physically run the tests from to give global + * coverage for accessibility of your application.. + * + * @param locations A list of where to physically run the tests from to give global coverage for + * accessibility of your application. + * @return the next definition stage. + */ + WithCreate withLocations(List locations); + } + /** The stage of the WebTest definition allowing to specify configuration. */ + interface WithConfiguration { + /** + * Specifies the configuration property: An XML configuration specification for a WebTest.. + * + * @param configuration An XML configuration specification for a WebTest. + * @return the next definition stage. + */ + WithCreate withConfiguration(WebTestPropertiesConfiguration configuration); + } + /** The stage of the WebTest definition allowing to specify request. */ + interface WithRequest { + /** + * Specifies the request property: The collection of request properties. + * + * @param request The collection of request properties. + * @return the next definition stage. + */ + WithCreate withRequest(WebTestPropertiesRequest request); + } + /** The stage of the WebTest definition allowing to specify contentValidation. */ + interface WithContentValidation { + /** + * Specifies the contentValidation property: The collection of content validation properties. + * + * @param contentValidation The collection of content validation properties. + * @return the next definition stage. + */ + WithCreate withContentValidation(WebTestPropertiesContentValidation contentValidation); + } + /** The stage of the WebTest definition allowing to specify sslCheck. */ + interface WithSslCheck { + /** + * Specifies the sslCheck property: Checks to see if the SSL cert is still valid.. + * + * @param sslCheck Checks to see if the SSL cert is still valid. + * @return the next definition stage. + */ + WithCreate withSslCheck(Boolean sslCheck); + } + /** The stage of the WebTest definition allowing to specify sslCertRemainingLifetimeCheck. */ + interface WithSslCertRemainingLifetimeCheck { + /** + * Specifies the sslCertRemainingLifetimeCheck property: A number of days to check still remain before the + * the existing SSL cert expires.. + * + * @param sslCertRemainingLifetimeCheck A number of days to check still remain before the the existing SSL + * cert expires. + * @return the next definition stage. + */ + WithCreate withSslCertRemainingLifetimeCheck(Integer sslCertRemainingLifetimeCheck); + } + /** The stage of the WebTest definition allowing to specify expectedHttpStatusCode. */ + interface WithExpectedHttpStatusCode { + /** + * Specifies the expectedHttpStatusCode property: Validate that the WebTest returns the http status code + * provided.. + * + * @param expectedHttpStatusCode Validate that the WebTest returns the http status code provided. + * @return the next definition stage. + */ + WithCreate withExpectedHttpStatusCode(Integer expectedHttpStatusCode); + } + /** The stage of the WebTest definition allowing to specify ignoreHttpsStatusCode. */ + interface WithIgnoreHttpsStatusCode { + /** + * Specifies the ignoreHttpsStatusCode property: When set, validation will ignore the status code.. + * + * @param ignoreHttpsStatusCode When set, validation will ignore the status code. + * @return the next definition stage. + */ + WithCreate withIgnoreHttpsStatusCode(Boolean ignoreHttpsStatusCode); + } + } + /** + * Begins update for the WebTest resource. + * + * @return the stage of resource update. + */ + WebTest.Update update(); + + /** The template for WebTest update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WebTest apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WebTest apply(Context context); + } + /** The WebTest update stages. */ + interface UpdateStages { + /** The stage of the WebTest update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WebTest refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WebTest refresh(Context context); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestGeolocation.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestGeolocation.java new file mode 100644 index 0000000000000..d2a6d0b7b5660 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestGeolocation.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.applicationinsights.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; + +/** Geo-physical location to run a WebTest from. You must specify one or more locations for the test to run from. */ +@Fluent +public final class WebTestGeolocation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestGeolocation.class); + + /* + * Location ID for the WebTest to run from. + */ + @JsonProperty(value = "Id") + private String location; + + /** + * Get the location property: Location ID for the WebTest to run from. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location ID for the WebTest to run from. + * + * @param location the location value to set. + * @return the WebTestGeolocation object itself. + */ + public WebTestGeolocation withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKind.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKind.java new file mode 100644 index 0000000000000..863583cd95cfe --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKind.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.applicationinsights.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for WebTestKind. */ +public enum WebTestKind { + /** Enum value ping. */ + PING("ping"), + + /** Enum value multistep. */ + MULTISTEP("multistep"); + + /** The actual serialized value for a WebTestKind instance. */ + private final String value; + + WebTestKind(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a WebTestKind instance. + * + * @param value the serialized value to parse. + * @return the parsed WebTestKind object, or null if unable to parse. + */ + @JsonCreator + public static WebTestKind fromString(String value) { + WebTestKind[] items = WebTestKind.values(); + for (WebTestKind item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKindEnum.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKindEnum.java new file mode 100644 index 0000000000000..d50742c383bff --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestKindEnum.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for WebTestKindEnum. */ +public enum WebTestKindEnum { + /** Enum value ping. */ + PING("ping"), + + /** Enum value multistep. */ + MULTISTEP("multistep"), + + /** Enum value basic. */ + BASIC("basic"), + + /** Enum value standard. */ + STANDARD("standard"); + + /** The actual serialized value for a WebTestKindEnum instance. */ + private final String value; + + WebTestKindEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a WebTestKindEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed WebTestKindEnum object, or null if unable to parse. + */ + @JsonCreator + public static WebTestKindEnum fromString(String value) { + WebTestKindEnum[] items = WebTestKindEnum.values(); + for (WebTestKindEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestListResult.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestListResult.java new file mode 100644 index 0000000000000..79c16189d27ab --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.applicationinsights.fluent.models.WebTestInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of 0 or more Application Insights WebTest definitions. */ +@Fluent +public final class WebTestListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestListResult.class); + + /* + * Set of Application Insights WebTest definitions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to get the next part of the returned list of WebTest, should + * the return set be too large for a single request. May be null. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Set of Application Insights WebTest definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Set of Application Insights WebTest definitions. + * + * @param value the value value to set. + * @return the WebTestListResult object itself. + */ + public WebTestListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to get the next part of the returned list of WebTest, should the return set + * be too large for a single request. May be null. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to get the next part of the returned list of WebTest, should the return set + * be too large for a single request. May be null. + * + * @param nextLink the nextLink value to set. + * @return the WebTestListResult object itself. + */ + public WebTestListResult 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) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model WebTestListResult")); + } else { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesConfiguration.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesConfiguration.java new file mode 100644 index 0000000000000..ab03f9880d4b2 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesConfiguration.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.applicationinsights.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; + +/** An XML configuration specification for a WebTest. */ +@Fluent +public final class WebTestPropertiesConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestPropertiesConfiguration.class); + + /* + * The XML specification of a WebTest to run against an application. + */ + @JsonProperty(value = "WebTest") + private String webTest; + + /** + * Get the webTest property: The XML specification of a WebTest to run against an application. + * + * @return the webTest value. + */ + public String webTest() { + return this.webTest; + } + + /** + * Set the webTest property: The XML specification of a WebTest to run against an application. + * + * @param webTest the webTest value to set. + * @return the WebTestPropertiesConfiguration object itself. + */ + public WebTestPropertiesConfiguration withWebTest(String webTest) { + this.webTest = webTest; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesContentValidation.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesContentValidation.java new file mode 100644 index 0000000000000..028ee56b40480 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesContentValidation.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.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 collection of content validation properties. */ +@Fluent +public final class WebTestPropertiesContentValidation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestPropertiesContentValidation.class); + + /* + * Content to look for in the return of the WebTest. + */ + @JsonProperty(value = "ContentMatch") + private String contentMatch; + + /* + * When set, this value makes the ContentMatch validation case insensitive. + */ + @JsonProperty(value = "IgnoreCase") + private Boolean ignoreCase; + + /* + * When true, validation will pass if there is a match for the ContentMatch + * string. If false, validation will fail if there is a match + */ + @JsonProperty(value = "PassIfTextFound") + private Boolean passIfTextFound; + + /** + * Get the contentMatch property: Content to look for in the return of the WebTest. + * + * @return the contentMatch value. + */ + public String contentMatch() { + return this.contentMatch; + } + + /** + * Set the contentMatch property: Content to look for in the return of the WebTest. + * + * @param contentMatch the contentMatch value to set. + * @return the WebTestPropertiesContentValidation object itself. + */ + public WebTestPropertiesContentValidation withContentMatch(String contentMatch) { + this.contentMatch = contentMatch; + return this; + } + + /** + * Get the ignoreCase property: When set, this value makes the ContentMatch validation case insensitive. + * + * @return the ignoreCase value. + */ + public Boolean ignoreCase() { + return this.ignoreCase; + } + + /** + * Set the ignoreCase property: When set, this value makes the ContentMatch validation case insensitive. + * + * @param ignoreCase the ignoreCase value to set. + * @return the WebTestPropertiesContentValidation object itself. + */ + public WebTestPropertiesContentValidation withIgnoreCase(Boolean ignoreCase) { + this.ignoreCase = ignoreCase; + return this; + } + + /** + * Get the passIfTextFound property: When true, validation will pass if there is a match for the ContentMatch + * string. If false, validation will fail if there is a match. + * + * @return the passIfTextFound value. + */ + public Boolean passIfTextFound() { + return this.passIfTextFound; + } + + /** + * Set the passIfTextFound property: When true, validation will pass if there is a match for the ContentMatch + * string. If false, validation will fail if there is a match. + * + * @param passIfTextFound the passIfTextFound value to set. + * @return the WebTestPropertiesContentValidation object itself. + */ + public WebTestPropertiesContentValidation withPassIfTextFound(Boolean passIfTextFound) { + this.passIfTextFound = passIfTextFound; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesRequest.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesRequest.java new file mode 100644 index 0000000000000..61cf3e35cdfec --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTestPropertiesRequest.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The collection of request properties. */ +@Fluent +public final class WebTestPropertiesRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebTestPropertiesRequest.class); + + /* + * Url location to test. + */ + @JsonProperty(value = "RequestUrl") + private String requestUrl; + + /* + * List of headers and their values to add to the WebTest call. + */ + @JsonProperty(value = "Headers") + private List headers; + + /* + * Http verb to use for this web test. + */ + @JsonProperty(value = "HttpVerb") + private String httpVerb; + + /* + * Base64 encoded string body to send with this web test. + */ + @JsonProperty(value = "RequestBody") + private String requestBody; + + /* + * Parse Dependent request for this WebTest. + */ + @JsonProperty(value = "ParseDependentRequests") + private Boolean parseDependentRequests; + + /* + * Follow redirects for this web test. + */ + @JsonProperty(value = "FollowRedirects") + private Boolean followRedirects; + + /** + * Get the requestUrl property: Url location to test. + * + * @return the requestUrl value. + */ + public String requestUrl() { + return this.requestUrl; + } + + /** + * Set the requestUrl property: Url location to test. + * + * @param requestUrl the requestUrl value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withRequestUrl(String requestUrl) { + this.requestUrl = requestUrl; + return this; + } + + /** + * Get the headers property: List of headers and their values to add to the WebTest call. + * + * @return the headers value. + */ + public List headers() { + return this.headers; + } + + /** + * Set the headers property: List of headers and their values to add to the WebTest call. + * + * @param headers the headers value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withHeaders(List headers) { + this.headers = headers; + return this; + } + + /** + * Get the httpVerb property: Http verb to use for this web test. + * + * @return the httpVerb value. + */ + public String httpVerb() { + return this.httpVerb; + } + + /** + * Set the httpVerb property: Http verb to use for this web test. + * + * @param httpVerb the httpVerb value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withHttpVerb(String httpVerb) { + this.httpVerb = httpVerb; + return this; + } + + /** + * Get the requestBody property: Base64 encoded string body to send with this web test. + * + * @return the requestBody value. + */ + public String requestBody() { + return this.requestBody; + } + + /** + * Set the requestBody property: Base64 encoded string body to send with this web test. + * + * @param requestBody the requestBody value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withRequestBody(String requestBody) { + this.requestBody = requestBody; + return this; + } + + /** + * Get the parseDependentRequests property: Parse Dependent request for this WebTest. + * + * @return the parseDependentRequests value. + */ + public Boolean parseDependentRequests() { + return this.parseDependentRequests; + } + + /** + * Set the parseDependentRequests property: Parse Dependent request for this WebTest. + * + * @param parseDependentRequests the parseDependentRequests value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withParseDependentRequests(Boolean parseDependentRequests) { + this.parseDependentRequests = parseDependentRequests; + return this; + } + + /** + * Get the followRedirects property: Follow redirects for this web test. + * + * @return the followRedirects value. + */ + public Boolean followRedirects() { + return this.followRedirects; + } + + /** + * Set the followRedirects property: Follow redirects for this web test. + * + * @param followRedirects the followRedirects value to set. + * @return the WebTestPropertiesRequest object itself. + */ + public WebTestPropertiesRequest withFollowRedirects(Boolean followRedirects) { + this.followRedirects = followRedirects; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (headers() != null) { + headers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTests.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTests.java new file mode 100644 index 0000000000000..ecbce7a6dcdbf --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebTests.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of WebTests. */ +public interface WebTests { + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get all Application Insights web tests defined within a specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined within a specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + WebTest getByResourceGroup(String resourceGroupName, String webTestName); + + /** + * Get a specific Application Insights web test definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String webTestName, Context context); + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String webTestName); + + /** + * Deletes an Application Insights web test. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param webTestName The name of the Application Insights WebTest resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String webTestName, Context context); + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @throws com.azure.core.management.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 all Application Insights web test alerts definitions within a subscription. + */ + PagedIterable list(); + + /** + * Get all Application Insights web test alerts definitions within a subscription. + * + * @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 all Application Insights web test alerts definitions within a subscription. + */ + PagedIterable list(Context context); + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + PagedIterable listByComponent(String componentName, String resourceGroupName); + + /** + * Get all Application Insights web tests defined for the specified component. + * + * @param componentName The name of the Application Insights component resource. + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all Application Insights web tests defined for the specified component. + */ + PagedIterable listByComponent(String componentName, String resourceGroupName, Context context); + + /** + * Get a specific Application Insights web test definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + WebTest getById(String id); + + /** + * Get a specific Application Insights web test definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a specific Application Insights web test definition. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Application Insights web test. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Application Insights web test. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WebTest resource. + * + * @param name resource name. + * @return the first stage of the new WebTest definition. + */ + WebTest.DefinitionStages.Blank define(String name); +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebtestsResource.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebtestsResource.java new file mode 100644 index 0000000000000..1c3102c9c9a5b --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/WebtestsResource.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.applicationinsights.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** An azure resource object. */ +@Immutable +public class WebtestsResource extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebtestsResource.class); + + /** {@inheritDoc} */ + @Override + public WebtestsResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public WebtestsResource withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/package-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/package-info.java new file mode 100644 index 0000000000000..9202cf0531185 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/models/package-info.java @@ -0,0 +1,9 @@ +// 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 ApplicationInsightsManagementClient. Composite Swagger for Application + * Insights Management Client. + */ +package com.azure.resourcemanager.applicationinsights.models; diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/package-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/package-info.java new file mode 100644 index 0000000000000..f6e592a7643c4 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/com/azure/resourcemanager/applicationinsights/package-info.java @@ -0,0 +1,9 @@ +// 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 ApplicationInsightsManagementClient. Composite Swagger for Application Insights + * Management Client. + */ +package com.azure.resourcemanager.applicationinsights; diff --git a/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/module-info.java b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/src/main/java/module-info.java new file mode 100644 index 0000000000000..4804b9d8c0bb9 --- /dev/null +++ b/sdk/applicationinsights/azure-resourcemanager-applicationinsights/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.applicationinsights { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.applicationinsights; + exports com.azure.resourcemanager.applicationinsights.fluent; + exports com.azure.resourcemanager.applicationinsights.fluent.models; + exports com.azure.resourcemanager.applicationinsights.models; + + opens com.azure.resourcemanager.applicationinsights.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.applicationinsights.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/applicationinsights/ci.yml b/sdk/applicationinsights/ci.yml new file mode 100644 index 0000000000000..3ff2c24654abb --- /dev/null +++ b/sdk/applicationinsights/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/applicationinsights/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/applicationinsights/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: applicationinsights + Artifacts: + - name: azure-resourcemanager-applicationinsights + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerapplicationinsights diff --git a/sdk/applicationinsights/pom.xml b/sdk/applicationinsights/pom.xml new file mode 100644 index 0000000000000..a0800c471c90d --- /dev/null +++ b/sdk/applicationinsights/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-applicationinsights-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-applicationinsights + + + +