diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/pom.xml b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/pom.xml new file mode 100644 index 000000000000..a2c7313e8619 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.workloadmonitor.v2018_08_31_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-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AlertGeneration.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AlertGeneration.java new file mode 100644 index 000000000000..07bee7f242cf --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AlertGeneration.java @@ -0,0 +1,41 @@ +/** + * 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.v2018_08_31_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for AlertGeneration. + */ +public final class AlertGeneration extends ExpandableStringEnum { + /** Static value Enabled for AlertGeneration. */ + public static final AlertGeneration ENABLED = fromString("Enabled"); + + /** Static value Disabled for AlertGeneration. */ + public static final AlertGeneration DISABLED = fromString("Disabled"); + + /** + * Creates or finds a AlertGeneration from its string representation. + * @param name a name to look for + * @return the corresponding AlertGeneration + */ + @JsonCreator + public static AlertGeneration fromString(String name) { + return fromString(name, AlertGeneration.class); + } + + /** + * @return known AlertGeneration values + */ + public static Collection values() { + return values(AlertGeneration.class); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AzureEntityResource.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AzureEntityResource.java new file mode 100644 index 000000000000..9644fcb969bb --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/AzureEntityResource.java @@ -0,0 +1,34 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends ProxyResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get resource Etag. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Component.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Component.java new file mode 100644 index 000000000000..b0270d586e35 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Component.java @@ -0,0 +1,128 @@ +/** + * 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.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.ComponentInner; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing Component. + */ +public interface Component extends HasInner, HasManager { + /** + * @return the aggregateProperties value. + */ + Map aggregateProperties(); + + /** + * @return the children value. + */ + List children(); + + /** + * @return the componentName value. + */ + String componentName(); + + /** + * @return the componentTypeGroupCategory value. + */ + String componentTypeGroupCategory(); + + /** + * @return the componentTypeId value. + */ + String componentTypeId(); + + /** + * @return the componentTypeName value. + */ + String componentTypeName(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the healthState value. + */ + HealthState healthState(); + + /** + * @return the healthStateCategory value. + */ + HealthStateCategory healthStateCategory(); + + /** + * @return the healthStateChangesEndTime value. + */ + DateTime healthStateChangesEndTime(); + + /** + * @return the healthStateChangesStartTime value. + */ + DateTime healthStateChangesStartTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastHealthStateChangeTime value. + */ + DateTime lastHealthStateChangeTime(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the solutionId value. + */ + String solutionId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the vmId value. + */ + String vmId(); + + /** + * @return the vmName value. + */ + String vmName(); + + /** + * @return the vmTags value. + */ + Map vmTags(); + + /** + * @return the workloadType value. + */ + WorkloadType workloadType(); + + /** + * @return the workspaceId value. + */ + String workspaceId(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Components.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Components.java new file mode 100644 index 000000000000..007fb1f3fdc3 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Components.java @@ -0,0 +1,43 @@ +/** + * 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.v2018_08_31_preview; + +import rx.Observable; +import java.util.UUID; + +/** + * Type representing Components. + */ +public interface Components { + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ComponentsSummarys.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ComponentsSummarys.java new file mode 100644 index 000000000000..3bbfc08d62fa --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ComponentsSummarys.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.v2018_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.ComponentsSummarysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ComponentsSummarys. + */ +public interface ComponentsSummarys extends HasInner { + /** + * Get subscription wide details of components. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorFieldContract.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorFieldContract.java new file mode 100644 index 000000000000..0db39d629dbb --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorFieldContract.java @@ -0,0 +1,95 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error field contract. + */ +public class ErrorFieldContract { + /** + * Property level error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Human-readable representation of property-level error. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Property name. + */ + @JsonProperty(value = "target") + private String target; + + /** + * 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 ErrorFieldContract object itself. + */ + public ErrorFieldContract 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 ErrorFieldContract object itself. + */ + public ErrorFieldContract withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get property name. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Set property name. + * + * @param target the target value to set + * @return the ErrorFieldContract object itself. + */ + public ErrorFieldContract withTarget(String target) { + this.target = target; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponse.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponse.java new file mode 100644 index 000000000000..cb71ac127f61 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponse.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.v2018_08_31_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error body contract. + */ +public class ErrorResponse { + /** + * 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; + + /** + * The list of invalid fields send in request, in case of validation 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 ErrorResponse object itself. + */ + public ErrorResponse 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 ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the list of invalid fields send in request, in case of validation error. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Set the list of invalid fields send in request, in case of validation error. + * + * @param details the details value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withDetails(List details) { + this.details = details; + return this; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponseException.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponseException.java new file mode 100644 index 000000000000..d2a618d5111c --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/ErrorResponseException.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.v2018_08_31_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException 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 ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthState.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthState.java new file mode 100644 index 000000000000..9129e594ab7e --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthState.java @@ -0,0 +1,62 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for HealthState. + */ +public enum HealthState { + /** Enum value Error. */ + ERROR("Error"), + + /** Enum value Warning. */ + WARNING("Warning"), + + /** Enum value Success. */ + SUCCESS("Success"), + + /** Enum value Unknown. */ + UNKNOWN("Unknown"), + + /** Enum value Uninitialized. */ + UNINITIALIZED("Uninitialized"); + + /** The actual serialized value for a HealthState instance. */ + private String value; + + HealthState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a HealthState instance. + * + * @param value the serialized value to parse. + * @return the parsed HealthState object, or null if unable to parse. + */ + @JsonCreator + public static HealthState fromString(String value) { + HealthState[] items = HealthState.values(); + for (HealthState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateCategory.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateCategory.java new file mode 100644 index 000000000000..b8d721b4339d --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateCategory.java @@ -0,0 +1,41 @@ +/** + * 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.v2018_08_31_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for HealthStateCategory. + */ +public final class HealthStateCategory extends ExpandableStringEnum { + /** Static value Identity for HealthStateCategory. */ + public static final HealthStateCategory IDENTITY = fromString("Identity"); + + /** Static value CustomGroup for HealthStateCategory. */ + public static final HealthStateCategory CUSTOM_GROUP = fromString("CustomGroup"); + + /** + * Creates or finds a HealthStateCategory from its string representation. + * @param name a name to look for + * @return the corresponding HealthStateCategory + */ + @JsonCreator + public static HealthStateCategory fromString(String name) { + return fromString(name, HealthStateCategory.class); + } + + /** + * @return known HealthStateCategory values + */ + public static Collection values() { + return values(HealthStateCategory.class); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateChange.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateChange.java new file mode 100644 index 000000000000..982196aa3bc6 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/HealthStateChange.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. + */ + +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Model for health state change. + */ +public class HealthStateChange { + /** + * Health state of monitor instance. Possible values include: 'Error', + * 'Warning', 'Success', 'Unknown', 'Uninitialized'. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /** + * Time at which this Health state was reached. + */ + @JsonProperty(value = "healthStateChangeTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime healthStateChangeTime; + + /** + * Get health state of monitor instance. Possible values include: 'Error', 'Warning', 'Success', 'Unknown', 'Uninitialized'. + * + * @return the healthState value + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get time at which this Health state was reached. + * + * @return the healthStateChangeTime value + */ + public DateTime healthStateChangeTime() { + return this.healthStateChangeTime; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitor.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitor.java new file mode 100644 index 000000000000..116f45f33a83 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitor.java @@ -0,0 +1,150 @@ +/** + * 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.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.MonitorInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import java.util.List; + +/** + * Type representing Monitor. + */ +public interface Monitor extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the alertGeneration value. + */ + AlertGeneration alertGeneration(); + + /** + * @return the componentTypeDisplayName value. + */ + String componentTypeDisplayName(); + + /** + * @return the componentTypeId value. + */ + String componentTypeId(); + + /** + * @return the componentTypeName value. + */ + String componentTypeName(); + + /** + * @return the criteria value. + */ + List criteria(); + + /** + * @return the description value. + */ + String description(); + + /** + * @return the documentationURL value. + */ + String documentationURL(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the frequency value. + */ + Integer frequency(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lookbackDuration value. + */ + Integer lookbackDuration(); + + /** + * @return the monitorCategory value. + */ + MonitorCategory monitorCategory(); + + /** + * @return the monitorDisplayName value. + */ + String monitorDisplayName(); + + /** + * @return the monitorId value. + */ + String monitorId(); + + /** + * @return the monitorName value. + */ + String monitorName(); + + /** + * @return the monitorState value. + */ + MonitorState monitorState(); + + /** + * @return the monitorType value. + */ + MonitorType monitorType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the parentMonitorDisplayName value. + */ + String parentMonitorDisplayName(); + + /** + * @return the parentMonitorName value. + */ + String parentMonitorName(); + + /** + * @return the signalName value. + */ + String signalName(); + + /** + * @return the signalType value. + */ + String signalType(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a Monitor update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of Monitor update stages. + */ + interface UpdateStages { + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCategory.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCategory.java new file mode 100644 index 000000000000..a50d16e75b20 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCategory.java @@ -0,0 +1,62 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for MonitorCategory. + */ +public enum MonitorCategory { + /** Enum value AvailabilityHealth. */ + AVAILABILITY_HEALTH("AvailabilityHealth"), + + /** Enum value Configuration. */ + CONFIGURATION("Configuration"), + + /** Enum value EntityHealth. */ + ENTITY_HEALTH("EntityHealth"), + + /** Enum value PerformanceHealth. */ + PERFORMANCE_HEALTH("PerformanceHealth"), + + /** Enum value Security. */ + SECURITY("Security"); + + /** The actual serialized value for a MonitorCategory instance. */ + private String value; + + MonitorCategory(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MonitorCategory instance. + * + * @param value the serialized value to parse. + * @return the parsed MonitorCategory object, or null if unable to parse. + */ + @JsonCreator + public static MonitorCategory fromString(String value) { + MonitorCategory[] items = MonitorCategory.values(); + for (MonitorCategory item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCriteria.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCriteria.java new file mode 100644 index 000000000000..3f6c9fb50edd --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorCriteria.java @@ -0,0 +1,65 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Criteria for monitor configuration. + */ +public class MonitorCriteria { + /** + * Target health state of the criteria. Possible values include: 'Error', + * 'Warning', 'Success', 'Unknown', 'Uninitialized'. + */ + @JsonProperty(value = "healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /** + * Threshold value for this criteria. + */ + @JsonProperty(value = "threshold", access = JsonProperty.Access.WRITE_ONLY) + private Double threshold; + + /** + * Comparison enum on threshold of this criteria. Possible values include: + * 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', + * 'LessThanOrEqual', 'NotEquals'. + */ + @JsonProperty(value = "comparisonOperator", access = JsonProperty.Access.WRITE_ONLY) + private Operator comparisonOperator; + + /** + * Get target health state of the criteria. Possible values include: 'Error', 'Warning', 'Success', 'Unknown', 'Uninitialized'. + * + * @return the healthState value + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get threshold value for this criteria. + * + * @return the threshold value + */ + public Double threshold() { + return this.threshold; + } + + /** + * Get comparison enum on threshold of this criteria. Possible values include: 'Equals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual', 'NotEquals'. + * + * @return the comparisonOperator value + */ + public Operator comparisonOperator() { + return this.comparisonOperator; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstance.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstance.java new file mode 100644 index 000000000000..08b82c413b09 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstance.java @@ -0,0 +1,143 @@ +/** + * 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.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.MonitorInstanceInner; +import java.util.Map; +import java.util.List; +import org.joda.time.DateTime; + +/** + * Type representing MonitorInstance. + */ +public interface MonitorInstance extends HasInner, HasManager { + /** + * @return the aggregateProperties value. + */ + Map aggregateProperties(); + + /** + * @return the alertGeneration value. + */ + AlertGeneration alertGeneration(); + + /** + * @return the children value. + */ + List children(); + + /** + * @return the componentId value. + */ + String componentId(); + + /** + * @return the componentName value. + */ + String componentName(); + + /** + * @return the componentTypeId value. + */ + String componentTypeId(); + + /** + * @return the componentTypeName value. + */ + String componentTypeName(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the healthState value. + */ + HealthState healthState(); + + /** + * @return the healthStateCategory value. + */ + HealthStateCategory healthStateCategory(); + + /** + * @return the healthStateChanges value. + */ + List healthStateChanges(); + + /** + * @return the healthStateChangesEndTime value. + */ + DateTime healthStateChangesEndTime(); + + /** + * @return the healthStateChangesStartTime value. + */ + DateTime healthStateChangesStartTime(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastHealthStateChangeTime value. + */ + DateTime lastHealthStateChangeTime(); + + /** + * @return the monitorCategory value. + */ + MonitorCategory monitorCategory(); + + /** + * @return the monitorId value. + */ + String monitorId(); + + /** + * @return the monitorName value. + */ + String monitorName(); + + /** + * @return the monitorType value. + */ + MonitorType monitorType(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the solutionId value. + */ + String solutionId(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the workloadType value. + */ + WorkloadType workloadType(); + + /** + * @return the workspaceId value. + */ + String workspaceId(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstances.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstances.java new file mode 100644 index 000000000000..f5664cf55776 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstances.java @@ -0,0 +1,43 @@ +/** + * 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.v2018_08_31_preview; + +import rx.Observable; +import java.util.UUID; + +/** + * Type representing MonitorInstances. + */ +public interface MonitorInstances { + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstancesSummarys.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstancesSummarys.java new file mode 100644 index 000000000000..95080795a93f --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorInstancesSummarys.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.v2018_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.MonitorInstancesSummarysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing MonitorInstancesSummarys. + */ +public interface MonitorInstancesSummarys extends HasInner { + /** + * Get subscription wide health instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorState.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorState.java new file mode 100644 index 000000000000..3619079b4f4b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorState.java @@ -0,0 +1,53 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for MonitorState. + */ +public enum MonitorState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a MonitorState instance. */ + private String value; + + MonitorState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MonitorState instance. + * + * @param value the serialized value to parse. + * @return the parsed MonitorState object, or null if unable to parse. + */ + @JsonCreator + public static MonitorState fromString(String value) { + MonitorState[] items = MonitorState.values(); + for (MonitorState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorType.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorType.java new file mode 100644 index 000000000000..08727b91dc06 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/MonitorType.java @@ -0,0 +1,56 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for MonitorType. + */ +public enum MonitorType { + /** Enum value Aggregate. */ + AGGREGATE("Aggregate"), + + /** Enum value Dependency. */ + DEPENDENCY("Dependency"), + + /** Enum value Unit. */ + UNIT("Unit"); + + /** The actual serialized value for a MonitorType instance. */ + private String value; + + MonitorType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MonitorType instance. + * + * @param value the serialized value to parse. + * @return the parsed MonitorType object, or null if unable to parse. + */ + @JsonCreator + public static MonitorType fromString(String value) { + MonitorType[] items = MonitorType.values(); + for (MonitorType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitors.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitors.java new file mode 100644 index 000000000000..b9b82eaf0ca6 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Monitors.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.v2018_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.MonitorsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Monitors. + */ +public interface Monitors extends HasInner { + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + + /** + * Get details of a single monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java new file mode 100644 index 000000000000..daabc0b5a14e --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSetting.java @@ -0,0 +1,60 @@ +/** + * 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.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import java.util.List; + +/** + * Type representing NotificationSetting. + */ +public interface NotificationSetting extends HasInner, Indexable, Updatable, HasManager { + /** + * @return the actionGroupResourceIds value. + */ + List actionGroupResourceIds(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a NotificationSetting update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable { + } + + /** + * Grouping of NotificationSetting update stages. + */ + interface UpdateStages { + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java new file mode 100644 index 000000000000..de4cf0523d1b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/NotificationSettings.java @@ -0,0 +1,43 @@ +/** + * 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.v2018_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.NotificationSettingsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing NotificationSettings. + */ +public interface NotificationSettings extends HasInner { + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName); + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operation.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operation.java new file mode 100644 index 000000000000..fcd3d66deecb --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.WorkloadMonitorManager; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationProperties display(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the origin value. + */ + String origin(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/OperationProperties.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/OperationProperties.java new file mode 100644 index 000000000000..6b719601f8fe --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/OperationProperties.java @@ -0,0 +1,77 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties of an operation supported by the resource provider. + */ +public class OperationProperties { + /** + * The description of the resource provider. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * This operation name. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /** + * The provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * The resource name. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /** + * Get the description of the resource provider. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get this operation name. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Get the provider name. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource name. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operations.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operations.java new file mode 100644 index 000000000000..8e3d2d1a4a89 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_preview; + +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Gets the details of all operations possible on the resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operator.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operator.java new file mode 100644 index 000000000000..0df6aa36b688 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/Operator.java @@ -0,0 +1,65 @@ +/** + * 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.v2018_08_31_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for Operator. + */ +public enum Operator { + /** Enum value Equals. */ + EQUALS("Equals"), + + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"), + + /** Enum value NotEquals. */ + NOT_EQUALS("NotEquals"); + + /** The actual serialized value for a Operator instance. */ + private String value; + + Operator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a Operator instance. + * + * @param value the serialized value to parse. + * @return the parsed Operator object, or null if unable to parse. + */ + @JsonCreator + public static Operator fromString(String value) { + Operator[] items = Operator.values(); + for (Operator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/WorkloadType.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/WorkloadType.java new file mode 100644 index 000000000000..73cd8880bb7e --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/WorkloadType.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.v2018_08_31_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WorkloadType. + */ +public final class WorkloadType extends ExpandableStringEnum { + /** Static value BaseOS for WorkloadType. */ + public static final WorkloadType BASE_OS = fromString("BaseOS"); + + /** Static value SQL for WorkloadType. */ + public static final WorkloadType SQL = fromString("SQL"); + + /** Static value IIS for WorkloadType. */ + public static final WorkloadType IIS = fromString("IIS"); + + /** Static value Apache for WorkloadType. */ + public static final WorkloadType APACHE = fromString("Apache"); + + /** + * Creates or finds a WorkloadType from its string representation. + * @param name a name to look for + * @return the corresponding WorkloadType + */ + @JsonCreator + public static WorkloadType fromString(String name) { + return fromString(name, WorkloadType.class); + } + + /** + * @return known WorkloadType values + */ + public static Collection values() { + return values(WorkloadType.class); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentImpl.java new file mode 100644 index 000000000000..4f0416064078 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentImpl.java @@ -0,0 +1,137 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Component; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import java.util.List; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthState; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateCategory; +import org.joda.time.DateTime; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.WorkloadType; + +class ComponentImpl extends WrapperImpl implements Component { + private final WorkloadMonitorManager manager; + ComponentImpl(ComponentInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Map aggregateProperties() { + return this.inner().aggregateProperties(); + } + + @Override + public List children() { + return this.inner().children(); + } + + @Override + public String componentName() { + return this.inner().componentName(); + } + + @Override + public String componentTypeGroupCategory() { + return this.inner().componentTypeGroupCategory(); + } + + @Override + public String componentTypeId() { + return this.inner().componentTypeId(); + } + + @Override + public String componentTypeName() { + return this.inner().componentTypeName(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public HealthState healthState() { + return this.inner().healthState(); + } + + @Override + public HealthStateCategory healthStateCategory() { + return this.inner().healthStateCategory(); + } + + @Override + public DateTime healthStateChangesEndTime() { + return this.inner().healthStateChangesEndTime(); + } + + @Override + public DateTime healthStateChangesStartTime() { + return this.inner().healthStateChangesStartTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastHealthStateChangeTime() { + return this.inner().lastHealthStateChangeTime(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String solutionId() { + return this.inner().solutionId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String vmId() { + return this.inner().vmId(); + } + + @Override + public String vmName() { + return this.inner().vmName(); + } + + @Override + public Map vmTags() { + return this.inner().vmTags(); + } + + @Override + public WorkloadType workloadType() { + return this.inner().workloadType(); + } + + @Override + public String workspaceId() { + return this.inner().workspaceId(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentInner.java new file mode 100644 index 000000000000..0d0ec452ccf7 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentInner.java @@ -0,0 +1,301 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.WorkloadType; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthState; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateCategory; +import org.joda.time.DateTime; +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Model for component. + */ +@JsonFlatten +public class ComponentInner extends ProxyResource { + /** + * For optimistic concurrency control. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * ID of the workspace. + */ + @JsonProperty(value = "properties.workspaceId", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceId; + + /** + * ID of the OMS solution this component belong to. + */ + @JsonProperty(value = "properties.solutionId", access = JsonProperty.Access.WRITE_ONLY) + private String solutionId; + + /** + * Type of the workload. Possible values include: 'BaseOS', 'SQL', 'IIS', + * 'Apache'. + */ + @JsonProperty(value = "properties.workloadType", access = JsonProperty.Access.WRITE_ONLY) + private WorkloadType workloadType; + + /** + * Name of the component. + */ + @JsonProperty(value = "properties.componentName", access = JsonProperty.Access.WRITE_ONLY) + private String componentName; + + /** + * ID of the component type. + */ + @JsonProperty(value = "properties.componentTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeId; + + /** + * Name of the component type. Qualifies the type of component such as + * whether it is a SQL database, logical disk, website, etc. + */ + @JsonProperty(value = "properties.componentTypeName", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeName; + + /** + * Component type group category. Classification of component type groups + * into a logical category. e.g. Network, Disk, Memory, CPU. + */ + @JsonProperty(value = "properties.componentTypeGroupCategory", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeGroupCategory; + + /** + * Health state of the component. Possible values include: 'Error', + * 'Warning', 'Success', 'Unknown', 'Uninitialized'. + */ + @JsonProperty(value = "properties.healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /** + * Category of component's health state. Possible values include: + * 'Identity', 'CustomGroup'. + */ + @JsonProperty(value = "properties.healthStateCategory", access = JsonProperty.Access.WRITE_ONLY) + private HealthStateCategory healthStateCategory; + + /** + * Start time for health state changes. + */ + @JsonProperty(value = "properties.healthStateChangesStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime healthStateChangesStartTime; + + /** + * End time for health state changes. + */ + @JsonProperty(value = "properties.healthStateChangesEndTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime healthStateChangesEndTime; + + /** + * Time of last health state change. + */ + @JsonProperty(value = "properties.lastHealthStateChangeTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastHealthStateChangeTime; + + /** + * ID of the VM this component belongs to. + */ + @JsonProperty(value = "properties.vmId", access = JsonProperty.Access.WRITE_ONLY) + private String vmId; + + /** + * Name of the VM this component belongs to. + */ + @JsonProperty(value = "properties.vmName", access = JsonProperty.Access.WRITE_ONLY) + private String vmName; + + /** + * Tags on the VM this component belongs to. + */ + @JsonProperty(value = "properties.vmTags", access = JsonProperty.Access.WRITE_ONLY) + private Map vmTags; + + /** + * Properties requested in aggregation queries. + */ + @JsonProperty(value = "properties.aggregateProperties", access = JsonProperty.Access.WRITE_ONLY) + private Map aggregateProperties; + + /** + * component children. + */ + @JsonProperty(value = "properties.children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get for optimistic concurrency control. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get iD of the workspace. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Get iD of the OMS solution this component belong to. + * + * @return the solutionId value + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Get type of the workload. Possible values include: 'BaseOS', 'SQL', 'IIS', 'Apache'. + * + * @return the workloadType value + */ + public WorkloadType workloadType() { + return this.workloadType; + } + + /** + * Get name of the component. + * + * @return the componentName value + */ + public String componentName() { + return this.componentName; + } + + /** + * Get iD of the component type. + * + * @return the componentTypeId value + */ + public String componentTypeId() { + return this.componentTypeId; + } + + /** + * Get name of the component type. Qualifies the type of component such as whether it is a SQL database, logical disk, website, etc. + * + * @return the componentTypeName value + */ + public String componentTypeName() { + return this.componentTypeName; + } + + /** + * Get component type group category. Classification of component type groups into a logical category. e.g. Network, Disk, Memory, CPU. + * + * @return the componentTypeGroupCategory value + */ + public String componentTypeGroupCategory() { + return this.componentTypeGroupCategory; + } + + /** + * Get health state of the component. Possible values include: 'Error', 'Warning', 'Success', 'Unknown', 'Uninitialized'. + * + * @return the healthState value + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get category of component's health state. Possible values include: 'Identity', 'CustomGroup'. + * + * @return the healthStateCategory value + */ + public HealthStateCategory healthStateCategory() { + return this.healthStateCategory; + } + + /** + * Get start time for health state changes. + * + * @return the healthStateChangesStartTime value + */ + public DateTime healthStateChangesStartTime() { + return this.healthStateChangesStartTime; + } + + /** + * Get end time for health state changes. + * + * @return the healthStateChangesEndTime value + */ + public DateTime healthStateChangesEndTime() { + return this.healthStateChangesEndTime; + } + + /** + * Get time of last health state change. + * + * @return the lastHealthStateChangeTime value + */ + public DateTime lastHealthStateChangeTime() { + return this.lastHealthStateChangeTime; + } + + /** + * Get iD of the VM this component belongs to. + * + * @return the vmId value + */ + public String vmId() { + return this.vmId; + } + + /** + * Get name of the VM this component belongs to. + * + * @return the vmName value + */ + public String vmName() { + return this.vmName; + } + + /** + * Get tags on the VM this component belongs to. + * + * @return the vmTags value + */ + public Map vmTags() { + return this.vmTags; + } + + /** + * Get properties requested in aggregation queries. + * + * @return the aggregateProperties value + */ + public Map aggregateProperties() { + return this.aggregateProperties; + } + + /** + * Get component children. + * + * @return the children value + */ + public List children() { + return this.children; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsImpl.java new file mode 100644 index 000000000000..bb18edd011d7 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsImpl.java @@ -0,0 +1,62 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Components; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Component; +import java.util.UUID; + +class ComponentsImpl extends WrapperImpl implements Components { + private final WorkloadMonitorManager manager; + + ComponentsImpl(WorkloadMonitorManager manager) { + super(manager.inner().components()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ComponentsInner client = this.inner(); + return client.listByResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Component call(ComponentInner inner) { + return new ComponentImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId) { + ComponentsInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId) + .map(new Func1() { + @Override + public Component call(ComponentInner inner) { + return new ComponentImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsInner.java new file mode 100644 index 000000000000..e9a90f97cc93 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsInner.java @@ -0,0 +1,704 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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 java.util.UUID; +import okhttp3.ResponseBody; +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 Components. + */ +public class ComponentsInner { + /** The Retrofit service to perform REST calls. */ + private ComponentsService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of ComponentsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ComponentsInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(ComponentsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Components to be + * used by Retrofit to perform actually REST calls. + */ + interface ComponentsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Components listByResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/components") + Observable> listByResource(@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("$select") String select, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$orderby") String orderby, @Query("$expand") String expand, @Query("$top") String top, @Query("$skiptoken") String skiptoken, @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.v2018_08_31_preview.Components get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/components/{componentId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("componentId") UUID componentId, @Query("api-version") String apiVersion, @Query("$select") String select, @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.v2018_08_31_preview.Components listByResourceNext" }) + @GET + Observable> listByResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 select = null; + final String filter = null; + final String apply = null; + final String orderby = null; + final String expand = null; + final String top = null; + final String skiptoken = null; + return service.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of components for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken) + .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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of components for a resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param resourceNamespace The Namespace of the resource. + ServiceResponse> * @param resourceType The type of the resource. + ServiceResponse> * @param resourceName Name of the resource. + ServiceResponse> * @param select Properties to be returned in the response. + ServiceResponse> * @param filter Filter to be applied on the operation. + ServiceResponse> * @param apply Apply aggregation. + ServiceResponse> * @param orderby Sort the result on one or more properties. + ServiceResponse> * @param expand Include properties inline in the response. + ServiceResponse> * @param top Limit the result to the specified number of rows. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComponentInner object if successful. + */ + public ComponentInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId).toBlocking().single().body(); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId), serviceCallback); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComponentInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId).map(new Func1, ComponentInner>() { + @Override + public ComponentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComponentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 (componentId == null) { + throw new IllegalArgumentException("Parameter componentId is required and cannot be null."); + } + final String select = null; + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, componentId, this.client.apiVersion(), select, 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 details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ComponentInner object if successful. + */ + public ComponentInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId, String select, String expand) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId, select, expand).toBlocking().single().body(); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId, String select, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId, select, expand), serviceCallback); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComponentInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId, String select, String expand) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, componentId, select, expand).map(new Func1, ComponentInner>() { + @Override + public ComponentInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get details of a component. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param componentId Component Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ComponentInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID componentId, String select, String expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 (componentId == null) { + throw new IllegalArgumentException("Parameter componentId is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, componentId, this.client.apiVersion(), select, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get list of components for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> object if successful. + */ + public PagedList listByResourceNext(final String nextPageLink) { + ServiceResponse> response = listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of components for a resource. + * + * @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> listByResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of components for a resource. + * + * @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<ComponentInner> object + */ + public Observable> listByResourceNextAsync(final String nextPageLink) { + return listByResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of components for a resource. + * + * @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<ComponentInner> object + */ + public Observable>> listByResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceNextSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of components for a resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceNextSinglePageAsync(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.listByResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysImpl.java new file mode 100644 index 000000000000..9838d3f3e1db --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysImpl.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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.ComponentsSummarys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Component; + +class ComponentsSummarysImpl extends WrapperImpl implements ComponentsSummarys { + private final WorkloadMonitorManager manager; + + ComponentsSummarysImpl(WorkloadMonitorManager manager) { + super(manager.inner().componentsSummarys()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + ComponentsSummarysInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Component call(ComponentInner inner) { + return new ComponentImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysInner.java new file mode 100644 index 000000000000..7ffc7fb9ca42 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/ComponentsSummarysInner.java @@ -0,0 +1,423 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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.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 ComponentsSummarys. + */ +public class ComponentsSummarysInner { + /** The Retrofit service to perform REST calls. */ + private ComponentsSummarysService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of ComponentsSummarysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ComponentsSummarysInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(ComponentsSummarysService.class); + this.client = client; + } + + /** + * The interface defining all the services for ComponentsSummarys to be + * used by Retrofit to perform actually REST calls. + */ + interface ComponentsSummarysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.ComponentsSummarys list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.WorkloadMonitor/componentsSummary") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$select") String select, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$orderby") String orderby, @Query("$expand") String expand, @Query("$top") String top, @Query("$skiptoken") String skiptoken, @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.v2018_08_31_preview.ComponentsSummarys listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get subscription wide details of components. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> 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(); + } + }; + } + + /** + * Get subscription wide details of components. + * + * @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); + } + + /** + * Get subscription wide details of components. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide details of components. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> 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)); + } + }); + } + + /** + * Get subscription wide details of components. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String select = null; + final String filter = null; + final String apply = null; + final String orderby = null; + final String expand = null; + final String top = null; + final String skiptoken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, 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 subscription wide details of components. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> object if successful. + */ + public PagedList list(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + ServiceResponse> response = listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get subscription wide details of components. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get subscription wide details of components. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable> listAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listWithServiceResponseAsync(select, filter, apply, orderby, expand, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide details of components. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ComponentInner> object + */ + public Observable>> listWithServiceResponseAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken) + .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 subscription wide details of components. + * + ServiceResponse> * @param select Properties to be returned in the response. + ServiceResponse> * @param filter Filter to be applied on the operation. + ServiceResponse> * @param apply Apply aggregation. + ServiceResponse> * @param orderby Sort the result on one or more properties. + ServiceResponse> * @param expand Include properties inline in the response. + ServiceResponse> * @param top Limit the result to the specified number of rows. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get subscription wide details of components. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<ComponentInner> 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 subscription wide details of components. + * + * @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 subscription wide details of components. + * + * @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<ComponentInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide details of components. + * + * @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<ComponentInner> 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 subscription wide details of components. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ComponentInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/IdParsingUtils.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..76314f35916d --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_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-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorImpl.java new file mode 100644 index 000000000000..5965b6547857 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorImpl.java @@ -0,0 +1,196 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Monitor; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.AlertGeneration; +import java.util.List; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCriteria; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCategory; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorState; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorType; + +class MonitorImpl extends CreatableUpdatableImpl implements Monitor, Monitor.Update { + private final WorkloadMonitorManager manager; + private String resourceGroupName; + private String resourceNamespace; + private String resourceType; + private String resourceName; + private String monitorId; + + MonitorImpl(String name, WorkloadMonitorManager manager) { + super(name, new MonitorInner()); + this.manager = manager; + // Set resource name + this.monitorId = name; + // + } + + MonitorImpl(MonitorInner inner, WorkloadMonitorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.monitorId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.resourceNamespace = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + this.monitorId = IdParsingUtils.getValueFromIdByName(inner.id(), "monitors"); + this.resourceType = IdParsingUtils.getValueFromIdByPosition(inner.id(), 6); + this.resourceName = IdParsingUtils.getValueFromIdByPosition(inner.id(), 7); + // + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + MonitorsInner client = this.manager().inner().monitors(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + MonitorsInner client = this.manager().inner().monitors(); + return client.updateAsync(this.resourceGroupName, this.resourceNamespace, this.resourceType, this.resourceName, this.monitorId) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MonitorsInner client = this.manager().inner().monitors(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public AlertGeneration alertGeneration() { + return this.inner().alertGeneration(); + } + + @Override + public String componentTypeDisplayName() { + return this.inner().componentTypeDisplayName(); + } + + @Override + public String componentTypeId() { + return this.inner().componentTypeId(); + } + + @Override + public String componentTypeName() { + return this.inner().componentTypeName(); + } + + @Override + public List criteria() { + return this.inner().criteria(); + } + + @Override + public String description() { + return this.inner().description(); + } + + @Override + public String documentationURL() { + return this.inner().documentationURL(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public Integer frequency() { + return this.inner().frequency(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Integer lookbackDuration() { + return this.inner().lookbackDuration(); + } + + @Override + public MonitorCategory monitorCategory() { + return this.inner().monitorCategory(); + } + + @Override + public String monitorDisplayName() { + return this.inner().monitorDisplayName(); + } + + @Override + public String monitorId() { + return this.inner().monitorId(); + } + + @Override + public String monitorName() { + return this.inner().monitorName(); + } + + @Override + public MonitorState monitorState() { + return this.inner().monitorState(); + } + + @Override + public MonitorType monitorType() { + return this.inner().monitorType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String parentMonitorDisplayName() { + return this.inner().parentMonitorDisplayName(); + } + + @Override + public String parentMonitorName() { + return this.inner().parentMonitorName(); + } + + @Override + public String signalName() { + return this.inner().signalName(); + } + + @Override + public String signalType() { + return this.inner().signalType(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInner.java new file mode 100644 index 000000000000..f3b985d94683 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInner.java @@ -0,0 +1,331 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorType; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCategory; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorState; +import java.util.List; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCriteria; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.AlertGeneration; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Model for Monitor. + */ +@JsonFlatten +public class MonitorInner extends ProxyResource { + /** + * For optimistic concurrency control. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Description of the monitor. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * ID of the monitor. + */ + @JsonProperty(value = "properties.monitorId", access = JsonProperty.Access.WRITE_ONLY) + private String monitorId; + + /** + * Name of the monitor. + */ + @JsonProperty(value = "properties.monitorName", access = JsonProperty.Access.WRITE_ONLY) + private String monitorName; + + /** + * User friendly display name of the monitor. + */ + @JsonProperty(value = "properties.monitorDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String monitorDisplayName; + + /** + * Name of the parent monitor. + */ + @JsonProperty(value = "properties.parentMonitorName", access = JsonProperty.Access.WRITE_ONLY) + private String parentMonitorName; + + /** + * User friendly display name of the parent monitor. + */ + @JsonProperty(value = "properties.parentMonitorDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String parentMonitorDisplayName; + + /** + * Type of the monitor. Possible values include: 'Aggregate', 'Dependency', + * 'Unit'. + */ + @JsonProperty(value = "properties.monitorType", access = JsonProperty.Access.WRITE_ONLY) + private MonitorType monitorType; + + /** + * Category of the monitor. Possible values include: 'AvailabilityHealth', + * 'Configuration', 'EntityHealth', 'PerformanceHealth', 'Security'. + */ + @JsonProperty(value = "properties.monitorCategory", access = JsonProperty.Access.WRITE_ONLY) + private MonitorCategory monitorCategory; + + /** + * Component Type Id of monitor. + */ + @JsonProperty(value = "properties.componentTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeId; + + /** + * Component Type Name of monitor. + */ + @JsonProperty(value = "properties.componentTypeName", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeName; + + /** + * Component Type Display Name of the monitor. + */ + @JsonProperty(value = "properties.componentTypeDisplayName", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeDisplayName; + + /** + * Is the monitor state enabled or disabled. Possible values include: + * 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.monitorState", access = JsonProperty.Access.WRITE_ONLY) + private MonitorState monitorState; + + /** + * Collection of MonitorCriteria. For PATCH calls, instead of partial list, + * complete list of expected criteria should be passed for proper updating. + */ + @JsonProperty(value = "properties.criteria", access = JsonProperty.Access.WRITE_ONLY) + private List criteria; + + /** + * Generates alerts or not. Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.alertGeneration", access = JsonProperty.Access.WRITE_ONLY) + private AlertGeneration alertGeneration; + + /** + * Frequency at which monitor condition is evaluated. + */ + @JsonProperty(value = "properties.frequency", access = JsonProperty.Access.WRITE_ONLY) + private Integer frequency; + + /** + * The duration in minutes in the past during which the monitor is + * evaluated. + */ + @JsonProperty(value = "properties.lookbackDuration", access = JsonProperty.Access.WRITE_ONLY) + private Integer lookbackDuration; + + /** + * URL pointing to the documentation of the monitor. + */ + @JsonProperty(value = "properties.documentationURL", access = JsonProperty.Access.WRITE_ONLY) + private String documentationURL; + + /** + * Name of the signal on which this monitor is configured. + */ + @JsonProperty(value = "properties.signalName", access = JsonProperty.Access.WRITE_ONLY) + private String signalName; + + /** + * Type of the signal on which this monitor is configured. + */ + @JsonProperty(value = "properties.signalType", access = JsonProperty.Access.WRITE_ONLY) + private String signalType; + + /** + * Get for optimistic concurrency control. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get description of the monitor. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Get iD of the monitor. + * + * @return the monitorId value + */ + public String monitorId() { + return this.monitorId; + } + + /** + * Get name of the monitor. + * + * @return the monitorName value + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Get user friendly display name of the monitor. + * + * @return the monitorDisplayName value + */ + public String monitorDisplayName() { + return this.monitorDisplayName; + } + + /** + * Get name of the parent monitor. + * + * @return the parentMonitorName value + */ + public String parentMonitorName() { + return this.parentMonitorName; + } + + /** + * Get user friendly display name of the parent monitor. + * + * @return the parentMonitorDisplayName value + */ + public String parentMonitorDisplayName() { + return this.parentMonitorDisplayName; + } + + /** + * Get type of the monitor. Possible values include: 'Aggregate', 'Dependency', 'Unit'. + * + * @return the monitorType value + */ + public MonitorType monitorType() { + return this.monitorType; + } + + /** + * Get category of the monitor. Possible values include: 'AvailabilityHealth', 'Configuration', 'EntityHealth', 'PerformanceHealth', 'Security'. + * + * @return the monitorCategory value + */ + public MonitorCategory monitorCategory() { + return this.monitorCategory; + } + + /** + * Get component Type Id of monitor. + * + * @return the componentTypeId value + */ + public String componentTypeId() { + return this.componentTypeId; + } + + /** + * Get component Type Name of monitor. + * + * @return the componentTypeName value + */ + public String componentTypeName() { + return this.componentTypeName; + } + + /** + * Get component Type Display Name of the monitor. + * + * @return the componentTypeDisplayName value + */ + public String componentTypeDisplayName() { + return this.componentTypeDisplayName; + } + + /** + * Get is the monitor state enabled or disabled. Possible values include: 'Enabled', 'Disabled'. + * + * @return the monitorState value + */ + public MonitorState monitorState() { + return this.monitorState; + } + + /** + * Get collection of MonitorCriteria. For PATCH calls, instead of partial list, complete list of expected criteria should be passed for proper updating. + * + * @return the criteria value + */ + public List criteria() { + return this.criteria; + } + + /** + * Get generates alerts or not. Possible values include: 'Enabled', 'Disabled'. + * + * @return the alertGeneration value + */ + public AlertGeneration alertGeneration() { + return this.alertGeneration; + } + + /** + * Get frequency at which monitor condition is evaluated. + * + * @return the frequency value + */ + public Integer frequency() { + return this.frequency; + } + + /** + * Get the duration in minutes in the past during which the monitor is evaluated. + * + * @return the lookbackDuration value + */ + public Integer lookbackDuration() { + return this.lookbackDuration; + } + + /** + * Get uRL pointing to the documentation of the monitor. + * + * @return the documentationURL value + */ + public String documentationURL() { + return this.documentationURL; + } + + /** + * Get name of the signal on which this monitor is configured. + * + * @return the signalName value + */ + public String signalName() { + return this.signalName; + } + + /** + * Get type of the signal on which this monitor is configured. + * + * @return the signalType value + */ + public String signalType() { + return this.signalType; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceImpl.java new file mode 100644 index 000000000000..7a63c3883202 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceImpl.java @@ -0,0 +1,156 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstance; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.Map; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.AlertGeneration; +import java.util.List; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthState; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateCategory; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateChange; +import org.joda.time.DateTime; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCategory; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorType; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.WorkloadType; + +class MonitorInstanceImpl extends WrapperImpl implements MonitorInstance { + private final WorkloadMonitorManager manager; + MonitorInstanceImpl(MonitorInstanceInner inner, WorkloadMonitorManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Map aggregateProperties() { + return this.inner().aggregateProperties(); + } + + @Override + public AlertGeneration alertGeneration() { + return this.inner().alertGeneration(); + } + + @Override + public List children() { + return this.inner().children(); + } + + @Override + public String componentId() { + return this.inner().componentId(); + } + + @Override + public String componentName() { + return this.inner().componentName(); + } + + @Override + public String componentTypeId() { + return this.inner().componentTypeId(); + } + + @Override + public String componentTypeName() { + return this.inner().componentTypeName(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public HealthState healthState() { + return this.inner().healthState(); + } + + @Override + public HealthStateCategory healthStateCategory() { + return this.inner().healthStateCategory(); + } + + @Override + public List healthStateChanges() { + return this.inner().healthStateChanges(); + } + + @Override + public DateTime healthStateChangesEndTime() { + return this.inner().healthStateChangesEndTime(); + } + + @Override + public DateTime healthStateChangesStartTime() { + return this.inner().healthStateChangesStartTime(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DateTime lastHealthStateChangeTime() { + return this.inner().lastHealthStateChangeTime(); + } + + @Override + public MonitorCategory monitorCategory() { + return this.inner().monitorCategory(); + } + + @Override + public String monitorId() { + return this.inner().monitorId(); + } + + @Override + public String monitorName() { + return this.inner().monitorName(); + } + + @Override + public MonitorType monitorType() { + return this.inner().monitorType(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String solutionId() { + return this.inner().solutionId(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public WorkloadType workloadType() { + return this.inner().workloadType(); + } + + @Override + public String workspaceId() { + return this.inner().workspaceId(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceInner.java new file mode 100644 index 000000000000..20745d3bca38 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstanceInner.java @@ -0,0 +1,354 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.WorkloadType; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorType; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorCategory; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthState; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateCategory; +import java.util.List; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.HealthStateChange; +import org.joda.time.DateTime; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.AlertGeneration; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Model for monitor instance. + */ +@JsonFlatten +public class MonitorInstanceInner extends ProxyResource { + /** + * For optimistic concurrency control. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * ID of the workspace. + */ + @JsonProperty(value = "properties.workspaceId", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceId; + + /** + * ID of the OMS solution this health instance belong to. + */ + @JsonProperty(value = "properties.solutionId", access = JsonProperty.Access.WRITE_ONLY) + private String solutionId; + + /** + * Type of the workload. Possible values include: 'BaseOS', 'SQL', 'IIS', + * 'Apache'. + */ + @JsonProperty(value = "properties.workloadType", access = JsonProperty.Access.WRITE_ONLY) + private WorkloadType workloadType; + + /** + * ID of the component. + */ + @JsonProperty(value = "properties.componentId", access = JsonProperty.Access.WRITE_ONLY) + private String componentId; + + /** + * Name of the component. + */ + @JsonProperty(value = "properties.componentName", access = JsonProperty.Access.WRITE_ONLY) + private String componentName; + + /** + * ID of the component type. + */ + @JsonProperty(value = "properties.componentTypeId", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeId; + + /** + * Name of the component type. Qualifies the type of component such as + * whether it is a SQL database, logical disk, website, etc. + */ + @JsonProperty(value = "properties.componentTypeName", access = JsonProperty.Access.WRITE_ONLY) + private String componentTypeName; + + /** + * ID of the monitor instance. + */ + @JsonProperty(value = "properties.monitorId", access = JsonProperty.Access.WRITE_ONLY) + private String monitorId; + + /** + * Name of the monitor. + */ + @JsonProperty(value = "properties.monitorName", access = JsonProperty.Access.WRITE_ONLY) + private String monitorName; + + /** + * Type of the monitor. The qualifier for the health criteria depending on + * the functionality it performs such as Unit, Aggregate, Dependency. + * Possible values include: 'Aggregate', 'Dependency', 'Unit'. + */ + @JsonProperty(value = "properties.monitorType", access = JsonProperty.Access.WRITE_ONLY) + private MonitorType monitorType; + + /** + * Monitor type category. Indicates the attribute of the component that the + * health criteria monitors such as Performance, Availability, etc. + * Possible values include: 'AvailabilityHealth', 'Configuration', + * 'EntityHealth', 'PerformanceHealth', 'Security'. + */ + @JsonProperty(value = "properties.monitorCategory", access = JsonProperty.Access.WRITE_ONLY) + private MonitorCategory monitorCategory; + + /** + * Health state of monitor instance. Possible values include: 'Error', + * 'Warning', 'Success', 'Unknown', 'Uninitialized'. + */ + @JsonProperty(value = "properties.healthState", access = JsonProperty.Access.WRITE_ONLY) + private HealthState healthState; + + /** + * Category of monitor instance's health state. Possible values include: + * 'Identity', 'CustomGroup'. + */ + @JsonProperty(value = "properties.healthStateCategory", access = JsonProperty.Access.WRITE_ONLY) + private HealthStateCategory healthStateCategory; + + /** + * Health state changes. + */ + @JsonProperty(value = "properties.healthStateChanges", access = JsonProperty.Access.WRITE_ONLY) + private List healthStateChanges; + + /** + * Start time for health state changes. + */ + @JsonProperty(value = "properties.healthStateChangesStartTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime healthStateChangesStartTime; + + /** + * End time for health state changes. + */ + @JsonProperty(value = "properties.healthStateChangesEndTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime healthStateChangesEndTime; + + /** + * Time of last health state change. + */ + @JsonProperty(value = "properties.lastHealthStateChangeTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime lastHealthStateChangeTime; + + /** + * Generates alert or not. Possible values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.alertGeneration", access = JsonProperty.Access.WRITE_ONLY) + private AlertGeneration alertGeneration; + + /** + * Properties requested in aggregation queries. + */ + @JsonProperty(value = "properties.aggregateProperties", access = JsonProperty.Access.WRITE_ONLY) + private Map aggregateProperties; + + /** + * Health instance children. + */ + @JsonProperty(value = "properties.children", access = JsonProperty.Access.WRITE_ONLY) + private List children; + + /** + * Get for optimistic concurrency control. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get iD of the workspace. + * + * @return the workspaceId value + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Get iD of the OMS solution this health instance belong to. + * + * @return the solutionId value + */ + public String solutionId() { + return this.solutionId; + } + + /** + * Get type of the workload. Possible values include: 'BaseOS', 'SQL', 'IIS', 'Apache'. + * + * @return the workloadType value + */ + public WorkloadType workloadType() { + return this.workloadType; + } + + /** + * Get iD of the component. + * + * @return the componentId value + */ + public String componentId() { + return this.componentId; + } + + /** + * Get name of the component. + * + * @return the componentName value + */ + public String componentName() { + return this.componentName; + } + + /** + * Get iD of the component type. + * + * @return the componentTypeId value + */ + public String componentTypeId() { + return this.componentTypeId; + } + + /** + * Get name of the component type. Qualifies the type of component such as whether it is a SQL database, logical disk, website, etc. + * + * @return the componentTypeName value + */ + public String componentTypeName() { + return this.componentTypeName; + } + + /** + * Get iD of the monitor instance. + * + * @return the monitorId value + */ + public String monitorId() { + return this.monitorId; + } + + /** + * Get name of the monitor. + * + * @return the monitorName value + */ + public String monitorName() { + return this.monitorName; + } + + /** + * Get type of the monitor. The qualifier for the health criteria depending on the functionality it performs such as Unit, Aggregate, Dependency. Possible values include: 'Aggregate', 'Dependency', 'Unit'. + * + * @return the monitorType value + */ + public MonitorType monitorType() { + return this.monitorType; + } + + /** + * Get monitor type category. Indicates the attribute of the component that the health criteria monitors such as Performance, Availability, etc. Possible values include: 'AvailabilityHealth', 'Configuration', 'EntityHealth', 'PerformanceHealth', 'Security'. + * + * @return the monitorCategory value + */ + public MonitorCategory monitorCategory() { + return this.monitorCategory; + } + + /** + * Get health state of monitor instance. Possible values include: 'Error', 'Warning', 'Success', 'Unknown', 'Uninitialized'. + * + * @return the healthState value + */ + public HealthState healthState() { + return this.healthState; + } + + /** + * Get category of monitor instance's health state. Possible values include: 'Identity', 'CustomGroup'. + * + * @return the healthStateCategory value + */ + public HealthStateCategory healthStateCategory() { + return this.healthStateCategory; + } + + /** + * Get health state changes. + * + * @return the healthStateChanges value + */ + public List healthStateChanges() { + return this.healthStateChanges; + } + + /** + * Get start time for health state changes. + * + * @return the healthStateChangesStartTime value + */ + public DateTime healthStateChangesStartTime() { + return this.healthStateChangesStartTime; + } + + /** + * Get end time for health state changes. + * + * @return the healthStateChangesEndTime value + */ + public DateTime healthStateChangesEndTime() { + return this.healthStateChangesEndTime; + } + + /** + * Get time of last health state change. + * + * @return the lastHealthStateChangeTime value + */ + public DateTime lastHealthStateChangeTime() { + return this.lastHealthStateChangeTime; + } + + /** + * Get generates alert or not. Possible values include: 'Enabled', 'Disabled'. + * + * @return the alertGeneration value + */ + public AlertGeneration alertGeneration() { + return this.alertGeneration; + } + + /** + * Get properties requested in aggregation queries. + * + * @return the aggregateProperties value + */ + public Map aggregateProperties() { + return this.aggregateProperties; + } + + /** + * Get health instance children. + * + * @return the children value + */ + public List children() { + return this.children; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesImpl.java new file mode 100644 index 000000000000..c6b11210d65c --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesImpl.java @@ -0,0 +1,62 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstances; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstance; +import java.util.UUID; + +class MonitorInstancesImpl extends WrapperImpl implements MonitorInstances { + private final WorkloadMonitorManager manager; + + MonitorInstancesImpl(WorkloadMonitorManager manager) { + super(manager.inner().monitorInstances()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + MonitorInstancesInner client = this.inner(); + return client.listByResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public MonitorInstance call(MonitorInstanceInner inner) { + return new MonitorInstanceImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId) { + MonitorInstancesInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId) + .map(new Func1() { + @Override + public MonitorInstance call(MonitorInstanceInner inner) { + return new MonitorInstanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesInner.java new file mode 100644 index 000000000000..a9d68fd45b6e --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesInner.java @@ -0,0 +1,704 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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 java.util.UUID; +import okhttp3.ResponseBody; +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 MonitorInstances. + */ +public class MonitorInstancesInner { + /** The Retrofit service to perform REST calls. */ + private MonitorInstancesService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of MonitorInstancesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MonitorInstancesInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(MonitorInstancesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MonitorInstances to be + * used by Retrofit to perform actually REST calls. + */ + interface MonitorInstancesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstances listByResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitorInstances") + Observable> listByResource(@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("$select") String select, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$orderby") String orderby, @Query("$expand") String expand, @Query("$top") String top, @Query("$skiptoken") String skiptoken, @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.v2018_08_31_preview.MonitorInstances get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitorInstances/{monitorInstanceId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("monitorInstanceId") UUID monitorInstanceId, @Query("api-version") String apiVersion, @Query("$select") String select, @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.v2018_08_31_preview.MonitorInstances listByResourceNext" }) + @GET + Observable> listByResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 select = null; + final String filter = null; + final String apply = null; + final String orderby = null; + final String expand = null; + final String top = null; + final String skiptoken = null; + return service.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, select, filter, apply, orderby, expand, top, skiptoken) + .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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param resourceNamespace The Namespace of the resource. + ServiceResponse> * @param resourceType The type of the resource. + ServiceResponse> * @param resourceName Name of the resource. + ServiceResponse> * @param select Properties to be returned in the response. + ServiceResponse> * @param filter Filter to be applied on the operation. + ServiceResponse> * @param apply Apply aggregation. + ServiceResponse> * @param orderby Sort the result on one or more properties. + ServiceResponse> * @param expand Include properties inline in the response. + ServiceResponse> * @param top Limit the result to the specified number of rows. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorInstanceInner object if successful. + */ + public MonitorInstanceInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId).toBlocking().single().body(); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId), serviceCallback); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInstanceInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId).map(new Func1, MonitorInstanceInner>() { + @Override + public MonitorInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInstanceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 (monitorInstanceId == null) { + throw new IllegalArgumentException("Parameter monitorInstanceId is required and cannot be null."); + } + final String select = null; + final String expand = null; + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId, this.client.apiVersion(), select, 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 details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the MonitorInstanceInner object if successful. + */ + public MonitorInstanceInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId, String select, String expand) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId, select, expand).toBlocking().single().body(); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId, String select, String expand, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId, select, expand), serviceCallback); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInstanceInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId, String select, String expand) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId, select, expand).map(new Func1, MonitorInstanceInner>() { + @Override + public MonitorInstanceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get details of a monitorInstance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorInstanceId MonitorInstance Id. + * @param select Properties to be returned in the response. + * @param expand Include properties inline in the response. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInstanceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, UUID monitorInstanceId, String select, String expand) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 (monitorInstanceId == null) { + throw new IllegalArgumentException("Parameter monitorInstanceId is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, monitorInstanceId, this.client.apiVersion(), select, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get list of monitor instances for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> object if successful. + */ + public PagedList listByResourceNext(final String nextPageLink) { + ServiceResponse> response = listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of monitor instances for a resource. + * + * @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> listByResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of monitor instances for a resource. + * + * @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<MonitorInstanceInner> object + */ + public Observable> listByResourceNextAsync(final String nextPageLink) { + return listByResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + * @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<MonitorInstanceInner> object + */ + public Observable>> listByResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceNextSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of monitor instances for a resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceNextSinglePageAsync(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.listByResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysImpl.java new file mode 100644 index 000000000000..4bba7b6edd7b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysImpl.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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstancesSummarys; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstance; + +class MonitorInstancesSummarysImpl extends WrapperImpl implements MonitorInstancesSummarys { + private final WorkloadMonitorManager manager; + + MonitorInstancesSummarysImpl(WorkloadMonitorManager manager) { + super(manager.inner().monitorInstancesSummarys()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + MonitorInstancesSummarysInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public MonitorInstance call(MonitorInstanceInner inner) { + return new MonitorInstanceImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysInner.java new file mode 100644 index 000000000000..4574be0341d0 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorInstancesSummarysInner.java @@ -0,0 +1,423 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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.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 MonitorInstancesSummarys. + */ +public class MonitorInstancesSummarysInner { + /** The Retrofit service to perform REST calls. */ + private MonitorInstancesSummarysService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of MonitorInstancesSummarysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MonitorInstancesSummarysInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(MonitorInstancesSummarysService.class); + this.client = client; + } + + /** + * The interface defining all the services for MonitorInstancesSummarys to be + * used by Retrofit to perform actually REST calls. + */ + interface MonitorInstancesSummarysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstancesSummarys list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.WorkloadMonitor/monitorInstancesSummary") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("$select") String select, @Query("$filter") String filter, @Query("$apply") String apply, @Query("$orderby") String orderby, @Query("$expand") String expand, @Query("$top") String top, @Query("$skiptoken") String skiptoken, @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.v2018_08_31_preview.MonitorInstancesSummarys listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get subscription wide health instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> 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(); + } + }; + } + + /** + * Get subscription wide health instances. + * + * @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); + } + + /** + * Get subscription wide health instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide health instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> 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)); + } + }); + } + + /** + * Get subscription wide health instances. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String select = null; + final String filter = null; + final String apply = null; + final String orderby = null; + final String expand = null; + final String top = null; + final String skiptoken = null; + return service.list(this.client.subscriptionId(), this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, 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 subscription wide health instances. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> object if successful. + */ + public PagedList list(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + ServiceResponse> response = listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get subscription wide health instances. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get subscription wide health instances. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable> listAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listWithServiceResponseAsync(select, filter, apply, orderby, expand, top, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide health instances. + * + * @param select Properties to be returned in the response. + * @param filter Filter to be applied on the operation. + * @param apply Apply aggregation. + * @param orderby Sort the result on one or more properties. + * @param expand Include properties inline in the response. + * @param top Limit the result to the specified number of rows. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInstanceInner> object + */ + public Observable>> listWithServiceResponseAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + return listSinglePageAsync(select, filter, apply, orderby, expand, top, skiptoken) + .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 subscription wide health instances. + * + ServiceResponse> * @param select Properties to be returned in the response. + ServiceResponse> * @param filter Filter to be applied on the operation. + ServiceResponse> * @param apply Apply aggregation. + ServiceResponse> * @param orderby Sort the result on one or more properties. + ServiceResponse> * @param expand Include properties inline in the response. + ServiceResponse> * @param top Limit the result to the specified number of rows. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String select, final String filter, final String apply, final String orderby, final String expand, final String top, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), select, filter, apply, orderby, expand, top, skiptoken, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get subscription wide health instances. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<MonitorInstanceInner> 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 subscription wide health instances. + * + * @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 subscription wide health instances. + * + * @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<MonitorInstanceInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get subscription wide health instances. + * + * @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<MonitorInstanceInner> 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 subscription wide health instances. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInstanceInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsImpl.java new file mode 100644 index 000000000000..97fb714ec32a --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsImpl.java @@ -0,0 +1,65 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Monitors; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Monitor; + +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; + } + + private MonitorImpl wrapModel(MonitorInner inner) { + return new MonitorImpl(inner, manager()); + } + + @Override + public Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + MonitorsInner client = this.inner(); + return client.listByResourceAsync(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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + MonitorsInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId) + .map(new Func1() { + @Override + public Monitor call(MonitorInner inner) { + return new MonitorImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsInner.java new file mode 100644 index 000000000000..964cab77bf4b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/MonitorsInner.java @@ -0,0 +1,676 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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 retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.PATCH; +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.v2018_08_31_preview.Monitors listByResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors") + Observable> listByResource(@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("$skiptoken") String skiptoken, @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.v2018_08_31_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, @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.v2018_08_31_preview.Monitors update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/monitors/{monitorId}") + Observable> update(@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, @Header("accept-language") String acceptLanguage, @Body MonitorInner body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Monitors listByResourceNext" }) + @GET + Observable> listByResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceWithServiceResponseAsync(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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 skiptoken = null; + return service.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(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. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param filter Filter to be applied on the operation. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String skiptoken) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param filter Filter to be applied on the operation. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param filter Filter to be applied on the operation. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String skiptoken) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of a monitors of a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param filter Filter to be applied on the operation. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<MonitorInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String skiptoken) { + return listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, filter, skiptoken) + .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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param resourceNamespace The Namespace of the resource. + ServiceResponse> * @param resourceType The type of the resource. + ServiceResponse> * @param resourceName Name of the resource. + ServiceResponse> * @param filter Filter to be applied on the operation. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<MonitorInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String filter, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), filter, skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get details of a single monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).toBlocking().single().body(); + } + + /** + * Get details of a single monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @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 resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId), serviceCallback); + } + + /** + * Get details of a single monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).map(new Func1, MonitorInner>() { + @Override + public MonitorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get details of a single monitor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update a Monitor's configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 update(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).toBlocking().single().body(); + } + + /** + * Update a Monitor's configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @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 updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId), serviceCallback); + } + + /** + * Update a Monitor's configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId).map(new Func1, MonitorInner>() { + @Override + public MonitorInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update a Monitor's configuration. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param monitorId Monitor Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MonitorInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, String monitorId) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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.update(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, monitorId, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get list of a monitors of a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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 listByResourceNext(final String nextPageLink) { + ServiceResponse> response = listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of a monitors of a resource. + * + * @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> listByResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of a monitors of a resource. + * + * @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> listByResourceNextAsync(final String nextPageLink) { + return listByResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of a monitors of a resource. + * + * @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>> listByResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceNextSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of a monitors of a resource. + * + 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>> listByResourceNextSinglePageAsync(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.listByResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java new file mode 100644 index 000000000000..04b4ab16a721 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingImpl.java @@ -0,0 +1,99 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSetting; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; + +class NotificationSettingImpl extends CreatableUpdatableImpl implements NotificationSetting, NotificationSetting.Update { + private final WorkloadMonitorManager manager; + private String resourceGroupName; + private String resourceNamespace; + private String resourceType; + private String resourceName; + + NotificationSettingImpl(String name, WorkloadMonitorManager manager) { + super(name, new NotificationSettingInner()); + this.manager = manager; + // Set resource name + this.resourceNamespace = name; + // + } + + NotificationSettingImpl(NotificationSettingInner inner, WorkloadMonitorManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.resourceNamespace = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.resourceNamespace = IdParsingUtils.getValueFromIdByName(inner.id(), "providers"); + this.resourceType = IdParsingUtils.getValueFromIdByPosition(inner.id(), 6); + this.resourceName = IdParsingUtils.getValueFromIdByPosition(inner.id(), 7); + // + } + + @Override + public WorkloadMonitorManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return client.updateAsync(this.resourceGroupName, this.resourceNamespace, this.resourceType, this.resourceName) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + NotificationSettingsInner client = this.manager().inner().notificationSettings(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List actionGroupResourceIds() { + return this.inner().actionGroupResourceIds(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java new file mode 100644 index 000000000000..005a232c8b35 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingInner.java @@ -0,0 +1,51 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Model for NotificationSetting. + */ +@JsonFlatten +public class NotificationSettingInner extends ProxyResource { + /** + * For optimistic concurrency control. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * List of action group resource ids to be notified. + */ + @JsonProperty(value = "properties.actionGroupResourceIds", access = JsonProperty.Access.WRITE_ONLY) + private List actionGroupResourceIds; + + /** + * Get for optimistic concurrency control. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Get list of action group resource ids to be notified. + * + * @return the actionGroupResourceIds value + */ + public List actionGroupResourceIds() { + return this.actionGroupResourceIds; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java new file mode 100644 index 000000000000..360d22bfcf25 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsImpl.java @@ -0,0 +1,65 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettings; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSetting; + +class NotificationSettingsImpl extends WrapperImpl implements NotificationSettings { + private final WorkloadMonitorManager manager; + + NotificationSettingsImpl(WorkloadMonitorManager manager) { + super(manager.inner().notificationSettings()); + this.manager = manager; + } + + public WorkloadMonitorManager manager() { + return this.manager; + } + + private NotificationSettingImpl wrapModel(NotificationSettingInner inner) { + return new NotificationSettingImpl(inner, manager()); + } + + @Override + public Observable listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + NotificationSettingsInner client = this.inner(); + return client.listByResourceAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public NotificationSetting call(NotificationSettingInner inner) { + return new NotificationSettingImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + NotificationSettingsInner client = this.inner(); + return client.getAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1() { + @Override + public NotificationSetting call(NotificationSettingInner inner) { + return new NotificationSettingImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java new file mode 100644 index 000000000000..35f6ad3cf673 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/NotificationSettingsInner.java @@ -0,0 +1,658 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.ErrorResponseException; +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 retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.PUT; +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 NotificationSettings. + */ +public class NotificationSettingsInner { + /** The Retrofit service to perform REST calls. */ + private NotificationSettingsService service; + /** The service client containing this operation class. */ + private WorkloadMonitorAPIImpl client; + + /** + * Initializes an instance of NotificationSettingsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public NotificationSettingsInner(Retrofit retrofit, WorkloadMonitorAPIImpl client) { + this.service = retrofit.create(NotificationSettingsService.class); + this.client = client; + } + + /** + * The interface defining all the services for NotificationSettings to be + * used by Retrofit to perform actually REST calls. + */ + interface NotificationSettingsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettings listByResource" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings") + Observable> listByResource(@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("$skiptoken") String skiptoken, @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.v2018_08_31_preview.NotificationSettings get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("notificationSettingName") String notificationSettingName, @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.v2018_08_31_preview.NotificationSettings update" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.WorkloadMonitor/notificationSettings/{notificationSettingName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("resourceNamespace") String resourceNamespace, @Path("resourceType") String resourceType, @Path("resourceName") String resourceName, @Path("notificationSettingName") String notificationSettingName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body NotificationSettingInner body, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettings listByResourceNext" }) + @GET + Observable> listByResourceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationSettingInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationSettingInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationSettingInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + return listByResourceSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationSettingInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 skiptoken = null; + return service.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationSettingInner> object if successful. + */ + public PagedList listByResource(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String skiptoken) { + ServiceResponse> response = listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationSettingInner> object + */ + public Observable> listByResourceAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String skiptoken) { + return listByResourceWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<NotificationSettingInner> object + */ + public Observable>> listByResourceWithServiceResponseAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String skiptoken) { + return listByResourceSinglePageAsync(resourceGroupName, resourceNamespace, resourceType, resourceName, skiptoken) + .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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param resourceNamespace The Namespace of the resource. + ServiceResponse> * @param resourceType The type of the resource. + ServiceResponse> * @param resourceName Name of the resource. + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationSettingInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceSinglePageAsync(final String resourceGroupName, final String resourceNamespace, final String resourceType, final String resourceName, final String skiptoken) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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.listByResource(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, this.client.apiVersion(), skiptoken, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationSettingInner object if successful. + */ + public NotificationSettingInner get(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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 getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), serviceCallback); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable getAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return getWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).map(new Func1, NotificationSettingInner>() { + @Override + public NotificationSettingInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get a of notification setting for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 notificationSettingName = "default"; + return service.get(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, notificationSettingName, this.client.apiVersion(), 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NotificationSettingInner object if successful. + */ + public NotificationSettingInner update(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).toBlocking().single().body(); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name 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 updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName), serviceCallback); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable updateAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + return updateWithServiceResponseAsync(resourceGroupName, resourceNamespace, resourceType, resourceName).map(new Func1, NotificationSettingInner>() { + @Override + public NotificationSettingInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update notification settings for a resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceNamespace The Namespace of the resource. + * @param resourceType The type of the resource. + * @param resourceName Name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NotificationSettingInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String resourceNamespace, String resourceType, String resourceName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.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 notificationSettingName = "default"; + return service.update(this.client.subscriptionId(), resourceGroupName, resourceNamespace, resourceType, resourceName, notificationSettingName, this.client.apiVersion(), this.client.acceptLanguage(), body, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Get list of notification settings for a resource. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException 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<NotificationSettingInner> object if successful. + */ + public PagedList listByResourceNext(final String nextPageLink) { + ServiceResponse> response = listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Get list of notification settings for a resource. + * + * @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> listByResourceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Get list of notification settings for a resource. + * + * @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<NotificationSettingInner> object + */ + public Observable> listByResourceNextAsync(final String nextPageLink) { + return listByResourceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + * @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<NotificationSettingInner> object + */ + public Observable>> listByResourceNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceNextSinglePageAsync(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(listByResourceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Get list of notification settings for a resource. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<NotificationSettingInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceNextSinglePageAsync(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.listByResourceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceNextDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..a20af57ec6c3 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.OperationProperties; + +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 OperationProperties 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-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..15785352f673 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationInner.java @@ -0,0 +1,63 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.OperationProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Operation supported by the resource provider. + */ +public class OperationInner { + /** + * The properties of the resource operation. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationProperties display; + + /** + * The name of the resource operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /** + * The origin of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /** + * Get the properties of the resource operation. + * + * @return the display value + */ + public OperationProperties display() { + return this.display; + } + + /** + * Get the name of the resource operation. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Get the origin of the operation. + * + * @return the origin value + */ + public String origin() { + return this.origin; + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationsImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..944dac1e5b7f --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_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-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationsInner.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..9d67844c5808 --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/OperationsInner.java @@ -0,0 +1,380 @@ +/** + * 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.v2018_08_31_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +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.v2018_08_31_preview.Operations list" }) + @GET("providers/Microsoft.WorkloadMonitor/operations") + Observable> list(@Query("api-version") String apiVersion, @Query("$skiptoken") String skiptoken, @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.v2018_08_31_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + final String skiptoken = null; + return service.list(this.client.apiVersion(), skiptoken, 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); + } + } + }); + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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(final String skiptoken) { + ServiceResponse> response = listSinglePageAsync(skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @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 skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync(final String skiptoken) { + return listWithServiceResponseAsync(skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync(final String skiptoken) { + return listSinglePageAsync(skiptoken) + .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 the details of all operations possible on the resource provider. + * + ServiceResponse> * @param skiptoken The page-continuation token to use with a paged version of this API. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync(final String skiptoken) { + return service.list(this.client.apiVersion(), skiptoken, 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 CloudException, IOException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the details of all operations possible on the resource provider. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException 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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + * @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 the details of all operations possible on the resource provider. + * + 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/PageImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..249d6cd07ebd --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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.v2018_08_31_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-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorAPIImpl.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorAPIImpl.java new file mode 100644 index 000000000000..d1f93a46157d --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorAPIImpl.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.v2018_08_31_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 ID of the target subscription. */ + private String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public WorkloadMonitorAPIImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** 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 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; + } + + /** + * The ComponentsInner object to access its operations. + */ + private ComponentsInner components; + + /** + * Gets the ComponentsInner object to access its operations. + * @return the ComponentsInner object. + */ + public ComponentsInner components() { + return this.components; + } + + /** + * The MonitorInstancesInner object to access its operations. + */ + private MonitorInstancesInner monitorInstances; + + /** + * Gets the MonitorInstancesInner object to access its operations. + * @return the MonitorInstancesInner object. + */ + public MonitorInstancesInner monitorInstances() { + return this.monitorInstances; + } + + /** + * The NotificationSettingsInner object to access its operations. + */ + private NotificationSettingsInner notificationSettings; + + /** + * Gets the NotificationSettingsInner object to access its operations. + * @return the NotificationSettingsInner object. + */ + public NotificationSettingsInner notificationSettings() { + return this.notificationSettings; + } + + /** + * The ComponentsSummarysInner object to access its operations. + */ + private ComponentsSummarysInner componentsSummarys; + + /** + * Gets the ComponentsSummarysInner object to access its operations. + * @return the ComponentsSummarysInner object. + */ + public ComponentsSummarysInner componentsSummarys() { + return this.componentsSummarys; + } + + /** + * The MonitorInstancesSummarysInner object to access its operations. + */ + private MonitorInstancesSummarysInner monitorInstancesSummarys; + + /** + * Gets the MonitorInstancesSummarysInner object to access its operations. + * @return the MonitorInstancesSummarysInner object. + */ + public MonitorInstancesSummarysInner monitorInstancesSummarys() { + return this.monitorInstancesSummarys; + } + + /** + * 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; + } + + /** + * 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 = "2018-08-31-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.monitors = new MonitorsInner(restClient().retrofit(), this); + this.components = new ComponentsInner(restClient().retrofit(), this); + this.monitorInstances = new MonitorInstancesInner(restClient().retrofit(), this); + this.notificationSettings = new NotificationSettingsInner(restClient().retrofit(), this); + this.componentsSummarys = new ComponentsSummarysInner(restClient().retrofit(), this); + this.monitorInstancesSummarys = new MonitorInstancesSummarysInner(restClient().retrofit(), this); + this.operations = new OperationsInner(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", "2018-08-31-preview"); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorManager.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorManager.java new file mode 100644 index 000000000000..6f4e8d2804fe --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/WorkloadMonitorManager.java @@ -0,0 +1,171 @@ +/** + * 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.v2018_08_31_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.v2018_08_31_preview.Monitors; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Components; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstances; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.NotificationSettings; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.ComponentsSummarys; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.MonitorInstancesSummarys; +import com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.Operations; +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 Monitors monitors; + private Components components; + private MonitorInstances monitorInstances; + private NotificationSettings notificationSettings; + private ComponentsSummarys componentsSummarys; + private MonitorInstancesSummarys monitorInstancesSummarys; + private Operations operations; + /** + * 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 + * @param subscriptionId the subscription UUID + * @return the WorkloadMonitorManager + */ + public static WorkloadMonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new WorkloadMonitorManager(new RestClient.Builder() + .withBaseUrl(credentials.environment(), AzureEnvironment.Endpoint.RESOURCE_MANAGER) + .withCredentials(credentials) + .withSerializerAdapter(new AzureJacksonAdapter()) + .withResponseBuilderFactory(new AzureResponseBuilder.Factory()) + .build(), subscriptionId); + } + /** + * Creates an instance of WorkloadMonitorManager that exposes WorkloadMonitor resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the WorkloadMonitorManager + */ + public static WorkloadMonitorManager authenticate(RestClient restClient, String subscriptionId) { + return new WorkloadMonitorManager(restClient, subscriptionId); + } + /** + * 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 + * @param subscriptionId the subscription UUID + * @return the interface exposing WorkloadMonitor management API entry points that work across subscriptions + */ + WorkloadMonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage Monitors. + */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(this); + } + return this.monitors; + } + + /** + * @return Entry point to manage Components. + */ + public Components components() { + if (this.components == null) { + this.components = new ComponentsImpl(this); + } + return this.components; + } + + /** + * @return Entry point to manage MonitorInstances. + */ + public MonitorInstances monitorInstances() { + if (this.monitorInstances == null) { + this.monitorInstances = new MonitorInstancesImpl(this); + } + return this.monitorInstances; + } + + /** + * @return Entry point to manage NotificationSettings. + */ + public NotificationSettings notificationSettings() { + if (this.notificationSettings == null) { + this.notificationSettings = new NotificationSettingsImpl(this); + } + return this.notificationSettings; + } + + /** + * @return Entry point to manage ComponentsSummarys. + */ + public ComponentsSummarys componentsSummarys() { + if (this.componentsSummarys == null) { + this.componentsSummarys = new ComponentsSummarysImpl(this); + } + return this.componentsSummarys; + } + + /** + * @return Entry point to manage MonitorInstancesSummarys. + */ + public MonitorInstancesSummarys monitorInstancesSummarys() { + if (this.monitorInstancesSummarys == null) { + this.monitorInstancesSummarys = new MonitorInstancesSummarysImpl(this); + } + return this.monitorInstancesSummarys; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public WorkloadMonitorManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return WorkloadMonitorManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private WorkloadMonitorManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new WorkloadMonitorAPIImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/package-info.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/implementation/package-info.java new file mode 100644 index 000000000000..7f77d419b81b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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. + * APIs for workload monitoring. + */ +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview.implementation; diff --git a/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/package-info.java b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_preview/package-info.java new file mode 100644 index 000000000000..2ee755ab019b --- /dev/null +++ b/sdk/workloadmonitor/mgmt-v2018_08_31_preview/src/main/java/com/microsoft/azure/management/workloadmonitor/v2018_08_31_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. + * APIs for workload monitoring. + */ +package com.microsoft.azure.management.workloadmonitor.v2018_08_31_preview;