diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/pom.xml b/sdk/loganalytics/mgmt-v2020_03_01_preview/pom.xml new file mode 100644 index 000000000000..d549de3cc484 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.loganalytics.v2020_03_01_preview + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-loganalytics + 1.0.0-beta + jar + Microsoft Azure SDK for LogAnalytics Management + This package contains Microsoft LogAnalytics 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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTier.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTier.java new file mode 100644 index 000000000000..41fade0d68a3 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTier.java @@ -0,0 +1,55 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.AvailableServiceTierInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing AvailableServiceTier. + */ +public interface AvailableServiceTier extends HasInner, HasManager { + /** + * @return the capacityReservationLevel value. + */ + Long capacityReservationLevel(); + + /** + * @return the defaultRetention value. + */ + Long defaultRetention(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the lastSkuUpdate value. + */ + String lastSkuUpdate(); + + /** + * @return the maximumRetention value. + */ + Long maximumRetention(); + + /** + * @return the minimumRetention value. + */ + Long minimumRetention(); + + /** + * @return the serviceTier value. + */ + SkuNameEnum serviceTier(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTiers.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTiers.java new file mode 100644 index 000000000000..1604da8435c9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AvailableServiceTiers.java @@ -0,0 +1,29 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.AvailableServiceTiersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing AvailableServiceTiers. + */ +public interface AvailableServiceTiers extends HasInner { + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AzureEntityResource.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/AzureEntityResource.java new file mode 100644 index 000000000000..ccc374d93c9a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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.loganalytics.v2020_03_01_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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Cluster.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Cluster.java new file mode 100644 index 000000000000..e947bde229f1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Cluster.java @@ -0,0 +1,170 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.ClusterInner; + +/** + * Type representing Cluster. + */ +public interface Cluster extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the clusterId value. + */ + String clusterId(); + + /** + * @return the identity value. + */ + Identity identity(); + + /** + * @return the keyVaultProperties value. + */ + KeyVaultProperties keyVaultProperties(); + + /** + * @return the nextLink value. + */ + String nextLink(); + + /** + * @return the provisioningState value. + */ + ClusterEntityStatus provisioningState(); + + /** + * @return the sku value. + */ + ClusterSku sku(); + + /** + * The entirety of the Cluster definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Cluster definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Cluster definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Cluster definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the cluster definition allowing to specify Identity. + */ + interface WithIdentity { + /** + * Specifies identity. + * @param identity The identity of the resource + * @return the next definition stage + */ + WithCreate withIdentity(Identity identity); + } + + /** + * The stage of the cluster definition allowing to specify KeyVaultProperties. + */ + interface WithKeyVaultProperties { + /** + * Specifies keyVaultProperties. + * @param keyVaultProperties The associated key properties + * @return the next definition stage + */ + WithCreate withKeyVaultProperties(KeyVaultProperties keyVaultProperties); + } + + /** + * The stage of the cluster definition allowing to specify NextLink. + */ + interface WithNextLink { + /** + * Specifies nextLink. + * @param nextLink The link used to get the next page of recommendations + * @return the next definition stage + */ + WithCreate withNextLink(String nextLink); + } + + /** + * The stage of the cluster definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The sku properties + * @return the next definition stage + */ + WithCreate withSku(ClusterSku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithIdentity, DefinitionStages.WithKeyVaultProperties, DefinitionStages.WithNextLink, DefinitionStages.WithSku { + } + } + /** + * The template for a Cluster update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithKeyVaultProperties, UpdateStages.WithSku { + } + + /** + * Grouping of Cluster update stages. + */ + interface UpdateStages { + /** + * The stage of the cluster update allowing to specify KeyVaultProperties. + */ + interface WithKeyVaultProperties { + /** + * Specifies keyVaultProperties. + * @param keyVaultProperties The associated key properties + * @return the next update stage + */ + Update withKeyVaultProperties(KeyVaultProperties keyVaultProperties); + } + + /** + * The stage of the cluster update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The sku properties + * @return the next update stage + */ + Update withSku(ClusterSku sku); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterEntityStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterEntityStatus.java new file mode 100644 index 000000000000..cb3008ec6259 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterEntityStatus.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ClusterEntityStatus. + */ +public final class ClusterEntityStatus extends ExpandableStringEnum { + /** Static value Creating for ClusterEntityStatus. */ + public static final ClusterEntityStatus CREATING = fromString("Creating"); + + /** Static value Succeeded for ClusterEntityStatus. */ + public static final ClusterEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ClusterEntityStatus. */ + public static final ClusterEntityStatus FAILED = fromString("Failed"); + + /** Static value Canceled for ClusterEntityStatus. */ + public static final ClusterEntityStatus CANCELED = fromString("Canceled"); + + /** Static value Deleting for ClusterEntityStatus. */ + public static final ClusterEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for ClusterEntityStatus. */ + public static final ClusterEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for ClusterEntityStatus. */ + public static final ClusterEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a ClusterEntityStatus from its string representation. + * @param name a name to look for + * @return the corresponding ClusterEntityStatus + */ + @JsonCreator + public static ClusterEntityStatus fromString(String name) { + return fromString(name, ClusterEntityStatus.class); + } + + /** + * @return known ClusterEntityStatus values + */ + public static Collection values() { + return values(ClusterEntityStatus.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponse.java new file mode 100644 index 000000000000..7acd30073fdc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponse.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class ClusterErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ClusterErrorResponse object itself. + */ + public ClusterErrorResponse withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponseException.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponseException.java new file mode 100644 index 000000000000..cb0fbb95f290 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterErrorResponseException.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ClusterErrorResponse + * information. + */ +public class ClusterErrorResponseException extends RestException { + /** + * Initializes a new instance of the ClusterErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ClusterErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ClusterErrorResponseException 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 ClusterErrorResponseException(final String message, final Response response, final ClusterErrorResponse body) { + super(message, response, body); + } + + @Override + public ClusterErrorResponse body() { + return (ClusterErrorResponse) super.body(); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterPatch.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterPatch.java new file mode 100644 index 000000000000..9bd565c09d28 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterPatch.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The top level Log Analytics cluster resource container. + */ +@JsonFlatten +public class ClusterPatch { + /** + * The associated key properties. + */ + @JsonProperty(value = "properties.keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * The sku properties. + */ + @JsonProperty(value = "sku") + private ClusterSku sku; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the associated key properties. + * + * @return the keyVaultProperties value + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the associated key properties. + * + * @param keyVaultProperties the keyVaultProperties value to set + * @return the ClusterPatch object itself. + */ + public ClusterPatch withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the sku properties. + * + * @return the sku value + */ + public ClusterSku sku() { + return this.sku; + } + + /** + * Set the sku properties. + * + * @param sku the sku value to set + * @return the ClusterPatch object itself. + */ + public ClusterPatch withSku(ClusterSku sku) { + this.sku = sku; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the ClusterPatch object itself. + */ + public ClusterPatch withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSku.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSku.java new file mode 100644 index 000000000000..0617bcbe7d58 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSku.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The cluster sku definition. + */ +public class ClusterSku { + /** + * The capacity value. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * The name of the SKU. Possible values include: 'CapacityReservation'. + */ + @JsonProperty(value = "name") + private ClusterSkuNameEnum name; + + /** + * Get the capacity value. + * + * @return the capacity value + */ + public Long capacity() { + return this.capacity; + } + + /** + * Set the capacity value. + * + * @param capacity the capacity value to set + * @return the ClusterSku object itself. + */ + public ClusterSku withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the name of the SKU. Possible values include: 'CapacityReservation'. + * + * @return the name value + */ + public ClusterSkuNameEnum name() { + return this.name; + } + + /** + * Set the name of the SKU. Possible values include: 'CapacityReservation'. + * + * @param name the name value to set + * @return the ClusterSku object itself. + */ + public ClusterSku withName(ClusterSkuNameEnum name) { + this.name = name; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSkuNameEnum.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSkuNameEnum.java new file mode 100644 index 000000000000..f6e0557e15bc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ClusterSkuNameEnum.java @@ -0,0 +1,38 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ClusterSkuNameEnum. + */ +public final class ClusterSkuNameEnum extends ExpandableStringEnum { + /** Static value CapacityReservation for ClusterSkuNameEnum. */ + public static final ClusterSkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a ClusterSkuNameEnum from its string representation. + * @param name a name to look for + * @return the corresponding ClusterSkuNameEnum + */ + @JsonCreator + public static ClusterSkuNameEnum fromString(String name) { + return fromString(name, ClusterSkuNameEnum.class); + } + + /** + * @return known ClusterSkuNameEnum values + */ + public static Collection values() { + return values(ClusterSkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Clusters.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Clusters.java new file mode 100644 index 000000000000..65501e9f779f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Clusters.java @@ -0,0 +1,25 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.ClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Clusters. + */ +public interface Clusters extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/CoreSummary.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/CoreSummary.java new file mode 100644 index 000000000000..624567579c3e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/CoreSummary.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The core summary of a search. + */ +public class CoreSummary { + /** + * The status of a core summary. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The number of documents of a core summary. + */ + @JsonProperty(value = "numberOfDocuments", required = true) + private long numberOfDocuments; + + /** + * Get the status of a core summary. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of a core summary. + * + * @param status the status value to set + * @return the CoreSummary object itself. + */ + public CoreSummary withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the number of documents of a core summary. + * + * @return the numberOfDocuments value + */ + public long numberOfDocuments() { + return this.numberOfDocuments; + } + + /** + * Set the number of documents of a core summary. + * + * @param numberOfDocuments the numberOfDocuments value to set + * @return the CoreSummary object itself. + */ + public CoreSummary withNumberOfDocuments(long numberOfDocuments) { + this.numberOfDocuments = numberOfDocuments; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExport.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExport.java new file mode 100644 index 000000000000..10db33da1626 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExport.java @@ -0,0 +1,314 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.DataExportInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; + +/** + * Type representing DataExport. + */ +public interface DataExport extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the allTables value. + */ + Boolean allTables(); + + /** + * @return the createdDate value. + */ + String createdDate(); + + /** + * @return the dataExportId value. + */ + String dataExportId(); + + /** + * @return the dataExportType value. + */ + Type dataExportType(); + + /** + * @return the enable value. + */ + Boolean enable(); + + /** + * @return the eventHubName value. + */ + String eventHubName(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the lastModifiedDate value. + */ + String lastModifiedDate(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the tableNames value. + */ + List tableNames(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataExport definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithResourceId, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataExport definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataExport definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the dataexport definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithResourceId withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the dataexport definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId The destination resource ID. This can be copied from the Properties entry of the destination resource in Azure + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the dataexport definition allowing to specify AllTables. + */ + interface WithAllTables { + /** + * Specifies allTables. + * @param allTables When ‘true’, all workspace's tables are exported + * @return the next definition stage + */ + WithCreate withAllTables(Boolean allTables); + } + + /** + * The stage of the dataexport definition allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The latest data export rule modification time + * @return the next definition stage + */ + WithCreate withCreatedDate(String createdDate); + } + + /** + * The stage of the dataexport definition allowing to specify DataExportId. + */ + interface WithDataExportId { + /** + * Specifies dataExportId. + * @param dataExportId The data export rule ID + * @return the next definition stage + */ + WithCreate withDataExportId(String dataExportId); + } + + /** + * The stage of the dataexport definition allowing to specify Enable. + */ + interface WithEnable { + /** + * Specifies enable. + * @param enable Active when enabled + * @return the next definition stage + */ + WithCreate withEnable(Boolean enable); + } + + /** + * The stage of the dataexport definition allowing to specify EventHubName. + */ + interface WithEventHubName { + /** + * Specifies eventHubName. + * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account + * @return the next definition stage + */ + WithCreate withEventHubName(String eventHubName); + } + + /** + * The stage of the dataexport definition allowing to specify LastModifiedDate. + */ + interface WithLastModifiedDate { + /** + * Specifies lastModifiedDate. + * @param lastModifiedDate Date and time when the export was last modified + * @return the next definition stage + */ + WithCreate withLastModifiedDate(String lastModifiedDate); + } + + /** + * The stage of the dataexport definition allowing to specify TableNames. + */ + interface WithTableNames { + /** + * Specifies tableNames. + * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”] + * @return the next definition stage + */ + WithCreate withTableNames(List tableNames); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithAllTables, DefinitionStages.WithCreatedDate, DefinitionStages.WithDataExportId, DefinitionStages.WithEnable, DefinitionStages.WithEventHubName, DefinitionStages.WithLastModifiedDate, DefinitionStages.WithTableNames { + } + } + /** + * The template for a DataExport update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithAllTables, UpdateStages.WithCreatedDate, UpdateStages.WithDataExportId, UpdateStages.WithEnable, UpdateStages.WithEventHubName, UpdateStages.WithLastModifiedDate, UpdateStages.WithTableNames { + } + + /** + * Grouping of DataExport update stages. + */ + interface UpdateStages { + /** + * The stage of the dataexport update allowing to specify AllTables. + */ + interface WithAllTables { + /** + * Specifies allTables. + * @param allTables When ‘true’, all workspace's tables are exported + * @return the next update stage + */ + Update withAllTables(Boolean allTables); + } + + /** + * The stage of the dataexport update allowing to specify CreatedDate. + */ + interface WithCreatedDate { + /** + * Specifies createdDate. + * @param createdDate The latest data export rule modification time + * @return the next update stage + */ + Update withCreatedDate(String createdDate); + } + + /** + * The stage of the dataexport update allowing to specify DataExportId. + */ + interface WithDataExportId { + /** + * Specifies dataExportId. + * @param dataExportId The data export rule ID + * @return the next update stage + */ + Update withDataExportId(String dataExportId); + } + + /** + * The stage of the dataexport update allowing to specify Enable. + */ + interface WithEnable { + /** + * Specifies enable. + * @param enable Active when enabled + * @return the next update stage + */ + Update withEnable(Boolean enable); + } + + /** + * The stage of the dataexport update allowing to specify EventHubName. + */ + interface WithEventHubName { + /** + * Specifies eventHubName. + * @param eventHubName Optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account + * @return the next update stage + */ + Update withEventHubName(String eventHubName); + } + + /** + * The stage of the dataexport update allowing to specify LastModifiedDate. + */ + interface WithLastModifiedDate { + /** + * Specifies lastModifiedDate. + * @param lastModifiedDate Date and time when the export was last modified + * @return the next update stage + */ + Update withLastModifiedDate(String lastModifiedDate); + } + + /** + * The stage of the dataexport update allowing to specify TableNames. + */ + interface WithTableNames { + /** + * Specifies tableNames. + * @param tableNames An array of tables to export, for example: [“Heartbeat, SecurityEvent”] + * @return the next update stage + */ + Update withTableNames(List tableNames); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponse.java new file mode 100644 index 000000000000..bfbcf121ec6d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponse.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error response indicates that the service is not able to process the + * incoming request. The reason is provided in the error message. + */ +public class DataExportErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the DataExportErrorResponse object itself. + */ + public DataExportErrorResponse withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponseException.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponseException.java new file mode 100644 index 000000000000..6cb68bda596e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExportErrorResponseException.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with DataExportErrorResponse + * information. + */ +public class DataExportErrorResponseException extends RestException { + /** + * Initializes a new instance of the DataExportErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public DataExportErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the DataExportErrorResponseException 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 DataExportErrorResponseException(final String message, final Response response, final DataExportErrorResponse body) { + super(message, response, body); + } + + @Override + public DataExportErrorResponse body() { + return (DataExportErrorResponse) super.body(); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExports.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExports.java new file mode 100644 index 000000000000..45ec4b26a52e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataExports.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.DataExportsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataExports. + */ +public interface DataExports extends SupportsCreating, HasInner { + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String dataExportName); + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String dataExportName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataIngestionStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataIngestionStatus.java new file mode 100644 index 000000000000..45c7f347b450 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataIngestionStatus.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataIngestionStatus. + */ +public final class DataIngestionStatus extends ExpandableStringEnum { + /** Static value RespectQuota for DataIngestionStatus. */ + public static final DataIngestionStatus RESPECT_QUOTA = fromString("RespectQuota"); + + /** Static value ForceOn for DataIngestionStatus. */ + public static final DataIngestionStatus FORCE_ON = fromString("ForceOn"); + + /** Static value ForceOff for DataIngestionStatus. */ + public static final DataIngestionStatus FORCE_OFF = fromString("ForceOff"); + + /** Static value OverQuota for DataIngestionStatus. */ + public static final DataIngestionStatus OVER_QUOTA = fromString("OverQuota"); + + /** Static value SubscriptionSuspended for DataIngestionStatus. */ + public static final DataIngestionStatus SUBSCRIPTION_SUSPENDED = fromString("SubscriptionSuspended"); + + /** Static value ApproachingQuota for DataIngestionStatus. */ + public static final DataIngestionStatus APPROACHING_QUOTA = fromString("ApproachingQuota"); + + /** + * Creates or finds a DataIngestionStatus from its string representation. + * @param name a name to look for + * @return the corresponding DataIngestionStatus + */ + @JsonCreator + public static DataIngestionStatus fromString(String name) { + return fromString(name, DataIngestionStatus.class); + } + + /** + * @return known DataIngestionStatus values + */ + public static Collection values() { + return values(DataIngestionStatus.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSource.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSource.java new file mode 100644 index 000000000000..a938301e9d3a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSource.java @@ -0,0 +1,181 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.DataSourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.Map; + +/** + * Type representing DataSource. + */ +public interface DataSource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + DataSourceKind kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + Object properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataSource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithKind, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataSource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataSource definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the datasource definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithKind withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the datasource definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + * @param kind Possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification' + * @return the next definition stage + */ + WithProperties withKind(DataSourceKind kind); + } + + /** + * The stage of the datasource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The data source properties in raw json format, each kind of data source have it's own schema + * @return the next definition stage + */ + WithCreate withProperties(Object properties); + } + + /** + * The stage of the datasource definition allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The ETag of the data source + * @return the next definition stage + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the datasource definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithEtag, DefinitionStages.WithTags { + } + } + /** + * The template for a DataSource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithEtag, UpdateStages.WithTags { + } + + /** + * Grouping of DataSource update stages. + */ + interface UpdateStages { + /** + * The stage of the datasource update allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The ETag of the data source + * @return the next update stage + */ + Update withEtag(String etag); + } + + /** + * The stage of the datasource update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceFilter.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceFilter.java new file mode 100644 index 000000000000..0e60ff4ba0c9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceFilter.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DataSource filter. Right now, only filter by kind is supported. + */ +public class DataSourceFilter { + /** + * Possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', + * 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', + * 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', + * 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', + * 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', + * 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', + * 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', + * 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', + * 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', + * 'SecurityWindowsBaselineConfiguration', + * 'SecurityCenterSecurityWindowsBaselineConfiguration', + * 'SecurityEventCollectionConfiguration', + * 'SecurityInsightsSecurityEventCollectionConfiguration', + * 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', + * 'ApplicationInsights', 'SqlDataClassification'. + */ + @JsonProperty(value = "kind") + private DataSourceKind kind; + + /** + * Get possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'. + * + * @return the kind value + */ + public DataSourceKind kind() { + return this.kind; + } + + /** + * Set possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'. + * + * @param kind the kind value to set + * @return the DataSourceFilter object itself. + */ + public DataSourceFilter withKind(DataSourceKind kind) { + this.kind = kind; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceKind.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceKind.java new file mode 100644 index 000000000000..4e5dd3e96127 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceKind.java @@ -0,0 +1,134 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataSourceKind. + */ +public final class DataSourceKind extends ExpandableStringEnum { + /** Static value WindowsEvent for DataSourceKind. */ + public static final DataSourceKind WINDOWS_EVENT = fromString("WindowsEvent"); + + /** Static value WindowsPerformanceCounter for DataSourceKind. */ + public static final DataSourceKind WINDOWS_PERFORMANCE_COUNTER = fromString("WindowsPerformanceCounter"); + + /** Static value IISLogs for DataSourceKind. */ + public static final DataSourceKind IISLOGS = fromString("IISLogs"); + + /** Static value LinuxSyslog for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG = fromString("LinuxSyslog"); + + /** Static value LinuxSyslogCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG_COLLECTION = fromString("LinuxSyslogCollection"); + + /** Static value LinuxPerformanceObject for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_OBJECT = fromString("LinuxPerformanceObject"); + + /** Static value LinuxPerformanceCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_COLLECTION = fromString("LinuxPerformanceCollection"); + + /** Static value CustomLog for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG = fromString("CustomLog"); + + /** Static value CustomLogCollection for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG_COLLECTION = fromString("CustomLogCollection"); + + /** Static value AzureAuditLog for DataSourceKind. */ + public static final DataSourceKind AZURE_AUDIT_LOG = fromString("AzureAuditLog"); + + /** Static value AzureActivityLog for DataSourceKind. */ + public static final DataSourceKind AZURE_ACTIVITY_LOG = fromString("AzureActivityLog"); + + /** Static value GenericDataSource for DataSourceKind. */ + public static final DataSourceKind GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** Static value ChangeTrackingCustomPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_CUSTOM_PATH = fromString("ChangeTrackingCustomPath"); + + /** Static value ChangeTrackingPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_PATH = fromString("ChangeTrackingPath"); + + /** Static value ChangeTrackingServices for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_SERVICES = fromString("ChangeTrackingServices"); + + /** Static value ChangeTrackingDataTypeConfiguration for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DATA_TYPE_CONFIGURATION = fromString("ChangeTrackingDataTypeConfiguration"); + + /** Static value ChangeTrackingDefaultRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DEFAULT_REGISTRY = fromString("ChangeTrackingDefaultRegistry"); + + /** Static value ChangeTrackingRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_REGISTRY = fromString("ChangeTrackingRegistry"); + + /** Static value ChangeTrackingLinuxPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_LINUX_PATH = fromString("ChangeTrackingLinuxPath"); + + /** Static value LinuxChangeTrackingPath for DataSourceKind. */ + public static final DataSourceKind LINUX_CHANGE_TRACKING_PATH = fromString("LinuxChangeTrackingPath"); + + /** Static value ChangeTrackingContentLocation for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_CONTENT_LOCATION = fromString("ChangeTrackingContentLocation"); + + /** Static value WindowsTelemetry for DataSourceKind. */ + public static final DataSourceKind WINDOWS_TELEMETRY = fromString("WindowsTelemetry"); + + /** Static value Office365 for DataSourceKind. */ + public static final DataSourceKind OFFICE365 = fromString("Office365"); + + /** Static value SecurityWindowsBaselineConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_WINDOWS_BASELINE_CONFIGURATION = fromString("SecurityWindowsBaselineConfiguration"); + + /** Static value SecurityCenterSecurityWindowsBaselineConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_CENTER_SECURITY_WINDOWS_BASELINE_CONFIGURATION = fromString("SecurityCenterSecurityWindowsBaselineConfiguration"); + + /** Static value SecurityEventCollectionConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_EVENT_COLLECTION_CONFIGURATION = fromString("SecurityEventCollectionConfiguration"); + + /** Static value SecurityInsightsSecurityEventCollectionConfiguration for DataSourceKind. */ + public static final DataSourceKind SECURITY_INSIGHTS_SECURITY_EVENT_COLLECTION_CONFIGURATION = fromString("SecurityInsightsSecurityEventCollectionConfiguration"); + + /** Static value ImportComputerGroup for DataSourceKind. */ + public static final DataSourceKind IMPORT_COMPUTER_GROUP = fromString("ImportComputerGroup"); + + /** Static value NetworkMonitoring for DataSourceKind. */ + public static final DataSourceKind NETWORK_MONITORING = fromString("NetworkMonitoring"); + + /** Static value Itsm for DataSourceKind. */ + public static final DataSourceKind ITSM = fromString("Itsm"); + + /** Static value DnsAnalytics for DataSourceKind. */ + public static final DataSourceKind DNS_ANALYTICS = fromString("DnsAnalytics"); + + /** Static value ApplicationInsights for DataSourceKind. */ + public static final DataSourceKind APPLICATION_INSIGHTS = fromString("ApplicationInsights"); + + /** Static value SqlDataClassification for DataSourceKind. */ + public static final DataSourceKind SQL_DATA_CLASSIFICATION = fromString("SqlDataClassification"); + + /** + * Creates or finds a DataSourceKind from its string representation. + * @param name a name to look for + * @return the corresponding DataSourceKind + */ + @JsonCreator + public static DataSourceKind fromString(String name) { + return fromString(name, DataSourceKind.class); + } + + /** + * @return known DataSourceKind values + */ + public static Collection values() { + return values(DataSourceKind.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceType.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceType.java new file mode 100644 index 000000000000..23e1a47696ef --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSourceType.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DataSourceType. + */ +public enum DataSourceType { + /** Enum value CustomLogs. */ + CUSTOM_LOGS("CustomLogs"), + + /** Enum value AzureWatson. */ + AZURE_WATSON("AzureWatson"); + + /** The actual serialized value for a DataSourceType instance. */ + private String value; + + DataSourceType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DataSourceType instance. + * + * @param value the serialized value to parse. + * @return the parsed DataSourceType object, or null if unable to parse. + */ + @JsonCreator + public static DataSourceType fromString(String value) { + DataSourceType[] items = DataSourceType.values(); + for (DataSourceType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSources.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSources.java new file mode 100644 index 000000000000..0f46829b3597 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DataSources.java @@ -0,0 +1,54 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.DataSourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataSources. + */ +public interface DataSources extends SupportsCreating, HasInner { + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter); + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DeletedWorkspaces.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DeletedWorkspaces.java new file mode 100644 index 000000000000..33d41db9a273 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/DeletedWorkspaces.java @@ -0,0 +1,20 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.DeletedWorkspacesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DeletedWorkspaces. + */ +public interface DeletedWorkspaces extends SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorAdditionalInfo.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..1022178bd576 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorAdditionalInfo.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error additional info. + */ +public class ErrorAdditionalInfo { + /** + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the additional info type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Get the additional info. + * + * @return the info value + */ + public Object info() { + return this.info; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContract.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContract.java new file mode 100644 index 000000000000..bb697f8ee64f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContract.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Error details. + * Contains details when the response code indicates an error. + */ +public class ErrorContract { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorContract object itself. + */ + public ErrorContract withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContractException.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContractException.java new file mode 100644 index 000000000000..778235298660 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorContractException.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorContract information. + */ +public class ErrorContractException extends RestException { + /** + * Initializes a new instance of the ErrorContractException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorContractException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorContractException 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 ErrorContractException(final String message, final Response response, final ErrorContract body) { + super(message, response, body); + } + + @Override + public ErrorContract body() { + return (ErrorContract) super.body(); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorResponse.java new file mode 100644 index 000000000000..20996e06d101 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ErrorResponse.java @@ -0,0 +1,93 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The resource management error response. + */ +public class ErrorResponse { + /** + * The error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * The error message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The error target. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * The error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * The error additional info. + */ + @JsonProperty(value = "additionalInfo", access = JsonProperty.Access.WRITE_ONLY) + private List additionalInfo; + + /** + * Get the error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get the error message. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the error target. + * + * @return the target value + */ + public String target() { + return this.target; + } + + /** + * Get the error details. + * + * @return the details value + */ + public List details() { + return this.details; + } + + /** + * Get the error additional info. + * + * @return the additionalInfo value + */ + public List additionalInfo() { + return this.additionalInfo; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Gateways.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Gateways.java new file mode 100644 index 000000000000..b33e98896052 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Gateways.java @@ -0,0 +1,30 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Completable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.GatewaysInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Gateways. + */ +public interface Gateways extends HasInner { + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String gatewayId); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Identity.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Identity.java new file mode 100644 index 000000000000..409186736736 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Identity.java @@ -0,0 +1,73 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Identity for the resource. + */ +public class Identity { + /** + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /** + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** + * The identity type. Possible values include: 'SystemAssigned', 'None'. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /** + * Get the principal ID of resource identity. + * + * @return the principalId value + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenant ID of resource. + * + * @return the tenantId value + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @return the type value + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the identity type. Possible values include: 'SystemAssigned', 'None'. + * + * @param type the type value to set + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IdentityType.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IdentityType.java new file mode 100644 index 000000000000..ba7550063bee --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IdentityType.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for IdentityType. + */ +public enum IdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a IdentityType instance. */ + private String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePack.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePack.java new file mode 100644 index 000000000000..8093ae06911b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePack.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.IntelligencePackInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing IntelligencePack. + */ +public interface IntelligencePack extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePacks.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePacks.java new file mode 100644 index 000000000000..8c27789df606 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/IntelligencePacks.java @@ -0,0 +1,52 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import rx.Completable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.IntelligencePacksInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing IntelligencePacks. + */ +public interface IntelligencePacks extends HasInner { + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/KeyVaultProperties.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/KeyVaultProperties.java new file mode 100644 index 000000000000..774e1cf05aa0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/KeyVaultProperties.java @@ -0,0 +1,96 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The key vault properties. + */ +public class KeyVaultProperties { + /** + * The Key Vault uri which holds they key associated with the Log Analytics + * cluster. + */ + @JsonProperty(value = "keyVaultUri") + private String keyVaultUri; + + /** + * The name of the key associated with the Log Analytics cluster. + */ + @JsonProperty(value = "keyName") + private String keyName; + + /** + * The version of the key associated with the Log Analytics cluster. + */ + @JsonProperty(value = "keyVersion") + private String keyVersion; + + /** + * Get the Key Vault uri which holds they key associated with the Log Analytics cluster. + * + * @return the keyVaultUri value + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the Key Vault uri which holds they key associated with the Log Analytics cluster. + * + * @param keyVaultUri the keyVaultUri value to set + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the name of the key associated with the Log Analytics cluster. + * + * @return the keyName value + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the name of the key associated with the Log Analytics cluster. + * + * @param keyName the keyName value to set + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the version of the key associated with the Log Analytics cluster. + * + * @return the keyVersion value + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the version of the key associated with the Log Analytics cluster. + * + * @param keyVersion the keyVersion value to set + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedService.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedService.java new file mode 100644 index 000000000000..3ef5ca2055d6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedService.java @@ -0,0 +1,205 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LinkedServiceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.Map; + +/** + * Type representing LinkedService. + */ +public interface LinkedService extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the provisioningState value. + */ + LinkedServiceEntityStatus provisioningState(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the writeAccessResourceId value. + */ + String writeAccessResourceId(); + + /** + * The entirety of the LinkedService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithCreate { + } + + /** + * Grouping of LinkedService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LinkedService definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the linkedservice definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the linkedservice definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating' + * @return the next definition stage + */ + WithCreate withProvisioningState(LinkedServiceEntityStatus provisioningState); + } + + /** + * The stage of the linkedservice definition allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the linkedservice definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the linkedservice definition allowing to specify WriteAccessResourceId. + */ + interface WithWriteAccessResourceId { + /** + * Specifies writeAccessResourceId. + * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access + * @return the next definition stage + */ + WithCreate withWriteAccessResourceId(String writeAccessResourceId); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithProvisioningState, DefinitionStages.WithResourceId, DefinitionStages.WithTags, DefinitionStages.WithWriteAccessResourceId { + } + } + /** + * The template for a LinkedService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithProvisioningState, UpdateStages.WithResourceId, UpdateStages.WithTags, UpdateStages.WithWriteAccessResourceId { + } + + /** + * Grouping of LinkedService update stages. + */ + interface UpdateStages { + /** + * The stage of the linkedservice update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating' + * @return the next update stage + */ + Update withProvisioningState(LinkedServiceEntityStatus provisioningState); + } + + /** + * The stage of the linkedservice update allowing to specify ResourceId. + */ + interface WithResourceId { + /** + * Specifies resourceId. + * @param resourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access + * @return the next update stage + */ + Update withResourceId(String resourceId); + } + + /** + * The stage of the linkedservice update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + /** + * The stage of the linkedservice update allowing to specify WriteAccessResourceId. + */ + interface WithWriteAccessResourceId { + /** + * Specifies writeAccessResourceId. + * @param writeAccessResourceId The resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access + * @return the next update stage + */ + Update withWriteAccessResourceId(String writeAccessResourceId); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServiceEntityStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServiceEntityStatus.java new file mode 100644 index 000000000000..c9c094921f4a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServiceEntityStatus.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for LinkedServiceEntityStatus. + */ +public final class LinkedServiceEntityStatus extends ExpandableStringEnum { + /** Static value Succeeded for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for LinkedServiceEntityStatus. */ + public static final LinkedServiceEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a LinkedServiceEntityStatus from its string representation. + * @param name a name to look for + * @return the corresponding LinkedServiceEntityStatus + */ + @JsonCreator + public static LinkedServiceEntityStatus fromString(String name) { + return fromString(name, LinkedServiceEntityStatus.class); + } + + /** + * @return known LinkedServiceEntityStatus values + */ + public static Collection values() { + return values(LinkedServiceEntityStatus.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServices.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServices.java new file mode 100644 index 000000000000..1e7899ed1d8a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedServices.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LinkedServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LinkedServices. + */ +public interface LinkedServices extends SupportsCreating, HasInner { + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String linkedServiceName); + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName); + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccounts.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccounts.java new file mode 100644 index 000000000000..06d2dba268af --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccounts.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LinkedStorageAccountsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LinkedStorageAccounts. + */ +public interface LinkedStorageAccounts extends SupportsCreating, HasInner { + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType); + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName); + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccountsResource.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccountsResource.java new file mode 100644 index 000000000000..ed811adaff5e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/LinkedStorageAccountsResource.java @@ -0,0 +1,123 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LinkedStorageAccountsResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; + +/** + * Type representing LinkedStorageAccountsResource. + */ +public interface LinkedStorageAccountsResource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the dataSourceType value. + */ + DataSourceType dataSourceType(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the storageAccountIds value. + */ + List storageAccountIds(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LinkedStorageAccountsResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithStorageAccountIds, DefinitionStages.WithCreate { + } + + /** + * Grouping of LinkedStorageAccountsResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LinkedStorageAccountsResource definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the linkedstorageaccountsresource definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithStorageAccountIds withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the linkedstorageaccountsresource definition allowing to specify StorageAccountIds. + */ + interface WithStorageAccountIds { + /** + * Specifies storageAccountIds. + * @param storageAccountIds Linked storage accounts resources ids + * @return the next definition stage + */ + WithCreate withStorageAccountIds(List storageAccountIds); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable { + } + } + /** + * The template for a LinkedStorageAccountsResource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithStorageAccountIds { + } + + /** + * Grouping of LinkedStorageAccountsResource update stages. + */ + interface UpdateStages { + /** + * The stage of the linkedstorageaccountsresource update allowing to specify StorageAccountIds. + */ + interface WithStorageAccountIds { + /** + * Specifies storageAccountIds. + * @param storageAccountIds Linked storage accounts resources ids + * @return the next update stage + */ + Update withStorageAccountIds(List storageAccountIds); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroup.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroup.java new file mode 100644 index 000000000000..fe5116b08719 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroup.java @@ -0,0 +1,61 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.ManagementGroupInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagementGroup. + */ +public interface ManagementGroup extends HasInner, HasManager { + /** + * @return the created value. + */ + DateTime created(); + + /** + * @return the dataReceived value. + */ + DateTime dataReceived(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isGateway value. + */ + Boolean isGateway(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverCount value. + */ + Integer serverCount(); + + /** + * @return the sku value. + */ + String sku(); + + /** + * @return the version value. + */ + String version(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroups.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroups.java new file mode 100644 index 000000000000..e2511eeadf2c --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/ManagementGroups.java @@ -0,0 +1,29 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.ManagementGroupsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing ManagementGroups. + */ +public interface ManagementGroups extends HasInner { + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/MetricName.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/MetricName.java new file mode 100644 index 000000000000..229041e87ddc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/MetricName.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The name of a metric. + */ +public class MetricName { + /** + * The system name of the metric. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The localized name of the metric. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the system name of the metric. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the system name of the metric. + * + * @param value the value value to set + * @return the MetricName object itself. + */ + public MetricName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localized name of the metric. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localized name of the metric. + * + * @param localizedValue the localizedValue value to set + * @return the MetricName object itself. + */ + public MetricName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Operation.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Operation.java new file mode 100644 index 000000000000..45c5a6433a0e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Operation.java @@ -0,0 +1,30 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationDisplay.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationDisplay.java new file mode 100644 index 000000000000..8b3a77957b0f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft OperationsManagement. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Description of operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get service provider: Microsoft OperationsManagement. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft OperationsManagement. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get type of operation: get, read, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set type of operation: get, read, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatus.java new file mode 100644 index 000000000000..70671acac36d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatus.java @@ -0,0 +1,52 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.OperationStatusInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing OperationStatus. + */ +public interface OperationStatus extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the endTime value. + */ + String endTime(); + + /** + * @return the error value. + */ + ErrorResponse error(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the startTime value. + */ + String startTime(); + + /** + * @return the status value. + */ + String status(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatuses.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatuses.java new file mode 100644 index 000000000000..7a926319cae6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/OperationStatuses.java @@ -0,0 +1,29 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.OperationStatusesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing OperationStatuses. + */ +public interface OperationStatuses extends HasInner { + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String location, String asyncOperationId); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Operations.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Operations.java new file mode 100644 index 000000000000..630aee5cba8d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PrivateLinkScopedResource.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PrivateLinkScopedResource.java new file mode 100644 index 000000000000..88cd7fa10690 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PrivateLinkScopedResource.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The private link scope resource reference. + */ +public class PrivateLinkScopedResource { + /** + * The full resource Id of the private link scope resource. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * The private link scope unique Identifier. + */ + @JsonProperty(value = "scopeId") + private String scopeId; + + /** + * Get the full resource Id of the private link scope resource. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the full resource Id of the private link scope resource. + * + * @param resourceId the resourceId value to set + * @return the PrivateLinkScopedResource object itself. + */ + public PrivateLinkScopedResource withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the private link scope unique Identifier. + * + * @return the scopeId value + */ + public String scopeId() { + return this.scopeId; + } + + /** + * Set the private link scope unique Identifier. + * + * @param scopeId the scopeId value to set + * @return the PrivateLinkScopedResource object itself. + */ + public PrivateLinkScopedResource withScopeId(String scopeId) { + this.scopeId = scopeId; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PublicNetworkAccessType.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PublicNetworkAccessType.java new file mode 100644 index 000000000000..bb6819566573 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PublicNetworkAccessType.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PublicNetworkAccessType. + */ +public final class PublicNetworkAccessType extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccessType. */ + public static final PublicNetworkAccessType ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccessType. */ + public static final PublicNetworkAccessType DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccessType from its string representation. + * @param name a name to look for + * @return the corresponding PublicNetworkAccessType + */ + @JsonCreator + public static PublicNetworkAccessType fromString(String name) { + return fromString(name, PublicNetworkAccessType.class); + } + + /** + * @return known PublicNetworkAccessType values + */ + public static Collection values() { + return values(PublicNetworkAccessType.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PurgeState.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PurgeState.java new file mode 100644 index 000000000000..dd891719cfc5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/PurgeState.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PurgeState. + */ +public final class PurgeState extends ExpandableStringEnum { + /** Static value pending for PurgeState. */ + public static final PurgeState PENDING = fromString("pending"); + + /** Static value completed for PurgeState. */ + public static final PurgeState COMPLETED = fromString("completed"); + + /** + * Creates or finds a PurgeState from its string representation. + * @param name a name to look for + * @return the corresponding PurgeState + */ + @JsonCreator + public static PurgeState fromString(String name) { + return fromString(name, PurgeState.class); + } + + /** + * @return known PurgeState values + */ + public static Collection values() { + return values(PurgeState.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearch.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearch.java new file mode 100644 index 000000000000..96c464ea83d4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearch.java @@ -0,0 +1,285 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SavedSearchInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; + +/** + * Type representing SavedSearch. + */ +public interface SavedSearch extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the category value. + */ + String category(); + + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the etag value. + */ + String etag(); + + /** + * @return the functionAlias value. + */ + String functionAlias(); + + /** + * @return the functionParameters value. + */ + String functionParameters(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the query value. + */ + String query(); + + /** + * @return the tags value. + */ + List tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the version value. + */ + Long version(); + + /** + * The entirety of the SavedSearch definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithCategory, DefinitionStages.WithDisplayName, DefinitionStages.WithQuery, DefinitionStages.WithCreate { + } + + /** + * Grouping of SavedSearch definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SavedSearch definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the savedsearch definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithCategory withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the savedsearch definition allowing to specify Category. + */ + interface WithCategory { + /** + * Specifies category. + * @param category The category of the saved search. This helps the user to find a saved search faster + * @return the next definition stage + */ + WithDisplayName withCategory(String category); + } + + /** + * The stage of the savedsearch definition allowing to specify DisplayName. + */ + interface WithDisplayName { + /** + * Specifies displayName. + * @param displayName Saved search display name + * @return the next definition stage + */ + WithQuery withDisplayName(String displayName); + } + + /** + * The stage of the savedsearch definition allowing to specify Query. + */ + interface WithQuery { + /** + * Specifies query. + * @param query The query expression for the saved search + * @return the next definition stage + */ + WithCreate withQuery(String query); + } + + /** + * The stage of the savedsearch definition allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The ETag of the saved search + * @return the next definition stage + */ + WithCreate withEtag(String etag); + } + + /** + * The stage of the savedsearch definition allowing to specify FunctionAlias. + */ + interface WithFunctionAlias { + /** + * Specifies functionAlias. + * @param functionAlias The function alias if query serves as a function + * @return the next definition stage + */ + WithCreate withFunctionAlias(String functionAlias); + } + + /** + * The stage of the savedsearch definition allowing to specify FunctionParameters. + */ + interface WithFunctionParameters { + /** + * Specifies functionParameters. + * @param functionParameters The optional function parameters if query serves as a function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more examples and proper syntax please refer to https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions + * @return the next definition stage + */ + WithCreate withFunctionParameters(String functionParameters); + } + + /** + * The stage of the savedsearch definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags attached to the saved search + * @return the next definition stage + */ + WithCreate withTags(List tags); + } + + /** + * The stage of the savedsearch definition allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + * @param version The version number of the query language. The current version is 2 and is the default + * @return the next definition stage + */ + WithCreate withVersion(Long version); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithEtag, DefinitionStages.WithFunctionAlias, DefinitionStages.WithFunctionParameters, DefinitionStages.WithTags, DefinitionStages.WithVersion { + } + } + /** + * The template for a SavedSearch update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithEtag, UpdateStages.WithFunctionAlias, UpdateStages.WithFunctionParameters, UpdateStages.WithTags, UpdateStages.WithVersion { + } + + /** + * Grouping of SavedSearch update stages. + */ + interface UpdateStages { + /** + * The stage of the savedsearch update allowing to specify Etag. + */ + interface WithEtag { + /** + * Specifies etag. + * @param etag The ETag of the saved search + * @return the next update stage + */ + Update withEtag(String etag); + } + + /** + * The stage of the savedsearch update allowing to specify FunctionAlias. + */ + interface WithFunctionAlias { + /** + * Specifies functionAlias. + * @param functionAlias The function alias if query serves as a function + * @return the next update stage + */ + Update withFunctionAlias(String functionAlias); + } + + /** + * The stage of the savedsearch update allowing to specify FunctionParameters. + */ + interface WithFunctionParameters { + /** + * Specifies functionParameters. + * @param functionParameters The optional function parameters if query serves as a function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more examples and proper syntax please refer to https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions + * @return the next update stage + */ + Update withFunctionParameters(String functionParameters); + } + + /** + * The stage of the savedsearch update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags The tags attached to the saved search + * @return the next update stage + */ + Update withTags(List tags); + } + + /** + * The stage of the savedsearch update allowing to specify Version. + */ + interface WithVersion { + /** + * Specifies version. + * @param version The version number of the query language. The current version is 2 and is the default + * @return the next update stage + */ + Update withVersion(Long version); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearches.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearches.java new file mode 100644 index 000000000000..446a19f6abe2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearches.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SavedSearchesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SavedSearches. + */ +public interface SavedSearches extends SupportsCreating, HasInner { + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName); + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String savedSearchId); + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String savedSearchId); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearchesListResult.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearchesListResult.java new file mode 100644 index 000000000000..34dcc5e31132 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SavedSearchesListResult.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SavedSearchesListResultInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SavedSearchInner; +import java.util.List; + +/** + * Type representing SavedSearchesListResult. + */ +public interface SavedSearchesListResult extends HasInner, HasManager { + /** + * @return the value value. + */ + List value(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Schemas.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Schemas.java new file mode 100644 index 000000000000..dc4484865f6f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Schemas.java @@ -0,0 +1,29 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SchemasInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Schemas. + */ +public interface Schemas extends HasInner { + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchGetSchemaResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchGetSchemaResponse.java new file mode 100644 index 000000000000..5f301679a749 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchGetSchemaResponse.java @@ -0,0 +1,31 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SearchGetSchemaResponseInner; +import java.util.List; + +/** + * Type representing SearchGetSchemaResponse. + */ +public interface SearchGetSchemaResponse extends HasInner, HasManager { + /** + * @return the metadata value. + */ + SearchMetadata metadata(); + + /** + * @return the value value. + */ + List value(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadata.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadata.java new file mode 100644 index 000000000000..9faf4b6a9e85 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadata.java @@ -0,0 +1,461 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.List; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metadata for search results. + */ +public class SearchMetadata { + /** + * The request id of the search. + */ + @JsonProperty(value = "requestId") + private String searchId; + + /** + * The search result type. + */ + @JsonProperty(value = "resultType") + private String resultType; + + /** + * The total number of search results. + */ + @JsonProperty(value = "total") + private Long total; + + /** + * The number of top search results. + */ + @JsonProperty(value = "top") + private Long top; + + /** + * The id of the search results request. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The core summaries. + */ + @JsonProperty(value = "coreSummaries") + private List coreSummaries; + + /** + * The status of the search results. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The start time for the search. + */ + @JsonProperty(value = "startTime") + private DateTime startTime; + + /** + * The time of last update. + */ + @JsonProperty(value = "lastUpdated") + private DateTime lastUpdated; + + /** + * The ETag of the search results. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * How the results are sorted. + */ + @JsonProperty(value = "sort") + private List sort; + + /** + * The request time. + */ + @JsonProperty(value = "requestTime") + private Long requestTime; + + /** + * The aggregated value field. + */ + @JsonProperty(value = "aggregatedValueField") + private String aggregatedValueField; + + /** + * The aggregated grouping fields. + */ + @JsonProperty(value = "aggregatedGroupingFields") + private String aggregatedGroupingFields; + + /** + * The sum of all aggregates returned in the result set. + */ + @JsonProperty(value = "sum") + private Long sum; + + /** + * The max of all aggregates returned in the result set. + */ + @JsonProperty(value = "max") + private Long max; + + /** + * The schema. + */ + @JsonProperty(value = "schema") + private SearchMetadataSchema schema; + + /** + * Get the request id of the search. + * + * @return the searchId value + */ + public String searchId() { + return this.searchId; + } + + /** + * Set the request id of the search. + * + * @param searchId the searchId value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSearchId(String searchId) { + this.searchId = searchId; + return this; + } + + /** + * Get the search result type. + * + * @return the resultType value + */ + public String resultType() { + return this.resultType; + } + + /** + * Set the search result type. + * + * @param resultType the resultType value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withResultType(String resultType) { + this.resultType = resultType; + return this; + } + + /** + * Get the total number of search results. + * + * @return the total value + */ + public Long total() { + return this.total; + } + + /** + * Set the total number of search results. + * + * @param total the total value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withTotal(Long total) { + this.total = total; + return this; + } + + /** + * Get the number of top search results. + * + * @return the top value + */ + public Long top() { + return this.top; + } + + /** + * Set the number of top search results. + * + * @param top the top value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withTop(Long top) { + this.top = top; + return this; + } + + /** + * Get the id of the search results request. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the id of the search results request. + * + * @param id the id value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withId(String id) { + this.id = id; + return this; + } + + /** + * Get the core summaries. + * + * @return the coreSummaries value + */ + public List coreSummaries() { + return this.coreSummaries; + } + + /** + * Set the core summaries. + * + * @param coreSummaries the coreSummaries value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withCoreSummaries(List coreSummaries) { + this.coreSummaries = coreSummaries; + return this; + } + + /** + * Get the status of the search results. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the search results. + * + * @param status the status value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the start time for the search. + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Set the start time for the search. + * + * @param startTime the startTime value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withStartTime(DateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the time of last update. + * + * @return the lastUpdated value + */ + public DateTime lastUpdated() { + return this.lastUpdated; + } + + /** + * Set the time of last update. + * + * @param lastUpdated the lastUpdated value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withLastUpdated(DateTime lastUpdated) { + this.lastUpdated = lastUpdated; + return this; + } + + /** + * Get the ETag of the search results. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag of the search results. + * + * @param eTag the eTag value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get how the results are sorted. + * + * @return the sort value + */ + public List sort() { + return this.sort; + } + + /** + * Set how the results are sorted. + * + * @param sort the sort value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSort(List sort) { + this.sort = sort; + return this; + } + + /** + * Get the request time. + * + * @return the requestTime value + */ + public Long requestTime() { + return this.requestTime; + } + + /** + * Set the request time. + * + * @param requestTime the requestTime value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withRequestTime(Long requestTime) { + this.requestTime = requestTime; + return this; + } + + /** + * Get the aggregated value field. + * + * @return the aggregatedValueField value + */ + public String aggregatedValueField() { + return this.aggregatedValueField; + } + + /** + * Set the aggregated value field. + * + * @param aggregatedValueField the aggregatedValueField value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withAggregatedValueField(String aggregatedValueField) { + this.aggregatedValueField = aggregatedValueField; + return this; + } + + /** + * Get the aggregated grouping fields. + * + * @return the aggregatedGroupingFields value + */ + public String aggregatedGroupingFields() { + return this.aggregatedGroupingFields; + } + + /** + * Set the aggregated grouping fields. + * + * @param aggregatedGroupingFields the aggregatedGroupingFields value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withAggregatedGroupingFields(String aggregatedGroupingFields) { + this.aggregatedGroupingFields = aggregatedGroupingFields; + return this; + } + + /** + * Get the sum of all aggregates returned in the result set. + * + * @return the sum value + */ + public Long sum() { + return this.sum; + } + + /** + * Set the sum of all aggregates returned in the result set. + * + * @param sum the sum value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSum(Long sum) { + this.sum = sum; + return this; + } + + /** + * Get the max of all aggregates returned in the result set. + * + * @return the max value + */ + public Long max() { + return this.max; + } + + /** + * Set the max of all aggregates returned in the result set. + * + * @param max the max value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withMax(Long max) { + this.max = max; + return this; + } + + /** + * Get the schema. + * + * @return the schema value + */ + public SearchMetadataSchema schema() { + return this.schema; + } + + /** + * Set the schema. + * + * @param schema the schema value to set + * @return the SearchMetadata object itself. + */ + public SearchMetadata withSchema(SearchMetadataSchema schema) { + this.schema = schema; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadataSchema.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadataSchema.java new file mode 100644 index 000000000000..b22bbabd5d9e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchMetadataSchema.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Schema metadata for search. + */ +public class SearchMetadataSchema { + /** + * The name of the metadata schema. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The version of the metadata schema. + */ + @JsonProperty(value = "version") + private Integer version; + + /** + * Get the name of the metadata schema. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the metadata schema. + * + * @param name the name value to set + * @return the SearchMetadataSchema object itself. + */ + public SearchMetadataSchema withName(String name) { + this.name = name; + return this; + } + + /** + * Get the version of the metadata schema. + * + * @return the version value + */ + public Integer version() { + return this.version; + } + + /** + * Set the version of the metadata schema. + * + * @param version the version value to set + * @return the SearchMetadataSchema object itself. + */ + public SearchMetadataSchema withVersion(Integer version) { + this.version = version; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSchemaValue.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSchemaValue.java new file mode 100644 index 000000000000..64e9d13b1019 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSchemaValue.java @@ -0,0 +1,200 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Value object for schema results. + */ +public class SearchSchemaValue { + /** + * The name of the schema. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The display name of the schema. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * The type. + */ + @JsonProperty(value = "type") + private String type; + + /** + * The boolean that indicates the field is searchable as free text. + */ + @JsonProperty(value = "indexed", required = true) + private boolean indexed; + + /** + * The boolean that indicates whether or not the field is stored. + */ + @JsonProperty(value = "stored", required = true) + private boolean stored; + + /** + * The boolean that indicates whether or not the field is a facet. + */ + @JsonProperty(value = "facet", required = true) + private boolean facet; + + /** + * The array of workflows containing the field. + */ + @JsonProperty(value = "ownerType") + private List ownerType; + + /** + * Get the name of the schema. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the schema. + * + * @param name the name value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display name of the schema. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the schema. + * + * @param displayName the displayName value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the type. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set the type. + * + * @param type the type value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withType(String type) { + this.type = type; + return this; + } + + /** + * Get the boolean that indicates the field is searchable as free text. + * + * @return the indexed value + */ + public boolean indexed() { + return this.indexed; + } + + /** + * Set the boolean that indicates the field is searchable as free text. + * + * @param indexed the indexed value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withIndexed(boolean indexed) { + this.indexed = indexed; + return this; + } + + /** + * Get the boolean that indicates whether or not the field is stored. + * + * @return the stored value + */ + public boolean stored() { + return this.stored; + } + + /** + * Set the boolean that indicates whether or not the field is stored. + * + * @param stored the stored value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withStored(boolean stored) { + this.stored = stored; + return this; + } + + /** + * Get the boolean that indicates whether or not the field is a facet. + * + * @return the facet value + */ + public boolean facet() { + return this.facet; + } + + /** + * Set the boolean that indicates whether or not the field is a facet. + * + * @param facet the facet value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withFacet(boolean facet) { + this.facet = facet; + return this; + } + + /** + * Get the array of workflows containing the field. + * + * @return the ownerType value + */ + public List ownerType() { + return this.ownerType; + } + + /** + * Set the array of workflows containing the field. + * + * @param ownerType the ownerType value to set + * @return the SearchSchemaValue object itself. + */ + public SearchSchemaValue withOwnerType(List ownerType) { + this.ownerType = ownerType; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSort.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSort.java new file mode 100644 index 000000000000..8f396fa25564 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSort.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The sort parameters for search. + */ +public class SearchSort { + /** + * The name of the field the search query is sorted on. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The sort order of the search. Possible values include: 'asc', 'desc'. + */ + @JsonProperty(value = "order") + private SearchSortEnum order; + + /** + * Get the name of the field the search query is sorted on. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the field the search query is sorted on. + * + * @param name the name value to set + * @return the SearchSort object itself. + */ + public SearchSort withName(String name) { + this.name = name; + return this; + } + + /** + * Get the sort order of the search. Possible values include: 'asc', 'desc'. + * + * @return the order value + */ + public SearchSortEnum order() { + return this.order; + } + + /** + * Set the sort order of the search. Possible values include: 'asc', 'desc'. + * + * @param order the order value to set + * @return the SearchSort object itself. + */ + public SearchSort withOrder(SearchSortEnum order) { + this.order = order; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSortEnum.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSortEnum.java new file mode 100644 index 000000000000..b0c3ee1238fd --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SearchSortEnum.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SearchSortEnum. + */ +public final class SearchSortEnum extends ExpandableStringEnum { + /** Static value asc for SearchSortEnum. */ + public static final SearchSortEnum ASC = fromString("asc"); + + /** Static value desc for SearchSortEnum. */ + public static final SearchSortEnum DESC = fromString("desc"); + + /** + * Creates or finds a SearchSortEnum from its string representation. + * @param name a name to look for + * @return the corresponding SearchSortEnum + */ + @JsonCreator + public static SearchSortEnum fromString(String name) { + return fromString(name, SearchSortEnum.class); + } + + /** + * @return known SearchSortEnum values + */ + public static Collection values() { + return values(SearchSortEnum.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeys.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeys.java new file mode 100644 index 000000000000..74a1040dafc1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeys.java @@ -0,0 +1,30 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SharedKeysInner; + +/** + * Type representing SharedKeys. + */ +public interface SharedKeys extends HasInner, HasManager { + /** + * @return the primarySharedKey value. + */ + String primarySharedKey(); + + /** + * @return the secondarySharedKey value. + */ + String secondarySharedKey(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeysOperations.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeysOperations.java new file mode 100644 index 000000000000..10d34d83dc4d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SharedKeysOperations.java @@ -0,0 +1,39 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.SharedKeysOperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing SharedKeysOperations. + */ +public interface SharedKeysOperations extends HasInner { + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSharedKeysAsync(String resourceGroupName, String workspaceName); + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable regenerateAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SkuNameEnum.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SkuNameEnum.java new file mode 100644 index 000000000000..1d51d6574332 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/SkuNameEnum.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuNameEnum. + */ +public final class SkuNameEnum extends ExpandableStringEnum { + /** Static value Free for SkuNameEnum. */ + public static final SkuNameEnum FREE = fromString("Free"); + + /** Static value Standard for SkuNameEnum. */ + public static final SkuNameEnum STANDARD = fromString("Standard"); + + /** Static value Premium for SkuNameEnum. */ + public static final SkuNameEnum PREMIUM = fromString("Premium"); + + /** Static value PerNode for SkuNameEnum. */ + public static final SkuNameEnum PER_NODE = fromString("PerNode"); + + /** Static value PerGB2018 for SkuNameEnum. */ + public static final SkuNameEnum PER_GB2018 = fromString("PerGB2018"); + + /** Static value Standalone for SkuNameEnum. */ + public static final SkuNameEnum STANDALONE = fromString("Standalone"); + + /** Static value CapacityReservation for SkuNameEnum. */ + public static final SkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a SkuNameEnum from its string representation. + * @param name a name to look for + * @return the corresponding SkuNameEnum + */ + @JsonCreator + public static SkuNameEnum fromString(String name) { + return fromString(name, SkuNameEnum.class); + } + + /** + * @return known SkuNameEnum values + */ + public static Collection values() { + return values(SkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageAccount.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageAccount.java new file mode 100644 index 000000000000..e66a56cefbf0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageAccount.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes a storage account connection. + */ +public class StorageAccount { + /** + * The Azure Resource Manager ID of the storage account resource. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The storage account key. + */ + @JsonProperty(value = "key", required = true) + private String key; + + /** + * Get the Azure Resource Manager ID of the storage account resource. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the Azure Resource Manager ID of the storage account resource. + * + * @param id the id value to set + * @return the StorageAccount object itself. + */ + public StorageAccount withId(String id) { + this.id = id; + return this; + } + + /** + * Get the storage account key. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set the storage account key. + * + * @param key the key value to set + * @return the StorageAccount object itself. + */ + public StorageAccount withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsight.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsight.java new file mode 100644 index 000000000000..ffa15d98368d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsight.java @@ -0,0 +1,228 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.StorageInsightInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; +import java.util.Map; + +/** + * Type representing StorageInsight. + */ +public interface StorageInsight extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the containers value. + */ + List containers(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the status value. + */ + StorageInsightStatus status(); + + /** + * @return the storageAccount value. + */ + StorageAccount storageAccount(); + + /** + * @return the tables value. + */ + List tables(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the StorageInsight definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithStorageAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of StorageInsight definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a StorageInsight definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the storageinsight definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param workspaceName The name of the workspace + * @return the next definition stage + */ + WithStorageAccount withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the storageinsight definition allowing to specify StorageAccount. + */ + interface WithStorageAccount { + /** + * Specifies storageAccount. + * @param storageAccount The storage account connection details + * @return the next definition stage + */ + WithCreate withStorageAccount(StorageAccount storageAccount); + } + + /** + * The stage of the storageinsight definition allowing to specify Containers. + */ + interface WithContainers { + /** + * Specifies containers. + * @param containers The names of the blob containers that the workspace should read + * @return the next definition stage + */ + WithCreate withContainers(List containers); + } + + /** + * The stage of the storageinsight definition allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the storage insight + * @return the next definition stage + */ + WithCreate withETag(String eTag); + } + + /** + * The stage of the storageinsight definition allowing to specify Tables. + */ + interface WithTables { + /** + * Specifies tables. + * @param tables The names of the Azure tables that the workspace should read + * @return the next definition stage + */ + WithCreate withTables(List tables); + } + + /** + * The stage of the storageinsight definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithContainers, DefinitionStages.WithETag, DefinitionStages.WithTables, DefinitionStages.WithTags { + } + } + /** + * The template for a StorageInsight update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithContainers, UpdateStages.WithETag, UpdateStages.WithTables, UpdateStages.WithTags { + } + + /** + * Grouping of StorageInsight update stages. + */ + interface UpdateStages { + /** + * The stage of the storageinsight update allowing to specify Containers. + */ + interface WithContainers { + /** + * Specifies containers. + * @param containers The names of the blob containers that the workspace should read + * @return the next update stage + */ + Update withContainers(List containers); + } + + /** + * The stage of the storageinsight update allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the storage insight + * @return the next update stage + */ + Update withETag(String eTag); + } + + /** + * The stage of the storageinsight update allowing to specify Tables. + */ + interface WithTables { + /** + * Specifies tables. + * @param tables The names of the Azure tables that the workspace should read + * @return the next update stage + */ + Update withTables(List tables); + } + + /** + * The stage of the storageinsight update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightConfigs.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightConfigs.java new file mode 100644 index 000000000000..91bf2afbc8b8 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightConfigs.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.StorageInsightConfigsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing StorageInsightConfigs. + */ +public interface StorageInsightConfigs extends SupportsCreating, HasInner { + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String storageInsightName); + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName); + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String storageInsightName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightState.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightState.java new file mode 100644 index 000000000000..6d9c00789165 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightState.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for StorageInsightState. + */ +public final class StorageInsightState extends ExpandableStringEnum { + /** Static value OK for StorageInsightState. */ + public static final StorageInsightState OK = fromString("OK"); + + /** Static value ERROR for StorageInsightState. */ + public static final StorageInsightState ERROR = fromString("ERROR"); + + /** + * Creates or finds a StorageInsightState from its string representation. + * @param name a name to look for + * @return the corresponding StorageInsightState + */ + @JsonCreator + public static StorageInsightState fromString(String name) { + return fromString(name, StorageInsightState.class); + } + + /** + * @return known StorageInsightState values + */ + public static Collection values() { + return values(StorageInsightState.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightStatus.java new file mode 100644 index 000000000000..041b5bb9cdd2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/StorageInsightStatus.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of the storage insight. + */ +public class StorageInsightStatus { + /** + * The state of the storage insight connection to the workspace. Possible + * values include: 'OK', 'ERROR'. + */ + @JsonProperty(value = "state", required = true) + private StorageInsightState state; + + /** + * Description of the state of the storage insight. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the state of the storage insight connection to the workspace. Possible values include: 'OK', 'ERROR'. + * + * @return the state value + */ + public StorageInsightState state() { + return this.state; + } + + /** + * Set the state of the storage insight connection to the workspace. Possible values include: 'OK', 'ERROR'. + * + * @param state the state value to set + * @return the StorageInsightStatus object itself. + */ + public StorageInsightStatus withState(StorageInsightState state) { + this.state = state; + return this; + } + + /** + * Get description of the state of the storage insight. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of the state of the storage insight. + * + * @param description the description value to set + * @return the StorageInsightStatus object itself. + */ + public StorageInsightStatus withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Table.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Table.java new file mode 100644 index 000000000000..b12869d76566 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Table.java @@ -0,0 +1,67 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.TableInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +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.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing Table. + */ +public interface Table extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * @return the type value. + */ + String type(); + + /** + * The template for a Table update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable
, UpdateStages.WithRetentionInDays { + } + + /** + * Grouping of Table update stages. + */ + interface UpdateStages { + /** + * The stage of the table update allowing to specify RetentionInDays. + */ + interface WithRetentionInDays { + /** + * Specifies retentionInDays. + * @param retentionInDays The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention + * @return the next update stage + */ + Update withRetentionInDays(Integer retentionInDays); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tables.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tables.java new file mode 100644 index 000000000000..5ff1cd051b6d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tables.java @@ -0,0 +1,40 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.TablesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Tables. + */ +public interface Tables extends HasInner { + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable
getAsync(String resourceGroupName, String workspaceName, String tableName); + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable
listByWorkspaceAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tag.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tag.java new file mode 100644 index 000000000000..73f5d1e34921 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Tag.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A tag of a saved search. + */ +public class Tag { + /** + * The tag name. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * The tag value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the tag name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the tag name. + * + * @param name the name value to set + * @return the Tag object itself. + */ + public Tag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tag value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the tag value. + * + * @param value the value value to set + * @return the Tag object itself. + */ + public Tag withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Type.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Type.java new file mode 100644 index 000000000000..5def6af3c038 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Type.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for Type. + */ +public final class Type extends ExpandableStringEnum { + /** Static value StorageAccount for Type. */ + public static final Type STORAGE_ACCOUNT = fromString("StorageAccount"); + + /** Static value EventHub for Type. */ + public static final Type EVENT_HUB = fromString("EventHub"); + + /** + * Creates or finds a Type from its string representation. + * @param name a name to look for + * @return the corresponding Type + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * @return known Type values + */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/UsageMetric.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/UsageMetric.java new file mode 100644 index 000000000000..379852b65e17 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/UsageMetric.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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.UsageMetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import org.joda.time.DateTime; + +/** + * Type representing UsageMetric. + */ +public interface UsageMetric extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Usages.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Usages.java new file mode 100644 index 000000000000..e07f9b67c073 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Usages.java @@ -0,0 +1,29 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.UsagesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Usages. + */ +public interface Usages extends HasInner { + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspace.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspace.java new file mode 100644 index 000000000000..0fe08f78a790 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspace.java @@ -0,0 +1,270 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspaceInner; + +/** + * Type representing Workspace. + */ +public interface Workspace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the privateLinkScopedResources value. + */ + List privateLinkScopedResources(); + + /** + * @return the provisioningState value. + */ + WorkspaceEntityStatus provisioningState(); + + /** + * @return the publicNetworkAccessForIngestion value. + */ + PublicNetworkAccessType publicNetworkAccessForIngestion(); + + /** + * @return the publicNetworkAccessForQuery value. + */ + PublicNetworkAccessType publicNetworkAccessForQuery(); + + /** + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * @return the sku value. + */ + WorkspaceSku sku(); + + /** + * @return the workspaceCapping value. + */ + WorkspaceCapping workspaceCapping(); + + /** + * The entirety of the Workspace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Workspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Workspace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Workspace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the workspace definition allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the workspace + * @return the next definition stage + */ + WithCreate withETag(String eTag); + } + + /** + * The stage of the workspace definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating' + * @return the next definition stage + */ + WithCreate withProvisioningState(WorkspaceEntityStatus provisioningState); + } + + /** + * The stage of the workspace definition allowing to specify PublicNetworkAccessForIngestion. + */ + interface WithPublicNetworkAccessForIngestion { + /** + * Specifies publicNetworkAccessForIngestion. + * @param publicNetworkAccessForIngestion The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion); + } + + /** + * The stage of the workspace definition allowing to specify PublicNetworkAccessForQuery. + */ + interface WithPublicNetworkAccessForQuery { + /** + * Specifies publicNetworkAccessForQuery. + * @param publicNetworkAccessForQuery The network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled' + * @return the next definition stage + */ + WithCreate withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery); + } + + /** + * The stage of the workspace definition allowing to specify RetentionInDays. + */ + interface WithRetentionInDays { + /** + * Specifies retentionInDays. + * @param retentionInDays The workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus + * @return the next definition stage + */ + WithCreate withRetentionInDays(Integer retentionInDays); + } + + /** + * The stage of the workspace definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the workspace + * @return the next definition stage + */ + WithCreate withSku(WorkspaceSku sku); + } + + /** + * The stage of the workspace definition allowing to specify WorkspaceCapping. + */ + interface WithWorkspaceCapping { + /** + * Specifies workspaceCapping. + * @param workspaceCapping The daily volume cap for ingestion + * @return the next definition stage + */ + WithCreate withWorkspaceCapping(WorkspaceCapping workspaceCapping); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithETag, DefinitionStages.WithProvisioningState, DefinitionStages.WithPublicNetworkAccessForIngestion, DefinitionStages.WithPublicNetworkAccessForQuery, DefinitionStages.WithRetentionInDays, DefinitionStages.WithSku, DefinitionStages.WithWorkspaceCapping { + } + } + /** + * The template for a Workspace update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithProvisioningState, UpdateStages.WithPublicNetworkAccessForIngestion, UpdateStages.WithPublicNetworkAccessForQuery, UpdateStages.WithRetentionInDays, UpdateStages.WithSku, UpdateStages.WithWorkspaceCapping { + } + + /** + * Grouping of Workspace update stages. + */ + interface UpdateStages { + /** + * The stage of the workspace update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating' + * @return the next update stage + */ + Update withProvisioningState(WorkspaceEntityStatus provisioningState); + } + + /** + * The stage of the workspace update allowing to specify PublicNetworkAccessForIngestion. + */ + interface WithPublicNetworkAccessForIngestion { + /** + * Specifies publicNetworkAccessForIngestion. + * @param publicNetworkAccessForIngestion The network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion); + } + + /** + * The stage of the workspace update allowing to specify PublicNetworkAccessForQuery. + */ + interface WithPublicNetworkAccessForQuery { + /** + * Specifies publicNetworkAccessForQuery. + * @param publicNetworkAccessForQuery The network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled' + * @return the next update stage + */ + Update withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery); + } + + /** + * The stage of the workspace update allowing to specify RetentionInDays. + */ + interface WithRetentionInDays { + /** + * Specifies retentionInDays. + * @param retentionInDays The workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus + * @return the next update stage + */ + Update withRetentionInDays(Integer retentionInDays); + } + + /** + * The stage of the workspace update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the workspace + * @return the next update stage + */ + Update withSku(WorkspaceSku sku); + } + + /** + * The stage of the workspace update allowing to specify WorkspaceCapping. + */ + interface WithWorkspaceCapping { + /** + * Specifies workspaceCapping. + * @param workspaceCapping The daily volume cap for ingestion + * @return the next update stage + */ + Update withWorkspaceCapping(WorkspaceCapping workspaceCapping); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceCapping.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceCapping.java new file mode 100644 index 000000000000..23d0e6dc3efc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceCapping.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The daily volume cap for ingestion. + */ +public class WorkspaceCapping { + /** + * The workspace daily quota for ingestion. -1 means unlimited. + */ + @JsonProperty(value = "dailyQuotaGb") + private Double dailyQuotaGb; + + /** + * The time when the quota will be rest. + */ + @JsonProperty(value = "quotaNextResetTime", access = JsonProperty.Access.WRITE_ONLY) + private String quotaNextResetTime; + + /** + * The status of data ingestion for this workspace. Possible values + * include: 'RespectQuota', 'ForceOn', 'ForceOff', 'OverQuota', + * 'SubscriptionSuspended', 'ApproachingQuota'. + */ + @JsonProperty(value = "dataIngestionStatus", access = JsonProperty.Access.WRITE_ONLY) + private DataIngestionStatus dataIngestionStatus; + + /** + * Get the workspace daily quota for ingestion. -1 means unlimited. + * + * @return the dailyQuotaGb value + */ + public Double dailyQuotaGb() { + return this.dailyQuotaGb; + } + + /** + * Set the workspace daily quota for ingestion. -1 means unlimited. + * + * @param dailyQuotaGb the dailyQuotaGb value to set + * @return the WorkspaceCapping object itself. + */ + public WorkspaceCapping withDailyQuotaGb(Double dailyQuotaGb) { + this.dailyQuotaGb = dailyQuotaGb; + return this; + } + + /** + * Get the time when the quota will be rest. + * + * @return the quotaNextResetTime value + */ + public String quotaNextResetTime() { + return this.quotaNextResetTime; + } + + /** + * Get the status of data ingestion for this workspace. Possible values include: 'RespectQuota', 'ForceOn', 'ForceOff', 'OverQuota', 'SubscriptionSuspended', 'ApproachingQuota'. + * + * @return the dataIngestionStatus value + */ + public DataIngestionStatus dataIngestionStatus() { + return this.dataIngestionStatus; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceEntityStatus.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceEntityStatus.java new file mode 100644 index 000000000000..41251ba2756f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceEntityStatus.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WorkspaceEntityStatus. + */ +public final class WorkspaceEntityStatus extends ExpandableStringEnum { + /** Static value Creating for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus CREATING = fromString("Creating"); + + /** Static value Succeeded for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus FAILED = fromString("Failed"); + + /** Static value Canceled for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus CANCELED = fromString("Canceled"); + + /** Static value Deleting for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** Static value Updating for WorkspaceEntityStatus. */ + public static final WorkspaceEntityStatus UPDATING = fromString("Updating"); + + /** + * Creates or finds a WorkspaceEntityStatus from its string representation. + * @param name a name to look for + * @return the corresponding WorkspaceEntityStatus + */ + @JsonCreator + public static WorkspaceEntityStatus fromString(String name) { + return fromString(name, WorkspaceEntityStatus.class); + } + + /** + * @return known WorkspaceEntityStatus values + */ + public static Collection values() { + return values(WorkspaceEntityStatus.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceModel.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceModel.java new file mode 100644 index 000000000000..54e6dfb3fffb --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceModel.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspaceInner; + +/** + * Type representing WorkspaceModel. + */ +public interface WorkspaceModel extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, HasManager { + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the privateLinkScopedResources value. + */ + List privateLinkScopedResources(); + + /** + * @return the provisioningState value. + */ + WorkspaceEntityStatus provisioningState(); + + /** + * @return the publicNetworkAccessForIngestion value. + */ + PublicNetworkAccessType publicNetworkAccessForIngestion(); + + /** + * @return the publicNetworkAccessForQuery value. + */ + PublicNetworkAccessType publicNetworkAccessForQuery(); + + /** + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * @return the sku value. + */ + WorkspaceSku sku(); + + /** + * @return the workspaceCapping value. + */ + WorkspaceCapping workspaceCapping(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePatch.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePatch.java new file mode 100644 index 000000000000..70d562d5f8f8 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePatch.java @@ -0,0 +1,239 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.List; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The top level Workspace resource container. + */ +@JsonFlatten +public class WorkspacePatch extends AzureEntityResource { + /** + * The provisioning state of the workspace. Possible values include: + * 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', + * 'ProvisioningAccount', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private WorkspaceEntityStatus provisioningState; + + /** + * This is a read-only property. Represents the ID associated with the + * workspace. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The SKU of the workspace. + */ + @JsonProperty(value = "properties.sku") + private WorkspaceSku sku; + + /** + * The workspace data retention in days. -1 means Unlimited retention for + * the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /** + * The daily volume cap for ingestion. + */ + @JsonProperty(value = "properties.workspaceCapping") + private WorkspaceCapping workspaceCapping; + + /** + * The network access type for accessing Log Analytics ingestion. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccessForIngestion") + private PublicNetworkAccessType publicNetworkAccessForIngestion; + + /** + * The network access type for accessing Log Analytics query. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccessForQuery") + private PublicNetworkAccessType publicNetworkAccessForQuery; + + /** + * List of linked private link scope resources. + */ + @JsonProperty(value = "properties.privateLinkScopedResources", access = JsonProperty.Access.WRITE_ONLY) + private List privateLinkScopedResources; + + /** + * Resource tags. Optional. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @return the provisioningState value + */ + public WorkspaceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @param provisioningState the provisioningState value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withProvisioningState(WorkspaceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get this is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the SKU of the workspace. + * + * @return the sku value + */ + public WorkspaceSku sku() { + return this.sku; + } + + /** + * Set the SKU of the workspace. + * + * @param sku the sku value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withSku(WorkspaceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @return the retentionInDays value + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @param retentionInDays the retentionInDays value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Get the daily volume cap for ingestion. + * + * @return the workspaceCapping value + */ + public WorkspaceCapping workspaceCapping() { + return this.workspaceCapping; + } + + /** + * Set the daily volume cap for ingestion. + * + * @param workspaceCapping the workspaceCapping value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + this.workspaceCapping = workspaceCapping; + return this; + } + + /** + * Get the network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. + * + * @return the publicNetworkAccessForIngestion value + */ + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.publicNetworkAccessForIngestion; + } + + /** + * Set the network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. + * + * @param publicNetworkAccessForIngestion the publicNetworkAccessForIngestion value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + this.publicNetworkAccessForIngestion = publicNetworkAccessForIngestion; + return this; + } + + /** + * Get the network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled'. + * + * @return the publicNetworkAccessForQuery value + */ + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.publicNetworkAccessForQuery; + } + + /** + * Set the network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled'. + * + * @param publicNetworkAccessForQuery the publicNetworkAccessForQuery value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + this.publicNetworkAccessForQuery = publicNetworkAccessForQuery; + return this; + } + + /** + * Get list of linked private link scope resources. + * + * @return the privateLinkScopedResources value + */ + public List privateLinkScopedResources() { + return this.privateLinkScopedResources; + } + + /** + * Get resource tags. Optional. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. Optional. + * + * @param tags the tags value to set + * @return the WorkspacePatch object itself. + */ + public WorkspacePatch withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBody.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBody.java new file mode 100644 index 000000000000..66baab9ec88a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBody.java @@ -0,0 +1,71 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the body of a purge request for an App Insights Workspace. + */ +public class WorkspacePurgeBody { + /** + * Table from which to purge data. + */ + @JsonProperty(value = "table", required = true) + private String table; + + /** + * The set of columns and filters (queries) to run over them to purge the + * resulting data. + */ + @JsonProperty(value = "filters", required = true) + private List filters; + + /** + * Get table from which to purge data. + * + * @return the table value + */ + public String table() { + return this.table; + } + + /** + * Set table from which to purge data. + * + * @param table the table value to set + * @return the WorkspacePurgeBody object itself. + */ + public WorkspacePurgeBody withTable(String table) { + this.table = table; + return this; + } + + /** + * Get the set of columns and filters (queries) to run over them to purge the resulting data. + * + * @return the filters value + */ + public List filters() { + return this.filters; + } + + /** + * Set the set of columns and filters (queries) to run over them to purge the resulting data. + * + * @param filters the filters value to set + * @return the WorkspacePurgeBody object itself. + */ + public WorkspacePurgeBody withFilters(List filters) { + this.filters = filters; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBodyFilters.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBodyFilters.java new file mode 100644 index 000000000000..d6c086f296ab --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeBodyFilters.java @@ -0,0 +1,125 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * User-defined filters to return data which will be purged from the table. + */ +public class WorkspacePurgeBodyFilters { + /** + * The column of the table over which the given query should run. + */ + @JsonProperty(value = "column") + private String column; + + /** + * A query operator to evaluate over the provided column and value(s). + * Supported operators are ==, =~, in, in~, >, >=, <, <=, + * between, and have the same behavior as they would in a KQL query. + */ + @JsonProperty(value = "operator") + private String operator; + + /** + * the value for the operator to function over. This can be a number (e.g., + * > 100), a string (timestamp >= '2017-09-01') or array of values. + */ + @JsonProperty(value = "value") + private Object value; + + /** + * When filtering over custom dimensions, this key will be used as the name + * of the custom dimension. + */ + @JsonProperty(value = "key") + private String key; + + /** + * Get the column of the table over which the given query should run. + * + * @return the column value + */ + public String column() { + return this.column; + } + + /** + * Set the column of the table over which the given query should run. + * + * @param column the column value to set + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withColumn(String column) { + this.column = column; + return this; + } + + /** + * Get a query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. + * + * @return the operator value + */ + public String operator() { + return this.operator; + } + + /** + * Set a query operator to evaluate over the provided column and value(s). Supported operators are ==, =~, in, in~, >, >=, <, <=, between, and have the same behavior as they would in a KQL query. + * + * @param operator the operator value to set + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. + * + * @return the value value + */ + public Object value() { + return this.value; + } + + /** + * Set the value for the operator to function over. This can be a number (e.g., > 100), a string (timestamp >= '2017-09-01') or array of values. + * + * @param value the value value to set + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withValue(Object value) { + this.value = value; + return this; + } + + /** + * Get when filtering over custom dimensions, this key will be used as the name of the custom dimension. + * + * @return the key value + */ + public String key() { + return this.key; + } + + /** + * Set when filtering over custom dimensions, this key will be used as the name of the custom dimension. + * + * @param key the key value to set + * @return the WorkspacePurgeBodyFilters object itself. + */ + public WorkspacePurgeBodyFilters withKey(String key) { + this.key = key; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgePurgeHeaders.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgePurgeHeaders.java new file mode 100644 index 000000000000..b403ed5e13f2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgePurgeHeaders.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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Defines headers for Purge operation. + */ +public class WorkspacePurgePurgeHeaders { + /** + * The location from which to request the operation status. + */ + @JsonProperty(value = "x-ms-status-location") + private String xMsStatusLocation; + + /** + * Get the location from which to request the operation status. + * + * @return the xMsStatusLocation value + */ + public String xMsStatusLocation() { + return this.xMsStatusLocation; + } + + /** + * Set the location from which to request the operation status. + * + * @param xMsStatusLocation the xMsStatusLocation value to set + * @return the WorkspacePurgePurgeHeaders object itself. + */ + public WorkspacePurgePurgeHeaders withXMsStatusLocation(String xMsStatusLocation) { + this.xMsStatusLocation = xMsStatusLocation; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeResponse.java new file mode 100644 index 000000000000..8b4106444ec8 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeResponse.java @@ -0,0 +1,25 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspacePurgeResponseInner; + +/** + * Type representing WorkspacePurgeResponse. + */ +public interface WorkspacePurgeResponse extends HasInner, HasManager { + /** + * @return the operationId value. + */ + String operationId(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeStatusResponse.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeStatusResponse.java new file mode 100644 index 000000000000..3bba6fd728c6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurgeStatusResponse.java @@ -0,0 +1,25 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspacePurgeStatusResponseInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing WorkspacePurgeStatusResponse. + */ +public interface WorkspacePurgeStatusResponse extends HasInner, HasManager { + /** + * @return the status value. + */ + PurgeState status(); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurges.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurges.java new file mode 100644 index 000000000000..a5907effcc93 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspacePurges.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.loganalytics.v2020_03_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspacePurgesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing WorkspacePurges. + */ +public interface WorkspacePurges extends HasInner { + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getPurgeStatusAsync(String resourceGroupName, String workspaceName, String purgeId); + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a request to purge data in a single table of an Log Analytics Workspace + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable purgeAsync(String resourceGroupName, String workspaceName, WorkspacePurgeBody body); + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSku.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSku.java new file mode 100644 index 000000000000..c50390203a08 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSku.java @@ -0,0 +1,102 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SKU (tier) of a workspace. + */ +public class WorkspaceSku { + /** + * The name of the SKU. Possible values include: 'Free', 'Standard', + * 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + */ + @JsonProperty(value = "name", required = true) + private WorkspaceSkuNameEnum name; + + /** + * The capacity reservation level for this workspace, when + * CapacityReservation sku is selected. + */ + @JsonProperty(value = "capacityReservationLevel") + private Integer capacityReservationLevel; + + /** + * The maximum capacity reservation level available for this workspace, + * when CapacityReservation sku is selected. + */ + @JsonProperty(value = "maxCapacityReservationLevel", access = JsonProperty.Access.WRITE_ONLY) + private Integer maxCapacityReservationLevel; + + /** + * The last time when the sku was updated. + */ + @JsonProperty(value = "lastSkuUpdate", access = JsonProperty.Access.WRITE_ONLY) + private String lastSkuUpdate; + + /** + * Get the name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + * + * @return the name value + */ + public WorkspaceSkuNameEnum name() { + return this.name; + } + + /** + * Set the name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + * + * @param name the name value to set + * @return the WorkspaceSku object itself. + */ + public WorkspaceSku withName(WorkspaceSkuNameEnum name) { + this.name = name; + return this; + } + + /** + * Get the capacity reservation level for this workspace, when CapacityReservation sku is selected. + * + * @return the capacityReservationLevel value + */ + public Integer capacityReservationLevel() { + return this.capacityReservationLevel; + } + + /** + * Set the capacity reservation level for this workspace, when CapacityReservation sku is selected. + * + * @param capacityReservationLevel the capacityReservationLevel value to set + * @return the WorkspaceSku object itself. + */ + public WorkspaceSku withCapacityReservationLevel(Integer capacityReservationLevel) { + this.capacityReservationLevel = capacityReservationLevel; + return this; + } + + /** + * Get the maximum capacity reservation level available for this workspace, when CapacityReservation sku is selected. + * + * @return the maxCapacityReservationLevel value + */ + public Integer maxCapacityReservationLevel() { + return this.maxCapacityReservationLevel; + } + + /** + * Get the last time when the sku was updated. + * + * @return the lastSkuUpdate value + */ + public String lastSkuUpdate() { + return this.lastSkuUpdate; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSkuNameEnum.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSkuNameEnum.java new file mode 100644 index 000000000000..a65a47df5549 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/WorkspaceSkuNameEnum.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.loganalytics.v2020_03_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for WorkspaceSkuNameEnum. + */ +public final class WorkspaceSkuNameEnum extends ExpandableStringEnum { + /** Static value Free for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum FREE = fromString("Free"); + + /** Static value Standard for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum STANDARD = fromString("Standard"); + + /** Static value Premium for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PREMIUM = fromString("Premium"); + + /** Static value PerNode for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PER_NODE = fromString("PerNode"); + + /** Static value PerGB2018 for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum PER_GB2018 = fromString("PerGB2018"); + + /** Static value Standalone for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum STANDALONE = fromString("Standalone"); + + /** Static value CapacityReservation for WorkspaceSkuNameEnum. */ + public static final WorkspaceSkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a WorkspaceSkuNameEnum from its string representation. + * @param name a name to look for + * @return the corresponding WorkspaceSkuNameEnum + */ + @JsonCreator + public static WorkspaceSkuNameEnum fromString(String name) { + return fromString(name, WorkspaceSkuNameEnum.class); + } + + /** + * @return known WorkspaceSkuNameEnum values + */ + public static Collection values() { + return values(WorkspaceSkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspaces.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspaces.java new file mode 100644 index 000000000000..b47d875f9937 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/Workspaces.java @@ -0,0 +1,25 @@ +/** + * 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.loganalytics.v2020_03_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation.WorkspacesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Workspaces. + */ +public interface Workspaces extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierImpl.java new file mode 100644 index 000000000000..a13e0e07b318 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierImpl.java @@ -0,0 +1,66 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.AvailableServiceTier; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SkuNameEnum; + +class AvailableServiceTierImpl extends WrapperImpl implements AvailableServiceTier { + private final LogAnalyticsManager manager; + + AvailableServiceTierImpl(AvailableServiceTierInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public Long capacityReservationLevel() { + return this.inner().capacityReservationLevel(); + } + + @Override + public Long defaultRetention() { + return this.inner().defaultRetention(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String lastSkuUpdate() { + return this.inner().lastSkuUpdate(); + } + + @Override + public Long maximumRetention() { + return this.inner().maximumRetention(); + } + + @Override + public Long minimumRetention() { + return this.inner().minimumRetention(); + } + + @Override + public SkuNameEnum serviceTier() { + return this.inner().serviceTier(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierInner.java new file mode 100644 index 000000000000..3f87b43fd8e0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTierInner.java @@ -0,0 +1,127 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SkuNameEnum; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Service Tier details. + */ +public class AvailableServiceTierInner { + /** + * The name of the Service Tier. Possible values include: 'Free', + * 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', + * 'CapacityReservation'. + */ + @JsonProperty(value = "serviceTier", access = JsonProperty.Access.WRITE_ONLY) + private SkuNameEnum serviceTier; + + /** + * True if the Service Tier is enabled for the workspace. + */ + @JsonProperty(value = "enabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean enabled; + + /** + * The minimum retention for the Service Tier, in days. + */ + @JsonProperty(value = "minimumRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long minimumRetention; + + /** + * The maximum retention for the Service Tier, in days. + */ + @JsonProperty(value = "maximumRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long maximumRetention; + + /** + * The default retention for the Service Tier, in days. + */ + @JsonProperty(value = "defaultRetention", access = JsonProperty.Access.WRITE_ONLY) + private Long defaultRetention; + + /** + * The capacity reservation level in GB per day. Returned for the Capacity + * Reservation Service Tier. + */ + @JsonProperty(value = "capacityReservationLevel", access = JsonProperty.Access.WRITE_ONLY) + private Long capacityReservationLevel; + + /** + * Time when the sku was last updated for the workspace. Returned for the + * Capacity Reservation Service Tier. + */ + @JsonProperty(value = "lastSkuUpdate", access = JsonProperty.Access.WRITE_ONLY) + private String lastSkuUpdate; + + /** + * Get the name of the Service Tier. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + * + * @return the serviceTier value + */ + public SkuNameEnum serviceTier() { + return this.serviceTier; + } + + /** + * Get true if the Service Tier is enabled for the workspace. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Get the minimum retention for the Service Tier, in days. + * + * @return the minimumRetention value + */ + public Long minimumRetention() { + return this.minimumRetention; + } + + /** + * Get the maximum retention for the Service Tier, in days. + * + * @return the maximumRetention value + */ + public Long maximumRetention() { + return this.maximumRetention; + } + + /** + * Get the default retention for the Service Tier, in days. + * + * @return the defaultRetention value + */ + public Long defaultRetention() { + return this.defaultRetention; + } + + /** + * Get the capacity reservation level in GB per day. Returned for the Capacity Reservation Service Tier. + * + * @return the capacityReservationLevel value + */ + public Long capacityReservationLevel() { + return this.capacityReservationLevel; + } + + /** + * Get time when the sku was last updated for the workspace. Returned for the Capacity Reservation Service Tier. + * + * @return the lastSkuUpdate value + */ + public String lastSkuUpdate() { + return this.lastSkuUpdate; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersImpl.java new file mode 100644 index 000000000000..096d3457a9e3 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersImpl.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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.AvailableServiceTiers; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.AvailableServiceTier; + +class AvailableServiceTiersImpl extends WrapperImpl implements AvailableServiceTiers { + private final LogAnalyticsManager manager; + + AvailableServiceTiersImpl(LogAnalyticsManager manager) { + super(manager.inner().availableServiceTiers()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private AvailableServiceTierImpl wrapModel(AvailableServiceTierInner inner) { + return new AvailableServiceTierImpl(inner, manager()); + } + + @Override + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + AvailableServiceTiersInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public AvailableServiceTier call(AvailableServiceTierInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersInner.java new file mode 100644 index 000000000000..8e0980502d88 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/AvailableServiceTiersInner.java @@ -0,0 +1,147 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in AvailableServiceTiers. + */ +public class AvailableServiceTiersInner { + /** The Retrofit service to perform REST calls. */ + private AvailableServiceTiersService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of AvailableServiceTiersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public AvailableServiceTiersInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(AvailableServiceTiersService.class); + this.client = client; + } + + /** + * The interface defining all the services for AvailableServiceTiers to be + * used by Retrofit to perform actually REST calls. + */ + interface AvailableServiceTiersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.AvailableServiceTiers listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/availableServiceTiers") + Observable> listByWorkspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<AvailableServiceTierInner> object if successful. + */ + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AvailableServiceTierInner> object + */ + public Observable> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the available service tiers for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<AvailableServiceTierInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(this.client.subscriptionId(), resourceGroupName, workspaceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listByWorkspaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterImpl.java new file mode 100644 index 000000000000..b17bdf930ca4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterImpl.java @@ -0,0 +1,133 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Cluster; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterPatch; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Identity; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterSku; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterEntityStatus; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.KeyVaultProperties; +import rx.functions.Func1; + +class ClusterImpl extends GroupableResourceCoreImpl implements Cluster, Cluster.Definition, Cluster.Update { + private ClusterPatch updateParameter; + ClusterImpl(String name, ClusterInner inner, LogAnalyticsManager manager) { + super(name, inner, manager); + this.updateParameter = new ClusterPatch(); + } + + @Override + public Observable createResourceAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public ClusterInner call(ClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public ClusterInner call(ClusterInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + ClustersInner client = this.manager().inner().clusters(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new ClusterPatch(); + } + + @Override + public String clusterId() { + return this.inner().clusterId(); + } + + @Override + public Identity identity() { + return this.inner().identity(); + } + + @Override + public KeyVaultProperties keyVaultProperties() { + return this.inner().keyVaultProperties(); + } + + @Override + public String nextLink() { + return this.inner().nextLink(); + } + + @Override + public ClusterEntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public ClusterSku sku() { + return this.inner().sku(); + } + + @Override + public ClusterImpl withIdentity(Identity identity) { + this.inner().withIdentity(identity); + return this; + } + + @Override + public ClusterImpl withNextLink(String nextLink) { + this.inner().withNextLink(nextLink); + return this; + } + + @Override + public ClusterImpl withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + if (isInCreateMode()) { + this.inner().withKeyVaultProperties(keyVaultProperties); + } else { + this.updateParameter.withKeyVaultProperties(keyVaultProperties); + } + return this; + } + + @Override + public ClusterImpl withSku(ClusterSku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterInner.java new file mode 100644 index 000000000000..5cd3fd1ad884 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClusterInner.java @@ -0,0 +1,160 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Identity; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterSku; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterEntityStatus; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.KeyVaultProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The top level Log Analytics cluster resource container. + */ +@JsonFlatten +public class ClusterInner extends Resource { + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * The sku properties. + */ + @JsonProperty(value = "sku") + private ClusterSku sku; + + /** + * The link used to get the next page of recommendations. + */ + @JsonProperty(value = "properties.nextLink") + private String nextLink; + + /** + * The ID associated with the cluster. + */ + @JsonProperty(value = "properties.clusterId", access = JsonProperty.Access.WRITE_ONLY) + private String clusterId; + + /** + * The provisioning state of the cluster. Possible values include: + * 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', + * 'ProvisioningAccount', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ClusterEntityStatus provisioningState; + + /** + * The associated key properties. + */ + @JsonProperty(value = "properties.keyVaultProperties") + private KeyVaultProperties keyVaultProperties; + + /** + * Get the identity of the resource. + * + * @return the identity value + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity of the resource. + * + * @param identity the identity value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku properties. + * + * @return the sku value + */ + public ClusterSku sku() { + return this.sku; + } + + /** + * Set the sku properties. + * + * @param sku the sku value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withSku(ClusterSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the link used to get the next page of recommendations. + * + * @return the nextLink value + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the link used to get the next page of recommendations. + * + * @param nextLink the nextLink value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Get the ID associated with the cluster. + * + * @return the clusterId value + */ + public String clusterId() { + return this.clusterId; + } + + /** + * Get the provisioning state of the cluster. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @return the provisioningState value + */ + public ClusterEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Get the associated key properties. + * + * @return the keyVaultProperties value + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the associated key properties. + * + * @param keyVaultProperties the keyVaultProperties value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersImpl.java new file mode 100644 index 000000000000..2638fb6969e3 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Clusters; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Cluster; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class ClustersImpl extends GroupableResourcesCoreImpl implements Clusters { + protected ClustersImpl(LogAnalyticsManager manager) { + super(manager.inner().clusters(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + ClustersInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + ClustersInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + ClustersInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + ClustersInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Cluster call(ClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + ClustersInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + ClustersInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Cluster call(ClusterInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public ClusterImpl define(String name) { + return wrapModel(name); + } + + @Override + protected ClusterImpl wrapModel(ClusterInner inner) { + return new ClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected ClusterImpl wrapModel(String name) { + return new ClusterImpl(name, new ClusterInner(), this.manager()); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersInner.java new file mode 100644 index 000000000000..c1922190e136 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ClustersInner.java @@ -0,0 +1,1062 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterErrorResponseException; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ClusterPatch; +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 com.microsoft.rest.Validator; +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.HTTP; +import retrofit2.http.PATCH; +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 Clusters. + */ +public class ClustersInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private ClustersService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of ClustersInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ClustersInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(ClustersService.class); + this.client = client; + } + + /** + * The interface defining all the services for Clusters to be + * used by Retrofit to perform actually REST calls. + */ + interface ClustersService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Clusters listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Clusters list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/clusters") + Observable> list(@Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Clusters createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterInner parameters, @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.loganalytics.v2020_03_01_preview.Clusters beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("clusterName") String clusterName, @Query("api-version") String apiVersion, @Body ClusterInner parameters, @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.loganalytics.v2020_03_01_preview.Clusters delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Clusters beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Clusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @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.loganalytics.v2020_03_01_preview.Clusters update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterPatch parameters, @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.loganalytics.v2020_03_01_preview.Clusters listByResourceGroupNext" }) + @GET + Observable> listByResourceGroupNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Clusters listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException 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<ClusterInner> object if successful. + */ + public PagedList listByResourceGroup(final String resourceGroupName) { + ServiceResponse> response = listByResourceGroupSinglePageAsync(resourceGroupName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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> listByResourceGroupAsync(final String resourceGroupName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupSinglePageAsync(resourceGroupName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClusterInner> object + */ + public Observable> listByResourceGroupAsync(final String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClusterInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(final String resourceGroupName) { + return listByResourceGroupSinglePageAsync(resourceGroupName) + .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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupSinglePageAsync(final String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ClusterErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException 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<ClusterInner> 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 Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClusterInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<ClusterInner> 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 Log Analytics clusters in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ClusterInner> 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."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ClusterErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @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 createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, this.client.subscriptionId(), clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner beginCreateOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName The name of the Log Analytics cluster. + * @param parameters The parameters required to create or update a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, this.client.subscriptionId(), clusterName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String clusterName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().last().body(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 deleteAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String clusterName) { + return deleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String clusterName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 beginDeleteAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String clusterName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String clusterName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, clusterName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner getByResourceGroup(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @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 getByResourceGroupAsync(String resourceGroupName, String clusterName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName), serviceCallback); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String clusterName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String clusterName) { + 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 (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, clusterName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The parameters required to patch a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the ClusterInner object if successful. + */ + public ClusterInner update(String resourceGroupName, String clusterName, ClusterPatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The parameters required to patch a Log Analytics cluster. + * @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 clusterName, ClusterPatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters), serviceCallback); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The parameters required to patch a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable updateAsync(String resourceGroupName, String clusterName, ClusterPatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, ClusterInner>() { + @Override + public ClusterInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param clusterName Name of the Log Analytics Cluster. + * @param parameters The parameters required to patch a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ClusterInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterPatch parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (clusterName == null) { + throw new IllegalArgumentException("Parameter clusterName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, clusterName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), 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 ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException 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<ClusterInner> object if successful. + */ + public PagedList listByResourceGroupNext(final String nextPageLink) { + ServiceResponse> response = listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @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> listByResourceGroupNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByResourceGroupNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @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<ClusterInner> object + */ + public Observable> listByResourceGroupNextAsync(final String nextPageLink) { + return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + * @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<ClusterInner> object + */ + public Observable>> listByResourceGroupNextWithServiceResponseAsync(final String nextPageLink) { + return listByResourceGroupNextSinglePageAsync(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(listByResourceGroupNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets Log Analytics clusters in a resource group. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ClusterInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByResourceGroupNextSinglePageAsync(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.listByResourceGroupNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupNextDelegate(Response response) throws ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ClusterErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ClusterErrorResponseException 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<ClusterInner> 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 Log Analytics clusters in a subscription. + * + * @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 Log Analytics clusters in a subscription. + * + * @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<ClusterInner> 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 Log Analytics clusters in a subscription. + * + * @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<ClusterInner> 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 Log Analytics clusters in a subscription. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<ClusterInner> 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 ClusterErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ClusterErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ClusterErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportImpl.java new file mode 100644 index 000000000000..3e1ff39a1f76 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportImpl.java @@ -0,0 +1,189 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataExport; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Type; + +class DataExportImpl extends CreatableUpdatableImpl implements DataExport, DataExport.Definition, DataExport.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String dataExportName; + + DataExportImpl(String name, LogAnalyticsManager manager) { + super(name, new DataExportInner()); + this.manager = manager; + // Set resource name + this.dataExportName = name; + // + } + + DataExportImpl(DataExportInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataExportName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.dataExportName = IdParsingUtils.getValueFromIdByName(inner.id(), "dataExports"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataExportsInner client = this.manager().inner().dataExports(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataExportName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataExportsInner client = this.manager().inner().dataExports(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataExportName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataExportsInner client = this.manager().inner().dataExports(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.dataExportName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public Boolean allTables() { + return this.inner().allTables(); + } + + @Override + public String createdDate() { + return this.inner().createdDate(); + } + + @Override + public String dataExportId() { + return this.inner().dataExportId(); + } + + @Override + public Type dataExportType() { + return this.inner().dataExportType(); + } + + @Override + public Boolean enable() { + return this.inner().enable(); + } + + @Override + public String eventHubName() { + return this.inner().eventHubName(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String lastModifiedDate() { + return this.inner().lastModifiedDate(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public List tableNames() { + return this.inner().tableNames(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataExportImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public DataExportImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + + @Override + public DataExportImpl withAllTables(Boolean allTables) { + this.inner().withAllTables(allTables); + return this; + } + + @Override + public DataExportImpl withCreatedDate(String createdDate) { + this.inner().withCreatedDate(createdDate); + return this; + } + + @Override + public DataExportImpl withDataExportId(String dataExportId) { + this.inner().withDataExportId(dataExportId); + return this; + } + + @Override + public DataExportImpl withEnable(Boolean enable) { + this.inner().withEnable(enable); + return this; + } + + @Override + public DataExportImpl withEventHubName(String eventHubName) { + this.inner().withEventHubName(eventHubName); + return this; + } + + @Override + public DataExportImpl withLastModifiedDate(String lastModifiedDate) { + this.inner().withLastModifiedDate(lastModifiedDate); + return this; + } + + @Override + public DataExportImpl withTableNames(List tableNames) { + this.inner().withTableNames(tableNames); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportInner.java new file mode 100644 index 000000000000..c927ba6efaca --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportInner.java @@ -0,0 +1,248 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Type; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The top level data export resource container. + */ +@JsonFlatten +public class DataExportInner extends ProxyResource { + /** + * The data export rule ID. + */ + @JsonProperty(value = "properties.dataExportId") + private String dataExportId; + + /** + * When ‘true’, all workspace's tables are exported. + */ + @JsonProperty(value = "properties.allTables") + private Boolean allTables; + + /** + * An array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + */ + @JsonProperty(value = "properties.tableNames") + private List tableNames; + + /** + * The destination resource ID. This can be copied from the Properties + * entry of the destination resource in Azure. + */ + @JsonProperty(value = "properties.destination.resourceId", required = true) + private String resourceId; + + /** + * The type of the destination resource. Possible values include: + * 'StorageAccount', 'EventHub'. + */ + @JsonProperty(value = "properties.destination.type", access = JsonProperty.Access.WRITE_ONLY) + private Type dataExportType; + + /** + * Optional. Allows to define an Event Hub name. Not applicable when + * destination is Storage Account. + */ + @JsonProperty(value = "properties.destination.metaData.eventHubName") + private String eventHubName; + + /** + * Active when enabled. + */ + @JsonProperty(value = "properties.enable") + private Boolean enable; + + /** + * The latest data export rule modification time. + */ + @JsonProperty(value = "properties.createdDate") + private String createdDate; + + /** + * Date and time when the export was last modified. + */ + @JsonProperty(value = "properties.lastModifiedDate") + private String lastModifiedDate; + + /** + * Get the data export rule ID. + * + * @return the dataExportId value + */ + public String dataExportId() { + return this.dataExportId; + } + + /** + * Set the data export rule ID. + * + * @param dataExportId the dataExportId value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withDataExportId(String dataExportId) { + this.dataExportId = dataExportId; + return this; + } + + /** + * Get when ‘true’, all workspace's tables are exported. + * + * @return the allTables value + */ + public Boolean allTables() { + return this.allTables; + } + + /** + * Set when ‘true’, all workspace's tables are exported. + * + * @param allTables the allTables value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withAllTables(Boolean allTables) { + this.allTables = allTables; + return this; + } + + /** + * Get an array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * + * @return the tableNames value + */ + public List tableNames() { + return this.tableNames; + } + + /** + * Set an array of tables to export, for example: [“Heartbeat, SecurityEvent”]. + * + * @param tableNames the tableNames value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withTableNames(List tableNames) { + this.tableNames = tableNames; + return this; + } + + /** + * Get the destination resource ID. This can be copied from the Properties entry of the destination resource in Azure. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the destination resource ID. This can be copied from the Properties entry of the destination resource in Azure. + * + * @param resourceId the resourceId value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the type of the destination resource. Possible values include: 'StorageAccount', 'EventHub'. + * + * @return the dataExportType value + */ + public Type dataExportType() { + return this.dataExportType; + } + + /** + * Get optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account. + * + * @return the eventHubName value + */ + public String eventHubName() { + return this.eventHubName; + } + + /** + * Set optional. Allows to define an Event Hub name. Not applicable when destination is Storage Account. + * + * @param eventHubName the eventHubName value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withEventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Get active when enabled. + * + * @return the enable value + */ + public Boolean enable() { + return this.enable; + } + + /** + * Set active when enabled. + * + * @param enable the enable value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withEnable(Boolean enable) { + this.enable = enable; + return this; + } + + /** + * Get the latest data export rule modification time. + * + * @return the createdDate value + */ + public String createdDate() { + return this.createdDate; + } + + /** + * Set the latest data export rule modification time. + * + * @param createdDate the createdDate value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withCreatedDate(String createdDate) { + this.createdDate = createdDate; + return this; + } + + /** + * Get date and time when the export was last modified. + * + * @return the lastModifiedDate value + */ + public String lastModifiedDate() { + return this.lastModifiedDate; + } + + /** + * Set date and time when the export was last modified. + * + * @param lastModifiedDate the lastModifiedDate value to set + * @return the DataExportInner object itself. + */ + public DataExportInner withLastModifiedDate(String lastModifiedDate) { + this.lastModifiedDate = lastModifiedDate; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsImpl.java new file mode 100644 index 000000000000..cd55f6480c65 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsImpl.java @@ -0,0 +1,85 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataExports; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataExport; + +class DataExportsImpl extends WrapperImpl implements DataExports { + private final LogAnalyticsManager manager; + + DataExportsImpl(LogAnalyticsManager manager) { + super(manager.inner().dataExports()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public DataExportImpl define(String name) { + return wrapModel(name); + } + + private DataExportImpl wrapModel(DataExportInner inner) { + return new DataExportImpl(inner, manager()); + } + + private DataExportImpl wrapModel(String name) { + return new DataExportImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + DataExportsInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DataExport call(DataExportInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String dataExportName) { + DataExportsInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, dataExportName) + .flatMap(new Func1>() { + @Override + public Observable call(DataExportInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DataExport)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String dataExportName) { + DataExportsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, dataExportName).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsInner.java new file mode 100644 index 000000000000..b4aff8bcd3be --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataExportsInner.java @@ -0,0 +1,456 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataExportErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataExports. + */ +public class DataExportsInner { + /** The Retrofit service to perform REST calls. */ + private DataExportsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DataExportsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataExportsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(DataExportsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataExports to be + * used by Retrofit to perform actually REST calls. + */ + interface DataExportsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataExports listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports") + Observable> listByWorkspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @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.loganalytics.v2020_03_01_preview.DataExports createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataExportName") String dataExportName, @Query("api-version") String apiVersion, @Body DataExportInner parameters, @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.loganalytics.v2020_03_01_preview.DataExports get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataExportName") String dataExportName, @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.loganalytics.v2020_03_01_preview.DataExports delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataExportName") String dataExportName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DataExportErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<DataExportInner> object if successful. + */ + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataExportInner> object + */ + public Observable> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<DataExportInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(this.client.subscriptionId(), resourceGroupName, workspaceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(Response response) throws DataExportErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., DataExportErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(DataExportErrorResponseException.class) + .build(response); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The parameters required to create or update a data export. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DataExportErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataExportInner object if successful. + */ + public DataExportInner createOrUpdate(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The parameters required to create or update a data export. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters), serviceCallback); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The parameters required to create or update a data export. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataExportInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters).map(new Func1, DataExportInner>() { + @Override + public DataExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @param parameters The parameters required to create or update a data export. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataExportInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataExportName == null) { + throw new IllegalArgumentException("Parameter dataExportName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, workspaceName, dataExportName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws DataExportErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(DataExportErrorResponseException.class) + .build(response); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DataExportErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataExportInner object if successful. + */ + public DataExportInner get(String resourceGroupName, String workspaceName, String dataExportName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName).toBlocking().single().body(); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @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 workspaceName, String dataExportName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName), serviceCallback); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataExportInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String dataExportName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName).map(new Func1, DataExportInner>() { + @Override + public DataExportInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataExportInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataExportName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataExportName == null) { + throw new IllegalArgumentException("Parameter dataExportName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, workspaceName, dataExportName, 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 DataExportErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(DataExportErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws DataExportErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String workspaceName, String dataExportName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName).toBlocking().single().body(); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @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 deleteAsync(String resourceGroupName, String workspaceName, String dataExportName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName), serviceCallback); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String dataExportName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataExportName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataExportName == null) { + throw new IllegalArgumentException("Parameter dataExportName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, workspaceName, dataExportName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws DataExportErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(DataExportErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceImpl.java new file mode 100644 index 000000000000..0ff8899ca4f2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceImpl.java @@ -0,0 +1,140 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSourceKind; +import java.util.Map; + +class DataSourceImpl extends CreatableUpdatableImpl implements DataSource, DataSource.Definition, DataSource.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String dataSourceName; + + DataSourceImpl(String name, LogAnalyticsManager manager) { + super(name, new DataSourceInner()); + this.manager = manager; + // Set resource name + this.dataSourceName = name; + // + } + + DataSourceImpl(DataSourceInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataSourceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.dataSourceName = IdParsingUtils.getValueFromIdByName(inner.id(), "dataSources"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DataSourceKind kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataSourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public DataSourceImpl withKind(DataSourceKind kind) { + this.inner().withKind(kind); + return this; + } + + @Override + public DataSourceImpl withProperties(Object properties) { + this.inner().withProperties(properties); + return this; + } + + @Override + public DataSourceImpl withEtag(String etag) { + this.inner().withEtag(etag); + return this; + } + + @Override + public DataSourceImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceInner.java new file mode 100644 index 000000000000..c826a431a0ba --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourceInner.java @@ -0,0 +1,139 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSourceKind; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Datasources under OMS Workspace. + */ +public class DataSourceInner extends ProxyResource { + /** + * The data source properties in raw json format, each kind of data source + * have it's own schema. + */ + @JsonProperty(value = "properties", required = true) + private Object properties; + + /** + * The ETag of the data source. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * Possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', + * 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', + * 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', + * 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', + * 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', + * 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', + * 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', + * 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', + * 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', + * 'SecurityWindowsBaselineConfiguration', + * 'SecurityCenterSecurityWindowsBaselineConfiguration', + * 'SecurityEventCollectionConfiguration', + * 'SecurityInsightsSecurityEventCollectionConfiguration', + * 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', + * 'ApplicationInsights', 'SqlDataClassification'. + */ + @JsonProperty(value = "kind", required = true) + private DataSourceKind kind; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the data source properties in raw json format, each kind of data source have it's own schema. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the data source properties in raw json format, each kind of data source have it's own schema. + * + * @param properties the properties value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the ETag of the data source. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the ETag of the data source. + * + * @param etag the etag value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'. + * + * @return the kind value + */ + public DataSourceKind kind() { + return this.kind; + } + + /** + * Set possible values include: 'WindowsEvent', 'WindowsPerformanceCounter', 'IISLogs', 'LinuxSyslog', 'LinuxSyslogCollection', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'CustomLog', 'CustomLogCollection', 'AzureAuditLog', 'AzureActivityLog', 'GenericDataSource', 'ChangeTrackingCustomPath', 'ChangeTrackingPath', 'ChangeTrackingServices', 'ChangeTrackingDataTypeConfiguration', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingRegistry', 'ChangeTrackingLinuxPath', 'LinuxChangeTrackingPath', 'ChangeTrackingContentLocation', 'WindowsTelemetry', 'Office365', 'SecurityWindowsBaselineConfiguration', 'SecurityCenterSecurityWindowsBaselineConfiguration', 'SecurityEventCollectionConfiguration', 'SecurityInsightsSecurityEventCollectionConfiguration', 'ImportComputerGroup', 'NetworkMonitoring', 'Itsm', 'DnsAnalytics', 'ApplicationInsights', 'SqlDataClassification'. + * + * @param kind the kind value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withKind(DataSourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesImpl.java new file mode 100644 index 000000000000..545e6d449818 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesImpl.java @@ -0,0 +1,85 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSources; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSource; + +class DataSourcesImpl extends WrapperImpl implements DataSources { + private final LogAnalyticsManager manager; + + DataSourcesImpl(LogAnalyticsManager manager) { + super(manager.inner().dataSources()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public DataSourceImpl define(String name) { + return wrapModel(name); + } + + private DataSourceImpl wrapModel(DataSourceInner inner) { + return new DataSourceImpl(inner, manager()); + } + + private DataSourceImpl wrapModel(String name) { + return new DataSourceImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter) { + DataSourcesInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DataSource call(DataSourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + DataSourcesInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, dataSourceName) + .flatMap(new Func1>() { + @Override + public Observable call(DataSourceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DataSource)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + DataSourcesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, dataSourceName).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesInner.java new file mode 100644 index 000000000000..8703a5d3e027 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DataSourcesInner.java @@ -0,0 +1,746 @@ +/** + * 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.loganalytics.v2020_03_01_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.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +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.HTTP; +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 DataSources. + */ +public class DataSourcesInner { + /** The Retrofit service to perform REST calls. */ + private DataSourcesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DataSourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataSourcesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(DataSourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataSources to be + * used by Retrofit to perform actually REST calls. + */ + interface DataSourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @Body DataSourceInner parameters, @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.loganalytics.v2020_03_01_preview.DataSources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.DataSources get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.DataSources listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @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.loganalytics.v2020_03_01_preview.DataSources listByWorkspaceNext" }) + @GET + Observable> listByWorkspaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @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 DataSourceInner object if successful. + */ + public DataSourceInner createOrUpdate(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters), serviceCallback); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters).map(new Func1, DataSourceInner>() { + @Override + public DataSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, String dataSourceName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).toBlocking().single().body(); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @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 deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName), serviceCallback); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource + * @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 DataSourceInner object if successful. + */ + public DataSourceInner get(String resourceGroupName, String workspaceName, String dataSourceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).toBlocking().single().body(); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource + * @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 workspaceName, String dataSourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName), serviceCallback); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).map(new Func1, DataSourceInner>() { + @Override + public DataSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the 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<DataSourceInner> object if successful. + */ + public PagedList listByWorkspace(final String resourceGroupName, final String workspaceName, final String filter) { + ServiceResponse> response = listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @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> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String filter) { + return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter) + .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(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final String workspaceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skiptoken = null; + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), filter, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @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<DataSourceInner> object if successful. + */ + public PagedList listByWorkspace(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + ServiceResponse> response = listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source 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> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, 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(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param workspaceName The name of the workspace. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), filter, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(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); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @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<DataSourceInner> object if successful. + */ + public PagedList listByWorkspaceNext(final String nextPageLink) { + ServiceResponse> response = listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @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> listByWorkspaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @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<DataSourceInner> object + */ + public Observable> listByWorkspaceNextAsync(final String nextPageLink) { + return listByWorkspaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @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<DataSourceInner> object + */ + public Observable>> listByWorkspaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(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(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceNextSinglePageAsync(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.listByWorkspaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceNextDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesImpl.java new file mode 100644 index 000000000000..698cb74c8652 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesImpl.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. + * def + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DeletedWorkspaces; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceModel; +import rx.Observable; +import rx.Completable; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class DeletedWorkspacesImpl extends GroupableResourcesCoreImpl implements DeletedWorkspaces { + protected DeletedWorkspacesImpl(LogAnalyticsManager manager) { + super(manager.inner().deletedWorkspaces(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + return null; // NOP Retrieve by resource group not supported + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + DeletedWorkspacesInner client = this.inner(); + return Completable.error(new Throwable("Delete by RG not supported for this resource")); // NOP Delete by RG not supported + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + DeletedWorkspacesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + DeletedWorkspacesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public WorkspaceModel call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + DeletedWorkspacesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + DeletedWorkspacesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public WorkspaceModel call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + protected WorkspaceModelImpl wrapModel(WorkspaceInner inner) { + return new WorkspaceModelImpl(inner.name(), inner, manager()); + } + + @Override + protected WorkspaceModelImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesInner.java new file mode 100644 index 000000000000..5e97bcd78750 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/DeletedWorkspacesInner.java @@ -0,0 +1,237 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DeletedWorkspaces. + */ +public class DeletedWorkspacesInner implements InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private DeletedWorkspacesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DeletedWorkspacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DeletedWorkspacesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(DeletedWorkspacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DeletedWorkspaces to be + * used by Retrofit to perform actually REST calls. + */ + interface DeletedWorkspacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DeletedWorkspaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/deletedWorkspaces") + Observable> list(@Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.DeletedWorkspaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/deletedWorkspaces") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets recently deleted workspaces in a subscription, available for recovery. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(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); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets recently deleted workspaces in a resource group, available for recovery. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysImpl.java new file mode 100644 index 000000000000..91cd92670935 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysImpl.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. + * abc + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Gateways; + +class GatewaysImpl extends WrapperImpl implements Gateways { + private final LogAnalyticsManager manager; + + GatewaysImpl(LogAnalyticsManager manager) { + super(manager.inner().gateways()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysInner.java new file mode 100644 index 000000000000..899feba670c1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/GatewaysInner.java @@ -0,0 +1,152 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Gateways. + */ +public class GatewaysInner { + /** The Retrofit service to perform REST calls. */ + private GatewaysService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of GatewaysInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GatewaysInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(GatewaysService.class); + this.client = client; + } + + /** + * The interface defining all the services for Gateways to be + * used by Retrofit to perform actually REST calls. + */ + interface GatewaysService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Gateways delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/gateways/{gatewayId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("gatewayId") String gatewayId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, String gatewayId) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, gatewayId).toBlocking().single().body(); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway 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 deleteAsync(String resourceGroupName, String workspaceName, String gatewayId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, gatewayId), serviceCallback); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String gatewayId) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, gatewayId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Delete a Log Analytics gateway. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param gatewayId The Log Analytics gateway Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String gatewayId) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (gatewayId == null) { + throw new IllegalArgumentException("Parameter gatewayId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, workspaceName, gatewayId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IdParsingUtils.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..0c327768100f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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.loganalytics.v2020_03_01_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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackImpl.java new file mode 100644 index 000000000000..a56919267720 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackImpl.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.IntelligencePack; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class IntelligencePackImpl extends WrapperImpl implements IntelligencePack { + private final LogAnalyticsManager manager; + + IntelligencePackImpl(IntelligencePackInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackInner.java new file mode 100644 index 000000000000..411d18fd83c1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePackInner.java @@ -0,0 +1,96 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Intelligence Pack containing a string name and boolean indicating if it's + * enabled. + */ +public class IntelligencePackInner { + /** + * The name of the intelligence pack. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The enabled boolean for the intelligence pack. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * The display name of the intelligence pack. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name of the intelligence pack. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the intelligence pack. + * + * @param name the name value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the enabled boolean for the intelligence pack. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled boolean for the intelligence pack. + * + * @param enabled the enabled value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the display name of the intelligence pack. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the intelligence pack. + * + * @param displayName the displayName value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksImpl.java new file mode 100644 index 000000000000..a628da8c6a2f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksImpl.java @@ -0,0 +1,66 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.IntelligencePacks; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.IntelligencePack; + +class IntelligencePacksImpl extends WrapperImpl implements IntelligencePacks { + private final LogAnalyticsManager manager; + + IntelligencePacksImpl(LogAnalyticsManager manager) { + super(manager.inner().intelligencePacks()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private IntelligencePackImpl wrapModel(IntelligencePackInner inner) { + return new IntelligencePackImpl(inner, manager()); + } + + @Override + public Completable disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + IntelligencePacksInner client = this.inner(); + return client.disableAsync(resourceGroupName, workspaceName, intelligencePackName).toCompletable(); + } + + @Override + public Completable enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + IntelligencePacksInner client = this.inner(); + return client.enableAsync(resourceGroupName, workspaceName, intelligencePackName).toCompletable(); + } + + @Override + public Observable listAsync(String resourceGroupName, String workspaceName) { + IntelligencePacksInner client = this.inner(); + return client.listAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public IntelligencePack call(IntelligencePackInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksInner.java new file mode 100644 index 000000000000..e91edfce7bc5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/IntelligencePacksInner.java @@ -0,0 +1,340 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in IntelligencePacks. + */ +public class IntelligencePacksInner { + /** The Retrofit service to perform REST calls. */ + private IntelligencePacksService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of IntelligencePacksInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public IntelligencePacksInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(IntelligencePacksService.class); + this.client = client; + } + + /** + * The interface defining all the services for IntelligencePacks to be + * used by Retrofit to perform actually REST calls. + */ + interface IntelligencePacksService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.IntelligencePacks disable" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable") + Observable> disable(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("intelligencePackName") String intelligencePackName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.IntelligencePacks enable" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable") + Observable> enable(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("intelligencePackName") String intelligencePackName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.IntelligencePacks list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 + */ + public void disable(String resourceGroupName, String workspaceName, String intelligencePackName) { + disableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).toBlocking().single().body(); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @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 disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName), serviceCallback); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return disableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableWithServiceResponseAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (intelligencePackName == null) { + throw new IllegalArgumentException("Parameter intelligencePackName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.disable(resourceGroupName, workspaceName, intelligencePackName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = disableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 + */ + public void enable(String resourceGroupName, String workspaceName, String intelligencePackName) { + enableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).toBlocking().single().body(); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @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 enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName), serviceCallback); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return enableWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableWithServiceResponseAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (intelligencePackName == null) { + throw new IllegalArgumentException("Parameter intelligencePackName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.enable(resourceGroupName, workspaceName, intelligencePackName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<IntelligencePackInner> object if successful. + */ + public List list(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IntelligencePackInner> object + */ + public Observable> listAsync(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IntelligencePackInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceImpl.java new file mode 100644 index 000000000000..d1bc709718cf --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceImpl.java @@ -0,0 +1,140 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedService; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedServiceEntityStatus; +import java.util.Map; + +class LinkedServiceImpl extends CreatableUpdatableImpl implements LinkedService, LinkedService.Definition, LinkedService.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String linkedServiceName; + + LinkedServiceImpl(String name, LogAnalyticsManager manager) { + super(name, new LinkedServiceInner()); + this.manager = manager; + // Set resource name + this.linkedServiceName = name; + // + } + + LinkedServiceImpl(LinkedServiceInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.linkedServiceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.linkedServiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "linkedServices"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public LinkedServiceEntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public String writeAccessResourceId() { + return this.inner().writeAccessResourceId(); + } + + @Override + public LinkedServiceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public LinkedServiceImpl withProvisioningState(LinkedServiceEntityStatus provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public LinkedServiceImpl withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + + @Override + public LinkedServiceImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public LinkedServiceImpl withWriteAccessResourceId(String writeAccessResourceId) { + this.inner().withWriteAccessResourceId(writeAccessResourceId); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceInner.java new file mode 100644 index 000000000000..7a80fa69fb79 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServiceInner.java @@ -0,0 +1,129 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedServiceEntityStatus; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The top level Linked service resource container. + */ +@JsonFlatten +public class LinkedServiceInner extends ProxyResource { + /** + * The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require read access. + */ + @JsonProperty(value = "properties.resourceId") + private String resourceId; + + /** + * The resource id of the resource that will be linked to the workspace. + * This should be used for linking resources which require write access. + */ + @JsonProperty(value = "properties.writeAccessResourceId") + private String writeAccessResourceId; + + /** + * The provisioning state of the linked service. Possible values include: + * 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private LinkedServiceEntityStatus provisioningState; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource id of the resource that will be linked to the workspace. This should be used for linking resources which require read access. + * + * @param resourceId the resourceId value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access. + * + * @return the writeAccessResourceId value + */ + public String writeAccessResourceId() { + return this.writeAccessResourceId; + } + + /** + * Set the resource id of the resource that will be linked to the workspace. This should be used for linking resources which require write access. + * + * @param writeAccessResourceId the writeAccessResourceId value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withWriteAccessResourceId(String writeAccessResourceId) { + this.writeAccessResourceId = writeAccessResourceId; + return this; + } + + /** + * Get the provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @return the provisioningState value + */ + public LinkedServiceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the linked service. Possible values include: 'Succeeded', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @param provisioningState the provisioningState value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withProvisioningState(LinkedServiceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesImpl.java new file mode 100644 index 000000000000..ee9a181012ed --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesImpl.java @@ -0,0 +1,85 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedServices; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedService; + +class LinkedServicesImpl extends WrapperImpl implements LinkedServices { + private final LogAnalyticsManager manager; + + LinkedServicesImpl(LogAnalyticsManager manager) { + super(manager.inner().linkedServices()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public LinkedServiceImpl define(String name) { + return wrapModel(name); + } + + private LinkedServiceImpl wrapModel(LinkedServiceInner inner) { + return new LinkedServiceImpl(inner, manager()); + } + + private LinkedServiceImpl wrapModel(String name) { + return new LinkedServiceImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + LinkedServicesInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public LinkedService call(LinkedServiceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + LinkedServicesInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, linkedServiceName) + .flatMap(new Func1>() { + @Override + public Observable call(LinkedServiceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LinkedService)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + LinkedServicesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, linkedServiceName).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesInner.java new file mode 100644 index 000000000000..91abb9726426 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedServicesInner.java @@ -0,0 +1,625 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LinkedServices. + */ +public class LinkedServicesInner { + /** The Retrofit service to perform REST calls. */ + private LinkedServicesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of LinkedServicesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LinkedServicesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(LinkedServicesService.class); + this.client = client; + } + + /** + * The interface defining all the services for LinkedServices to be + * used by Retrofit to perform actually REST calls. + */ + interface LinkedServicesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedServices createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("linkedServiceName") String linkedServiceName, @Path("subscriptionId") String subscriptionId, @Body LinkedServiceInner parameters, @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.loganalytics.v2020_03_01_preview.LinkedServices beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("linkedServiceName") String linkedServiceName, @Path("subscriptionId") String subscriptionId, @Body LinkedServiceInner parameters, @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.loganalytics.v2020_03_01_preview.LinkedServices delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("linkedServiceName") String linkedServiceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.LinkedServices beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("linkedServiceName") String linkedServiceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.LinkedServices get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("linkedServiceName") String linkedServiceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.LinkedServices listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @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 LinkedServiceInner object if successful. + */ + public LinkedServiceInner createOrUpdate(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters), serviceCallback); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).map(new Func1, LinkedServiceInner>() { + @Override + public LinkedServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @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 LinkedServiceInner object if successful. + */ + public LinkedServiceInner beginCreateOrUpdate(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters), serviceCallback); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).map(new Func1, LinkedServiceInner>() { + @Override + public LinkedServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linkedServices resource + * @param parameters The parameters required to create or update a linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String linkedServiceName, LinkedServiceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, workspaceName, linkedServiceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 LinkedServiceInner object if successful. + */ + public LinkedServiceInner delete(String resourceGroupName, String workspaceName, String linkedServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).toBlocking().last().body(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName), serviceCallback); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).map(new Func1, LinkedServiceInner>() { + @Override + public LinkedServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, workspaceName, linkedServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 LinkedServiceInner object if successful. + */ + public LinkedServiceInner beginDelete(String resourceGroupName, String workspaceName, String linkedServiceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).toBlocking().single().body(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 beginDeleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName), serviceCallback); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable beginDeleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).map(new Func1, LinkedServiceInner>() { + @Override + public LinkedServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, workspaceName, linkedServiceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 LinkedServiceInner object if successful. + */ + public LinkedServiceInner get(String resourceGroupName, String workspaceName, String linkedServiceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).toBlocking().single().body(); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @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 workspaceName, String linkedServiceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName), serviceCallback); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).map(new Func1, LinkedServiceInner>() { + @Override + public LinkedServiceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedServiceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (linkedServiceName == null) { + throw new IllegalArgumentException("Parameter linkedServiceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, linkedServiceName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<LinkedServiceInner> object if successful. + */ + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedServiceInner> object + */ + public Observable> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the linked services instances in a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedServiceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsImpl.java new file mode 100644 index 000000000000..142a1a3eb8d2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsImpl.java @@ -0,0 +1,85 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccounts; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccountsResource; + +class LinkedStorageAccountsImpl extends WrapperImpl implements LinkedStorageAccounts { + private final LogAnalyticsManager manager; + + LinkedStorageAccountsImpl(LogAnalyticsManager manager) { + super(manager.inner().linkedStorageAccounts()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public LinkedStorageAccountsResourceImpl define(String name) { + return wrapModel(name); + } + + private LinkedStorageAccountsResourceImpl wrapModel(LinkedStorageAccountsResourceInner inner) { + return new LinkedStorageAccountsResourceImpl(inner, manager()); + } + + private LinkedStorageAccountsResourceImpl wrapModel(String name) { + return new LinkedStorageAccountsResourceImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + LinkedStorageAccountsInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public LinkedStorageAccountsResource call(LinkedStorageAccountsResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + LinkedStorageAccountsInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, dataSourceType) + .flatMap(new Func1>() { + @Override + public Observable call(LinkedStorageAccountsResourceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LinkedStorageAccountsResource)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + LinkedStorageAccountsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, dataSourceType).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsInner.java new file mode 100644 index 000000000000..9d2da1672589 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsInner.java @@ -0,0 +1,543 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSourceType; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +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.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in LinkedStorageAccounts. + */ +public class LinkedStorageAccountsInner { + /** The Retrofit service to perform REST calls. */ + private LinkedStorageAccountsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of LinkedStorageAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public LinkedStorageAccountsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(LinkedStorageAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for LinkedStorageAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface LinkedStorageAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccounts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceType") DataSourceType dataSourceType1, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body LinkedStorageAccountsResourceInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccounts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceType") DataSourceType dataSourceType1, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.LinkedStorageAccounts get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts/{dataSourceType}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceType") DataSourceType dataSourceType1, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.LinkedStorageAccounts listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedStorageAccounts") + Observable> listByWorkspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 LinkedStorageAccountsResourceInner object if successful. + */ + public LinkedStorageAccountsResourceInner createOrUpdate(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).toBlocking().single().body(); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType), serviceCallback); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).map(new Func1, LinkedStorageAccountsResourceInner>() { + @Override + public LinkedStorageAccountsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceType == null) { + throw new IllegalArgumentException("Parameter dataSourceType is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final List storageAccountIds = null; + LinkedStorageAccountsResourceInner parameters = new LinkedStorageAccountsResourceInner(); + parameters.withStorageAccountIds(null); + return service.createOrUpdate(resourceGroupName, workspaceName, dataSourceType, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @param storageAccountIds Linked storage accounts resources ids. + * @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 LinkedStorageAccountsResourceInner object if successful. + */ + public LinkedStorageAccountsResourceInner createOrUpdate(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, List storageAccountIds) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType, storageAccountIds).toBlocking().single().body(); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @param storageAccountIds Linked storage accounts resources ids. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, List storageAccountIds, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType, storageAccountIds), serviceCallback); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @param storageAccountIds Linked storage accounts resources ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, List storageAccountIds) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType, storageAccountIds).map(new Func1, LinkedStorageAccountsResourceInner>() { + @Override + public LinkedStorageAccountsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @param storageAccountIds Linked storage accounts resources ids. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, List storageAccountIds) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceType == null) { + throw new IllegalArgumentException("Parameter dataSourceType is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(storageAccountIds); + LinkedStorageAccountsResourceInner parameters = new LinkedStorageAccountsResourceInner(); + parameters.withStorageAccountIds(storageAccountIds); + return service.createOrUpdate(resourceGroupName, workspaceName, dataSourceType, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), parameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).toBlocking().single().body(); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 deleteAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType), serviceCallback); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes all linked storage accounts of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceType == null) { + throw new IllegalArgumentException("Parameter dataSourceType is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, workspaceName, dataSourceType, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 LinkedStorageAccountsResourceInner object if successful. + */ + public LinkedStorageAccountsResourceInner get(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).toBlocking().single().body(); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @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 workspaceName, DataSourceType dataSourceType, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType), serviceCallback); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).map(new Func1, LinkedStorageAccountsResourceInner>() { + @Override + public LinkedStorageAccountsResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets all linked storage account of a specific data source type associated with the specified workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountsResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceType == null) { + throw new IllegalArgumentException("Parameter dataSourceType is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, dataSourceType, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<LinkedStorageAccountsResourceInner> object if successful. + */ + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedStorageAccountsResourceInner> object + */ + public Observable> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all linked storage accounts associated with the specified workspace, storage accounts will be sorted by their data source type. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedStorageAccountsResourceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(this.client.subscriptionId(), resourceGroupName, workspaceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceImpl.java new file mode 100644 index 000000000000..71bcde3d59da --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceImpl.java @@ -0,0 +1,118 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccountsResource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSourceType; + +class LinkedStorageAccountsResourceImpl extends CreatableUpdatableImpl implements LinkedStorageAccountsResource, LinkedStorageAccountsResource.Definition, LinkedStorageAccountsResource.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private DataSourceType dataSourceType; + private List cstorageAccountIds; + private List ustorageAccountIds; + + LinkedStorageAccountsResourceImpl(String name, LogAnalyticsManager manager) { + super(name, new LinkedStorageAccountsResourceInner()); + this.manager = manager; + // Set resource name + this.dataSourceType = name; + // + } + + LinkedStorageAccountsResourceImpl(LinkedStorageAccountsResourceInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataSourceType = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.dataSourceType = DataSourceType.valueOf(IdParsingUtils.getValueFromIdByName(inner.id(), "linkedStorageAccounts")); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LinkedStorageAccountsInner client = this.manager().inner().linkedStorageAccounts(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceType, this.cstorageAccountIds) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LinkedStorageAccountsInner client = this.manager().inner().linkedStorageAccounts(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceType, this.ustorageAccountIds) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LinkedStorageAccountsInner client = this.manager().inner().linkedStorageAccounts(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.dataSourceType); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public DataSourceType dataSourceType() { + return this.inner().dataSourceType(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List storageAccountIds() { + return this.inner().storageAccountIds(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public LinkedStorageAccountsResourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public LinkedStorageAccountsResourceImpl withStorageAccountIds(List storageAccountIds) { + if (isInCreateMode()) { + this.cstorageAccountIds = storageAccountIds; + } else { + this.ustorageAccountIds = storageAccountIds; + } + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceInner.java new file mode 100644 index 000000000000..11a699b26b86 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LinkedStorageAccountsResourceInner.java @@ -0,0 +1,64 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSourceType; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Linked storage accounts top level resource container. + */ +@JsonFlatten +public class LinkedStorageAccountsResourceInner extends ProxyResource { + /** + * Linked storage accounts type. Possible values include: 'CustomLogs', + * 'AzureWatson'. + */ + @JsonProperty(value = "properties.dataSourceType", access = JsonProperty.Access.WRITE_ONLY) + private DataSourceType dataSourceType; + + /** + * Linked storage accounts resources ids. + */ + @JsonProperty(value = "properties.storageAccountIds") + private List storageAccountIds; + + /** + * Get linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson'. + * + * @return the dataSourceType value + */ + public DataSourceType dataSourceType() { + return this.dataSourceType; + } + + /** + * Get linked storage accounts resources ids. + * + * @return the storageAccountIds value + */ + public List storageAccountIds() { + return this.storageAccountIds; + } + + /** + * Set linked storage accounts resources ids. + * + * @param storageAccountIds the storageAccountIds value to set + * @return the LinkedStorageAccountsResourceInner object itself. + */ + public LinkedStorageAccountsResourceInner withStorageAccountIds(List storageAccountIds) { + this.storageAccountIds = storageAccountIds; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LogAnalyticsManager.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LogAnalyticsManager.java new file mode 100644 index 000000000000..92c8b304288b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/LogAnalyticsManager.java @@ -0,0 +1,327 @@ +/** + * 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.loganalytics.v2020_03_01_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.loganalytics.v2020_03_01_preview.DataExports; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DataSources; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.IntelligencePacks; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedServices; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.LinkedStorageAccounts; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ManagementGroups; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Operations; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationStatuses; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SharedKeysOperations; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Usages; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Workspaces; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.DeletedWorkspaces; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Clusters; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsightConfigs; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearches; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.AvailableServiceTiers; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Gateways; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Schemas; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurges; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tables; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure LogAnalytics resource management. + */ +public final class LogAnalyticsManager extends ManagerCore { + private DataExports dataExports; + private DataSources dataSources; + private IntelligencePacks intelligencePacks; + private LinkedServices linkedServices; + private LinkedStorageAccounts linkedStorageAccounts; + private ManagementGroups managementGroups; + private Operations operations; + private OperationStatuses operationStatuses; + private SharedKeysOperations sharedKeysOperations; + private Usages usages; + private Workspaces workspaces; + private DeletedWorkspaces deletedWorkspaces; + private Clusters clusters; + private StorageInsightConfigs storageInsightConfigs; + private SavedSearches savedSearches; + private AvailableServiceTiers availableServiceTiers; + private Gateways gateways; + private Schemas schemas; + private WorkspacePurges workspacePurges; + private Tables tables; + /** + * Get a Configurable instance that can be used to create LogAnalyticsManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new LogAnalyticsManager.ConfigurableImpl(); + } + /** + * Creates an instance of LogAnalyticsManager that exposes LogAnalytics resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the LogAnalyticsManager + */ + public static LogAnalyticsManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new LogAnalyticsManager(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 LogAnalyticsManager that exposes LogAnalytics resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the LogAnalyticsManager + */ + public static LogAnalyticsManager authenticate(RestClient restClient, String subscriptionId) { + return new LogAnalyticsManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of LogAnalyticsManager that exposes LogAnalytics management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing LogAnalytics management API entry points that work across subscriptions + */ + LogAnalyticsManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DataExports. + */ + public DataExports dataExports() { + if (this.dataExports == null) { + this.dataExports = new DataExportsImpl(this); + } + return this.dataExports; + } + + /** + * @return Entry point to manage DataSources. + */ + public DataSources dataSources() { + if (this.dataSources == null) { + this.dataSources = new DataSourcesImpl(this); + } + return this.dataSources; + } + + /** + * @return Entry point to manage IntelligencePacks. + */ + public IntelligencePacks intelligencePacks() { + if (this.intelligencePacks == null) { + this.intelligencePacks = new IntelligencePacksImpl(this); + } + return this.intelligencePacks; + } + + /** + * @return Entry point to manage LinkedServices. + */ + public LinkedServices linkedServices() { + if (this.linkedServices == null) { + this.linkedServices = new LinkedServicesImpl(this); + } + return this.linkedServices; + } + + /** + * @return Entry point to manage LinkedStorageAccounts. + */ + public LinkedStorageAccounts linkedStorageAccounts() { + if (this.linkedStorageAccounts == null) { + this.linkedStorageAccounts = new LinkedStorageAccountsImpl(this); + } + return this.linkedStorageAccounts; + } + + /** + * @return Entry point to manage ManagementGroups. + */ + public ManagementGroups managementGroups() { + if (this.managementGroups == null) { + this.managementGroups = new ManagementGroupsImpl(this); + } + return this.managementGroups; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage OperationStatuses. + */ + public OperationStatuses operationStatuses() { + if (this.operationStatuses == null) { + this.operationStatuses = new OperationStatusesImpl(this); + } + return this.operationStatuses; + } + + /** + * @return Entry point to manage SharedKeysOperations. + */ + public SharedKeysOperations sharedKeysOperations() { + if (this.sharedKeysOperations == null) { + this.sharedKeysOperations = new SharedKeysOperationsImpl(this); + } + return this.sharedKeysOperations; + } + + /** + * @return Entry point to manage Usages. + */ + public Usages usages() { + if (this.usages == null) { + this.usages = new UsagesImpl(this); + } + return this.usages; + } + + /** + * @return Entry point to manage Workspaces. + */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(this); + } + return this.workspaces; + } + + /** + * @return Entry point to manage DeletedWorkspaces. + */ + public DeletedWorkspaces deletedWorkspaces() { + if (this.deletedWorkspaces == null) { + this.deletedWorkspaces = new DeletedWorkspacesImpl(this); + } + return this.deletedWorkspaces; + } + + /** + * @return Entry point to manage Clusters. + */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(this); + } + return this.clusters; + } + + /** + * @return Entry point to manage StorageInsightConfigs. + */ + public StorageInsightConfigs storageInsightConfigs() { + if (this.storageInsightConfigs == null) { + this.storageInsightConfigs = new StorageInsightConfigsImpl(this); + } + return this.storageInsightConfigs; + } + + /** + * @return Entry point to manage SavedSearches. + */ + public SavedSearches savedSearches() { + if (this.savedSearches == null) { + this.savedSearches = new SavedSearchesImpl(this); + } + return this.savedSearches; + } + + /** + * @return Entry point to manage AvailableServiceTiers. + */ + public AvailableServiceTiers availableServiceTiers() { + if (this.availableServiceTiers == null) { + this.availableServiceTiers = new AvailableServiceTiersImpl(this); + } + return this.availableServiceTiers; + } + + /** + * @return Entry point to manage Gateways. + */ + public Gateways gateways() { + if (this.gateways == null) { + this.gateways = new GatewaysImpl(this); + } + return this.gateways; + } + + /** + * @return Entry point to manage Schemas. + */ + public Schemas schemas() { + if (this.schemas == null) { + this.schemas = new SchemasImpl(this); + } + return this.schemas; + } + + /** + * @return Entry point to manage WorkspacePurges. + */ + public WorkspacePurges workspacePurges() { + if (this.workspacePurges == null) { + this.workspacePurges = new WorkspacePurgesImpl(this); + } + return this.workspacePurges; + } + + /** + * @return Entry point to manage Tables. + */ + public Tables tables() { + if (this.tables == null) { + this.tables = new TablesImpl(this); + } + return this.tables; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public LogAnalyticsManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return LogAnalyticsManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private LogAnalyticsManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new OperationalInsightsManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupImpl.java new file mode 100644 index 000000000000..d818b64ccf69 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupImpl.java @@ -0,0 +1,71 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ManagementGroup; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ManagementGroupImpl extends WrapperImpl implements ManagementGroup { + private final LogAnalyticsManager manager; + + ManagementGroupImpl(ManagementGroupInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public DateTime created() { + return this.inner().created(); + } + + @Override + public DateTime dataReceived() { + return this.inner().dataReceived(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isGateway() { + return this.inner().isGateway(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer serverCount() { + return this.inner().serverCount(); + } + + @Override + public String sku() { + return this.inner().sku(); + } + + @Override + public String version() { + return this.inner().version(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupInner.java new file mode 100644 index 000000000000..e09f02b540f0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupInner.java @@ -0,0 +1,229 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A management group that is connected to a workspace. + */ +@JsonFlatten +public class ManagementGroupInner { + /** + * The number of servers connected to the management group. + */ + @JsonProperty(value = "properties.serverCount") + private Integer serverCount; + + /** + * Gets or sets a value indicating whether the management group is a + * gateway. + */ + @JsonProperty(value = "properties.isGateway") + private Boolean isGateway; + + /** + * The name of the management group. + */ + @JsonProperty(value = "properties.name") + private String name; + + /** + * The unique ID of the management group. + */ + @JsonProperty(value = "properties.id") + private String id; + + /** + * The datetime that the management group was created. + */ + @JsonProperty(value = "properties.created") + private DateTime created; + + /** + * The last datetime that the management group received data. + */ + @JsonProperty(value = "properties.dataReceived") + private DateTime dataReceived; + + /** + * The version of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The SKU of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.sku") + private String sku; + + /** + * Get the number of servers connected to the management group. + * + * @return the serverCount value + */ + public Integer serverCount() { + return this.serverCount; + } + + /** + * Set the number of servers connected to the management group. + * + * @param serverCount the serverCount value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withServerCount(Integer serverCount) { + this.serverCount = serverCount; + return this; + } + + /** + * Get gets or sets a value indicating whether the management group is a gateway. + * + * @return the isGateway value + */ + public Boolean isGateway() { + return this.isGateway; + } + + /** + * Set gets or sets a value indicating whether the management group is a gateway. + * + * @param isGateway the isGateway value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withIsGateway(Boolean isGateway) { + this.isGateway = isGateway; + return this; + } + + /** + * Get the name of the management group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the management group. + * + * @param name the name value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the unique ID of the management group. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the unique ID of the management group. + * + * @param id the id value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the datetime that the management group was created. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Set the datetime that the management group was created. + * + * @param created the created value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withCreated(DateTime created) { + this.created = created; + return this; + } + + /** + * Get the last datetime that the management group received data. + * + * @return the dataReceived value + */ + public DateTime dataReceived() { + return this.dataReceived; + } + + /** + * Set the last datetime that the management group received data. + * + * @param dataReceived the dataReceived value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDataReceived(DateTime dataReceived) { + this.dataReceived = dataReceived; + return this; + } + + /** + * Get the version of System Center that is managing the management group. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of System Center that is managing the management group. + * + * @param version the version value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the SKU of System Center that is managing the management group. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set the SKU of System Center that is managing the management group. + * + * @param sku the sku value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withSku(String sku) { + this.sku = sku; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsImpl.java new file mode 100644 index 000000000000..be103c894a38 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsImpl.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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ManagementGroups; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ManagementGroup; + +class ManagementGroupsImpl extends WrapperImpl implements ManagementGroups { + private final LogAnalyticsManager manager; + + ManagementGroupsImpl(LogAnalyticsManager manager) { + super(manager.inner().managementGroups()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private ManagementGroupImpl wrapModel(ManagementGroupInner inner) { + return new ManagementGroupImpl(inner, manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String workspaceName) { + ManagementGroupsInner client = this.inner(); + return client.listAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ManagementGroup call(ManagementGroupInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsInner.java new file mode 100644 index 000000000000..fbca195079ce --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/ManagementGroupsInner.java @@ -0,0 +1,152 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in ManagementGroups. + */ +public class ManagementGroupsInner { + /** The Retrofit service to perform REST calls. */ + private ManagementGroupsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of ManagementGroupsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public ManagementGroupsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(ManagementGroupsService.class); + this.client = client; + } + + /** + * The interface defining all the services for ManagementGroups to be + * used by Retrofit to perform actually REST calls. + */ + interface ManagementGroupsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ManagementGroups list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<ManagementGroupInner> object if successful. + */ + public List list(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ManagementGroupInner> object + */ + public Observable> listAsync(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ManagementGroupInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationImpl.java new file mode 100644 index 000000000000..25d99bf2a5fd --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final LogAnalyticsManager manager; + OperationImpl(OperationInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationInner.java new file mode 100644 index 000000000000..30125c6a10a9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Supported operation of OperationalInsights resource provider. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusImpl.java new file mode 100644 index 000000000000..e1fdf67809d4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusImpl.java @@ -0,0 +1,72 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationStatus; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ErrorResponse; + +class OperationStatusImpl extends IndexableRefreshableWrapperImpl implements OperationStatus { + private final LogAnalyticsManager manager; + private String location; + private String asyncOperationId; + + OperationStatusImpl(OperationStatusInner inner, LogAnalyticsManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.location = IdParsingUtils.getValueFromIdByName(inner.id(), "locations"); + this.asyncOperationId = IdParsingUtils.getValueFromIdByName(inner.id(), "operationStatuses"); + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + OperationStatusesInner client = this.manager().inner().operationStatuses(); + return client.getAsync(this.location, this.asyncOperationId); + } + + + + @Override + public String endTime() { + return this.inner().endTime(); + } + + @Override + public ErrorResponse error() { + return this.inner().error(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String startTime() { + return this.inner().startTime(); + } + + @Override + public String status() { + return this.inner().status(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusInner.java new file mode 100644 index 000000000000..cc72a52fd509 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusInner.java @@ -0,0 +1,174 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of operation. + */ +public class OperationStatusInner { + /** + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /** + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the operation Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the operation Id. + * + * @param id the id value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the operation name. + * + * @param name the name value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the start time of the operation. + * + * @return the startTime value + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the start time of the operation. + * + * @param startTime the startTime value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the end time of the operation. + * + * @return the endTime value + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the end time of the operation. + * + * @param endTime the endTime value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status of the operation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the operation. + * + * @param status the status value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error detail of the operation if any. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the error detail of the operation if any. + * + * @param error the error value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesImpl.java new file mode 100644 index 000000000000..5e3e9510f490 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesImpl.java @@ -0,0 +1,50 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationStatuses; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationStatus; + +class OperationStatusesImpl extends WrapperImpl implements OperationStatuses { + private final LogAnalyticsManager manager; + + OperationStatusesImpl(LogAnalyticsManager manager) { + super(manager.inner().operationStatuses()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private OperationStatusImpl wrapModel(OperationStatusInner inner) { + return new OperationStatusImpl(inner, manager()); + } + + @Override + public Observable getAsync(String location, String asyncOperationId) { + OperationStatusesInner client = this.inner(); + return client.getAsync(location, asyncOperationId) + .flatMap(new Func1>() { + @Override + public Observable call(OperationStatusInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((OperationStatus)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesInner.java new file mode 100644 index 000000000000..56fb2d1a5655 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationStatusesInner.java @@ -0,0 +1,146 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in OperationStatuses. + */ +public class OperationStatusesInner { + /** The Retrofit service to perform REST calls. */ + private OperationStatusesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of OperationStatusesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationStatusesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(OperationStatusesService.class); + this.client = client; + } + + /** + * The interface defining all the services for OperationStatuses to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationStatusesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.OperationStatuses get" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/locations/{location}/operationStatuses/{asyncOperationId}") + Observable> get(@Path("location") String location, @Path("asyncOperationId") String asyncOperationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @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 OperationStatusInner object if successful. + */ + public OperationStatusInner get(String location, String asyncOperationId) { + return getWithServiceResponseAsync(location, asyncOperationId).toBlocking().single().body(); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation 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 location, String asyncOperationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(location, asyncOperationId), serviceCallback); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusInner object + */ + public Observable getAsync(String location, String asyncOperationId) { + return getWithServiceResponseAsync(location, asyncOperationId).map(new Func1, OperationStatusInner>() { + @Override + public OperationStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the status of a long running azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusInner object + */ + public Observable> getWithServiceResponseAsync(String location, String asyncOperationId) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (asyncOperationId == null) { + throw new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(location, asyncOperationId, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationalInsightsManagementClientImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationalInsightsManagementClientImpl.java new file mode 100644 index 000000000000..bcb82c481204 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationalInsightsManagementClientImpl.java @@ -0,0 +1,462 @@ +/** + * 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.loganalytics.v2020_03_01_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 OperationalInsightsManagementClientImpl class. + */ +public class OperationalInsightsManagementClientImpl 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 OperationalInsightsManagementClientImpl 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 OperationalInsightsManagementClientImpl 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 OperationalInsightsManagementClientImpl 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 OperationalInsightsManagementClientImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DataExportsInner object to access its operations. + */ + private DataExportsInner dataExports; + + /** + * Gets the DataExportsInner object to access its operations. + * @return the DataExportsInner object. + */ + public DataExportsInner dataExports() { + return this.dataExports; + } + + /** + * The DataSourcesInner object to access its operations. + */ + private DataSourcesInner dataSources; + + /** + * Gets the DataSourcesInner object to access its operations. + * @return the DataSourcesInner object. + */ + public DataSourcesInner dataSources() { + return this.dataSources; + } + + /** + * The IntelligencePacksInner object to access its operations. + */ + private IntelligencePacksInner intelligencePacks; + + /** + * Gets the IntelligencePacksInner object to access its operations. + * @return the IntelligencePacksInner object. + */ + public IntelligencePacksInner intelligencePacks() { + return this.intelligencePacks; + } + + /** + * The LinkedServicesInner object to access its operations. + */ + private LinkedServicesInner linkedServices; + + /** + * Gets the LinkedServicesInner object to access its operations. + * @return the LinkedServicesInner object. + */ + public LinkedServicesInner linkedServices() { + return this.linkedServices; + } + + /** + * The LinkedStorageAccountsInner object to access its operations. + */ + private LinkedStorageAccountsInner linkedStorageAccounts; + + /** + * Gets the LinkedStorageAccountsInner object to access its operations. + * @return the LinkedStorageAccountsInner object. + */ + public LinkedStorageAccountsInner linkedStorageAccounts() { + return this.linkedStorageAccounts; + } + + /** + * The ManagementGroupsInner object to access its operations. + */ + private ManagementGroupsInner managementGroups; + + /** + * Gets the ManagementGroupsInner object to access its operations. + * @return the ManagementGroupsInner object. + */ + public ManagementGroupsInner managementGroups() { + return this.managementGroups; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The OperationStatusesInner object to access its operations. + */ + private OperationStatusesInner operationStatuses; + + /** + * Gets the OperationStatusesInner object to access its operations. + * @return the OperationStatusesInner object. + */ + public OperationStatusesInner operationStatuses() { + return this.operationStatuses; + } + + /** + * The SharedKeysOperationsInner object to access its operations. + */ + private SharedKeysOperationsInner sharedKeysOperations; + + /** + * Gets the SharedKeysOperationsInner object to access its operations. + * @return the SharedKeysOperationsInner object. + */ + public SharedKeysOperationsInner sharedKeysOperations() { + return this.sharedKeysOperations; + } + + /** + * The UsagesInner object to access its operations. + */ + private UsagesInner usages; + + /** + * Gets the UsagesInner object to access its operations. + * @return the UsagesInner object. + */ + public UsagesInner usages() { + return this.usages; + } + + /** + * The WorkspacesInner object to access its operations. + */ + private WorkspacesInner workspaces; + + /** + * Gets the WorkspacesInner object to access its operations. + * @return the WorkspacesInner object. + */ + public WorkspacesInner workspaces() { + return this.workspaces; + } + + /** + * The DeletedWorkspacesInner object to access its operations. + */ + private DeletedWorkspacesInner deletedWorkspaces; + + /** + * Gets the DeletedWorkspacesInner object to access its operations. + * @return the DeletedWorkspacesInner object. + */ + public DeletedWorkspacesInner deletedWorkspaces() { + return this.deletedWorkspaces; + } + + /** + * The ClustersInner object to access its operations. + */ + private ClustersInner clusters; + + /** + * Gets the ClustersInner object to access its operations. + * @return the ClustersInner object. + */ + public ClustersInner clusters() { + return this.clusters; + } + + /** + * The StorageInsightConfigsInner object to access its operations. + */ + private StorageInsightConfigsInner storageInsightConfigs; + + /** + * Gets the StorageInsightConfigsInner object to access its operations. + * @return the StorageInsightConfigsInner object. + */ + public StorageInsightConfigsInner storageInsightConfigs() { + return this.storageInsightConfigs; + } + + /** + * The SavedSearchesInner object to access its operations. + */ + private SavedSearchesInner savedSearches; + + /** + * Gets the SavedSearchesInner object to access its operations. + * @return the SavedSearchesInner object. + */ + public SavedSearchesInner savedSearches() { + return this.savedSearches; + } + + /** + * The AvailableServiceTiersInner object to access its operations. + */ + private AvailableServiceTiersInner availableServiceTiers; + + /** + * Gets the AvailableServiceTiersInner object to access its operations. + * @return the AvailableServiceTiersInner object. + */ + public AvailableServiceTiersInner availableServiceTiers() { + return this.availableServiceTiers; + } + + /** + * The GatewaysInner object to access its operations. + */ + private GatewaysInner gateways; + + /** + * Gets the GatewaysInner object to access its operations. + * @return the GatewaysInner object. + */ + public GatewaysInner gateways() { + return this.gateways; + } + + /** + * The SchemasInner object to access its operations. + */ + private SchemasInner schemas; + + /** + * Gets the SchemasInner object to access its operations. + * @return the SchemasInner object. + */ + public SchemasInner schemas() { + return this.schemas; + } + + /** + * The WorkspacePurgesInner object to access its operations. + */ + private WorkspacePurgesInner workspacePurges; + + /** + * Gets the WorkspacePurgesInner object to access its operations. + * @return the WorkspacePurgesInner object. + */ + public WorkspacePurgesInner workspacePurges() { + return this.workspacePurges; + } + + /** + * The TablesInner object to access its operations. + */ + private TablesInner tables; + + /** + * Gets the TablesInner object to access its operations. + * @return the TablesInner object. + */ + public TablesInner tables() { + return this.tables; + } + + /** + * Initializes an instance of OperationalInsightsManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public OperationalInsightsManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of OperationalInsightsManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public OperationalInsightsManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of OperationalInsightsManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public OperationalInsightsManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2020-03-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.dataExports = new DataExportsInner(restClient().retrofit(), this); + this.dataSources = new DataSourcesInner(restClient().retrofit(), this); + this.intelligencePacks = new IntelligencePacksInner(restClient().retrofit(), this); + this.linkedServices = new LinkedServicesInner(restClient().retrofit(), this); + this.linkedStorageAccounts = new LinkedStorageAccountsInner(restClient().retrofit(), this); + this.managementGroups = new ManagementGroupsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.operationStatuses = new OperationStatusesInner(restClient().retrofit(), this); + this.sharedKeysOperations = new SharedKeysOperationsInner(restClient().retrofit(), this); + this.usages = new UsagesInner(restClient().retrofit(), this); + this.workspaces = new WorkspacesInner(restClient().retrofit(), this); + this.deletedWorkspaces = new DeletedWorkspacesInner(restClient().retrofit(), this); + this.clusters = new ClustersInner(restClient().retrofit(), this); + this.storageInsightConfigs = new StorageInsightConfigsInner(restClient().retrofit(), this); + this.savedSearches = new SavedSearchesInner(restClient().retrofit(), this); + this.availableServiceTiers = new AvailableServiceTiersInner(restClient().retrofit(), this); + this.gateways = new GatewaysInner(restClient().retrofit(), this); + this.schemas = new SchemasInner(restClient().retrofit(), this); + this.workspacePurges = new WorkspacePurgesInner(restClient().retrofit(), this); + this.tables = new TablesInner(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(), "OperationalInsightsManagementClient", "2020-03-01-preview"); + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationsImpl.java new file mode 100644 index 000000000000..ef20ac60ec34 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final LogAnalyticsManager manager; + + OperationsImpl(LogAnalyticsManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public LogAnalyticsManager 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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationsInner.java new file mode 100644 index 000000000000..1dd0003cdc2f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * 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.loganalytics.v2020_03_01_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 OperationalInsightsManagementClientImpl 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, OperationalInsightsManagementClientImpl 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.loganalytics.v2020_03_01_preview.Operations list" }) + @GET("providers/Microsoft.OperationalInsights/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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(); + } + }; + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @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(); + } + }; + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws 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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..5b603f66023a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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.loganalytics.v2020_03_01_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("") + 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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl1.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl1.java new file mode 100644 index 000000000000..b4666af90ac3 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl1.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.loganalytics.v2020_03_01_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 PageImpl1 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 PageImpl1 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 PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl2.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl2.java new file mode 100644 index 000000000000..203ddb229555 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/PageImpl2.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.loganalytics.v2020_03_01_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 PageImpl2 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("@odata.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 PageImpl2 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 PageImpl2 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchImpl.java new file mode 100644 index 000000000000..4ba86e50a251 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchImpl.java @@ -0,0 +1,184 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearch; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tag; + +class SavedSearchImpl extends CreatableUpdatableImpl implements SavedSearch, SavedSearch.Definition, SavedSearch.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String savedSearchId; + + SavedSearchImpl(String name, LogAnalyticsManager manager) { + super(name, new SavedSearchInner()); + this.manager = manager; + // Set resource name + this.savedSearchId = name; + // + } + + SavedSearchImpl(SavedSearchInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.savedSearchId = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.savedSearchId = IdParsingUtils.getValueFromIdByName(inner.id(), "savedSearches"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SavedSearchesInner client = this.manager().inner().savedSearches(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.savedSearchId, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SavedSearchesInner client = this.manager().inner().savedSearches(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.savedSearchId, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SavedSearchesInner client = this.manager().inner().savedSearches(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.savedSearchId); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String category() { + return this.inner().category(); + } + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public String etag() { + return this.inner().etag(); + } + + @Override + public String functionAlias() { + return this.inner().functionAlias(); + } + + @Override + public String functionParameters() { + return this.inner().functionParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String query() { + return this.inner().query(); + } + + @Override + public List tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public Long version() { + return this.inner().version(); + } + + @Override + public SavedSearchImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public SavedSearchImpl withCategory(String category) { + this.inner().withCategory(category); + return this; + } + + @Override + public SavedSearchImpl withDisplayName(String displayName) { + this.inner().withDisplayName(displayName); + return this; + } + + @Override + public SavedSearchImpl withQuery(String query) { + this.inner().withQuery(query); + return this; + } + + @Override + public SavedSearchImpl withEtag(String etag) { + this.inner().withEtag(etag); + return this; + } + + @Override + public SavedSearchImpl withFunctionAlias(String functionAlias) { + this.inner().withFunctionAlias(functionAlias); + return this; + } + + @Override + public SavedSearchImpl withFunctionParameters(String functionParameters) { + this.inner().withFunctionParameters(functionParameters); + return this; + } + + @Override + public SavedSearchImpl withTags(List tags) { + this.inner().withTags(tags); + return this; + } + + @Override + public SavedSearchImpl withVersion(Long version) { + this.inner().withVersion(version); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchInner.java new file mode 100644 index 000000000000..5de77f9f2480 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchInner.java @@ -0,0 +1,236 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tag; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Value object for saved search results. + */ +@JsonFlatten +public class SavedSearchInner extends ProxyResource { + /** + * The ETag of the saved search. + */ + @JsonProperty(value = "etag") + private String etag; + + /** + * The category of the saved search. This helps the user to find a saved + * search faster. + */ + @JsonProperty(value = "properties.category", required = true) + private String category; + + /** + * Saved search display name. + */ + @JsonProperty(value = "properties.displayName", required = true) + private String displayName; + + /** + * The query expression for the saved search. + */ + @JsonProperty(value = "properties.query", required = true) + private String query; + + /** + * The function alias if query serves as a function. + */ + @JsonProperty(value = "properties.functionAlias") + private String functionAlias; + + /** + * The optional function parameters if query serves as a function. Value + * should be in the following format: 'param-name1:type1 = default_value1, + * param-name2:type2 = default_value2'. For more examples and proper syntax + * please refer to + * https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + */ + @JsonProperty(value = "properties.functionParameters") + private String functionParameters; + + /** + * The version number of the query language. The current version is 2 and + * is the default. + */ + @JsonProperty(value = "properties.version") + private Long version; + + /** + * The tags attached to the saved search. + */ + @JsonProperty(value = "properties.tags") + private List tags; + + /** + * Get the ETag of the saved search. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + + /** + * Set the ETag of the saved search. + * + * @param etag the etag value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withEtag(String etag) { + this.etag = etag; + return this; + } + + /** + * Get the category of the saved search. This helps the user to find a saved search faster. + * + * @return the category value + */ + public String category() { + return this.category; + } + + /** + * Set the category of the saved search. This helps the user to find a saved search faster. + * + * @param category the category value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get saved search display name. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set saved search display name. + * + * @param displayName the displayName value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the query expression for the saved search. + * + * @return the query value + */ + public String query() { + return this.query; + } + + /** + * Set the query expression for the saved search. + * + * @param query the query value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the function alias if query serves as a function. + * + * @return the functionAlias value + */ + public String functionAlias() { + return this.functionAlias; + } + + /** + * Set the function alias if query serves as a function. + * + * @param functionAlias the functionAlias value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withFunctionAlias(String functionAlias) { + this.functionAlias = functionAlias; + return this; + } + + /** + * Get the optional function parameters if query serves as a function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more examples and proper syntax please refer to https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * + * @return the functionParameters value + */ + public String functionParameters() { + return this.functionParameters; + } + + /** + * Set the optional function parameters if query serves as a function. Value should be in the following format: 'param-name1:type1 = default_value1, param-name2:type2 = default_value2'. For more examples and proper syntax please refer to https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions. + * + * @param functionParameters the functionParameters value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withFunctionParameters(String functionParameters) { + this.functionParameters = functionParameters; + return this; + } + + /** + * Get the version number of the query language. The current version is 2 and is the default. + * + * @return the version value + */ + public Long version() { + return this.version; + } + + /** + * Set the version number of the query language. The current version is 2 and is the default. + * + * @param version the version value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withVersion(Long version) { + this.version = version; + return this; + } + + /** + * Get the tags attached to the saved search. + * + * @return the tags value + */ + public List tags() { + return this.tags; + } + + /** + * Set the tags attached to the saved search. + * + * @param tags the tags value to set + * @return the SavedSearchInner object itself. + */ + public SavedSearchInner withTags(List tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesImpl.java new file mode 100644 index 000000000000..2829e8f1c948 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesImpl.java @@ -0,0 +1,79 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearches; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearchesListResult; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearch; + +class SavedSearchesImpl extends WrapperImpl implements SavedSearches { + private final LogAnalyticsManager manager; + + SavedSearchesImpl(LogAnalyticsManager manager) { + super(manager.inner().savedSearches()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public SavedSearchImpl define(String name) { + return wrapModel(name); + } + + private SavedSearchImpl wrapModel(SavedSearchInner inner) { + return new SavedSearchImpl(inner, manager()); + } + + private SavedSearchImpl wrapModel(String name) { + return new SavedSearchImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + SavedSearchesInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .map(new Func1() { + @Override + public SavedSearchesListResult call(SavedSearchesListResultInner inner) { + return new SavedSearchesListResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + SavedSearchesInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, savedSearchId) + .flatMap(new Func1>() { + @Override + public Observable call(SavedSearchInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SavedSearch)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + SavedSearchesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, savedSearchId).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesInner.java new file mode 100644 index 000000000000..8f814fd4dbb0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesInner.java @@ -0,0 +1,448 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SavedSearches. + */ +public class SavedSearchesInner { + /** The Retrofit service to perform REST calls. */ + private SavedSearchesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SavedSearchesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SavedSearchesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(SavedSearchesService.class); + this.client = client; + } + + /** + * The interface defining all the services for SavedSearches to be + * used by Retrofit to perform actually REST calls. + */ + interface SavedSearchesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearches delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("savedSearchId") String savedSearchId, @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.loganalytics.v2020_03_01_preview.SavedSearches createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("savedSearchId") String savedSearchId, @Query("api-version") String apiVersion, @Body SavedSearchInner parameters, @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.loganalytics.v2020_03_01_preview.SavedSearches get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchId}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("savedSearchId") String savedSearchId, @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.loganalytics.v2020_03_01_preview.SavedSearches listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, String savedSearchId) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId).toBlocking().single().body(); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 deleteAsync(String resourceGroupName, String workspaceName, String savedSearchId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId), serviceCallback); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes the specified saved search in a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (savedSearchId == null) { + throw new IllegalArgumentException("Parameter savedSearchId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(this.client.subscriptionId(), resourceGroupName, workspaceName, savedSearchId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters The parameters required to save a search. + * @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 SavedSearchInner object if successful. + */ + public SavedSearchInner createOrUpdate(String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId, parameters).toBlocking().single().body(); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters The parameters required to save a search. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId, parameters), serviceCallback); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters The parameters required to save a search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId, parameters).map(new Func1, SavedSearchInner>() { + @Override + public SavedSearchInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates a saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @param parameters The parameters required to save a search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String savedSearchId, SavedSearchInner parameters) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (savedSearchId == null) { + throw new IllegalArgumentException("Parameter savedSearchId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, workspaceName, savedSearchId, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 SavedSearchInner object if successful. + */ + public SavedSearchInner get(String resourceGroupName, String workspaceName, String savedSearchId) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId).toBlocking().single().body(); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @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 workspaceName, String savedSearchId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId), serviceCallback); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, savedSearchId).map(new Func1, SavedSearchInner>() { + @Override + public SavedSearchInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the specified saved search for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param savedSearchId The id of the saved search. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String savedSearchId) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (savedSearchId == null) { + throw new IllegalArgumentException("Parameter savedSearchId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, workspaceName, savedSearchId, 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 SavedSearchesListResultInner object if successful. + */ + public SavedSearchesListResultInner listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchesListResultInner object + */ + public Observable listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, SavedSearchesListResultInner>() { + @Override + public SavedSearchesListResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the saved searches for a given Log Analytics Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SavedSearchesListResultInner object + */ + public Observable> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listByWorkspaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listByWorkspaceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultImpl.java new file mode 100644 index 000000000000..dea4aa5e63e2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultImpl.java @@ -0,0 +1,32 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SavedSearchesListResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; + +class SavedSearchesListResultImpl extends WrapperImpl implements SavedSearchesListResult { + private final LogAnalyticsManager manager; + SavedSearchesListResultImpl(SavedSearchesListResultInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultInner.java new file mode 100644 index 000000000000..f5a6503b2b5a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SavedSearchesListResultInner.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.loganalytics.v2020_03_01_preview.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The saved search list operation response. + */ +public class SavedSearchesListResultInner { + /** + * The array of result values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the array of result values. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the array of result values. + * + * @param value the value value to set + * @return the SavedSearchesListResultInner object itself. + */ + public SavedSearchesListResultInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasImpl.java new file mode 100644 index 000000000000..5996e72697a2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasImpl.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. + * abc + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Schemas; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchGetSchemaResponse; + +class SchemasImpl extends WrapperImpl implements Schemas { + private final LogAnalyticsManager manager; + + SchemasImpl(LogAnalyticsManager manager) { + super(manager.inner().schemas()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName) { + SchemasInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName) + .map(new Func1() { + @Override + public SearchGetSchemaResponse call(SearchGetSchemaResponseInner inner) { + return new SearchGetSchemaResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasInner.java new file mode 100644 index 000000000000..f1bbbb69e12f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SchemasInner.java @@ -0,0 +1,146 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Schemas. + */ +public class SchemasInner { + /** The Retrofit service to perform REST calls. */ + private SchemasService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SchemasInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SchemasInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(SchemasService.class); + this.client = client; + } + + /** + * The interface defining all the services for Schemas to be + * used by Retrofit to perform actually REST calls. + */ + interface SchemasService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Schemas get" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/schema") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 SearchGetSchemaResponseInner object if successful. + */ + public SearchGetSchemaResponseInner get(String resourceGroupName, String workspaceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchGetSchemaResponseInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, SearchGetSchemaResponseInner>() { + @Override + public SearchGetSchemaResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the schema for a given workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SearchGetSchemaResponseInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseImpl.java new file mode 100644 index 000000000000..e05dec819784 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseImpl.java @@ -0,0 +1,39 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchGetSchemaResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchMetadata; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchSchemaValue; + +class SearchGetSchemaResponseImpl extends WrapperImpl implements SearchGetSchemaResponse { + private final LogAnalyticsManager manager; + SearchGetSchemaResponseImpl(SearchGetSchemaResponseInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public SearchMetadata metadata() { + return this.inner().metadata(); + } + + @Override + public List value() { + return this.inner().value(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseInner.java new file mode 100644 index 000000000000..c23ad0c1ec28 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SearchGetSchemaResponseInner.java @@ -0,0 +1,72 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchMetadata; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SearchSchemaValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The get schema operation response. + */ +public class SearchGetSchemaResponseInner { + /** + * The metadata from search results. + */ + @JsonProperty(value = "metadata") + private SearchMetadata metadata; + + /** + * The array of result values. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the metadata from search results. + * + * @return the metadata value + */ + public SearchMetadata metadata() { + return this.metadata; + } + + /** + * Set the metadata from search results. + * + * @param metadata the metadata value to set + * @return the SearchGetSchemaResponseInner object itself. + */ + public SearchGetSchemaResponseInner withMetadata(SearchMetadata metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the array of result values. + * + * @return the value value + */ + public List value() { + return this.value; + } + + /** + * Set the array of result values. + * + * @param value the value value to set + * @return the SearchGetSchemaResponseInner object itself. + */ + public SearchGetSchemaResponseInner withValue(List value) { + this.value = value; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysImpl.java new file mode 100644 index 000000000000..a9c814a3a70b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysImpl.java @@ -0,0 +1,36 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SharedKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SharedKeysImpl extends WrapperImpl implements SharedKeys { + private final LogAnalyticsManager manager; + SharedKeysImpl(SharedKeysInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public String primarySharedKey() { + return this.inner().primarySharedKey(); + } + + @Override + public String secondarySharedKey() { + return this.inner().secondarySharedKey(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysInner.java new file mode 100644 index 000000000000..313ced6378fb --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysInner.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The shared keys for a workspace. + */ +public class SharedKeysInner { + /** + * The primary shared key of a workspace. + */ + @JsonProperty(value = "primarySharedKey") + private String primarySharedKey; + + /** + * The secondary shared key of a workspace. + */ + @JsonProperty(value = "secondarySharedKey") + private String secondarySharedKey; + + /** + * Get the primary shared key of a workspace. + * + * @return the primarySharedKey value + */ + public String primarySharedKey() { + return this.primarySharedKey; + } + + /** + * Set the primary shared key of a workspace. + * + * @param primarySharedKey the primarySharedKey value to set + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withPrimarySharedKey(String primarySharedKey) { + this.primarySharedKey = primarySharedKey; + return this; + } + + /** + * Get the secondary shared key of a workspace. + * + * @return the secondarySharedKey value + */ + public String secondarySharedKey() { + return this.secondarySharedKey; + } + + /** + * Set the secondary shared key of a workspace. + * + * @param secondarySharedKey the secondarySharedKey value to set + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withSecondarySharedKey(String secondarySharedKey) { + this.secondarySharedKey = secondarySharedKey; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsImpl.java new file mode 100644 index 000000000000..1710329f83eb --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsImpl.java @@ -0,0 +1,54 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SharedKeysOperations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SharedKeys; + +class SharedKeysOperationsImpl extends WrapperImpl implements SharedKeysOperations { + private final LogAnalyticsManager manager; + + SharedKeysOperationsImpl(LogAnalyticsManager manager) { + super(manager.inner().sharedKeysOperations()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable getSharedKeysAsync(String resourceGroupName, String workspaceName) { + SharedKeysOperationsInner client = this.inner(); + return client.getSharedKeysAsync(resourceGroupName, workspaceName) + .map(new Func1() { + @Override + public SharedKeys call(SharedKeysInner inner) { + return new SharedKeysImpl(inner, manager()); + } + }); + } + + @Override + public Observable regenerateAsync(String resourceGroupName, String workspaceName) { + SharedKeysOperationsInner client = this.inner(); + return client.regenerateAsync(resourceGroupName, workspaceName) + .map(new Func1() { + @Override + public SharedKeys call(SharedKeysInner inner) { + return new SharedKeysImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsInner.java new file mode 100644 index 000000000000..8be081d63581 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/SharedKeysOperationsInner.java @@ -0,0 +1,236 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SharedKeysOperations. + */ +public class SharedKeysOperationsInner { + /** The Retrofit service to perform REST calls. */ + private SharedKeysOperationsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of SharedKeysOperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SharedKeysOperationsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(SharedKeysOperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for SharedKeysOperations to be + * used by Retrofit to perform actually REST calls. + */ + interface SharedKeysOperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.SharedKeysOperations getSharedKeys" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys") + Observable> getSharedKeys(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.SharedKeysOperations regenerate" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/regenerateSharedKey") + Observable> regenerate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 SharedKeysInner object if successful. + */ + public SharedKeysInner getSharedKeys(String resourceGroupName, String workspaceName) { + return getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 getSharedKeysAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable getSharedKeysAsync(String resourceGroupName, String workspaceName) { + return getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, SharedKeysInner>() { + @Override + public SharedKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable> getSharedKeysWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getSharedKeys(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSharedKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSharedKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 SharedKeysInner object if successful. + */ + public SharedKeysInner regenerate(String resourceGroupName, String workspaceName) { + return regenerateWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 regenerateAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable regenerateAsync(String resourceGroupName, String workspaceName) { + return regenerateWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, SharedKeysInner>() { + @Override + public SharedKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates the shared keys for a Log Analytics Workspace. These keys are used to connect Microsoft Operational Insights agents to the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable> regenerateWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.regenerate(this.client.subscriptionId(), resourceGroupName, workspaceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = regenerateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse regenerateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsImpl.java new file mode 100644 index 000000000000..4fde079f0af0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsImpl.java @@ -0,0 +1,85 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsightConfigs; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsight; + +class StorageInsightConfigsImpl extends WrapperImpl implements StorageInsightConfigs { + private final LogAnalyticsManager manager; + + StorageInsightConfigsImpl(LogAnalyticsManager manager) { + super(manager.inner().storageInsightConfigs()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public StorageInsightImpl define(String name) { + return wrapModel(name); + } + + private StorageInsightImpl wrapModel(StorageInsightInner inner) { + return new StorageInsightImpl(inner, manager()); + } + + private StorageInsightImpl wrapModel(String name) { + return new StorageInsightImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName) { + StorageInsightConfigsInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public StorageInsight call(StorageInsightInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + StorageInsightConfigsInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, storageInsightName) + .flatMap(new Func1>() { + @Override + public Observable call(StorageInsightInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((StorageInsight)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + StorageInsightConfigsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, storageInsightName).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsInner.java new file mode 100644 index 000000000000..76f0b2143f44 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightConfigsInner.java @@ -0,0 +1,608 @@ +/** + * 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.loganalytics.v2020_03_01_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.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +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.HTTP; +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 StorageInsightConfigs. + */ +public class StorageInsightConfigsInner { + /** The Retrofit service to perform REST calls. */ + private StorageInsightConfigsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of StorageInsightConfigsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public StorageInsightConfigsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(StorageInsightConfigsService.class); + this.client = client; + } + + /** + * The interface defining all the services for StorageInsightConfigs to be + * used by Retrofit to perform actually REST calls. + */ + interface StorageInsightConfigsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsightConfigs createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("storageInsightName") String storageInsightName, @Path("subscriptionId") String subscriptionId, @Body StorageInsightInner parameters, @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.loganalytics.v2020_03_01_preview.StorageInsightConfigs get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("storageInsightName") String storageInsightName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.StorageInsightConfigs delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("storageInsightName") String storageInsightName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.StorageInsightConfigs listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.StorageInsightConfigs listByWorkspaceNext" }) + @GET + Observable> listByWorkspaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @param parameters The parameters required to create or update a storage insight. + * @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 StorageInsightInner object if successful. + */ + public StorageInsightInner createOrUpdate(String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @param parameters The parameters required to create or update a storage insight. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName, parameters), serviceCallback); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @param parameters The parameters required to create or update a storage insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageInsightInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName, parameters).map(new Func1, StorageInsightInner>() { + @Override + public StorageInsightInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a storage insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @param parameters The parameters required to create or update a storage insight. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageInsightInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String storageInsightName, StorageInsightInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (storageInsightName == null) { + throw new IllegalArgumentException("Parameter storageInsightName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, workspaceName, storageInsightName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @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 StorageInsightInner object if successful. + */ + public StorageInsightInner get(String resourceGroupName, String workspaceName, String storageInsightName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName).toBlocking().single().body(); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 workspaceName, String storageInsightName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName), serviceCallback); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageInsightInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName).map(new Func1, StorageInsightInner>() { + @Override + public StorageInsightInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a storage insight instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the StorageInsightInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (storageInsightName == null) { + throw new IllegalArgumentException("Parameter storageInsightName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, storageInsightName, this.client.subscriptionId(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, String storageInsightName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName).toBlocking().single().body(); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs 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 deleteAsync(String resourceGroupName, String workspaceName, String storageInsightName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName), serviceCallback); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, storageInsightName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a storageInsightsConfigs resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param storageInsightName Name of the storageInsightsConfigs resource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String storageInsightName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (storageInsightName == null) { + throw new IllegalArgumentException("Parameter storageInsightName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, workspaceName, storageInsightName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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<StorageInsightInner> object if successful. + */ + public PagedList listByWorkspace(final String resourceGroupName, final String workspaceName) { + ServiceResponse> response = listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageInsightInner> object + */ + public Observable> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<StorageInsightInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName) { + return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName) + .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(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the storage insight instances within a workspace. + * + ServiceResponse> * @param resourceGroupName The name of the resource group. The name is case insensitive. + ServiceResponse> * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageInsightInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(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); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @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<StorageInsightInner> object if successful. + */ + public PagedList listByWorkspaceNext(final String nextPageLink) { + ServiceResponse> response = listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists the storage insight instances within a workspace. + * + * @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> listByWorkspaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @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<StorageInsightInner> object + */ + public Observable> listByWorkspaceNextAsync(final String nextPageLink) { + return listByWorkspaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the storage insight instances within a workspace. + * + * @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<StorageInsightInner> object + */ + public Observable>> listByWorkspaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(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(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists the storage insight instances within a workspace. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<StorageInsightInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceNextSinglePageAsync(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.listByWorkspaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceNextDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightImpl.java new file mode 100644 index 000000000000..4c971588ed58 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightImpl.java @@ -0,0 +1,158 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsight; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageAccount; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsightStatus; +import java.util.Map; + +class StorageInsightImpl extends CreatableUpdatableImpl implements StorageInsight, StorageInsight.Definition, StorageInsight.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String storageInsightName; + + StorageInsightImpl(String name, LogAnalyticsManager manager) { + super(name, new StorageInsightInner()); + this.manager = manager; + // Set resource name + this.storageInsightName = name; + // + } + + StorageInsightImpl(StorageInsightInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.storageInsightName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.storageInsightName = IdParsingUtils.getValueFromIdByName(inner.id(), "storageInsightConfigs"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + StorageInsightConfigsInner client = this.manager().inner().storageInsightConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.storageInsightName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + StorageInsightConfigsInner client = this.manager().inner().storageInsightConfigs(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.storageInsightName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + StorageInsightConfigsInner client = this.manager().inner().storageInsightConfigs(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.storageInsightName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public List containers() { + return this.inner().containers(); + } + + @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 StorageInsightStatus status() { + return this.inner().status(); + } + + @Override + public StorageAccount storageAccount() { + return this.inner().storageAccount(); + } + + @Override + public List tables() { + return this.inner().tables(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public StorageInsightImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public StorageInsightImpl withStorageAccount(StorageAccount storageAccount) { + this.inner().withStorageAccount(storageAccount); + return this; + } + + @Override + public StorageInsightImpl withContainers(List containers) { + this.inner().withContainers(containers); + return this; + } + + @Override + public StorageInsightImpl withETag(String eTag) { + this.inner().withETag(eTag); + return this; + } + + @Override + public StorageInsightImpl withTables(List tables) { + this.inner().withTables(tables); + return this; + } + + @Override + public StorageInsightImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightInner.java new file mode 100644 index 000000000000..0a487be711d7 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/StorageInsightInner.java @@ -0,0 +1,169 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageAccount; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.StorageInsightStatus; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The top level storage insight resource container. + */ +@JsonFlatten +public class StorageInsightInner extends ProxyResource { + /** + * The names of the blob containers that the workspace should read. + */ + @JsonProperty(value = "properties.containers") + private List containers; + + /** + * The names of the Azure tables that the workspace should read. + */ + @JsonProperty(value = "properties.tables") + private List tables; + + /** + * The storage account connection details. + */ + @JsonProperty(value = "properties.storageAccount", required = true) + private StorageAccount storageAccount; + + /** + * The status of the storage insight. + */ + @JsonProperty(value = "properties.status", access = JsonProperty.Access.WRITE_ONLY) + private StorageInsightStatus status; + + /** + * The ETag of the storage insight. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the names of the blob containers that the workspace should read. + * + * @return the containers value + */ + public List containers() { + return this.containers; + } + + /** + * Set the names of the blob containers that the workspace should read. + * + * @param containers the containers value to set + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withContainers(List containers) { + this.containers = containers; + return this; + } + + /** + * Get the names of the Azure tables that the workspace should read. + * + * @return the tables value + */ + public List tables() { + return this.tables; + } + + /** + * Set the names of the Azure tables that the workspace should read. + * + * @param tables the tables value to set + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withTables(List tables) { + this.tables = tables; + return this; + } + + /** + * Get the storage account connection details. + * + * @return the storageAccount value + */ + public StorageAccount storageAccount() { + return this.storageAccount; + } + + /** + * Set the storage account connection details. + * + * @param storageAccount the storageAccount value to set + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withStorageAccount(StorageAccount storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get the status of the storage insight. + * + * @return the status value + */ + public StorageInsightStatus status() { + return this.status; + } + + /** + * Get the ETag of the storage insight. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag of the storage insight. + * + * @param eTag the eTag value to set + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the StorageInsightInner object itself. + */ + public StorageInsightInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableImpl.java new file mode 100644 index 000000000000..ad72e2868d70 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableImpl.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Table; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +class TableImpl extends CreatableUpdatableImpl implements Table, Table.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String tableName; + private Integer uretentionInDays; + + TableImpl(String name, LogAnalyticsManager manager) { + super(name, new TableInner()); + this.manager = manager; + // Set resource name + this.tableName = name; + // + } + + TableImpl(TableInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.tableName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable
createResourceAsync() { + TablesInner client = this.manager().inner().tables(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable
updateResourceAsync() { + TablesInner client = this.manager().inner().tables(); + return client.updateAsync(this.resourceGroupName, this.workspaceName, this.tableName, this.uretentionInDays) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TablesInner client = this.manager().inner().tables(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.tableName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer retentionInDays() { + return this.inner().retentionInDays(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TableImpl withRetentionInDays(Integer retentionInDays) { + this.uretentionInDays = retentionInDays; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableInner.java new file mode 100644 index 000000000000..18b4c2855871 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TableInner.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.loganalytics.v2020_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Workspace data table definition. + */ +@JsonFlatten +public class TableInner extends ProxyResource { + /** + * The data table data retention in days, between 30 and 730. Setting this + * property to null will default to the workspace retention. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /** + * Get the data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * + * @return the retentionInDays value + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * + * @param retentionInDays the retentionInDays value to set + * @return the TableInner object itself. + */ + public TableInner withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesImpl.java new file mode 100644 index 000000000000..18603fa5191d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesImpl.java @@ -0,0 +1,69 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tables; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Table; + +class TablesImpl extends WrapperImpl implements Tables { + private final LogAnalyticsManager manager; + + TablesImpl(LogAnalyticsManager manager) { + super(manager.inner().tables()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private TableImpl wrapModel(TableInner inner) { + return new TableImpl(inner, manager()); + } + + @Override + public Observable
listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + TablesInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public Table call(TableInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable
getAsync(String resourceGroupName, String workspaceName, String tableName) { + TablesInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, tableName) + .flatMap(new Func1>() { + @Override + public Observable
call(TableInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((Table)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesInner.java new file mode 100644 index 000000000000..ed327a63b3e2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/TablesInner.java @@ -0,0 +1,443 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.ErrorContractException; +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.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Tables. + */ +public class TablesInner { + /** The Retrofit service to perform REST calls. */ + private TablesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of TablesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TablesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(TablesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Tables to be + * used by Retrofit to perform actually REST calls. + */ + interface TablesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tables listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables") + Observable> listByWorkspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @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.loganalytics.v2020_03_01_preview.Tables update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body TableInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Tables get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/tables/{tableName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorContractException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<TableInner> object if successful. + */ + public List listByWorkspace(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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> listByWorkspaceAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TableInner> object + */ + public Observable> listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets all the tables for the specified Log Analytics workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<TableInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(this.client.subscriptionId(), resourceGroupName, workspaceName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(Response response) throws ErrorContractException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorContractException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorContractException.class) + .build(response); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorContractException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TableInner object if successful. + */ + public TableInner update(String resourceGroupName, String workspaceName, String tableName) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName).toBlocking().single().body(); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 workspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName), serviceCallback); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable updateAsync(String resourceGroupName, String workspaceName, String tableName) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName).map(new Func1, TableInner>() { + @Override + public TableInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String tableName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Integer retentionInDays = null; + TableInner parameters = new TableInner(); + parameters.withRetentionInDays(null); + return service.update(this.client.subscriptionId(), resourceGroupName, workspaceName, tableName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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); + } + } + }); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param retentionInDays The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorContractException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TableInner object if successful. + */ + public TableInner update(String resourceGroupName, String workspaceName, String tableName, Integer retentionInDays) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName, retentionInDays).toBlocking().single().body(); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param retentionInDays The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * @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 workspaceName, String tableName, Integer retentionInDays, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName, retentionInDays), serviceCallback); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param retentionInDays The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable updateAsync(String resourceGroupName, String workspaceName, String tableName, Integer retentionInDays) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, tableName, retentionInDays).map(new Func1, TableInner>() { + @Override + public TableInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a Log Analytics workspace table properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @param retentionInDays The data table data retention in days, between 30 and 730. Setting this property to null will default to the workspace retention. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String tableName, Integer retentionInDays) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + TableInner parameters = new TableInner(); + parameters.withRetentionInDays(retentionInDays); + return service.update(this.client.subscriptionId(), resourceGroupName, workspaceName, tableName, this.client.apiVersion(), this.client.acceptLanguage(), parameters, 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 ErrorContractException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorContractException.class) + .build(response); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorContractException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the TableInner object if successful. + */ + public TableInner get(String resourceGroupName, String workspaceName, String tableName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, tableName).toBlocking().single().body(); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @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 workspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, tableName), serviceCallback); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String tableName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, tableName).map(new Func1, TableInner>() { + @Override + public TableInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a Log Analytics workspace table. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param tableName The name of the table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String tableName) { + 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 (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(this.client.subscriptionId(), resourceGroupName, workspaceName, tableName, 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 ErrorContractException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorContractException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricImpl.java new file mode 100644 index 000000000000..8030cb3856bc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricImpl.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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.UsageMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.MetricName; +import org.joda.time.DateTime; + +class UsageMetricImpl extends WrapperImpl implements UsageMetric { + private final LogAnalyticsManager manager; + + UsageMetricImpl(UsageMetricInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricInner.java new file mode 100644 index 000000000000..bc63a82c56d4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsageMetricInner.java @@ -0,0 +1,176 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.MetricName; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric describing the usage of a resource. + */ +public class UsageMetricInner { + /** + * The name of the metric. + */ + @JsonProperty(value = "name") + private MetricName name; + + /** + * The units used for the metric. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * The current value of the metric. + */ + @JsonProperty(value = "currentValue") + private Double currentValue; + + /** + * The quota limit for the metric. + */ + @JsonProperty(value = "limit") + private Double limit; + + /** + * The time that the metric's value will reset. + */ + @JsonProperty(value = "nextResetTime") + private DateTime nextResetTime; + + /** + * The quota period that determines the length of time between value + * resets. + */ + @JsonProperty(value = "quotaPeriod") + private String quotaPeriod; + + /** + * Get the name of the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Set the name of the metric. + * + * @param name the name value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withName(MetricName name) { + this.name = name; + return this; + } + + /** + * Get the units used for the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set the units used for the metric. + * + * @param unit the unit value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Set the current value of the metric. + * + * @param currentValue the currentValue value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withCurrentValue(Double currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the quota limit for the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Set the quota limit for the metric. + * + * @param limit the limit value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withLimit(Double limit) { + this.limit = limit; + return this; + } + + /** + * Get the time that the metric's value will reset. + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Set the time that the metric's value will reset. + * + * @param nextResetTime the nextResetTime value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withNextResetTime(DateTime nextResetTime) { + this.nextResetTime = nextResetTime; + return this; + } + + /** + * Get the quota period that determines the length of time between value resets. + * + * @return the quotaPeriod value + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Set the quota period that determines the length of time between value resets. + * + * @param quotaPeriod the quotaPeriod value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withQuotaPeriod(String quotaPeriod) { + this.quotaPeriod = quotaPeriod; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesImpl.java new file mode 100644 index 000000000000..5ed34883b99c --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesImpl.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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Usages; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.UsageMetric; + +class UsagesImpl extends WrapperImpl implements Usages { + private final LogAnalyticsManager manager; + + UsagesImpl(LogAnalyticsManager manager) { + super(manager.inner().usages()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private UsageMetricImpl wrapModel(UsageMetricInner inner) { + return new UsageMetricImpl(inner, manager()); + } + + @Override + public Observable listAsync(String resourceGroupName, String workspaceName) { + UsagesInner client = this.inner(); + return client.listAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public UsageMetric call(UsageMetricInner inner) { + return wrapModel(inner); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesInner.java new file mode 100644 index 000000000000..bcdbe698ac2a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/UsagesInner.java @@ -0,0 +1,152 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +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.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Usages. + */ +public class UsagesInner { + /** The Retrofit service to perform REST calls. */ + private UsagesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of UsagesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public UsagesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(UsagesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Usages to be + * used by Retrofit to perform actually REST calls. + */ + interface UsagesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Usages list" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages") + Observable> list(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 List<UsageMetricInner> object if successful. + */ + public List list(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageMetricInner> object + */ + public Observable> listAsync(String resourceGroupName, String workspaceName) { + return listWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageMetricInner> object + */ + public Observable>> listWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(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/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceImpl.java new file mode 100644 index 000000000000..02a0ccc468b1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceImpl.java @@ -0,0 +1,184 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Workspace; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePatch; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceEntityStatus; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceSku; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceCapping; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PublicNetworkAccessType; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PrivateLinkScopedResource; +import rx.functions.Func1; + +class WorkspaceImpl extends GroupableResourceCoreImpl implements Workspace, Workspace.Definition, Workspace.Update { + private WorkspacePatch updateParameter; + WorkspaceImpl(String name, WorkspaceInner inner, LogAnalyticsManager manager) { + super(name, inner, manager); + this.updateParameter = new WorkspacePatch(); + } + + @Override + public Observable createResourceAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(new Func1() { + @Override + public WorkspaceInner call(WorkspaceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public WorkspaceInner call(WorkspaceInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.updateParameter = new WorkspacePatch(); + } + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public List privateLinkScopedResources() { + return this.inner().privateLinkScopedResources(); + } + + @Override + public WorkspaceEntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.inner().publicNetworkAccessForIngestion(); + } + + @Override + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.inner().publicNetworkAccessForQuery(); + } + + @Override + public Integer retentionInDays() { + return this.inner().retentionInDays(); + } + + @Override + public WorkspaceSku sku() { + return this.inner().sku(); + } + + @Override + public WorkspaceCapping workspaceCapping() { + return this.inner().workspaceCapping(); + } + + @Override + public WorkspaceImpl withETag(String eTag) { + this.inner().withETag(eTag); + return this; + } + + @Override + public WorkspaceImpl withProvisioningState(WorkspaceEntityStatus provisioningState) { + if (isInCreateMode()) { + this.inner().withProvisioningState(provisioningState); + } else { + this.updateParameter.withProvisioningState(provisioningState); + } + return this; + } + + @Override + public WorkspaceImpl withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + if (isInCreateMode()) { + this.inner().withPublicNetworkAccessForIngestion(publicNetworkAccessForIngestion); + } else { + this.updateParameter.withPublicNetworkAccessForIngestion(publicNetworkAccessForIngestion); + } + return this; + } + + @Override + public WorkspaceImpl withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + if (isInCreateMode()) { + this.inner().withPublicNetworkAccessForQuery(publicNetworkAccessForQuery); + } else { + this.updateParameter.withPublicNetworkAccessForQuery(publicNetworkAccessForQuery); + } + return this; + } + + @Override + public WorkspaceImpl withRetentionInDays(Integer retentionInDays) { + if (isInCreateMode()) { + this.inner().withRetentionInDays(retentionInDays); + } else { + this.updateParameter.withRetentionInDays(retentionInDays); + } + return this; + } + + @Override + public WorkspaceImpl withSku(WorkspaceSku sku) { + if (isInCreateMode()) { + this.inner().withSku(sku); + } else { + this.updateParameter.withSku(sku); + } + return this; + } + + @Override + public WorkspaceImpl withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + if (isInCreateMode()) { + this.inner().withWorkspaceCapping(workspaceCapping); + } else { + this.updateParameter.withWorkspaceCapping(workspaceCapping); + } + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceInner.java new file mode 100644 index 000000000000..93cd280d9ae6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceInner.java @@ -0,0 +1,244 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceEntityStatus; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceSku; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceCapping; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PublicNetworkAccessType; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PrivateLinkScopedResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * The top level Workspace resource container. + */ +@JsonFlatten +public class WorkspaceInner extends Resource { + /** + * The provisioning state of the workspace. Possible values include: + * 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', + * 'ProvisioningAccount', 'Updating'. + */ + @JsonProperty(value = "properties.provisioningState") + private WorkspaceEntityStatus provisioningState; + + /** + * This is a read-only property. Represents the ID associated with the + * workspace. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * The SKU of the workspace. + */ + @JsonProperty(value = "properties.sku") + private WorkspaceSku sku; + + /** + * The workspace data retention in days. -1 means Unlimited retention for + * the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /** + * The daily volume cap for ingestion. + */ + @JsonProperty(value = "properties.workspaceCapping") + private WorkspaceCapping workspaceCapping; + + /** + * The network access type for accessing Log Analytics ingestion. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccessForIngestion") + private PublicNetworkAccessType publicNetworkAccessForIngestion; + + /** + * The network access type for accessing Log Analytics query. Possible + * values include: 'Enabled', 'Disabled'. + */ + @JsonProperty(value = "properties.publicNetworkAccessForQuery") + private PublicNetworkAccessType publicNetworkAccessForQuery; + + /** + * List of linked private link scope resources. + */ + @JsonProperty(value = "properties.privateLinkScopedResources", access = JsonProperty.Access.WRITE_ONLY) + private List privateLinkScopedResources; + + /** + * The ETag of the workspace. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Get the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @return the provisioningState value + */ + public WorkspaceEntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount', 'Updating'. + * + * @param provisioningState the provisioningState value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProvisioningState(WorkspaceEntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get this is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get the SKU of the workspace. + * + * @return the sku value + */ + public WorkspaceSku sku() { + return this.sku; + } + + /** + * Set the SKU of the workspace. + * + * @param sku the sku value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withSku(WorkspaceSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @return the retentionInDays value + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @param retentionInDays the retentionInDays value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Get the daily volume cap for ingestion. + * + * @return the workspaceCapping value + */ + public WorkspaceCapping workspaceCapping() { + return this.workspaceCapping; + } + + /** + * Set the daily volume cap for ingestion. + * + * @param workspaceCapping the workspaceCapping value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withWorkspaceCapping(WorkspaceCapping workspaceCapping) { + this.workspaceCapping = workspaceCapping; + return this; + } + + /** + * Get the network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. + * + * @return the publicNetworkAccessForIngestion value + */ + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.publicNetworkAccessForIngestion; + } + + /** + * Set the network access type for accessing Log Analytics ingestion. Possible values include: 'Enabled', 'Disabled'. + * + * @param publicNetworkAccessForIngestion the publicNetworkAccessForIngestion value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withPublicNetworkAccessForIngestion(PublicNetworkAccessType publicNetworkAccessForIngestion) { + this.publicNetworkAccessForIngestion = publicNetworkAccessForIngestion; + return this; + } + + /** + * Get the network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled'. + * + * @return the publicNetworkAccessForQuery value + */ + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.publicNetworkAccessForQuery; + } + + /** + * Set the network access type for accessing Log Analytics query. Possible values include: 'Enabled', 'Disabled'. + * + * @param publicNetworkAccessForQuery the publicNetworkAccessForQuery value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withPublicNetworkAccessForQuery(PublicNetworkAccessType publicNetworkAccessForQuery) { + this.publicNetworkAccessForQuery = publicNetworkAccessForQuery; + return this; + } + + /** + * Get list of linked private link scope resources. + * + * @return the privateLinkScopedResources value + */ + public List privateLinkScopedResources() { + return this.privateLinkScopedResources; + } + + /** + * Get the ETag of the workspace. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag of the workspace. + * + * @param eTag the eTag value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceModelImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceModelImpl.java new file mode 100644 index 000000000000..c3375e3db16b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspaceModelImpl.java @@ -0,0 +1,91 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceModel; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PrivateLinkScopedResource; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceEntityStatus; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PublicNetworkAccessType; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceSku; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspaceCapping; + +class WorkspaceModelImpl extends GroupableResourceCoreImpl implements WorkspaceModel { + WorkspaceModelImpl(String name, WorkspaceInner inner, LogAnalyticsManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + DeletedWorkspacesInner client = this.manager().inner().deletedWorkspaces(); + return null; // NOP createResourceAsync implementation as create is not supported + } + + @Override + public Observable updateResourceAsync() { + DeletedWorkspacesInner client = this.manager().inner().deletedWorkspaces(); + return null; // NOP updateResourceAsync implementation as update is not supported + } + + @Override + protected Observable getInnerAsync() { + DeletedWorkspacesInner client = this.manager().inner().deletedWorkspaces(); + return null; // NOP getInnerAsync implementation as get is not supported + } + + + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public List privateLinkScopedResources() { + return this.inner().privateLinkScopedResources(); + } + + @Override + public WorkspaceEntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public PublicNetworkAccessType publicNetworkAccessForIngestion() { + return this.inner().publicNetworkAccessForIngestion(); + } + + @Override + public PublicNetworkAccessType publicNetworkAccessForQuery() { + return this.inner().publicNetworkAccessForQuery(); + } + + @Override + public Integer retentionInDays() { + return this.inner().retentionInDays(); + } + + @Override + public WorkspaceSku sku() { + return this.inner().sku(); + } + + @Override + public WorkspaceCapping workspaceCapping() { + return this.inner().workspaceCapping(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseImpl.java new file mode 100644 index 000000000000..92ab7a9263a4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseImpl.java @@ -0,0 +1,31 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class WorkspacePurgeResponseImpl extends WrapperImpl implements WorkspacePurgeResponse { + private final LogAnalyticsManager manager; + WorkspacePurgeResponseImpl(WorkspacePurgeResponseInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public String operationId() { + return this.inner().operationId(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseInner.java new file mode 100644 index 000000000000..96cdcea3813b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeResponseInner.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.loganalytics.v2020_03_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing operationId for a specific purge action. + */ +public class WorkspacePurgeResponseInner { + /** + * Id to use when querying for status for a particular purge operation. + */ + @JsonProperty(value = "operationId", required = true) + private String operationId; + + /** + * Get id to use when querying for status for a particular purge operation. + * + * @return the operationId value + */ + public String operationId() { + return this.operationId; + } + + /** + * Set id to use when querying for status for a particular purge operation. + * + * @param operationId the operationId value to set + * @return the WorkspacePurgeResponseInner object itself. + */ + public WorkspacePurgeResponseInner withOperationId(String operationId) { + this.operationId = operationId; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseImpl.java new file mode 100644 index 000000000000..f6ee51544676 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseImpl.java @@ -0,0 +1,39 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeStatusResponse; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PurgeState; + +class WorkspacePurgeStatusResponseImpl extends WrapperImpl implements WorkspacePurgeStatusResponse { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String purgeId; + + WorkspacePurgeStatusResponseImpl(WorkspacePurgeStatusResponseInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public PurgeState status() { + return this.inner().status(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseInner.java new file mode 100644 index 000000000000..c709936ffbba --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgeStatusResponseInner.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.PurgeState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response containing status for a specific purge operation. + */ +public class WorkspacePurgeStatusResponseInner { + /** + * Status of the operation represented by the requested Id. Possible values + * include: 'pending', 'completed'. + */ + @JsonProperty(value = "status", required = true) + private PurgeState status; + + /** + * Get status of the operation represented by the requested Id. Possible values include: 'pending', 'completed'. + * + * @return the status value + */ + public PurgeState status() { + return this.status; + } + + /** + * Set status of the operation represented by the requested Id. Possible values include: 'pending', 'completed'. + * + * @param status the status value to set + * @return the WorkspacePurgeStatusResponseInner object itself. + */ + public WorkspacePurgeStatusResponseInner withStatus(PurgeState status) { + this.status = status; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesImpl.java new file mode 100644 index 000000000000..f2bf232a43cd --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesImpl.java @@ -0,0 +1,64 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurges; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeStatusResponse; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeResponse; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeBody; + +class WorkspacePurgesImpl extends WrapperImpl implements WorkspacePurges { + private final LogAnalyticsManager manager; + + WorkspacePurgesImpl(LogAnalyticsManager manager) { + super(manager.inner().workspacePurges()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + private WorkspacePurgeStatusResponseImpl wrapModel(WorkspacePurgeStatusResponseInner inner) { + return new WorkspacePurgeStatusResponseImpl(inner, manager()); + } + + @Override + public Observable getPurgeStatusAsync(String resourceGroupName, String workspaceName, String purgeId) { + WorkspacePurgesInner client = this.inner(); + return client.getPurgeStatusAsync(resourceGroupName, workspaceName, purgeId) + .flatMap(new Func1>() { + @Override + public Observable call(WorkspacePurgeStatusResponseInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((WorkspacePurgeStatusResponse)wrapModel(inner)); + } + } + }); + } + + @Override + public Observable purgeAsync(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + WorkspacePurgesInner client = this.inner(); + return client.purgeAsync(resourceGroupName, workspaceName, body) + .map(new Func1() { + @Override + public WorkspacePurgeResponse call(WorkspacePurgeResponseInner inner) { + return new WorkspacePurgeResponseImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesInner.java new file mode 100644 index 000000000000..5ea79a4f40ab --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacePurgesInner.java @@ -0,0 +1,261 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgeBody; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurgePurgeHeaders; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.ServiceResponseWithHeaders; +import com.microsoft.rest.Validator; +import java.io.IOException; +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.POST; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in WorkspacePurges. + */ +public class WorkspacePurgesInner { + /** The Retrofit service to perform REST calls. */ + private WorkspacePurgesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of WorkspacePurgesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WorkspacePurgesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(WorkspacePurgesService.class); + this.client = client; + } + + /** + * The interface defining all the services for WorkspacePurges to be + * used by Retrofit to perform actually REST calls. + */ + interface WorkspacePurgesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePurges purge" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/purge") + Observable> purge(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("workspaceName") String workspaceName, @Query("api-version") String apiVersion, @Body WorkspacePurgeBody body, @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.loganalytics.v2020_03_01_preview.WorkspacePurges getPurgeStatus" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/operations/{purgeId}") + Observable> getPurgeStatus(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Path("workspaceName") String workspaceName, @Path("purgeId") String purgeId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a request to purge data in a single table of an Log Analytics Workspace + * @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 WorkspacePurgeResponseInner object if successful. + */ + public WorkspacePurgeResponseInner purge(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + return purgeWithServiceResponseAsync(resourceGroupName, workspaceName, body).toBlocking().single().body(); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a request to purge data in a single table of an Log Analytics Workspace + * @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 purgeAsync(String resourceGroupName, String workspaceName, WorkspacePurgeBody body, final ServiceCallback serviceCallback) { + return ServiceFuture.fromHeaderResponse(purgeWithServiceResponseAsync(resourceGroupName, workspaceName, body), serviceCallback); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a request to purge data in a single table of an Log Analytics Workspace + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspacePurgeResponseInner object + */ + public Observable purgeAsync(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + return purgeWithServiceResponseAsync(resourceGroupName, workspaceName, body).map(new Func1, WorkspacePurgeResponseInner>() { + @Override + public WorkspacePurgeResponseInner call(ServiceResponseWithHeaders response) { + return response.body(); + } + }); + } + + /** + * Purges data in an Log Analytics workspace by a set of user-defined filters. + In order to manage system resources, purge requests are throttled at 50 requests per hour. You should batch the execution of purge requests by sending a single command whose predicate includes all user identities that require purging. Use the in operator to specify multiple identities. You should run the query prior to using for a purge request to verify that the results are expected. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param body Describes the body of a request to purge data in a single table of an Log Analytics Workspace + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspacePurgeResponseInner object + */ + public Observable> purgeWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspacePurgeBody body) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (body == null) { + throw new IllegalArgumentException("Parameter body is required and cannot be null."); + } + Validator.validate(body); + return service.purge(resourceGroupName, this.client.subscriptionId(), workspaceName, this.client.apiVersion(), body, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponseWithHeaders clientResponse = purgeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponseWithHeaders purgeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildWithHeaders(response, WorkspacePurgePurgeHeaders.class); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 WorkspacePurgeStatusResponseInner object if successful. + */ + public WorkspacePurgeStatusResponseInner getPurgeStatus(String resourceGroupName, String workspaceName, String purgeId) { + return getPurgeStatusWithServiceResponseAsync(resourceGroupName, workspaceName, purgeId).toBlocking().single().body(); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @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 getPurgeStatusAsync(String resourceGroupName, String workspaceName, String purgeId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getPurgeStatusWithServiceResponseAsync(resourceGroupName, workspaceName, purgeId), serviceCallback); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspacePurgeStatusResponseInner object + */ + public Observable getPurgeStatusAsync(String resourceGroupName, String workspaceName, String purgeId) { + return getPurgeStatusWithServiceResponseAsync(resourceGroupName, workspaceName, purgeId).map(new Func1, WorkspacePurgeStatusResponseInner>() { + @Override + public WorkspacePurgeStatusResponseInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets status of an ongoing purge operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param purgeId In a purge status request, this is the Id of the operation the status of which is returned. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspacePurgeStatusResponseInner object + */ + public Observable> getPurgeStatusWithServiceResponseAsync(String resourceGroupName, String workspaceName, String purgeId) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (purgeId == null) { + throw new IllegalArgumentException("Parameter purgeId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getPurgeStatus(resourceGroupName, this.client.subscriptionId(), workspaceName, purgeId, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getPurgeStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getPurgeStatusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesImpl.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesImpl.java new file mode 100644 index 000000000000..5ed798d9f357 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesImpl.java @@ -0,0 +1,138 @@ +/** + * 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. + * def + */ + +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Workspaces; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Workspace; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; + +class WorkspacesImpl extends GroupableResourcesCoreImpl implements Workspaces { + protected WorkspacesImpl(LogAnalyticsManager manager) { + super(manager.inner().workspaces(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + WorkspacesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + WorkspacesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + WorkspacesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + WorkspacesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Workspace call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + WorkspacesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + WorkspacesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Workspace call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public WorkspaceImpl define(String name) { + return wrapModel(name); + } + + @Override + protected WorkspaceImpl wrapModel(WorkspaceInner inner) { + return new WorkspaceImpl(inner.name(), inner, manager()); + } + + @Override + protected WorkspaceImpl wrapModel(String name) { + return new WorkspaceImpl(name, new WorkspaceInner(), this.manager()); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesInner.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesInner.java new file mode 100644 index 000000000000..c911bf17bca1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/WorkspacesInner.java @@ -0,0 +1,932 @@ +/** + * 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.loganalytics.v2020_03_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.loganalytics.v2020_03_01_preview.WorkspacePatch; +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 com.microsoft.rest.Validator; +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.HTTP; +import retrofit2.http.PATCH; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Workspaces. + */ +public class WorkspacesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private WorkspacesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of WorkspacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WorkspacesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(WorkspacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Workspaces to be + * used by Retrofit to perform actually REST calls. + */ + interface WorkspacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2020_03_01_preview.Workspaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces") + Observable> list(@Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Workspaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Workspaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspaceInner parameters, @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.loganalytics.v2020_03_01_preview.Workspaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspaceInner parameters, @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.loganalytics.v2020_03_01_preview.Workspaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("force") Boolean force, @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.loganalytics.v2020_03_01_preview.Workspaces beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Query("force") Boolean force, @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.loganalytics.v2020_03_01_preview.Workspaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @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.loganalytics.v2020_03_01_preview.Workspaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspacePatch parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the workspaces in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets the workspaces in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the workspaces in a subscription. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets the workspaces in a subscription. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(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); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(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); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @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 WorkspaceInner object if successful. + */ + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @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 createOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @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 WorkspaceInner object if successful. + */ + public WorkspaceInner beginCreateOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 + */ + public void delete(String resourceGroupName, String workspaceName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().last().body(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 deleteAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean force = null; + Observable> observable = service.delete(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), force, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, Boolean force) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, force).toBlocking().last().body(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @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 deleteAsync(String resourceGroupName, String workspaceName, Boolean force, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, force), serviceCallback); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, Boolean force) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, force).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, Boolean force) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), force, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 + */ + public void beginDelete(String resourceGroupName, String workspaceName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 beginDeleteAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String workspaceName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final Boolean force = null; + return service.beginDelete(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), force, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @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 + */ + public void beginDelete(String resourceGroupName, String workspaceName, Boolean force) { + beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, force).toBlocking().single().body(); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @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 beginDeleteAsync(String resourceGroupName, String workspaceName, Boolean force, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, force), serviceCallback); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String workspaceName, Boolean force) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, workspaceName, force).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a workspace resource. To recover the workspace, create it again with the same name, in the same subscription, resource group and location. The name is kept for 14 days and cannot be used for another workspace. To remove the workspace completely and release the name, use the force flag. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param force Deletes the workspace without the recovery option. A workspace that was deleted with this flag cannot be recovered. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, Boolean force) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), force, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 WorkspaceInner object if successful. + */ + public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @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 getByResourceGroupAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @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 WorkspaceInner object if successful. + */ + public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @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 workspaceName, WorkspacePatch parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable updateAsync(String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspacePatch parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), 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 CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/package-info.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..3daea12a60c8 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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 OperationalInsightsManagementClient. + * Operational Insights Client. + */ +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview.implementation; diff --git a/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/package-info.java b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_preview/package-info.java new file mode 100644 index 000000000000..41a65d003a28 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2020_03_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2020_03_01_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 OperationalInsightsManagementClient. + * Operational Insights Client. + */ +package com.microsoft.azure.management.loganalytics.v2020_03_01_preview;