diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/pom.xml b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/pom.xml new file mode 100644 index 000000000000..9f3eb5a066cf --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.workloadmonitor.v2020-01-13-preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-workloadmonitor + 1.0.0-beta + jar + Microsoft Azure SDK for WorkloadMonitor Management + This package contains Microsoft WorkloadMonitor Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultError.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultError.java new file mode 100644 index 000000000000..81d2b1cb1666 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultError.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Default Error. + * Error body contract. + */ +public class DefaultError { + /** + * error details. + * Details about the error. + */ + @JsonProperty(value = "error") + private DefaultErrorError error; + + /** + * Get details about the error. + * + * @return the error value + */ + public DefaultErrorError error() { + return this.error; + } + + /** + * Set details about the error. + * + * @param error the error value to set + * @return the DefaultError object itself. + */ + public DefaultError withError(DefaultErrorError error) { + this.error = error; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorError.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorError.java new file mode 100644 index 000000000000..df9481627c14 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorError.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * error details. + * Details about the error. + */ +public class DefaultErrorError { + /** + * Service-defined error code. This code serves as a sub-status for the + * HTTP error code specified in the response. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of the error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Details of the error. + */ + @JsonProperty(value = "details") + private List details; + + /** + * Get service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set service-defined error code. This code serves as a sub-status for the HTTP error code specified in the response. + * + * @param code the code value to set + * @return the DefaultErrorError object itself. + */ + public DefaultErrorError withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of the error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of the error. + * + * @param message the message value to set + * @return the DefaultErrorError object itself. + */ + public DefaultErrorError withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get details of the error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set details of the error. + * + * @param details the details value to set + * @return the DefaultErrorError object itself. + */ + public DefaultErrorError withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorException.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorException.java new file mode 100644 index 000000000000..e378f9a366a3 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/DefaultErrorException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with DefaultError information. + */ +public class DefaultErrorException extends RestException { + /** + * Initializes a new instance of the DefaultErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public DefaultErrorException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the DefaultErrorException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public DefaultErrorException(final String message, final Response response, final DefaultError body) { + super(message, response, body); + } + + @Override + public DefaultError body() { + return (DefaultError) super.body(); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/ErrorDetails.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/ErrorDetails.java new file mode 100644 index 000000000000..4bdab08abaef --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/ErrorDetails.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error Details. + * Error details of the error body contract. + */ +public class ErrorDetails { + /** + * Property level error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of property-level error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get property level error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set property level error code. + * + * @param code the code value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withCode(String code) { + this.code = code; + return this; + } + + /** + * Get human-readable representation of property-level error. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set human-readable representation of property-level error. + * + * @param message the message value to set + * @return the ErrorDetails object itself. + */ + public ErrorDetails withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/HealthState.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/HealthState.java new file mode 100644 index 000000000000..ac19e1a7b072 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/HealthState.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * 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"); + + /** + * 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/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitor.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitor.java new file mode 100644 index 000000000000..94cb8dca8aed --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitor.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.MonitorInner; + +/** + * Type representing Monitor. + */ +public interface Monitor extends HasInner, HasManager { + /** + * @return the currentMonitorState value. + */ + HealthState currentMonitorState(); + + /** + * @return the currentStateFirstObservedTimestamp value. + */ + String currentStateFirstObservedTimestamp(); + + /** + * @return the evaluationTimestamp value. + */ + String evaluationTimestamp(); + + /** + * @return the evidence value. + */ + Object evidence(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastReportedTimestamp value. + */ + String lastReportedTimestamp(); + + /** + * @return the monitorConfiguration value. + */ + Object monitorConfiguration(); + + /** + * @return the monitoredObject value. + */ + String monitoredObject(); + + /** + * @return the monitorName value. + */ + String monitorName(); + + /** + * @return the monitorType value. + */ + String monitorType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parentMonitorName value. + */ + String parentMonitorName(); + + /** + * @return the previousMonitorState value. + */ + HealthState previousMonitorState(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/MonitorStateChange.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/MonitorStateChange.java new file mode 100644 index 000000000000..b2f55a8f98e8 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/MonitorStateChange.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.MonitorStateChangeInner; + +/** + * Type representing MonitorStateChange. + */ +public interface MonitorStateChange extends HasInner, HasManager { + /** + * @return the currentMonitorState value. + */ + HealthState currentMonitorState(); + + /** + * @return the currentStateFirstObservedTimestamp value. + */ + String currentStateFirstObservedTimestamp(); + + /** + * @return the evaluationTimestamp value. + */ + String evaluationTimestamp(); + + /** + * @return the evidence value. + */ + Object evidence(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the monitorConfiguration value. + */ + Object monitorConfiguration(); + + /** + * @return the monitoredObject value. + */ + String monitoredObject(); + + /** + * @return the monitorName value. + */ + String monitorName(); + + /** + * @return the monitorType value. + */ + String monitorType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the previousMonitorState value. + */ + HealthState previousMonitorState(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitors.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitors.java new file mode 100644 index 000000000000..e87634144091 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Monitors.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import rx.Observable; + +/** + * Type representing Monitors. + */ +public interface Monitors { + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId); + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId); + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix); + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operation.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operation.java new file mode 100644 index 000000000000..015d45b459de --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operation.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/OperationDisplay.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/OperationDisplay.java new file mode 100644 index 000000000000..a8656cec741c --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/OperationDisplay.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display. + * The properties of the resource operation. + */ +public class OperationDisplay { + /** + * Provider Name. + * Provider name of this operation. + */ + @JsonProperty(value = "provider", required = true) + private String provider; + + /** + * Resource Name. + * Resource name of this operation. + */ + @JsonProperty(value = "resource", required = true) + private String resource; + + /** + * Operation Name. + * Operation name of the operation. + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /** + * Description. + * Description of the operation. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /** + * Get provider name of this operation. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set provider name of this operation. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource name of this operation. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource name of this operation. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation name of the operation. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation name of 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 description of the operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operations.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operations.java new file mode 100644 index 000000000000..d15547189a71 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Gets a list of possible operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/IdParsingUtils.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..f4ea0d460c07 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/IdParsingUtils.java @@ -0,0 +1,57 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorImpl.java new file mode 100644 index 000000000000..20f4c4f856ca --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorImpl.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitor; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.HealthState; + +class MonitorImpl extends WrapperImpl implements Monitor { + private final WorkloadMonitorManager manager; + MonitorImpl(MonitorInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public HealthState currentMonitorState() { + return this.inner().currentMonitorState(); + } + + @Override + public String currentStateFirstObservedTimestamp() { + return this.inner().currentStateFirstObservedTimestamp(); + } + + @Override + public String evaluationTimestamp() { + return this.inner().evaluationTimestamp(); + } + + @Override + public Object evidence() { + return this.inner().evidence(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastReportedTimestamp() { + return this.inner().lastReportedTimestamp(); + } + + @Override + public Object monitorConfiguration() { + return this.inner().monitorConfiguration(); + } + + @Override + public String monitoredObject() { + return this.inner().monitoredObject(); + } + + @Override + public String monitorName() { + return this.inner().monitorName(); + } + + @Override + public String monitorType() { + return this.inner().monitorType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String parentMonitorName() { + return this.inner().parentMonitorName(); + } + + @Override + public HealthState previousMonitorState() { + return this.inner().previousMonitorState(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorInner.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorInner.java new file mode 100644 index 000000000000..bc7bf64ac7fe --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorInner.java @@ -0,0 +1,321 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.HealthState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Monitor Status. + * Information about a monitor. + */ +@JsonFlatten +public class MonitorInner extends ProxyResource { + /** + * Monitor Name. + * Human-readable name of this monitor. + */ + @JsonProperty(value = "properties.monitorName") + private String monitorName; + + /** + * Monitor Type. + * Type of this monitor. + */ + @JsonProperty(value = "properties.monitorType") + private String monitorType; + + /** + * Monitored Object. + * Dynamic monitored object of this monitor. + */ + @JsonProperty(value = "properties.monitoredObject") + private String monitoredObject; + + /** + * Parent Monitor Name. + * Name of this monitor's parent. + */ + @JsonProperty(value = "properties.parentMonitorName") + private String parentMonitorName; + + /** + * Health State. + * Current health state of this monitor. Possible values include: + * 'Healthy', 'Critical', 'Warning', 'Unknown'. + */ + @JsonProperty(value = "properties.previousMonitorState") + private HealthState previousMonitorState; + + /** + * Health State. + * Current health state of this monitor. Possible values include: + * 'Healthy', 'Critical', 'Warning', 'Unknown'. + */ + @JsonProperty(value = "properties.currentMonitorState") + private HealthState currentMonitorState; + + /** + * Last Evaluated. + * Timestamp that this monitor was last evaluated. + */ + @JsonProperty(value = "properties.evaluationTimestamp") + private String evaluationTimestamp; + + /** + * Last State Change. + * Timestamp of this monitor's last state change. + */ + @JsonProperty(value = "properties.currentStateFirstObservedTimestamp") + private String currentStateFirstObservedTimestamp; + + /** + * Last Reported. + * Timestamp of this monitor's last reported state. + */ + @JsonProperty(value = "properties.lastReportedTimestamp") + private String lastReportedTimestamp; + + /** + * Evidence. + * Evidence of this monitor's last state change. + */ + @JsonProperty(value = "properties.evidence") + private Object evidence; + + /** + * Configuration. + * Configuration settings at the time of this monitor's last state change. + */ + @JsonProperty(value = "properties.monitorConfiguration") + private Object monitorConfiguration; + + /** + * Get human-readable name of this monitor. + * + * @return the monitorName value + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Set human-readable name of this monitor. + * + * @param monitorName the monitorName value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withMonitorName(String monitorName) { + this.monitorName = monitorName; + return this; + } + + /** + * Get type of this monitor. + * + * @return the monitorType value + */ + public String monitorType() { + return this.monitorType; + } + + /** + * Set type of this monitor. + * + * @param monitorType the monitorType value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withMonitorType(String monitorType) { + this.monitorType = monitorType; + return this; + } + + /** + * Get dynamic monitored object of this monitor. + * + * @return the monitoredObject value + */ + public String monitoredObject() { + return this.monitoredObject; + } + + /** + * Set dynamic monitored object of this monitor. + * + * @param monitoredObject the monitoredObject value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withMonitoredObject(String monitoredObject) { + this.monitoredObject = monitoredObject; + return this; + } + + /** + * Get name of this monitor's parent. + * + * @return the parentMonitorName value + */ + public String parentMonitorName() { + return this.parentMonitorName; + } + + /** + * Set name of this monitor's parent. + * + * @param parentMonitorName the parentMonitorName value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withParentMonitorName(String parentMonitorName) { + this.parentMonitorName = parentMonitorName; + return this; + } + + /** + * Get current health state of this monitor. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @return the previousMonitorState value + */ + public HealthState previousMonitorState() { + return this.previousMonitorState; + } + + /** + * Set current health state of this monitor. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @param previousMonitorState the previousMonitorState value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withPreviousMonitorState(HealthState previousMonitorState) { + this.previousMonitorState = previousMonitorState; + return this; + } + + /** + * Get current health state of this monitor. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @return the currentMonitorState value + */ + public HealthState currentMonitorState() { + return this.currentMonitorState; + } + + /** + * Set current health state of this monitor. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @param currentMonitorState the currentMonitorState value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withCurrentMonitorState(HealthState currentMonitorState) { + this.currentMonitorState = currentMonitorState; + return this; + } + + /** + * Get timestamp that this monitor was last evaluated. + * + * @return the evaluationTimestamp value + */ + public String evaluationTimestamp() { + return this.evaluationTimestamp; + } + + /** + * Set timestamp that this monitor was last evaluated. + * + * @param evaluationTimestamp the evaluationTimestamp value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withEvaluationTimestamp(String evaluationTimestamp) { + this.evaluationTimestamp = evaluationTimestamp; + return this; + } + + /** + * Get timestamp of this monitor's last state change. + * + * @return the currentStateFirstObservedTimestamp value + */ + public String currentStateFirstObservedTimestamp() { + return this.currentStateFirstObservedTimestamp; + } + + /** + * Set timestamp of this monitor's last state change. + * + * @param currentStateFirstObservedTimestamp the currentStateFirstObservedTimestamp value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withCurrentStateFirstObservedTimestamp(String currentStateFirstObservedTimestamp) { + this.currentStateFirstObservedTimestamp = currentStateFirstObservedTimestamp; + return this; + } + + /** + * Get timestamp of this monitor's last reported state. + * + * @return the lastReportedTimestamp value + */ + public String lastReportedTimestamp() { + return this.lastReportedTimestamp; + } + + /** + * Set timestamp of this monitor's last reported state. + * + * @param lastReportedTimestamp the lastReportedTimestamp value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withLastReportedTimestamp(String lastReportedTimestamp) { + this.lastReportedTimestamp = lastReportedTimestamp; + return this; + } + + /** + * Get evidence of this monitor's last state change. + * + * @return the evidence value + */ + public Object evidence() { + return this.evidence; + } + + /** + * Set evidence of this monitor's last state change. + * + * @param evidence the evidence value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withEvidence(Object evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get configuration settings at the time of this monitor's last state change. + * + * @return the monitorConfiguration value + */ + public Object monitorConfiguration() { + return this.monitorConfiguration; + } + + /** + * Set configuration settings at the time of this monitor's last state change. + * + * @param monitorConfiguration the monitorConfiguration value to set + * @return the MonitorInner object itself. + */ + public MonitorInner withMonitorConfiguration(Object monitorConfiguration) { + this.monitorConfiguration = monitorConfiguration; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeImpl.java new file mode 100644 index 000000000000..3259e8930318 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeImpl.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.MonitorStateChange; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.HealthState; + +class MonitorStateChangeImpl extends WrapperImpl implements MonitorStateChange { + private final WorkloadMonitorManager manager; + MonitorStateChangeImpl(MonitorStateChangeInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public HealthState currentMonitorState() { + return this.inner().currentMonitorState(); + } + + @Override + public String currentStateFirstObservedTimestamp() { + return this.inner().currentStateFirstObservedTimestamp(); + } + + @Override + public String evaluationTimestamp() { + return this.inner().evaluationTimestamp(); + } + + @Override + public Object evidence() { + return this.inner().evidence(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Object monitorConfiguration() { + return this.inner().monitorConfiguration(); + } + + @Override + public String monitoredObject() { + return this.inner().monitoredObject(); + } + + @Override + public String monitorName() { + return this.inner().monitorName(); + } + + @Override + public String monitorType() { + return this.inner().monitorType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public HealthState previousMonitorState() { + return this.inner().previousMonitorState(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeInner.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeInner.java new file mode 100644 index 000000000000..7f90f9876ef5 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorStateChangeInner.java @@ -0,0 +1,267 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.HealthState; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Monitor State Change. + * Information about a state transition of a monitor. + */ +@JsonFlatten +public class MonitorStateChangeInner extends ProxyResource { + /** + * Monitor Name. + * Human-readable name of this monitor. + */ + @JsonProperty(value = "properties.monitorName") + private String monitorName; + + /** + * Monitor Type. + * Type of this monitor. + */ + @JsonProperty(value = "properties.monitorType") + private String monitorType; + + /** + * Monitored Object. + * Dynamic monitored object of this monitor. + */ + @JsonProperty(value = "properties.monitoredObject") + private String monitoredObject; + + /** + * Timestamp. + * Timestamp of that this event ocurred. + */ + @JsonProperty(value = "properties.evaluationTimestamp") + private String evaluationTimestamp; + + /** + * Timestamp. + * Timestamp of that this health state first ocurred. + */ + @JsonProperty(value = "properties.currentStateFirstObservedTimestamp") + private String currentStateFirstObservedTimestamp; + + /** + * Previous Health State. + * Previous health state. Possible values include: 'Healthy', 'Critical', + * 'Warning', 'Unknown'. + */ + @JsonProperty(value = "properties.previousMonitorState") + private HealthState previousMonitorState; + + /** + * New Health State. + * New health state. Possible values include: 'Healthy', 'Critical', + * 'Warning', 'Unknown'. + */ + @JsonProperty(value = "properties.currentMonitorState") + private HealthState currentMonitorState; + + /** + * Evidence. + * Evidence of this monitor's last state change. + */ + @JsonProperty(value = "properties.evidence") + private Object evidence; + + /** + * Configuration. + * Configuration settings at the time of this monitor's last state change. + */ + @JsonProperty(value = "properties.monitorConfiguration") + private Object monitorConfiguration; + + /** + * Get human-readable name of this monitor. + * + * @return the monitorName value + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Set human-readable name of this monitor. + * + * @param monitorName the monitorName value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withMonitorName(String monitorName) { + this.monitorName = monitorName; + return this; + } + + /** + * Get type of this monitor. + * + * @return the monitorType value + */ + public String monitorType() { + return this.monitorType; + } + + /** + * Set type of this monitor. + * + * @param monitorType the monitorType value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withMonitorType(String monitorType) { + this.monitorType = monitorType; + return this; + } + + /** + * Get dynamic monitored object of this monitor. + * + * @return the monitoredObject value + */ + public String monitoredObject() { + return this.monitoredObject; + } + + /** + * Set dynamic monitored object of this monitor. + * + * @param monitoredObject the monitoredObject value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withMonitoredObject(String monitoredObject) { + this.monitoredObject = monitoredObject; + return this; + } + + /** + * Get timestamp of that this event ocurred. + * + * @return the evaluationTimestamp value + */ + public String evaluationTimestamp() { + return this.evaluationTimestamp; + } + + /** + * Set timestamp of that this event ocurred. + * + * @param evaluationTimestamp the evaluationTimestamp value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withEvaluationTimestamp(String evaluationTimestamp) { + this.evaluationTimestamp = evaluationTimestamp; + return this; + } + + /** + * Get timestamp of that this health state first ocurred. + * + * @return the currentStateFirstObservedTimestamp value + */ + public String currentStateFirstObservedTimestamp() { + return this.currentStateFirstObservedTimestamp; + } + + /** + * Set timestamp of that this health state first ocurred. + * + * @param currentStateFirstObservedTimestamp the currentStateFirstObservedTimestamp value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withCurrentStateFirstObservedTimestamp(String currentStateFirstObservedTimestamp) { + this.currentStateFirstObservedTimestamp = currentStateFirstObservedTimestamp; + return this; + } + + /** + * Get previous health state. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @return the previousMonitorState value + */ + public HealthState previousMonitorState() { + return this.previousMonitorState; + } + + /** + * Set previous health state. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @param previousMonitorState the previousMonitorState value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withPreviousMonitorState(HealthState previousMonitorState) { + this.previousMonitorState = previousMonitorState; + return this; + } + + /** + * Get new health state. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @return the currentMonitorState value + */ + public HealthState currentMonitorState() { + return this.currentMonitorState; + } + + /** + * Set new health state. Possible values include: 'Healthy', 'Critical', 'Warning', 'Unknown'. + * + * @param currentMonitorState the currentMonitorState value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withCurrentMonitorState(HealthState currentMonitorState) { + this.currentMonitorState = currentMonitorState; + return this; + } + + /** + * Get evidence of this monitor's last state change. + * + * @return the evidence value + */ + public Object evidence() { + return this.evidence; + } + + /** + * Set evidence of this monitor's last state change. + * + * @param evidence the evidence value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withEvidence(Object evidence) { + this.evidence = evidence; + return this; + } + + /** + * Get configuration settings at the time of this monitor's last state change. + * + * @return the monitorConfiguration value + */ + public Object monitorConfiguration() { + return this.monitorConfiguration; + } + + /** + * Set configuration settings at the time of this monitor's last state change. + * + * @param monitorConfiguration the monitorConfiguration value to set + * @return the MonitorStateChangeInner object itself. + */ + public MonitorStateChangeInner withMonitorConfiguration(Object monitorConfiguration) { + this.monitorConfiguration = monitorConfiguration; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsImpl.java new file mode 100644 index 000000000000..e34e7211ebb8 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsImpl.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitor; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.MonitorStateChange; + +class MonitorsImpl extends WrapperImpl implements Monitors { + private final WorkloadMonitorManager manager; + + MonitorsImpl(WorkloadMonitorManager manager) { + super(manager.inner().monitors()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + MonitorsInner client = this.inner(); + return client.listAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Monitor call(MonitorInner inner) { + return new MonitorImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + MonitorsInner client = this.inner(); + return client.getAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId) + .map(new Func1() { + @Override + public Monitor call(MonitorInner inner) { + return new MonitorImpl(inner, manager()); + } + }); + } + + @Override + public Observable listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId) { + MonitorsInner client = this.inner(); + return client.listStateChangesAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public MonitorStateChange call(MonitorStateChangeInner inner) { + return new MonitorStateChangeImpl(inner, manager()); + } + }); + } + + @Override + public Observable getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix) { + MonitorsInner client = this.inner(); + return client.getStateChangeAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix) + .map(new Func1() { + @Override + public MonitorStateChange call(MonitorStateChangeInner inner) { + return new MonitorStateChangeImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsInner.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsInner.java new file mode 100644 index 000000000000..30612822e67b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/MonitorsInner.java @@ -0,0 +1,1353 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.DefaultErrorException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import org.joda.time.DateTime; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Monitors. + */ +public class MonitorsInner { + /** The Retrofit service to perform REST calls. */ + private MonitorsService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of MonitorsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MonitorsInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(MonitorsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Monitors to be + * used by Retrofit to perform actually REST calls. + */ + interface MonitorsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors list" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors") + Observable> list(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("monitorId") String monitorId, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors listStateChanges" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history") + Observable> listStateChanges(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("monitorId") String monitorId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Query("$expand") String expand, @Query("startTimestampUtc") DateTime startTimestampUtc, @Query("endTimestampUtc") DateTime endTimestampUtc, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors getStateChange" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}/history/{timestampUnix}") + Observable> getStateChange(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("monitorId") String monitorId, @Path("timestampUnix") String timestampUnix, @Query("api-version") String apiVersion, @Query("$expand") String expand, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors listStateChangesNext" }) + @GET + Observable> listStateChangesNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorInner> object if successful. + */ + public PagedList list(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ServiceResponse> response = listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable> listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable>> listWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + final String filter = null; + final String expand = null; + return service.list(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), filter, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorInner> object if successful. + */ + public PagedList list(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String expand) { + ServiceResponse> response = listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, filter, expand).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String expand, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, filter, expand), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable> listAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String expand) { + return listWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, filter, expand) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable>> listWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String expand) { + return listSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, filter, expand) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + ServiceResponse> * @param subscriptionId The subscriptionId of the resource + ServiceResponse> * @param resourceGroupName The resourceGroupName of the resource + ServiceResponse> * @param resourceNamespace The resourceNamespace of the resource + ServiceResponse> * @param resourceType The resourceType of the resource + ServiceResponse> * @param resourceName The resourceType of the resource + ServiceResponse> * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + ServiceResponse> * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String expand) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + return service.list(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), filter, expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorInner object if successful. + */ + public MonitorInner get(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).toBlocking().single().body(); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId), serviceCallback); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).map(new Func1, MonitorInner>() { + @Override + public MonitorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable> getWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + final String expand = null; + return service.get(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorInner object if successful. + */ + public MonitorInner get(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String expand) { + return getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, expand).toBlocking().single().body(); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param expand ex: $expand=evidence,configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, expand), serviceCallback); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable getAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String expand) { + return getWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, expand).map(new Func1, MonitorInner>() { + @Override + public MonitorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the current status of a monitor of a resource. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable> getWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String expand) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + return service.get(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorStateChangeInner> object if successful. + */ + public PagedList listStateChanges(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId) { + ServiceResponse> response = listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable> listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId) { + return listStateChangesWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable>> listStateChangesWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId) { + return listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listStateChangesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorStateChangeInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listStateChangesSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + final String filter = null; + final String expand = null; + final DateTime startTimestampUtc = null; + final DateTime endTimestampUtc = null; + return service.listStateChanges(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), filter, expand, startTimestampUtc, endTimestampUtc, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listStateChangesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @param startTimestampUtc The start Timestamp for the desired history + * @param endTimestampUtc The end Timestamp for the desired history + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorStateChangeInner> object if successful. + */ + public PagedList listStateChanges(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final String filter, final String expand, final DateTime startTimestampUtc, final DateTime endTimestampUtc) { + ServiceResponse> response = listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, filter, expand, startTimestampUtc, endTimestampUtc).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @param startTimestampUtc The start Timestamp for the desired history + * @param endTimestampUtc The end Timestamp for the desired history + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final String filter, final String expand, final DateTime startTimestampUtc, final DateTime endTimestampUtc, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, filter, expand, startTimestampUtc, endTimestampUtc), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @param startTimestampUtc The start Timestamp for the desired history + * @param endTimestampUtc The end Timestamp for the desired history + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable> listStateChangesAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final String filter, final String expand, final DateTime startTimestampUtc, final DateTime endTimestampUtc) { + return listStateChangesWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, filter, expand, startTimestampUtc, endTimestampUtc) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + * @param expand ex: $expand=evidence,configuration + * @param startTimestampUtc The start Timestamp for the desired history + * @param endTimestampUtc The end Timestamp for the desired history + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable>> listStateChangesWithServiceResponseAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final String filter, final String expand, final DateTime startTimestampUtc, final DateTime endTimestampUtc) { + return listStateChangesSinglePageAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, filter, expand, startTimestampUtc, endTimestampUtc) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listStateChangesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + ServiceResponse> * @param subscriptionId The subscriptionId of the resource + ServiceResponse> * @param resourceGroupName The resourceGroupName of the resource + ServiceResponse> * @param resourceNamespace The resourceNamespace of the resource + ServiceResponse> * @param resourceType The resourceType of the resource + ServiceResponse> * @param resourceName The resourceType of the resource + ServiceResponse> * @param monitorId The monitorId of the resource (url encoded) + ServiceResponse> * @param filter list example: $filter=monitorName eq 'logical-disks|C:|disk-free-space-mb'; history example: $filter=isHeartbeat eq false + ServiceResponse> * @param expand ex: $expand=evidence,configuration + ServiceResponse> * @param startTimestampUtc The start Timestamp for the desired history + ServiceResponse> * @param endTimestampUtc The end Timestamp for the desired history + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorStateChangeInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listStateChangesSinglePageAsync(final String subscriptionId, final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String monitorId, final String filter, final String expand, final DateTime startTimestampUtc, final DateTime endTimestampUtc) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + return service.listStateChanges(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), filter, expand, startTimestampUtc, endTimestampUtc, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listStateChangesDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listStateChangesDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorStateChangeInner object if successful. + */ + public MonitorStateChangeInner getStateChange(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix) { + return getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix).toBlocking().single().body(); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix), serviceCallback); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorStateChangeInner object + */ + public Observable getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix) { + return getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix).map(new Func1, MonitorStateChangeInner>() { + @Override + public MonitorStateChangeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorStateChangeInner object + */ + public Observable> getStateChangeWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + if (timestampUnix == null) { + throw new IllegalArgumentException("Parameter timestampUnix is required and cannot be null."); + } + final String expand = null; + return service.getStateChange(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getStateChangeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorStateChangeInner object if successful. + */ + public MonitorStateChangeInner getStateChange(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix, String expand) { + return getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix, expand).toBlocking().single().body(); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @param expand ex: $expand=evidence,configuration + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix, expand), serviceCallback); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorStateChangeInner object + */ + public Observable getStateChangeAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix, String expand) { + return getStateChangeWithServiceResponseAsync(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix, expand).map(new Func1, MonitorStateChangeInner>() { + @Override + public MonitorStateChangeInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the status of a monitor at a specific timestamp in history. + * + * @param subscriptionId The subscriptionId of the resource + * @param resourceGroupName The resourceGroupName of the resource + * @param resourceNamespace The resourceNamespace of the resource + * @param resourceType The resourceType of the resource + * @param resourceName The resourceType of the resource + * @param monitorId The monitorId of the resource (url encoded) + * @param timestampUnix The timestamp of the state change (Unix format) + * @param expand ex: $expand=evidence,configuration + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorStateChangeInner object + */ + public Observable> getStateChangeWithServiceResponseAsync(String subscriptionId, String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, String timestampUnix, String expand) { + if (subscriptionId == null) { + throw new IllegalArgumentException("Parameter subscriptionId is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (resourceNamespace == null) { + throw new IllegalArgumentException("Parameter resourceNamespace is required and cannot be null."); + } + if (resourceType == null) { + throw new IllegalArgumentException("Parameter resourceType is required and cannot be null."); + } + if (resourceName == null) { + throw new IllegalArgumentException("Parameter resourceName is required and cannot be null."); + } + if (monitorId == null) { + throw new IllegalArgumentException("Parameter monitorId is required and cannot be null."); + } + if (timestampUnix == null) { + throw new IllegalArgumentException("Parameter timestampUnix is required and cannot be null."); + } + return service.getStateChange(subscriptionId, resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, timestampUnix, this.client.apiVersion(), expand, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getStateChangeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getStateChangeDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource (with optional filter). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<MonitorStateChangeInner> object if successful. + */ + public PagedList listStateChangesNext(final String nextPageLink) { + ServiceResponse> response = listStateChangesNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listStateChangesNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listStateChangesNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable> listStateChangesNextAsync(final String nextPageLink) { + return listStateChangesNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorStateChangeInner> object + */ + public Observable>> listStateChangesNextWithServiceResponseAsync(final String nextPageLink) { + return listStateChangesNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listStateChangesNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get history of a monitor of a resource (with optional filter). + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorStateChangeInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listStateChangesNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listStateChangesNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listStateChangesNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listStateChangesNextDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..512b7963ee83 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationImpl.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final WorkloadMonitorManager manager; + OperationImpl(OperationInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String origin() { + return this.inner().origin(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationInner.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationInner.java new file mode 100644 index 000000000000..f724756287df --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationInner.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation. + * Operation supported by the resource provider. + */ +public class OperationInner { + /** + * Operation Name. + * Name of the operation. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Display. + * The properties of the resource operation. + */ + @JsonProperty(value = "display", required = true) + private OperationDisplay display; + + /** + * Origin. + * The origin of the operation. + */ + @JsonProperty(value = "origin", required = true) + private String origin; + + /** + * Get name of the operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the operation. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the properties of the resource operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the properties of the resource operation. + * + * @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 of the operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin of the operation. + * + * @param origin the origin value to set + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..4c0ce6d0c9a1 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final WorkloadMonitorManager manager; + + OperationsImpl(WorkloadMonitorManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsInner.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..1a8d4c4ed01e --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/OperationsInner.java @@ -0,0 +1,280 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.DefaultErrorException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operations list" }) + @GET("providers/Microsoft.WorkloadMonitor/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of possible operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of possible operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of possible operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of possible operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of possible operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws DefaultErrorException, IOException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + + /** + * Gets a list of possible operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DefaultErrorException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets a list of possible operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets a list of possible operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of possible operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets a list of possible operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws DefaultErrorException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DefaultErrorException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DefaultErrorException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/PageImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/PageImpl.java new file mode 100644 index 000000000000..511b3caf354f --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/PageImpl.java @@ -0,0 +1,75 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorAPIImpl.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorAPIImpl.java new file mode 100644 index 000000000000..e481edceb05b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorAPIImpl.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the WorkloadMonitorAPIImpl class. + */ +public class WorkloadMonitorAPIImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** The API version to use for this operation. */ + private String apiVersion; + + /** + * Gets The API version to use for this operation. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public WorkloadMonitorAPIImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public WorkloadMonitorAPIImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public WorkloadMonitorAPIImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The MonitorsInner object to access its operations. + */ + private MonitorsInner monitors; + + /** + * Gets the MonitorsInner object to access its operations. + * @return the MonitorsInner object. + */ + public MonitorsInner monitors() { + return this.monitors; + } + + /** + * Initializes an instance of WorkloadMonitorAPI client. + * + * @param credentials the management credentials for Azure + */ + public WorkloadMonitorAPIImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of WorkloadMonitorAPI client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public WorkloadMonitorAPIImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of WorkloadMonitorAPI client. + * + * @param restClient the REST client to connect to Azure. + */ + public WorkloadMonitorAPIImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2020-01-13-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.operations = new OperationsInner(restClient().retrofit(), this); + this.monitors = new MonitorsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "WorkloadMonitorAPI", "2020-01-13-preview"); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorManager.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorManager.java new file mode 100644 index 000000000000..649452f5db62 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/WorkloadMonitorManager.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; + +import com.microsoft.azure.AzureEnvironment; +import com.microsoft.azure.AzureResponseBuilder; +import com.microsoft.azure.credentials.AzureTokenCredentials; +import com.microsoft.azure.management.apigeneration.Beta; +import com.microsoft.azure.management.apigeneration.Beta.SinceVersion; +import com.microsoft.azure.arm.resources.AzureConfigurable; +import com.microsoft.azure.serializer.AzureJacksonAdapter; +import com.microsoft.rest.RestClient; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Operations; +import com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.Monitors; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure WorkloadMonitor resource management. + */ +public final class WorkloadMonitorManager extends ManagerCore { + private Operations operations; + private Monitors monitors; + /** + * Get a Configurable instance that can be used to create WorkloadMonitorManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new WorkloadMonitorManager.ConfigurableImpl(); + } + /** + * Creates an instance of WorkloadMonitorManager that exposes WorkloadMonitor resource management API entry points. + * + * @param credentials the credentials to use + * @return the WorkloadMonitorManager + */ + public static WorkloadMonitorManager authenticate(AzureTokenCredentials credentials) { + return new WorkloadMonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build()); + } + /** + * Creates an instance of WorkloadMonitorManager that exposes WorkloadMonitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @return the WorkloadMonitorManager + */ + public static WorkloadMonitorManager authenticate(RestClient restClient) { + return new WorkloadMonitorManager(restClient); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of WorkloadMonitorManager that exposes WorkloadMonitor management API entry points. + * + * @param credentials the credentials to use + * @return the interface exposing WorkloadMonitor management API entry points that work across subscriptions + */ + WorkloadMonitorManager authenticate(AzureTokenCredentials credentials); + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Monitors. + */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(this); + } + return this.monitors; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public WorkloadMonitorManager authenticate(AzureTokenCredentials credentials) { + return WorkloadMonitorManager.authenticate(buildRestClient(credentials)); + } + } + private WorkloadMonitorManager(RestClient restClient) { + super( + restClient, + null, + new WorkloadMonitorAPIImpl(restClient)); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/package-info.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/package-info.java new file mode 100644 index 000000000000..80918a4fd0d3 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the implementation classes for WorkloadMonitorAPI. + * Workload Monitor API. + */ +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview.implementation; diff --git a/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/package-info.java b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/package-info.java new file mode 100644 index 000000000000..7bcb5ab66aab --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2020-01-13-preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2020-01-13-preview/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * This package contains the classes for WorkloadMonitorAPI. + * Workload Monitor API. + */ +package com.microsoft.azure.management.workloadmonitor.v2020-01-13-preview;