From 1c8f164ab8770203768fa776fe3f996b12ac4b6c Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Sat, 10 Oct 2020 06:01:04 +0000 Subject: [PATCH] Generated from fa184e5e2ffd1abd1cab37811730ecfae9ed2542 --- .../mgmt-v2019_08_01_preview/pom.xml | 135 +++ .../v2019_08_01_preview/Cluster.java | 91 ++ .../v2019_08_01_preview/ClusterPatch.java | 98 ++ .../v2019_08_01_preview/Clusters.java | 37 + .../v2019_08_01_preview/DataExport.java | 314 ++++++ .../v2019_08_01_preview/DataExports.java | 53 + .../v2019_08_01_preview/DataSourceType.java | 53 + .../v2019_08_01_preview/EntityStatus.java | 53 + .../v2019_08_01_preview/ErrorDetails.java | 62 ++ .../v2019_08_01_preview/ErrorResponse.java | 44 + .../ErrorResponseException.java | 44 + .../v2019_08_01_preview/Identity.java | 73 ++ .../v2019_08_01_preview/IdentityType.java | 53 + .../KeyVaultProperties.java | 96 ++ .../v2019_08_01_preview/LinkedService.java | 146 +++ .../v2019_08_01_preview/LinkedServices.java | 53 + .../LinkedStorageAccountList.java | 123 +++ .../LinkedStorageAccounts.java | 53 + .../loganalytics/v2019_08_01_preview/Sku.java | 69 ++ .../v2019_08_01_preview/SkuNameEnum.java | 38 + .../implementation/ClusterImpl.java | 105 ++ .../implementation/ClusterInner.java | 162 +++ .../implementation/ClustersImpl.java | 139 +++ .../implementation/ClustersInner.java | 986 ++++++++++++++++++ .../implementation/DataExportImpl.java | 188 ++++ .../implementation/DataExportInner.java | 247 +++++ .../implementation/DataExportsImpl.java | 85 ++ .../implementation/DataExportsInner.java | 697 +++++++++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/LinkedServiceImpl.java | 116 +++ .../implementation/LinkedServiceInner.java | 74 ++ .../implementation/LinkedServicesImpl.java | 85 ++ .../implementation/LinkedServicesInner.java | 456 ++++++++ .../LinkedStorageAccountListImpl.java | 118 +++ .../LinkedStorageAccountListInner.java | 64 ++ .../LinkedStorageAccountsImpl.java | 85 ++ .../LinkedStorageAccountsInner.java | 543 ++++++++++ .../implementation/LogAnalyticsManager.java | 135 +++ ...erationalInsightsManagementClientImpl.java | 238 +++++ .../implementation/PageImpl.java | 75 ++ .../implementation/PageImpl1.java | 75 ++ .../implementation/package-info.java | 11 + .../v2019_08_01_preview/package-info.java | 11 + 43 files changed, 6440 insertions(+) create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/pom.xml create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Cluster.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ClusterPatch.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Clusters.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExport.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExports.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataSourceType.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/EntityStatus.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorDetails.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponse.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponseException.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Identity.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/IdentityType.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/KeyVaultProperties.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedService.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedServices.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccountList.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccounts.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Sku.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/SkuNameEnum.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/IdParsingUtils.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsInner.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LogAnalyticsManager.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/OperationalInsightsManagementClientImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl1.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/package-info.java create mode 100644 sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/package-info.java diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/pom.xml b/sdk/loganalytics/mgmt-v2019_08_01_preview/pom.xml new file mode 100644 index 000000000000..6e386123f5db --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.loganalytics.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Cluster.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Cluster.java new file mode 100644 index 000000000000..9699d057ee74 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Cluster.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.v2019_08_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.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2019_08_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. + */ + EntityStatus provisioningState(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * 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(Sku sku); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ClusterPatch.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ClusterPatch.java new file mode 100644 index 000000000000..8d440bfec813 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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 Sku 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 Sku sku() { + return this.sku; + } + + /** + * Set the sku properties. + * + * @param sku the sku value to set + * @return the ClusterPatch object itself. + */ + public ClusterPatch withSku(Sku 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Clusters.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Clusters.java new file mode 100644 index 000000000000..be9f5cab8e52 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Clusters.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.v2019_08_01_preview; + +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 rx.Completable; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.implementation.ClusterInner; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.implementation.ClustersInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Clusters. + */ +public interface Clusters extends SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 + */ + Completable createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters); + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExport.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExport.java new file mode 100644 index 000000000000..004d777ddbf9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2019_08_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.v2019_08_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. + */ + String 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 workspace's resource group name + * @param workspaceName The Log Analytics workspace name + * @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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExports.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataExports.java new file mode 100644 index 000000000000..5ad35db9c3a2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2019_08_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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName); + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataSourceType.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/DataSourceType.java new file mode 100644 index 000000000000..af2910c88784 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/EntityStatus.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/EntityStatus.java new file mode 100644 index 000000000000..1c3ff795cc60 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/EntityStatus.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.v2019_08_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for EntityStatus. + */ +public final class EntityStatus extends ExpandableStringEnum { + /** Static value Creating for EntityStatus. */ + public static final EntityStatus CREATING = fromString("Creating"); + + /** Static value Succeeded for EntityStatus. */ + public static final EntityStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for EntityStatus. */ + public static final EntityStatus FAILED = fromString("Failed"); + + /** Static value Canceled for EntityStatus. */ + public static final EntityStatus CANCELED = fromString("Canceled"); + + /** Static value Deleting for EntityStatus. */ + public static final EntityStatus DELETING = fromString("Deleting"); + + /** Static value ProvisioningAccount for EntityStatus. */ + public static final EntityStatus PROVISIONING_ACCOUNT = fromString("ProvisioningAccount"); + + /** + * Creates or finds a EntityStatus from its string representation. + * @param name a name to look for + * @return the corresponding EntityStatus + */ + @JsonCreator + public static EntityStatus fromString(String name) { + return fromString(name, EntityStatus.class); + } + + /** + * @return known EntityStatus values + */ + public static Collection values() { + return values(EntityStatus.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorDetails.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorDetails.java new file mode 100644 index 000000000000..68e36ef46d60 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorDetails.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.v2019_08_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The details of the error. + */ +public class ErrorDetails { + /** + * Error code. + */ + @JsonProperty(value = "code", access = JsonProperty.Access.WRITE_ONLY) + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * The target of the particular error. + */ + @JsonProperty(value = "target", access = JsonProperty.Access.WRITE_ONLY) + private String target; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Get the target of the particular error. + * + * @return the target value + */ + public String target() { + return this.target; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponse.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponse.java new file mode 100644 index 000000000000..86df0e34355c --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponse.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.v2019_08_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 ErrorResponse { + /** + * The details of the error. + */ + @JsonProperty(value = "error") + private ErrorDetails error; + + /** + * Get the details of the error. + * + * @return the error value + */ + public ErrorDetails error() { + return this.error; + } + + /** + * Set the details of the error. + * + * @param error the error value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withError(ErrorDetails error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponseException.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponseException.java new file mode 100644 index 000000000000..046fa4af1085 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2019_08_01_preview; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Identity.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Identity.java new file mode 100644 index 000000000000..1bff0ccaa1da --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/IdentityType.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/IdentityType.java new file mode 100644 index 000000000000..23eee5b07046 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/KeyVaultProperties.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/KeyVaultProperties.java new file mode 100644 index 000000000000..f0673bff3994 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The KeyVaultProperties model. + */ +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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedService.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedService.java new file mode 100644 index 000000000000..d5ca26271d6b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedService.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.v2019_08_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2019_08_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.v2019_08_01_preview.implementation.LogAnalyticsManager; + +/** + * 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 resourceId value. + */ + String resourceId(); + + /** + * @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 workspace's resource group name + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @return the next definition stage + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * 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 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.WithResourceId, DefinitionStages.WithWriteAccessResourceId { + } + } + /** + * The template for a LinkedService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithResourceId, UpdateStages.WithWriteAccessResourceId { + } + + /** + * Grouping of LinkedService update stages. + */ + interface UpdateStages { + /** + * 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 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedServices.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedServices.java new file mode 100644 index 000000000000..768decf7fde2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2019_08_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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linked services. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccountList.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccountList.java new file mode 100644 index 000000000000..53ba81d19359 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccountList.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.v2019_08_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.implementation.LinkedStorageAccountListInner; +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.v2019_08_01_preview.implementation.LogAnalyticsManager; +import java.util.List; + +/** + * Type representing LinkedStorageAccountList. + */ +public interface LinkedStorageAccountList 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 LinkedStorageAccountList definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithStorageAccountIds, DefinitionStages.WithCreate { + } + + /** + * Grouping of LinkedStorageAccountList definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LinkedStorageAccountList definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the linkedstorageaccountlist definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The workspace's resource group name + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource + * @return the next definition stage + */ + WithStorageAccountIds withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the linkedstorageaccountlist 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 LinkedStorageAccountList update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithStorageAccountIds { + } + + /** + * Grouping of LinkedStorageAccountList update stages. + */ + interface UpdateStages { + /** + * The stage of the linkedstorageaccountlist 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccounts.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/LinkedStorageAccounts.java new file mode 100644 index 000000000000..e4d3feae4f2f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2019_08_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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Sku.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Sku.java new file mode 100644 index 000000000000..3a846464bb70 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/Sku.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.v2019_08_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The Sku model. + */ +public class Sku { + /** + * The capacity value. + */ + @JsonProperty(value = "capacity") + private Long capacity; + + /** + * The name of the SKU. Possible values include: 'CapacityReservation'. + */ + @JsonProperty(value = "name") + private SkuNameEnum 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 Sku object itself. + */ + public Sku withCapacity(Long capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the name of the SKU. Possible values include: 'CapacityReservation'. + * + * @return the name value + */ + public SkuNameEnum name() { + return this.name; + } + + /** + * Set the name of the SKU. Possible values include: 'CapacityReservation'. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuNameEnum name) { + this.name = name; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/SkuNameEnum.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/SkuNameEnum.java new file mode 100644 index 000000000000..43b8c223f5fc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/SkuNameEnum.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.v2019_08_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 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterImpl.java new file mode 100644 index 000000000000..a68257115794 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterImpl.java @@ -0,0 +1,105 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Cluster; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.ClusterPatch; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Identity; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.KeyVaultProperties; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.EntityStatus; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Sku; +import rx.functions.Func1; + +class ClusterImpl extends GroupableResourceCoreImpl implements Cluster, 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 null; // NOP createResourceAsync implementation as create is not supported + } + + @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 EntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public ClusterImpl withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.updateParameter.withKeyVaultProperties(keyVaultProperties); + return this; + } + + @Override + public ClusterImpl withSku(Sku sku) { + this.updateParameter.withSku(sku); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterInner.java new file mode 100644 index 000000000000..02dca99aa390 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClusterInner.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Identity; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Sku; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.EntityStatus; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.KeyVaultProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.rest.SkipParentValidation; +import com.microsoft.azure.Resource; + +/** + * The top level Log Analytics cluster resource container. + */ +@JsonFlatten +@SkipParentValidation +public class ClusterInner extends Resource { + /** + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /** + * The sku properties. + */ + @JsonProperty(value = "sku") + private Sku 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'. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private EntityStatus 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 Sku sku() { + return this.sku; + } + + /** + * Set the sku properties. + * + * @param sku the sku value to set + * @return the ClusterInner object itself. + */ + public ClusterInner withSku(Sku 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'. + * + * @return the provisioningState value + */ + public EntityStatus 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersImpl.java new file mode 100644 index 000000000000..a91d8dc4dac5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersImpl.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. + * def + */ + +package com.microsoft.azure.management.loganalytics.v2019_08_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.Clusters; +import com.microsoft.azure.management.loganalytics.v2019_08_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 Completable createOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + ClustersInner client = this.inner(); + return client.createOrUpdateAsync(resourceGroupName, clusterName, parameters).toCompletable(); + } + + @Override + protected ClusterImpl wrapModel(ClusterInner inner) { + return new ClusterImpl(inner.name(), inner, manager()); + } + + @Override + protected ClusterImpl wrapModel(String name) { + return null; // Model is not creatable + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersInner.java new file mode 100644 index 000000000000..ce30fde655c7 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/ClustersInner.java @@ -0,0 +1,986 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_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.v2019_08_01_preview.ClusterPatch; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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.v2019_08_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.v2019_08_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.v2019_08_01_preview.Clusters createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterInner 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.v2019_08_01_preview.Clusters beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("clusterName") String clusterName, @Path("subscriptionId") String subscriptionId, @Body ClusterInner 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.v2019_08_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.v2019_08_01_preview.Clusters getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/clusters/{clusterName}") + Observable> getByResourceGroup(@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.v2019_08_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.v2019_08_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.v2019_08_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 workspace's resource group name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 workspace's resource group 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> 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 workspace's resource group name. + * @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 workspace's resource group name. + * @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 workspace's resource group name. + * @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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets the Log Analytics clusters in a subscription. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void createOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + createOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 resource group name of the Log Analytics cluster. + * @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, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 (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); + Observable> observable = service.createOrUpdate(resourceGroupName, clusterName, 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 Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginCreateOrUpdate(String resourceGroupName, String clusterName, ClusterInner parameters) { + beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 resource group name of the Log Analytics cluster. + * @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 {@link ServiceResponse} object if successful. + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 {@link ServiceResponse} object if successful. + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String clusterName, ClusterInner 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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String clusterName) { + deleteWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body(); + } + + /** + * Deletes a cluster instance. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @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 resource group name of the Log Analytics cluster. + * @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 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 resource group name of the Log Analytics cluster. + * @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> 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."); + } + return service.delete(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 = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a Log Analytics cluster instance. + * + * @param resourceGroupName The resource group name of the Log Analytics cluster. + * @param clusterName Name of the Log Analytics Cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the 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 resource group name of the Log Analytics cluster. + * @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 resource group name of the Log Analytics cluster. + * @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 resource group name of the Log Analytics cluster. + * @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 (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.getByResourceGroup(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 = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Updates a Log Analytics cluster. + * + * @param resourceGroupName The resource group name of the cluster. + * @param clusterName The name of the cluster. + * @param parameters The parameters required to patch a Log Analytics cluster. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the 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 resource group name of the cluster. + * @param clusterName The name of the 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 resource group name of the cluster. + * @param clusterName The name of the 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 resource group name of the cluster. + * @param clusterName The name of the 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportImpl.java new file mode 100644 index 000000000000..36c92da8eaf0 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportImpl.java @@ -0,0 +1,188 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.DataExport; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; + +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 String 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportInner.java new file mode 100644 index 000000000000..93515a334bcc --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportInner.java @@ -0,0 +1,247 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import java.util.List; +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 String 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 String 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsImpl.java new file mode 100644 index 000000000000..8047960f4760 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.DataExports; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2019_08_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(final String resourceGroupName, final String workspaceName) { + DataExportsInner 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 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsInner.java new file mode 100644 index 000000000000..ca29c008cc5f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/DataExportsInner.java @@ -0,0 +1,697 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.ErrorResponseException; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import 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 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.v2019_08_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.v2019_08_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.v2019_08_01_preview.DataExports beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataExports/{dataExportName}") + Observable> beginCreateOrUpdate(@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.v2019_08_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.v2019_08_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); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2019_08_01_preview.DataExports listByWorkspaceNext" }) + @GET + Observable> listByWorkspaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the data export instances within a workspace. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DataExportInner> 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 data export instances within a workspace. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace 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> 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 data export instances within a workspace. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataExportInner> 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 data export instances within a workspace. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataExportInner> 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 data export instances within a workspace. + * + ServiceResponse> * @param resourceGroupName The workspace's resource group name. + ServiceResponse> * @param workspaceName The Log Analytics workspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataExportInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final 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); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataExportInner object if successful. + */ + public DataExportInner createOrUpdate(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 for the request + */ + 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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 for the request + */ + 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); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, workspaceName, dataExportName, this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataExportInner object if successful. + */ + public DataExportInner beginCreateOrUpdate(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataExportName, parameters), serviceCallback); + } + + /** + * Create or update a data export. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, String dataExportName, DataExportInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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> beginCreateOrUpdateWithServiceResponseAsync(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.beginCreateOrUpdate(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 = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets a data export instance. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the 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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes the specified data export in a given workspace.. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @param dataExportName The data export rule name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + 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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 workspace's resource group name. + * @param workspaceName The Log Analytics workspace name. + * @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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the data export 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 ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DataExportInner> 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 data export 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 data export 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<DataExportInner> 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 data export 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<DataExportInner> 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 data export 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<DataExportInner> 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., ErrorResponseException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/IdParsingUtils.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 000000000000..7eb3d195276d --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceImpl.java new file mode 100644 index 000000000000..f4f044605944 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceImpl.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedService; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; + +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 String resourceId() { + return this.inner().resourceId(); + } + + @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 withResourceId(String resourceId) { + this.inner().withResourceId(resourceId); + return this; + } + + @Override + public LinkedServiceImpl withWriteAccessResourceId(String writeAccessResourceId) { + this.inner().withWriteAccessResourceId(writeAccessResourceId); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceInner.java new file mode 100644 index 000000000000..d443b4662acd --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServiceInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_01_preview.implementation; + +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; + + /** + * 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; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesImpl.java new file mode 100644 index 000000000000..e0f3aa69f519 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedServices; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2019_08_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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesInner.java new file mode 100644 index 000000000000..500b61bdfb0b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedServicesInner.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.v2019_08_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.v2019_08_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.v2019_08_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.v2019_08_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.v2019_08_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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @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().single().body(); + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @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 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @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> 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); + return service.createOrUpdate(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 = 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 linked service instance. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 + */ + public void delete(String resourceGroupName, String workspaceName, String linkedServiceName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).toBlocking().single().body(); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String linkedServiceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, linkedServiceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a linked service instance. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @param linkedServiceName Name of the linked service. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + 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."); + } + return service.delete(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 = 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 linked service instance. + * + * @param resourceGroupName The workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linkedServices resource + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linked services. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linked services. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linked services. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that contains the linked services. + * @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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListImpl.java new file mode 100644 index 000000000000..cc57cfd9c6df --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListImpl.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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedStorageAccountList; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.DataSourceType; + +class LinkedStorageAccountListImpl extends CreatableUpdatableImpl implements LinkedStorageAccountList, LinkedStorageAccountList.Definition, LinkedStorageAccountList.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private DataSourceType dataSourceType; + private List cstorageAccountIds; + private List ustorageAccountIds; + + LinkedStorageAccountListImpl(String name, LogAnalyticsManager manager) { + super(name, new LinkedStorageAccountListInner()); + this.manager = manager; + // Set resource name + this.dataSourceType = name; + // + } + + LinkedStorageAccountListImpl(LinkedStorageAccountListInner 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 LinkedStorageAccountListImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public LinkedStorageAccountListImpl withStorageAccountIds(List storageAccountIds) { + if (isInCreateMode()) { + this.cstorageAccountIds = storageAccountIds; + } else { + this.ustorageAccountIds = storageAccountIds; + } + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListInner.java new file mode 100644 index 000000000000..7dcb03a33b3a --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountListInner.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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2019_08_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 LinkedStorageAccountListInner 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 LinkedStorageAccountListInner object itself. + */ + public LinkedStorageAccountListInner withStorageAccountIds(List storageAccountIds) { + this.storageAccountIds = storageAccountIds; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsImpl.java new file mode 100644 index 000000000000..0048ce187015 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedStorageAccounts; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedStorageAccountList; + +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 LinkedStorageAccountListImpl define(String name) { + return wrapModel(name); + } + + private LinkedStorageAccountListImpl wrapModel(LinkedStorageAccountListInner inner) { + return new LinkedStorageAccountListImpl(inner, manager()); + } + + private LinkedStorageAccountListImpl wrapModel(String name) { + return new LinkedStorageAccountListImpl(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 LinkedStorageAccountList call(LinkedStorageAccountListInner 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(LinkedStorageAccountListInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((LinkedStorageAccountList)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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsInner.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LinkedStorageAccountsInner.java new file mode 100644 index 000000000000..67acb9583088 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.loganalytics.v2019_08_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.v2019_08_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 LinkedStorageAccountListInner parameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2019_08_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.v2019_08_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.v2019_08_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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 LinkedStorageAccountListInner object if successful. + */ + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountListInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).map(new Func1, LinkedStorageAccountListInner>() { + @Override + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountListInner 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; + LinkedStorageAccountListInner parameters = new LinkedStorageAccountListInner(); + 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 LinkedStorageAccountListInner object if successful. + */ + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 LinkedStorageAccountListInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType, List storageAccountIds) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType, storageAccountIds).map(new Func1, LinkedStorageAccountListInner>() { + @Override + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 LinkedStorageAccountListInner 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); + LinkedStorageAccountListInner parameters = new LinkedStorageAccountListInner(); + 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 LinkedStorageAccountListInner object if successful. + */ + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountListInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, DataSourceType dataSourceType) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceType).map(new Func1, LinkedStorageAccountListInner>() { + @Override + public LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @param dataSourceType Linked storage accounts type. Possible values include: 'CustomLogs', 'AzureWatson' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the LinkedStorageAccountListInner 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the 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 List<LinkedStorageAccountListInner> 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedStorageAccountListInner> 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 workspace's resource group name. + * @param workspaceName Name of the Log Analytics Workspace that will contain the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<LinkedStorageAccountListInner> 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LogAnalyticsManager.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LogAnalyticsManager.java new file mode 100644 index 000000000000..8092854ef905 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/LogAnalyticsManager.java @@ -0,0 +1,135 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_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.v2019_08_01_preview.Clusters; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedServices; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.DataExports; +import com.microsoft.azure.management.loganalytics.v2019_08_01_preview.LinkedStorageAccounts; +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 Clusters clusters; + private LinkedServices linkedServices; + private DataExports dataExports; + private LinkedStorageAccounts linkedStorageAccounts; + /** + * 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 Clusters. + */ + public Clusters clusters() { + if (this.clusters == null) { + this.clusters = new ClustersImpl(this); + } + return this.clusters; + } + + /** + * @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 DataExports. + */ + public DataExports dataExports() { + if (this.dataExports == null) { + this.dataExports = new DataExportsImpl(this); + } + return this.dataExports; + } + + /** + * @return Entry point to manage LinkedStorageAccounts. + */ + public LinkedStorageAccounts linkedStorageAccounts() { + if (this.linkedStorageAccounts == null) { + this.linkedStorageAccounts = new LinkedStorageAccountsImpl(this); + } + return this.linkedStorageAccounts; + } + + /** + * 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/OperationalInsightsManagementClientImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/OperationalInsightsManagementClientImpl.java new file mode 100644 index 000000000000..ba4198ef0755 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/OperationalInsightsManagementClientImpl.java @@ -0,0 +1,238 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2019_08_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 workspace's resource subscription ID. */ + private String subscriptionId; + + /** + * Gets The workspace's resource subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets The workspace's resource subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public OperationalInsightsManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The client API version. */ + private String apiVersion; + + /** + * Gets The client API version. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public 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 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 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 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 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; + } + + /** + * 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 = "2019-08-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.clusters = new ClustersInner(restClient().retrofit(), this); + this.linkedServices = new LinkedServicesInner(restClient().retrofit(), this); + this.dataExports = new DataExportsInner(restClient().retrofit(), this); + this.linkedStorageAccounts = new LinkedStorageAccountsInner(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", "2019-08-01-preview"); + } +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl.java new file mode 100644 index 000000000000..4ec4008832a5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl1.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/PageImpl1.java new file mode 100644 index 000000000000..67f7fec5019b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_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("") + 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-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/package-info.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/implementation/package-info.java new file mode 100644 index 000000000000..35e7d2035ced --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview.implementation; diff --git a/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/package-info.java b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_01_preview/package-info.java new file mode 100644 index 000000000000..f1ae8d52680f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2019_08_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2019_08_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.v2019_08_01_preview;