From 0e1d2e5ffd47adfc1f2f2ddf8238fd9fe1cbcd20 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Jun 2021 05:01:45 +0000 Subject: [PATCH] CodeGen from PR 15004 in Azure/azure-rest-api-specs Merge 6499299d6c461b8efb750d5850f0e59ac7acdcea into 25af5c1c0fae2bc594c1932445d06209745f5917 --- eng/versioning/version_client.txt | 1 + pom.xml | 3 +- .../CHANGELOG.md | 5 + .../README.md | 101 + .../pom.xml | 86 + .../WorkloadMonitorManager.java | 238 +++ .../fluent/HealthMonitorsClient.java | 242 +++ .../fluent/OperationsClient.java | 36 + .../fluent/WorkloadMonitorApi.java | 53 + .../fluent/models/HealthMonitorInner.java | 293 +++ .../models/HealthMonitorStateChangeInner.java | 242 +++ .../fluent/models/OperationInner.java | 121 ++ .../fluent/models/package-info.java | 6 + .../workloadmonitor/fluent/package-info.java | 6 + .../implementation/HealthMonitorImpl.java | 86 + .../HealthMonitorStateChangeImpl.java | 78 + .../HealthMonitorsClientImpl.java | 1720 +++++++++++++++++ .../implementation/HealthMonitorsImpl.java | 234 +++ .../implementation/OperationImpl.java | 41 + .../implementation/OperationsClientImpl.java | 269 +++ .../implementation/OperationsImpl.java | 46 + .../workloadmonitor/implementation/Utils.java | 204 ++ .../WorkloadMonitorApiBuilder.java | 129 ++ .../WorkloadMonitorApiImpl.java | 292 +++ .../implementation/package-info.java | 6 + .../workloadmonitor/models/HealthMonitor.java | 116 ++ .../models/HealthMonitorList.java | 81 + .../models/HealthMonitorStateChange.java | 102 + .../models/HealthMonitorStateChangeList.java | 81 + .../models/HealthMonitors.java | 230 +++ .../workloadmonitor/models/HealthState.java | 46 + .../workloadmonitor/models/Operation.java | 38 + .../models/OperationDisplay.java | 148 ++ .../workloadmonitor/models/OperationList.java | 81 + .../workloadmonitor/models/Operations.java | 31 + .../workloadmonitor/models/package-info.java | 6 + .../workloadmonitor/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/workloadmonitor/ci.yml | 33 + sdk/workloadmonitor/pom.xml | 53 + 40 files changed, 5608 insertions(+), 1 deletion(-) create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/CHANGELOG.md create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/README.md create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/pom.xml create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/WorkloadMonitorManager.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/HealthMonitorsClient.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/OperationsClient.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/WorkloadMonitorApi.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorInner.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorStateChangeInner.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/OperationInner.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/package-info.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/package-info.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorStateChangeImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsClientImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsClientImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/Utils.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiBuilder.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiImpl.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/package-info.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitor.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorList.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChange.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChangeList.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitors.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthState.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operation.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationDisplay.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationList.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operations.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/package-info.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/package-info.java create mode 100644 sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/module-info.java create mode 100644 sdk/workloadmonitor/ci.yml create mode 100644 sdk/workloadmonitor/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 8fd37cf545ed1..edc0985192f77 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -300,6 +300,7 @@ com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-workloadmonitor;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 8a459dd59a622..b01f8176565c1 100644 --- a/pom.xml +++ b/pom.xml @@ -707,6 +707,7 @@ eng/code-quality-reports eng/jacoco-test-coverage sdk/advisor + sdk/agrifood sdk/anomalydetector sdk/apimanagement sdk/appconfiguration @@ -751,7 +752,6 @@ sdk/digitaltwins sdk/eventgrid sdk/eventhubs - sdk/agrifood sdk/formrecognizer sdk/frontdoor sdk/hanaonazure @@ -822,6 +822,7 @@ sdk/videoanalyzer sdk/vmwarecloudsimple sdk/webpubsub + sdk/workloadmonitor diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/CHANGELOG.md b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/CHANGELOG.md new file mode 100644 index 0000000000000..56229f0b5c41b --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-06-28) + +- Azure Resource Manager WorkloadMonitor client library for Java. This package contains Microsoft Azure SDK for WorkloadMonitor Management SDK. Workload Monitor API. Package tag package-2020-01-13-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/README.md b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/README.md new file mode 100644 index 0000000000000..d09ddcda9aedd --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager WorkloadMonitor client library for Java + +Azure Resource Manager WorkloadMonitor client library for Java. + +This package contains Microsoft Azure SDK for WorkloadMonitor Management SDK. Workload Monitor API. Package tag package-2020-01-13-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-workloadmonitor;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-workloadmonitor + 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(); +WorkloadMonitorManager manager = WorkloadMonitorManager + .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/workloadmonitor/azure-resourcemanager-workloadmonitor/pom.xml b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/pom.xml new file mode 100644 index 0000000000000..8ff8f78b6ec62 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-workloadmonitor + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for WorkloadMonitor Management + This package contains Microsoft Azure SDK for WorkloadMonitor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Workload Monitor API. Package tag package-2020-01-13-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.17.0 + + + com.azure + azure-core-management + 1.3.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/WorkloadMonitorManager.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/WorkloadMonitorManager.java new file mode 100644 index 0000000000000..c0787031a6496 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/WorkloadMonitorManager.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor; + +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.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.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.fluent.WorkloadMonitorApi; +import com.azure.resourcemanager.workloadmonitor.implementation.HealthMonitorsImpl; +import com.azure.resourcemanager.workloadmonitor.implementation.OperationsImpl; +import com.azure.resourcemanager.workloadmonitor.implementation.WorkloadMonitorApiBuilder; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitors; +import com.azure.resourcemanager.workloadmonitor.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to WorkloadMonitorManager. Workload Monitor API. */ +public final class WorkloadMonitorManager { + private Operations operations; + + private HealthMonitors healthMonitors; + + private final WorkloadMonitorApi clientObject; + + private WorkloadMonitorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new WorkloadMonitorApiBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of WorkloadMonitor service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the WorkloadMonitor service API instance. + */ + public static WorkloadMonitorManager 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 WorkloadMonitorManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new WorkloadMonitorManager.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 final List scopes = 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; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' 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 WorkloadMonitor service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the WorkloadMonitor service API instance. + */ + public WorkloadMonitorManager 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.workloadmonitor") + .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 (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + 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 ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new WorkloadMonitorManager(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 HealthMonitors. */ + public HealthMonitors healthMonitors() { + if (this.healthMonitors == null) { + this.healthMonitors = new HealthMonitorsImpl(clientObject.getHealthMonitors(), this); + } + return healthMonitors; + } + + /** + * @return Wrapped service client WorkloadMonitorApi providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public WorkloadMonitorApi serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/HealthMonitorsClient.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/HealthMonitorsClient.java new file mode 100644 index 0000000000000..c4f0be0a07b55 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/HealthMonitorsClient.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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.workloadmonitor.fluent.models.HealthMonitorInner; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; +import java.time.OffsetDateTime; + +/** An instance of this class provides access to all the operations defined in HealthMonitorsClient. */ +public interface HealthMonitorsClient { + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @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 current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName); + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context); + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @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 current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthMonitorInner get( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId); + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand, + Context context); + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId); + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context); + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + HealthMonitorStateChangeInner getStateChange( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix); + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getStateChangeWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand, + Context context); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/OperationsClient.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/OperationsClient.java new file mode 100644 index 0000000000000..78232fc8a52ab --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/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.workloadmonitor.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.workloadmonitor.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Get a list of all available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/WorkloadMonitorApi.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/WorkloadMonitorApi.java new file mode 100644 index 0000000000000..1e0287b0970d6 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/WorkloadMonitorApi.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.workloadmonitor.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for WorkloadMonitorApi class. */ +public interface WorkloadMonitorApi { + /** + * 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 HealthMonitorsClient object to access its operations. + * + * @return the HealthMonitorsClient object. + */ + HealthMonitorsClient getHealthMonitors(); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorInner.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorInner.java new file mode 100644 index 0000000000000..df47cc211c5ba --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorInner.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.models.HealthState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the monitor’s current health status. */ +@JsonFlatten +@Fluent +public class HealthMonitorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthMonitorInner.class); + + /* + * Human-readable name of the monitor. + */ + @JsonProperty(value = "properties.monitorName") + private String monitorName; + + /* + * Type of the monitor. + */ + @JsonProperty(value = "properties.monitorType") + private String monitorType; + + /* + * Dynamic monitored object of the monitor. + */ + @JsonProperty(value = "properties.monitoredObject") + private String monitoredObject; + + /* + * Name of the parent monitor. + */ + @JsonProperty(value = "properties.parentMonitorName") + private String parentMonitorName; + + /* + * Previous health state of the monitor. + */ + @JsonProperty(value = "properties.previousMonitorState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState previousMonitorState; + + /* + * Current health state of the monitor. + */ + @JsonProperty(value = "properties.currentMonitorState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState currentMonitorState; + + /* + * Timestamp of the monitor's last health evaluation. + */ + @JsonProperty(value = "properties.evaluationTimestamp") + private String evaluationTimestamp; + + /* + * Timestamp of the monitor's last health state change. + */ + @JsonProperty(value = "properties.currentStateFirstObservedTimestamp") + private String currentStateFirstObservedTimestamp; + + /* + * Timestamp of the monitor's last reported health state. + */ + @JsonProperty(value = "properties.lastReportedTimestamp") + private String lastReportedTimestamp; + + /* + * Evidence validating the monitor's current health state. + */ + @JsonProperty(value = "properties.evidence") + private Object evidence; + + /* + * The configuration settings at the time of the monitor's health + * evaluation. + */ + @JsonProperty(value = "properties.monitorConfiguration") + private Object monitorConfiguration; + + /** + * Get the monitorName property: Human-readable name of the monitor. + * + * @return the monitorName value. + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Set the monitorName property: Human-readable name of the monitor. + * + * @param monitorName the monitorName value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withMonitorName(String monitorName) { + this.monitorName = monitorName; + return this; + } + + /** + * Get the monitorType property: Type of the monitor. + * + * @return the monitorType value. + */ + public String monitorType() { + return this.monitorType; + } + + /** + * Set the monitorType property: Type of the monitor. + * + * @param monitorType the monitorType value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withMonitorType(String monitorType) { + this.monitorType = monitorType; + return this; + } + + /** + * Get the monitoredObject property: Dynamic monitored object of the monitor. + * + * @return the monitoredObject value. + */ + public String monitoredObject() { + return this.monitoredObject; + } + + /** + * Set the monitoredObject property: Dynamic monitored object of the monitor. + * + * @param monitoredObject the monitoredObject value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withMonitoredObject(String monitoredObject) { + this.monitoredObject = monitoredObject; + return this; + } + + /** + * Get the parentMonitorName property: Name of the parent monitor. + * + * @return the parentMonitorName value. + */ + public String parentMonitorName() { + return this.parentMonitorName; + } + + /** + * Set the parentMonitorName property: Name of the parent monitor. + * + * @param parentMonitorName the parentMonitorName value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withParentMonitorName(String parentMonitorName) { + this.parentMonitorName = parentMonitorName; + return this; + } + + /** + * Get the previousMonitorState property: Previous health state of the monitor. + * + * @return the previousMonitorState value. + */ + public HealthState previousMonitorState() { + return this.previousMonitorState; + } + + /** + * Get the currentMonitorState property: Current health state of the monitor. + * + * @return the currentMonitorState value. + */ + public HealthState currentMonitorState() { + return this.currentMonitorState; + } + + /** + * Get the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @return the evaluationTimestamp value. + */ + public String evaluationTimestamp() { + return this.evaluationTimestamp; + } + + /** + * Set the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @param evaluationTimestamp the evaluationTimestamp value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withEvaluationTimestamp(String evaluationTimestamp) { + this.evaluationTimestamp = evaluationTimestamp; + return this; + } + + /** + * Get the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @return the currentStateFirstObservedTimestamp value. + */ + public String currentStateFirstObservedTimestamp() { + return this.currentStateFirstObservedTimestamp; + } + + /** + * Set the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @param currentStateFirstObservedTimestamp the currentStateFirstObservedTimestamp value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withCurrentStateFirstObservedTimestamp(String currentStateFirstObservedTimestamp) { + this.currentStateFirstObservedTimestamp = currentStateFirstObservedTimestamp; + return this; + } + + /** + * Get the lastReportedTimestamp property: Timestamp of the monitor's last reported health state. + * + * @return the lastReportedTimestamp value. + */ + public String lastReportedTimestamp() { + return this.lastReportedTimestamp; + } + + /** + * Set the lastReportedTimestamp property: Timestamp of the monitor's last reported health state. + * + * @param lastReportedTimestamp the lastReportedTimestamp value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withLastReportedTimestamp(String lastReportedTimestamp) { + this.lastReportedTimestamp = lastReportedTimestamp; + return this; + } + + /** + * Get the evidence property: Evidence validating the monitor's current health state. + * + * @return the evidence value. + */ + public Object evidence() { + return this.evidence; + } + + /** + * Set the evidence property: Evidence validating the monitor's current health state. + * + * @param evidence the evidence value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withEvidence(Object evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get the monitorConfiguration property: The configuration settings at the time of the monitor's health evaluation. + * + * @return the monitorConfiguration value. + */ + public Object monitorConfiguration() { + return this.monitorConfiguration; + } + + /** + * Set the monitorConfiguration property: The configuration settings at the time of the monitor's health evaluation. + * + * @param monitorConfiguration the monitorConfiguration value to set. + * @return the HealthMonitorInner object itself. + */ + public HealthMonitorInner withMonitorConfiguration(Object monitorConfiguration) { + this.monitorConfiguration = monitorConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorStateChangeInner.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorStateChangeInner.java new file mode 100644 index 0000000000000..77101e0b1fbc0 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/HealthMonitorStateChangeInner.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.models.HealthState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about the monitor’s health state change at the provided timestamp. */ +@JsonFlatten +@Fluent +public class HealthMonitorStateChangeInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthMonitorStateChangeInner.class); + + /* + * Human-readable name of the monitor. + */ + @JsonProperty(value = "properties.monitorName") + private String monitorName; + + /* + * Type of the monitor. + */ + @JsonProperty(value = "properties.monitorType") + private String monitorType; + + /* + * Dynamic monitored object of the monitor. + */ + @JsonProperty(value = "properties.monitoredObject") + private String monitoredObject; + + /* + * Timestamp of the monitor's last health evaluation. + */ + @JsonProperty(value = "properties.evaluationTimestamp") + private String evaluationTimestamp; + + /* + * Timestamp of the monitor's last health state change. + */ + @JsonProperty(value = "properties.currentStateFirstObservedTimestamp") + private String currentStateFirstObservedTimestamp; + + /* + * Previous health state of the monitor. + */ + @JsonProperty(value = "properties.previousMonitorState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState previousMonitorState; + + /* + * Current health state of the monitor. + */ + @JsonProperty(value = "properties.currentMonitorState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState currentMonitorState; + + /* + * Evidence validating the monitor's current health state. + */ + @JsonProperty(value = "properties.evidence") + private Object evidence; + + /* + * The configuration settings at the time of the monitor's health + * evaluation. + */ + @JsonProperty(value = "properties.monitorConfiguration") + private Object monitorConfiguration; + + /** + * Get the monitorName property: Human-readable name of the monitor. + * + * @return the monitorName value. + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Set the monitorName property: Human-readable name of the monitor. + * + * @param monitorName the monitorName value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withMonitorName(String monitorName) { + this.monitorName = monitorName; + return this; + } + + /** + * Get the monitorType property: Type of the monitor. + * + * @return the monitorType value. + */ + public String monitorType() { + return this.monitorType; + } + + /** + * Set the monitorType property: Type of the monitor. + * + * @param monitorType the monitorType value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withMonitorType(String monitorType) { + this.monitorType = monitorType; + return this; + } + + /** + * Get the monitoredObject property: Dynamic monitored object of the monitor. + * + * @return the monitoredObject value. + */ + public String monitoredObject() { + return this.monitoredObject; + } + + /** + * Set the monitoredObject property: Dynamic monitored object of the monitor. + * + * @param monitoredObject the monitoredObject value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withMonitoredObject(String monitoredObject) { + this.monitoredObject = monitoredObject; + return this; + } + + /** + * Get the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @return the evaluationTimestamp value. + */ + public String evaluationTimestamp() { + return this.evaluationTimestamp; + } + + /** + * Set the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @param evaluationTimestamp the evaluationTimestamp value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withEvaluationTimestamp(String evaluationTimestamp) { + this.evaluationTimestamp = evaluationTimestamp; + return this; + } + + /** + * Get the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @return the currentStateFirstObservedTimestamp value. + */ + public String currentStateFirstObservedTimestamp() { + return this.currentStateFirstObservedTimestamp; + } + + /** + * Set the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @param currentStateFirstObservedTimestamp the currentStateFirstObservedTimestamp value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withCurrentStateFirstObservedTimestamp( + String currentStateFirstObservedTimestamp) { + this.currentStateFirstObservedTimestamp = currentStateFirstObservedTimestamp; + return this; + } + + /** + * Get the previousMonitorState property: Previous health state of the monitor. + * + * @return the previousMonitorState value. + */ + public HealthState previousMonitorState() { + return this.previousMonitorState; + } + + /** + * Get the currentMonitorState property: Current health state of the monitor. + * + * @return the currentMonitorState value. + */ + public HealthState currentMonitorState() { + return this.currentMonitorState; + } + + /** + * Get the evidence property: Evidence validating the monitor's current health state. + * + * @return the evidence value. + */ + public Object evidence() { + return this.evidence; + } + + /** + * Set the evidence property: Evidence validating the monitor's current health state. + * + * @param evidence the evidence value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withEvidence(Object evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get the monitorConfiguration property: The configuration settings at the time of the monitor's health evaluation. + * + * @return the monitorConfiguration value. + */ + public Object monitorConfiguration() { + return this.monitorConfiguration; + } + + /** + * Set the monitorConfiguration property: The configuration settings at the time of the monitor's health evaluation. + * + * @param monitorConfiguration the monitorConfiguration value to set. + * @return the HealthMonitorStateChangeInner object itself. + */ + public HealthMonitorStateChangeInner withMonitorConfiguration(Object monitorConfiguration) { + this.monitorConfiguration = monitorConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/OperationInner.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..e9983ca23721b --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/OperationInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Operation supported by the resource provider. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The localized display information for this particular operation or + * action. + */ + @JsonProperty(value = "display", required = true) + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", required = true) + private String origin; + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the operation being performed on this particular object. + * + * @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: The localized display information for this particular operation or action. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The localized display information for this particular operation or action. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The intended executor 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model OperationInner")); + } + if (display() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property display in model OperationInner")); + } else { + display().validate(); + } + if (origin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property origin in model OperationInner")); + } + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/package-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/package-info.java new file mode 100644 index 0000000000000..fc1d3b85a960b --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for WorkloadMonitorApi. Workload Monitor API. */ +package com.azure.resourcemanager.workloadmonitor.fluent.models; diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/package-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/package-info.java new file mode 100644 index 0000000000000..ac04456e3f11f --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for WorkloadMonitorApi. Workload Monitor API. */ +package com.azure.resourcemanager.workloadmonitor.fluent; diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorImpl.java new file mode 100644 index 0000000000000..293e925f1048d --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.implementation; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitor; +import com.azure.resourcemanager.workloadmonitor.models.HealthState; + +public final class HealthMonitorImpl implements HealthMonitor { + private HealthMonitorInner innerObject; + + private final com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager; + + HealthMonitorImpl( + HealthMonitorInner innerObject, + com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String monitorName() { + return this.innerModel().monitorName(); + } + + public String monitorType() { + return this.innerModel().monitorType(); + } + + public String monitoredObject() { + return this.innerModel().monitoredObject(); + } + + public String parentMonitorName() { + return this.innerModel().parentMonitorName(); + } + + public HealthState previousMonitorState() { + return this.innerModel().previousMonitorState(); + } + + public HealthState currentMonitorState() { + return this.innerModel().currentMonitorState(); + } + + public String evaluationTimestamp() { + return this.innerModel().evaluationTimestamp(); + } + + public String currentStateFirstObservedTimestamp() { + return this.innerModel().currentStateFirstObservedTimestamp(); + } + + public String lastReportedTimestamp() { + return this.innerModel().lastReportedTimestamp(); + } + + public Object evidence() { + return this.innerModel().evidence(); + } + + public Object monitorConfiguration() { + return this.innerModel().monitorConfiguration(); + } + + public HealthMonitorInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorStateChangeImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorStateChangeImpl.java new file mode 100644 index 0000000000000..f9199faa6839d --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorStateChangeImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.implementation; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitorStateChange; +import com.azure.resourcemanager.workloadmonitor.models.HealthState; + +public final class HealthMonitorStateChangeImpl implements HealthMonitorStateChange { + private HealthMonitorStateChangeInner innerObject; + + private final com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager; + + HealthMonitorStateChangeImpl( + HealthMonitorStateChangeInner innerObject, + com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String monitorName() { + return this.innerModel().monitorName(); + } + + public String monitorType() { + return this.innerModel().monitorType(); + } + + public String monitoredObject() { + return this.innerModel().monitoredObject(); + } + + public String evaluationTimestamp() { + return this.innerModel().evaluationTimestamp(); + } + + public String currentStateFirstObservedTimestamp() { + return this.innerModel().currentStateFirstObservedTimestamp(); + } + + public HealthState previousMonitorState() { + return this.innerModel().previousMonitorState(); + } + + public HealthState currentMonitorState() { + return this.innerModel().currentMonitorState(); + } + + public Object evidence() { + return this.innerModel().evidence(); + } + + public Object monitorConfiguration() { + return this.innerModel().monitorConfiguration(); + } + + public HealthMonitorStateChangeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsClientImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsClientImpl.java new file mode 100644 index 0000000000000..9b36a7b351ec5 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsClientImpl.java @@ -0,0 +1,1720 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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.workloadmonitor.fluent.HealthMonitorsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitorList; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitorStateChangeList; +import java.time.OffsetDateTime; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in HealthMonitorsClient. */ +public final class HealthMonitorsClientImpl implements HealthMonitorsClient { + private final ClientLogger logger = new ClientLogger(HealthMonitorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final HealthMonitorsService service; + + /** The service client containing this operation class. */ + private final WorkloadMonitorApiImpl client; + + /** + * Initializes an instance of HealthMonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + HealthMonitorsClientImpl(WorkloadMonitorApiImpl client) { + this.service = + RestProxy.create(HealthMonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WorkloadMonitorApiHealthMonitors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "WorkloadMonitorApiHe") + private interface HealthMonitorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}" + + "/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @PathParam("resourceCollectionName") String resourceCollectionName, + @PathParam("resourceName") String resourceName, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}" + + "/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @PathParam("resourceCollectionName") String resourceCollectionName, + @PathParam("resourceName") String resourceName, + @PathParam("monitorId") String monitorId, + @QueryParam("$expand") String expand, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}" + + "/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}" + + "/history") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listStateChanges( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @PathParam("resourceCollectionName") String resourceCollectionName, + @PathParam("resourceName") String resourceName, + @PathParam("monitorId") String monitorId, + @QueryParam("$filter") String filter, + @QueryParam("$expand") String expand, + @QueryParam("startTimestampUtc") OffsetDateTime startTimestampUtc, + @QueryParam("endTimestampUtc") OffsetDateTime endTimestampUtc, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{providerName}" + + "/{resourceCollectionName}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}" + + "/history/{timestampUnix}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getStateChange( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @PathParam("resourceCollectionName") String resourceCollectionName, + @PathParam("resourceName") String resourceName, + @PathParam("monitorId") String monitorId, + @PathParam("timestampUnix") String timestampUnix, + @QueryParam("$expand") String expand, + @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> listStateChangesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand, + 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 current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName 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(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName) { + final String filter = null; + final String expand = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand, + context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName) { + final String filter = null; + final String expand = null; + return new PagedIterable<>( + listAsync( + subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName, filter, expand)); + } + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of all monitors of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context) { + return new PagedIterable<>( + listAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand, + context)); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand, + accept, + context); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand) { + return getWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + final String expand = null; + return getWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthMonitorInner get( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + final String expand = null; + return getAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand) + .block(); + } + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of a monitor of a virtual machine. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand, + Context context) { + return getWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand, + context) + .block(); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStateChangesSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listStateChanges( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc, + 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 health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStateChangesSinglePageAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listStateChanges( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listStateChangesAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc) { + return new PagedFlux<>( + () -> + listStateChangesSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc), + nextLink -> listStateChangesNextSinglePageAsync(nextLink)); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listStateChangesAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + final String filter = null; + final String expand = null; + final OffsetDateTime startTimestampUtc = null; + final OffsetDateTime endTimestampUtc = null; + return new PagedFlux<>( + () -> + listStateChangesSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc), + nextLink -> listStateChangesNextSinglePageAsync(nextLink)); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listStateChangesAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context) { + return new PagedFlux<>( + () -> + listStateChangesSinglePageAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc, + context), + nextLink -> listStateChangesNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + final String filter = null; + final String expand = null; + final OffsetDateTime startTimestampUtc = null; + final OffsetDateTime endTimestampUtc = null; + return new PagedIterable<>( + listStateChangesAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc)); + } + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context) { + return new PagedIterable<>( + listStateChangesAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc, + context)); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStateChangeWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + if (timestampUnix == null) { + return Mono.error(new IllegalArgumentException("Parameter timestampUnix is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getStateChange( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getStateChangeWithResponseAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (subscriptionId == null) { + return Mono.error(new IllegalArgumentException("Parameter subscriptionId is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (resourceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter resourceCollectionName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (monitorId == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorId is required and cannot be null.")); + } + if (timestampUnix == null) { + return Mono.error(new IllegalArgumentException("Parameter timestampUnix is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getStateChange( + this.client.getEndpoint(), + this.client.getApiVersion(), + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand, + accept, + context); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getStateChangeAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand) { + return getStateChangeWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getStateChangeAsync( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix) { + final String expand = null; + return getStateChangeWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public HealthMonitorStateChangeInner getStateChange( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix) { + final String expand = null; + return getStateChangeAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand) + .block(); + } + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getStateChangeWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand, + Context context) { + return getStateChangeWithResponseAsync( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand, + context) + .block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the current health statuses of the monitors. + */ + @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 information about the current health statuses of the monitors. + */ + @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 information about the health state changes of the monitor within the provided time window. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStateChangesNextSinglePageAsync(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.listStateChangesNext(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 information about the health state changes of the monitor within the provided time window. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listStateChangesNextSinglePageAsync( + 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 + .listStateChangesNext(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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsImpl.java new file mode 100644 index 0000000000000..22be1166e1183 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/HealthMonitorsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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.workloadmonitor.fluent.HealthMonitorsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitor; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitorStateChange; +import com.azure.resourcemanager.workloadmonitor.models.HealthMonitors; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.OffsetDateTime; + +public final class HealthMonitorsImpl implements HealthMonitors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthMonitorsImpl.class); + + private final HealthMonitorsClient innerClient; + + private final com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager; + + public HealthMonitorsImpl( + HealthMonitorsClient innerClient, + com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName) { + PagedIterable inner = + this + .serviceClient() + .list(subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName); + return Utils.mapPage(inner, inner1 -> new HealthMonitorImpl(inner1, this.manager())); + } + + public PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + filter, + expand, + context); + return Utils.mapPage(inner, inner1 -> new HealthMonitorImpl(inner1, this.manager())); + } + + public HealthMonitor get( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + HealthMonitorInner inner = + this + .serviceClient() + .get(subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorId); + if (inner != null) { + return new HealthMonitorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + expand, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HealthMonitorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId) { + PagedIterable inner = + this + .serviceClient() + .listStateChanges( + subscriptionId, resourceGroupName, providerName, resourceCollectionName, resourceName, monitorId); + return Utils.mapPage(inner, inner1 -> new HealthMonitorStateChangeImpl(inner1, this.manager())); + } + + public PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listStateChanges( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + filter, + expand, + startTimestampUtc, + endTimestampUtc, + context); + return Utils.mapPage(inner, inner1 -> new HealthMonitorStateChangeImpl(inner1, this.manager())); + } + + public HealthMonitorStateChange getStateChange( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix) { + HealthMonitorStateChangeInner inner = + this + .serviceClient() + .getStateChange( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix); + if (inner != null) { + return new HealthMonitorStateChangeImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getStateChangeWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand, + Context context) { + Response inner = + this + .serviceClient() + .getStateChangeWithResponse( + subscriptionId, + resourceGroupName, + providerName, + resourceCollectionName, + resourceName, + monitorId, + timestampUnix, + expand, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new HealthMonitorStateChangeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private HealthMonitorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationImpl.java new file mode 100644 index 0000000000000..b2dd227efe45c --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.implementation; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner; +import com.azure.resourcemanager.workloadmonitor.models.Operation; +import com.azure.resourcemanager.workloadmonitor.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsClientImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..ef769314660ba --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/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.workloadmonitor.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.workloadmonitor.fluent.OperationsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner; +import com.azure.resourcemanager.workloadmonitor.models.OperationList; +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 WorkloadMonitorApiImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(WorkloadMonitorApiImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for WorkloadMonitorApiOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "WorkloadMonitorApiOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.WorkloadMonitor/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); + } + + /** + * Get a list of all available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @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())); + } + + /** + * Get a list of all available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @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)); + } + + /** + * Get a list of all available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all available REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + @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 list of available REST API operations. + */ + @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 list of available REST API operations. + */ + @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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..8acd5ad374e72 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/OperationsImpl.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.workloadmonitor.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.workloadmonitor.fluent.OperationsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner; +import com.azure.resourcemanager.workloadmonitor.models.Operation; +import com.azure.resourcemanager.workloadmonitor.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.workloadmonitor.WorkloadMonitorManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.workloadmonitor.WorkloadMonitorManager 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.workloadmonitor.WorkloadMonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/Utils.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/Utils.java new file mode 100644 index 0000000000000..c250594a51286 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/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.workloadmonitor.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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiBuilder.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiBuilder.java new file mode 100644 index 0000000000000..f050fec289de4 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiBuilder.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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 WorkloadMonitorApiImpl type. */ +@ServiceClientBuilder(serviceClients = {WorkloadMonitorApiImpl.class}) +public final class WorkloadMonitorApiBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the WorkloadMonitorApiBuilder. + */ + public WorkloadMonitorApiBuilder 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 WorkloadMonitorApiBuilder. + */ + public WorkloadMonitorApiBuilder 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 WorkloadMonitorApiBuilder. + */ + public WorkloadMonitorApiBuilder 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 WorkloadMonitorApiBuilder. + */ + public WorkloadMonitorApiBuilder 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 WorkloadMonitorApiBuilder. + */ + public WorkloadMonitorApiBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of WorkloadMonitorApiImpl with the provided parameters. + * + * @return an instance of WorkloadMonitorApiImpl. + */ + public WorkloadMonitorApiImpl 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(); + } + WorkloadMonitorApiImpl client = + new WorkloadMonitorApiImpl(pipeline, serializerAdapter, defaultPollInterval, environment, endpoint); + return client; + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiImpl.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiImpl.java new file mode 100644 index 0000000000000..5f8a5a38a6f76 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/WorkloadMonitorApiImpl.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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.workloadmonitor.fluent.HealthMonitorsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.OperationsClient; +import com.azure.resourcemanager.workloadmonitor.fluent.WorkloadMonitorApi; +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 WorkloadMonitorApiImpl type. */ +@ServiceClient(builder = WorkloadMonitorApiBuilder.class) +public final class WorkloadMonitorApiImpl implements WorkloadMonitorApi { + private final ClientLogger logger = new ClientLogger(WorkloadMonitorApiImpl.class); + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The 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 HealthMonitorsClient object to access its operations. */ + private final HealthMonitorsClient healthMonitors; + + /** + * Gets the HealthMonitorsClient object to access its operations. + * + * @return the HealthMonitorsClient object. + */ + public HealthMonitorsClient getHealthMonitors() { + return this.healthMonitors; + } + + /** + * Initializes an instance of WorkloadMonitorApi client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint server parameter. + */ + WorkloadMonitorApiImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2020-01-13-preview"; + this.operations = new OperationsClientImpl(this); + this.healthMonitors = new HealthMonitorsClientImpl(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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/package-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/package-info.java new file mode 100644 index 0000000000000..b00a1303386b0 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for WorkloadMonitorApi. Workload Monitor API. */ +package com.azure.resourcemanager.workloadmonitor.implementation; diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitor.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitor.java new file mode 100644 index 0000000000000..7850504a337cc --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitor.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.models; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner; + +/** An immutable client-side representation of HealthMonitor. */ +public interface HealthMonitor { + /** + * 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 monitorName property: Human-readable name of the monitor. + * + * @return the monitorName value. + */ + String monitorName(); + + /** + * Gets the monitorType property: Type of the monitor. + * + * @return the monitorType value. + */ + String monitorType(); + + /** + * Gets the monitoredObject property: Dynamic monitored object of the monitor. + * + * @return the monitoredObject value. + */ + String monitoredObject(); + + /** + * Gets the parentMonitorName property: Name of the parent monitor. + * + * @return the parentMonitorName value. + */ + String parentMonitorName(); + + /** + * Gets the previousMonitorState property: Previous health state of the monitor. + * + * @return the previousMonitorState value. + */ + HealthState previousMonitorState(); + + /** + * Gets the currentMonitorState property: Current health state of the monitor. + * + * @return the currentMonitorState value. + */ + HealthState currentMonitorState(); + + /** + * Gets the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @return the evaluationTimestamp value. + */ + String evaluationTimestamp(); + + /** + * Gets the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @return the currentStateFirstObservedTimestamp value. + */ + String currentStateFirstObservedTimestamp(); + + /** + * Gets the lastReportedTimestamp property: Timestamp of the monitor's last reported health state. + * + * @return the lastReportedTimestamp value. + */ + String lastReportedTimestamp(); + + /** + * Gets the evidence property: Evidence validating the monitor's current health state. + * + * @return the evidence value. + */ + Object evidence(); + + /** + * Gets the monitorConfiguration property: The configuration settings at the time of the monitor's health + * evaluation. + * + * @return the monitorConfiguration value. + */ + Object monitorConfiguration(); + + /** + * Gets the inner com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner object. + * + * @return the inner object. + */ + HealthMonitorInner innerModel(); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorList.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorList.java new file mode 100644 index 0000000000000..9c8d256619251 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorList.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.workloadmonitor.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about the current health statuses of the monitors. */ +@Fluent +public final class HealthMonitorList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthMonitorList.class); + + /* + * Array of health monitors of the virtual machine. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to next page if the list is too long. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Array of health monitors of the virtual machine. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of health monitors of the virtual machine. + * + * @param value the value value to set. + * @return the HealthMonitorList object itself. + */ + public HealthMonitorList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to next page if the list is too long. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to next page if the list is too long. + * + * @param nextLink the nextLink value to set. + * @return the HealthMonitorList object itself. + */ + public HealthMonitorList 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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChange.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChange.java new file mode 100644 index 0000000000000..951bceada9199 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChange.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.models; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; + +/** An immutable client-side representation of HealthMonitorStateChange. */ +public interface HealthMonitorStateChange { + /** + * 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 monitorName property: Human-readable name of the monitor. + * + * @return the monitorName value. + */ + String monitorName(); + + /** + * Gets the monitorType property: Type of the monitor. + * + * @return the monitorType value. + */ + String monitorType(); + + /** + * Gets the monitoredObject property: Dynamic monitored object of the monitor. + * + * @return the monitoredObject value. + */ + String monitoredObject(); + + /** + * Gets the evaluationTimestamp property: Timestamp of the monitor's last health evaluation. + * + * @return the evaluationTimestamp value. + */ + String evaluationTimestamp(); + + /** + * Gets the currentStateFirstObservedTimestamp property: Timestamp of the monitor's last health state change. + * + * @return the currentStateFirstObservedTimestamp value. + */ + String currentStateFirstObservedTimestamp(); + + /** + * Gets the previousMonitorState property: Previous health state of the monitor. + * + * @return the previousMonitorState value. + */ + HealthState previousMonitorState(); + + /** + * Gets the currentMonitorState property: Current health state of the monitor. + * + * @return the currentMonitorState value. + */ + HealthState currentMonitorState(); + + /** + * Gets the evidence property: Evidence validating the monitor's current health state. + * + * @return the evidence value. + */ + Object evidence(); + + /** + * Gets the monitorConfiguration property: The configuration settings at the time of the monitor's health + * evaluation. + * + * @return the monitorConfiguration value. + */ + Object monitorConfiguration(); + + /** + * Gets the inner com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner object. + * + * @return the inner object. + */ + HealthMonitorStateChangeInner innerModel(); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChangeList.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChangeList.java new file mode 100644 index 0000000000000..30a654523522b --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitorStateChangeList.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.workloadmonitor.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.fluent.models.HealthMonitorStateChangeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Information about the health state changes of the monitor within the provided time window. */ +@Fluent +public final class HealthMonitorStateChangeList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HealthMonitorStateChangeList.class); + + /* + * Array of health state changes within the specified time window. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to next page if the list is too long. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Array of health state changes within the specified time window. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of health state changes within the specified time window. + * + * @param value the value value to set. + * @return the HealthMonitorStateChangeList object itself. + */ + public HealthMonitorStateChangeList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to next page if the list is too long. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to next page if the list is too long. + * + * @param nextLink the nextLink value to set. + * @return the HealthMonitorStateChangeList object itself. + */ + public HealthMonitorStateChangeList 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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitors.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitors.java new file mode 100644 index 0000000000000..1d8bb2ad14002 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthMonitors.java @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.OffsetDateTime; + +/** Resource collection API of HealthMonitors. */ +public interface HealthMonitors { + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @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 current health status of all monitors of a virtual machine. + */ + PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName); + + /** + * Get the current health status of all monitors of a virtual machine. Optional parameters: $expand (retrieve the + * monitor's evidence and configuration) and $filter (filter by monitor name). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param filter Optionally filter by monitor name. Example: $filter=monitorName eq + * 'logical-disks|C:|disk-free-space-mb.'. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of all monitors of a virtual machine. + */ + PagedIterable list( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String filter, + String expand, + Context context); + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @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 current health status of a monitor of a virtual machine. + */ + HealthMonitor get( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId); + + /** + * Get the current health status of a monitor of a virtual machine. Optional parameter: $expand (retrieve the + * monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 current health status of a monitor of a virtual machine. + */ + Response getWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String expand, + Context context); + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId); + + /** + * Get the health state changes of a monitor of a virtual machine within the provided time window (default is the + * last 24 hours). Optional parameters: $expand (retrieve the monitor's evidence and configuration) and $filter + * (filter by heartbeat condition). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param filter Optionally filter by heartbeat condition. Example: $filter=isHeartbeat eq false. + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @param startTimestampUtc The start of the time window. + * @param endTimestampUtc The end of the time window. + * @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 health state changes of a monitor of a virtual machine within the provided time window (default is + * the last 24 hours). + */ + PagedIterable listStateChanges( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String filter, + String expand, + OffsetDateTime startTimestampUtc, + OffsetDateTime endTimestampUtc, + Context context); + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + HealthMonitorStateChange getStateChange( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix); + + /** + * Get the health state change of a monitor of a virtual machine at the provided timestamp. Optional parameter: + * $expand (retrieve the monitor's evidence and configuration). + * + * @param subscriptionId The subscription Id of the virtual machine. + * @param resourceGroupName The resource group of the virtual machine. + * @param providerName The provider name (ex: Microsoft.Compute for virtual machines). + * @param resourceCollectionName The resource collection name (ex: virtualMachines for virtual machines). + * @param resourceName The name of the virtual machine. + * @param monitorId The monitor Id of the virtual machine. + * @param timestampUnix The timestamp of the state change (unix format). + * @param expand Optionally expand the monitor’s evidence and/or configuration. Example: + * $expand=evidence,configuration. + * @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 health state change of a monitor of a virtual machine at the provided timestamp. + */ + Response getStateChangeWithResponse( + String subscriptionId, + String resourceGroupName, + String providerName, + String resourceCollectionName, + String resourceName, + String monitorId, + String timestampUnix, + String expand, + Context context); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthState.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthState.java new file mode 100644 index 0000000000000..d42ad21d6f20e --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/HealthState.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.workloadmonitor.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for HealthState. */ +public final class HealthState extends ExpandableStringEnum { + /** Static value Healthy for HealthState. */ + public static final HealthState HEALTHY = fromString("Healthy"); + + /** Static value Critical for HealthState. */ + public static final HealthState CRITICAL = fromString("Critical"); + + /** Static value Warning for HealthState. */ + public static final HealthState WARNING = fromString("Warning"); + + /** Static value Unknown for HealthState. */ + public static final HealthState UNKNOWN = fromString("Unknown"); + + /** Static value Disabled for HealthState. */ + public static final HealthState DISABLED = fromString("Disabled"); + + /** Static value None for HealthState. */ + public static final HealthState NONE = fromString("None"); + + /** + * Creates or finds a HealthState from its string representation. + * + * @param name a name to look for. + * @return the corresponding HealthState. + */ + @JsonCreator + public static HealthState fromString(String name) { + return fromString(name, HealthState.class); + } + + /** @return known HealthState values. */ + public static Collection values() { + return values(HealthState.class); + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operation.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operation.java new file mode 100644 index 0000000000000..e7a9d62b7635e --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operation.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.models; + +import com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The localized display information for this particular operation or action. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the inner com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationDisplay.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationDisplay.java new file mode 100644 index 0000000000000..6ab49821ce7ea --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationDisplay.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.workloadmonitor.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 localized display information for this particular operation or action. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Operation resource provider name. + */ + @JsonProperty(value = "provider", required = true) + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource", required = true) + private String resource; + + /* + * Human-readable, friendly name for the operation. + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /* + * Operation description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * Get the provider property: Operation resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Operation resource provider name. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Human-readable, friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Human-readable, friendly name for the operation. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Operation description. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provider() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property provider in model OperationDisplay")); + } + if (resource() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resource in model OperationDisplay")); + } + if (operation() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property operation in model OperationDisplay")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property description in model OperationDisplay")); + } + } +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationList.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationList.java new file mode 100644 index 0000000000000..42a8fae05195e --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/OperationList.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.workloadmonitor.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.workloadmonitor.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of available REST API operations. */ +@Fluent +public final class OperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationList.class); + + /* + * Array of available REST API operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to next page if the list is too long. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Array of available REST API operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of available REST API operations. + * + * @param value the value value to set. + * @return the OperationList object itself. + */ + public OperationList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to next page if the list is too long. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Link to next page if the list is too long. + * + * @param nextLink the nextLink value to set. + * @return the OperationList object itself. + */ + public OperationList 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/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operations.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/Operations.java new file mode 100644 index 0000000000000..5418e9f467a56 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/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.workloadmonitor.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Get a list of all available REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + PagedIterable list(); + + /** + * Get a list of all available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all available REST API operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/package-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/package-info.java new file mode 100644 index 0000000000000..37384ee246544 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for WorkloadMonitorApi. Workload Monitor API. */ +package com.azure.resourcemanager.workloadmonitor.models; diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/package-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/package-info.java new file mode 100644 index 0000000000000..e712fe7420678 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/com/azure/resourcemanager/workloadmonitor/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for WorkloadMonitorApi. Workload Monitor API. */ +package com.azure.resourcemanager.workloadmonitor; diff --git a/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/module-info.java b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/src/main/java/module-info.java new file mode 100644 index 0000000000000..3234379c58d57 --- /dev/null +++ b/sdk/workloadmonitor/azure-resourcemanager-workloadmonitor/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.workloadmonitor { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.workloadmonitor; + exports com.azure.resourcemanager.workloadmonitor.fluent; + exports com.azure.resourcemanager.workloadmonitor.fluent.models; + exports com.azure.resourcemanager.workloadmonitor.models; + + opens com.azure.resourcemanager.workloadmonitor.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.workloadmonitor.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/workloadmonitor/ci.yml b/sdk/workloadmonitor/ci.yml new file mode 100644 index 0000000000000..24ab9fc3919e5 --- /dev/null +++ b/sdk/workloadmonitor/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/workloadmonitor/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/workloadmonitor/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: workloadmonitor + Artifacts: + - name: azure-resourcemanager-workloadmonitor + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerworkloadmonitor diff --git a/sdk/workloadmonitor/pom.xml b/sdk/workloadmonitor/pom.xml new file mode 100644 index 0000000000000..a50735bc44e86 --- /dev/null +++ b/sdk/workloadmonitor/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-workloadmonitor-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-workloadmonitor + + + +