From daf68d1d8bf95be3eea780448562b80d27139eda Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 19 Nov 2020 16:19:55 +0000 Subject: [PATCH] CodeGen from PR 11752 in Azure/azure-rest-api-specs Merge 9b59d1f5bd5d68133ec103d89646252cfe875134 into f7fd049bbc0089ad8faa7dc1c89610ca8ad78c83 --- .../mgmt-v2015_11_01_preview/pom.xml | 135 ++ .../v2015_11_01_preview/DataSource.java | 181 +++ .../v2015_11_01_preview/DataSourceFilter.java | 48 + .../v2015_11_01_preview/DataSourceKind.java | 80 ++ .../v2015_11_01_preview/DataSources.java | 54 + .../v2015_11_01_preview/EntityStatus.java | 53 + .../v2015_11_01_preview/ErrorResponse.java | 69 + .../v2015_11_01_preview/IntelligencePack.java | 35 + .../v2015_11_01_preview/LinkedService.java | 135 ++ .../v2015_11_01_preview/LinkedServices.java | 53 + .../v2015_11_01_preview/ManagementGroup.java | 61 + .../v2015_11_01_preview/MetricName.java | 69 + .../v2015_11_01_preview/Operation.java | 30 + .../v2015_11_01_preview/OperationDisplay.java | 95 ++ .../v2015_11_01_preview/Operations.java | 27 + .../v2015_11_01_preview/SharedKeys.java | 30 + .../loganalytics/v2015_11_01_preview/Sku.java | 44 + .../v2015_11_01_preview/SkuNameEnum.java | 56 + .../v2015_11_01_preview/UsageMetric.java | 51 + .../v2015_11_01_preview/Workspace.java | 199 +++ .../v2015_11_01_preview/Workspaces.java | 91 ++ .../implementation/DataSourceImpl.java | 140 ++ .../implementation/DataSourceInner.java | 130 ++ .../implementation/DataSourcesImpl.java | 85 ++ .../implementation/DataSourcesInner.java | 746 ++++++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/IntelligencePackImpl.java | 45 + .../implementation/IntelligencePackInner.java | 96 ++ .../implementation/LinkedServiceImpl.java | 117 ++ .../implementation/LinkedServiceInner.java | 73 + .../implementation/LinkedServicesImpl.java | 85 ++ .../implementation/LinkedServicesInner.java | 456 ++++++ .../implementation/LogAnalyticsManager.java | 135 ++ .../implementation/ManagementGroupImpl.java | 71 + .../implementation/ManagementGroupInner.java | 229 +++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationStatusInner.java | 174 +++ ...erationalInsightsManagementClientImpl.java | 358 +++++ .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++++ .../implementation/PageImpl.java | 75 + .../implementation/PageImpl1.java | 75 + .../implementation/SharedKeysImpl.java | 36 + .../implementation/SharedKeysInner.java | 69 + .../implementation/UsageMetricImpl.java | 62 + .../implementation/UsageMetricInner.java | 176 +++ .../implementation/WorkspaceImpl.java | 107 ++ .../implementation/WorkspaceInner.java | 179 +++ .../implementation/WorkspacesImpl.java | 233 +++ .../implementation/WorkspacesInner.java | 1265 +++++++++++++++++ .../implementation/package-info.java | 11 + .../v2015_11_01_preview/package-info.java | 11 + 53 files changed, 7331 insertions(+) create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/pom.xml create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSource.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceFilter.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceKind.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSources.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/EntityStatus.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ErrorResponse.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/IntelligencePack.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedService.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedServices.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ManagementGroup.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/MetricName.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operation.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/OperationDisplay.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operations.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SharedKeys.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Sku.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SkuNameEnum.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/UsageMetric.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspace.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspaces.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IdParsingUtils.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LogAnalyticsManager.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationStatusInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationalInsightsManagementClientImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl1.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesImpl.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesInner.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/package-info.java create mode 100644 sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/package-info.java diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/pom.xml b/sdk/loganalytics/mgmt-v2015_11_01_preview/pom.xml new file mode 100644 index 0000000000000..ab9d4eb612036 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.loganalytics.v2015_11_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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSource.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSource.java new file mode 100644 index 0000000000000..c90d14ee637b9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSource.java @@ -0,0 +1,181 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.DataSourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import java.util.Map; + +/** + * Type representing DataSource. + */ +public interface DataSource extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the kind value. + */ + DataSourceKind kind(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the properties value. + */ + Object properties(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the DataSource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithKind, DefinitionStages.WithProperties, DefinitionStages.WithCreate { + } + + /** + * Grouping of DataSource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DataSource definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the datasource definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group to get. The name is case insensitive + * @param workspaceName Name of the Log Analytics Workspace that will contain the datasource + * @return the next definition stage + */ + WithKind withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the datasource definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + * @param kind Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter' + * @return the next definition stage + */ + WithProperties withKind(DataSourceKind kind); + } + + /** + * The stage of the datasource definition allowing to specify Properties. + */ + interface WithProperties { + /** + * Specifies properties. + * @param properties The data source properties in raw json format, each kind of data source have it's own schema + * @return the next definition stage + */ + WithCreate withProperties(Object properties); + } + + /** + * The stage of the datasource definition allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the data source + * @return the next definition stage + */ + WithCreate withETag(String eTag); + } + + /** + * The stage of the datasource definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithETag, DefinitionStages.WithTags { + } + } + /** + * The template for a DataSource update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithETag, UpdateStages.WithTags { + } + + /** + * Grouping of DataSource update stages. + */ + interface UpdateStages { + /** + * The stage of the datasource update allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the data source + * @return the next update stage + */ + Update withETag(String eTag); + } + + /** + * The stage of the datasource update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceFilter.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceFilter.java new file mode 100644 index 0000000000000..1551a30f97614 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceFilter.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * DataSource filter. Right now, only filter by kind is supported. + */ +public class DataSourceFilter { + /** + * Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', + * 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', + * 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', + * 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', + * 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', + * 'WindowsEvent', 'WindowsPerformanceCounter'. + */ + @JsonProperty(value = "kind") + private DataSourceKind kind; + + /** + * Get possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'. + * + * @return the kind value + */ + public DataSourceKind kind() { + return this.kind; + } + + /** + * Set possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'. + * + * @param kind the kind value to set + * @return the DataSourceFilter object itself. + */ + public DataSourceFilter withKind(DataSourceKind kind) { + this.kind = kind; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceKind.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceKind.java new file mode 100644 index 0000000000000..39fa9242d6d06 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSourceKind.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataSourceKind. + */ +public final class DataSourceKind extends ExpandableStringEnum { + /** Static value AzureActivityLog for DataSourceKind. */ + public static final DataSourceKind AZURE_ACTIVITY_LOG = fromString("AzureActivityLog"); + + /** Static value ChangeTrackingPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_PATH = fromString("ChangeTrackingPath"); + + /** Static value ChangeTrackingDefaultPath for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DEFAULT_PATH = fromString("ChangeTrackingDefaultPath"); + + /** Static value ChangeTrackingDefaultRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_DEFAULT_REGISTRY = fromString("ChangeTrackingDefaultRegistry"); + + /** Static value ChangeTrackingCustomRegistry for DataSourceKind. */ + public static final DataSourceKind CHANGE_TRACKING_CUSTOM_REGISTRY = fromString("ChangeTrackingCustomRegistry"); + + /** Static value CustomLog for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG = fromString("CustomLog"); + + /** Static value CustomLogCollection for DataSourceKind. */ + public static final DataSourceKind CUSTOM_LOG_COLLECTION = fromString("CustomLogCollection"); + + /** Static value GenericDataSource for DataSourceKind. */ + public static final DataSourceKind GENERIC_DATA_SOURCE = fromString("GenericDataSource"); + + /** Static value IISLogs for DataSourceKind. */ + public static final DataSourceKind IISLOGS = fromString("IISLogs"); + + /** Static value LinuxPerformanceObject for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_OBJECT = fromString("LinuxPerformanceObject"); + + /** Static value LinuxPerformanceCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_PERFORMANCE_COLLECTION = fromString("LinuxPerformanceCollection"); + + /** Static value LinuxSyslog for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG = fromString("LinuxSyslog"); + + /** Static value LinuxSyslogCollection for DataSourceKind. */ + public static final DataSourceKind LINUX_SYSLOG_COLLECTION = fromString("LinuxSyslogCollection"); + + /** Static value WindowsEvent for DataSourceKind. */ + public static final DataSourceKind WINDOWS_EVENT = fromString("WindowsEvent"); + + /** Static value WindowsPerformanceCounter for DataSourceKind. */ + public static final DataSourceKind WINDOWS_PERFORMANCE_COUNTER = fromString("WindowsPerformanceCounter"); + + /** + * Creates or finds a DataSourceKind from its string representation. + * @param name a name to look for + * @return the corresponding DataSourceKind + */ + @JsonCreator + public static DataSourceKind fromString(String name) { + return fromString(name, DataSourceKind.class); + } + + /** + * @return known DataSourceKind values + */ + public static Collection values() { + return values(DataSourceKind.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSources.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSources.java new file mode 100644 index 0000000000000..e425f3154cd9b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/DataSources.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.DataSourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DataSources. + */ +public interface DataSources extends SupportsCreating, HasInner { + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName); + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter); + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/EntityStatus.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/EntityStatus.java new file mode 100644 index 0000000000000..4b9821e606ea2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ErrorResponse.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ErrorResponse.java new file mode 100644 index 0000000000000..1744de96bbba7 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ErrorResponse.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.v2015_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Describes the format of Error response. + */ +public class ErrorResponse { + /** + * Error code. + */ + @JsonProperty(value = "code") + private String code; + + /** + * Error message indicating why the operation failed. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get error code. + * + * @return the code value + */ + public String code() { + return this.code; + } + + /** + * Set error code. + * + * @param code the code value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withCode(String code) { + this.code = code; + return this; + } + + /** + * Get error message indicating why the operation failed. + * + * @return the message value + */ + public String message() { + return this.message; + } + + /** + * Set error message indicating why the operation failed. + * + * @param message the message value to set + * @return the ErrorResponse object itself. + */ + public ErrorResponse withMessage(String message) { + this.message = message; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/IntelligencePack.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/IntelligencePack.java new file mode 100644 index 0000000000000..98e778109061f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/IntelligencePack.java @@ -0,0 +1,35 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.IntelligencePackInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; + +/** + * Type representing IntelligencePack. + */ +public interface IntelligencePack extends HasInner, HasManager { + /** + * @return the displayName value. + */ + String displayName(); + + /** + * @return the enabled value. + */ + Boolean enabled(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedService.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedService.java new file mode 100644 index 0000000000000..c6a9be0a8bcc1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedService.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.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_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.v2015_11_01_preview.implementation.LogAnalyticsManager; +import java.util.Map; + +/** + * Type representing LinkedService. + */ +public interface LinkedService extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resourceId value. + */ + String resourceId(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the LinkedService definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithWorkspace, DefinitionStages.WithResourceId, DefinitionStages.WithCreate { + } + + /** + * Grouping of LinkedService definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a LinkedService definition. + */ + interface Blank extends WithWorkspace { + } + + /** + * The stage of the linkedservice definition allowing to specify Workspace. + */ + interface WithWorkspace { + /** + * Specifies resourceGroupName, workspaceName. + * @param resourceGroupName The name of the resource group to get. The name is case insensitive + * @param workspaceName Name of the Log Analytics Workspace that will contain the linkedServices resource + * @return the next definition stage + */ + WithResourceId 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 + * @return the next definition stage + */ + WithCreate withResourceId(String resourceId); + } + + /** + * The stage of the linkedservice definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the 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.WithTags { + } + } + /** + * The template for a LinkedService update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of LinkedService update stages. + */ + interface UpdateStages { + /** + * The stage of the linkedservice update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags Resource tags + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedServices.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/LinkedServices.java new file mode 100644 index 0000000000000..36545b986195f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LinkedServicesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing LinkedServices. + */ +public interface LinkedServices extends SupportsCreating, HasInner { + /** + * Gets a linked service instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ManagementGroup.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ManagementGroup.java new file mode 100644 index 0000000000000..c93fbadd9a3ec --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/ManagementGroup.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.ManagementGroupInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import org.joda.time.DateTime; + +/** + * Type representing ManagementGroup. + */ +public interface ManagementGroup extends HasInner, HasManager { + /** + * @return the created value. + */ + DateTime created(); + + /** + * @return the dataReceived value. + */ + DateTime dataReceived(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the isGateway value. + */ + Boolean isGateway(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the serverCount value. + */ + Integer serverCount(); + + /** + * @return the sku value. + */ + String sku(); + + /** + * @return the version value. + */ + String version(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/MetricName.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/MetricName.java new file mode 100644 index 0000000000000..3067a34771c59 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/MetricName.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The name of a metric. + */ +public class MetricName { + /** + * The system name of the metric. + */ + @JsonProperty(value = "value") + private String value; + + /** + * The localized name of the metric. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the system name of the metric. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the system name of the metric. + * + * @param value the value value to set + * @return the MetricName object itself. + */ + public MetricName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localized name of the metric. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localized name of the metric. + * + * @param localizedValue the localizedValue value to set + * @return the MetricName object itself. + */ + public MetricName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operation.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operation.java new file mode 100644 index 0000000000000..6f1b99befe5d1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operation.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/OperationDisplay.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/OperationDisplay.java new file mode 100644 index 0000000000000..6b817d4191d1f --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/OperationDisplay.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Display metadata associated with the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft OperationsManagement. + */ + @JsonProperty(value = "provider") + private String provider; + + /** + * Resource on which the operation is performed etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /** + * Type of operation: get, read, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** + * Get service provider: Microsoft OperationsManagement. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft OperationsManagement. + * + * @param provider the provider value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get resource on which the operation is performed etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get type of operation: get, read, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set type of operation: get, read, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operations.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operations.java new file mode 100644 index 0000000000000..1be87f98df600 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Operations.java @@ -0,0 +1,27 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SharedKeys.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SharedKeys.java new file mode 100644 index 0000000000000..4febb0d9d20fb --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SharedKeys.java @@ -0,0 +1,30 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.SharedKeysInner; + +/** + * Type representing SharedKeys. + */ +public interface SharedKeys extends HasInner, HasManager { + /** + * @return the primarySharedKey value. + */ + String primarySharedKey(); + + /** + * @return the secondarySharedKey value. + */ + String secondarySharedKey(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Sku.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Sku.java new file mode 100644 index 0000000000000..9ab5029c4f201 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Sku.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.v2015_11_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SKU (tier) of a workspace. + */ +public class Sku { + /** + * The name of the SKU. Possible values include: 'Free', 'Standard', + * 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + */ + @JsonProperty(value = "name", required = true) + private SkuNameEnum name; + + /** + * Get the name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + * + * @return the name value + */ + public SkuNameEnum name() { + return this.name; + } + + /** + * Set the name of the SKU. Possible values include: 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone', 'CapacityReservation'. + * + * @param name the name value to set + * @return the Sku object itself. + */ + public Sku withName(SkuNameEnum name) { + this.name = name; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SkuNameEnum.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SkuNameEnum.java new file mode 100644 index 0000000000000..2293d8129dd17 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/SkuNameEnum.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SkuNameEnum. + */ +public final class SkuNameEnum extends ExpandableStringEnum { + /** Static value Free for SkuNameEnum. */ + public static final SkuNameEnum FREE = fromString("Free"); + + /** Static value Standard for SkuNameEnum. */ + public static final SkuNameEnum STANDARD = fromString("Standard"); + + /** Static value Premium for SkuNameEnum. */ + public static final SkuNameEnum PREMIUM = fromString("Premium"); + + /** Static value PerNode for SkuNameEnum. */ + public static final SkuNameEnum PER_NODE = fromString("PerNode"); + + /** Static value PerGB2018 for SkuNameEnum. */ + public static final SkuNameEnum PER_GB2018 = fromString("PerGB2018"); + + /** Static value Standalone for SkuNameEnum. */ + public static final SkuNameEnum STANDALONE = fromString("Standalone"); + + /** Static value CapacityReservation for SkuNameEnum. */ + public static final SkuNameEnum CAPACITY_RESERVATION = fromString("CapacityReservation"); + + /** + * Creates or finds a SkuNameEnum from its string representation. + * @param name a name to look for + * @return the corresponding SkuNameEnum + */ + @JsonCreator + public static SkuNameEnum fromString(String name) { + return fromString(name, SkuNameEnum.class); + } + + /** + * @return known SkuNameEnum values + */ + public static Collection values() { + return values(SkuNameEnum.class); + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/UsageMetric.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/UsageMetric.java new file mode 100644 index 0000000000000..a656e617d8f72 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/UsageMetric.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.UsageMetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import org.joda.time.DateTime; + +/** + * Type representing UsageMetric. + */ +public interface UsageMetric extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Double currentValue(); + + /** + * @return the limit value. + */ + Double limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the nextResetTime value. + */ + DateTime nextResetTime(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + String unit(); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspace.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspace.java new file mode 100644 index 0000000000000..e11be00dfcec6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspace.java @@ -0,0 +1,199 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.Resource; +import com.microsoft.azure.arm.resources.models.GroupableResourceCore; +import com.microsoft.azure.arm.resources.models.HasResourceGroup; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.LogAnalyticsManager; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.WorkspaceInner; + +/** + * Type representing Workspace. + */ +public interface Workspace extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the customerId value. + */ + String customerId(); + + /** + * @return the eTag value. + */ + String eTag(); + + /** + * @return the portalUrl value. + */ + String portalUrl(); + + /** + * @return the provisioningState value. + */ + EntityStatus provisioningState(); + + /** + * @return the retentionInDays value. + */ + Integer retentionInDays(); + + /** + * @return the sku value. + */ + Sku sku(); + + /** + * @return the source value. + */ + String source(); + + /** + * The entirety of the Workspace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithCreate { + } + + /** + * Grouping of Workspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a Workspace definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the Workspace definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the workspace definition allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the workspace + * @return the next definition stage + */ + WithCreate withETag(String eTag); + } + + /** + * The stage of the workspace definition allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount' + * @return the next definition stage + */ + WithCreate withProvisioningState(EntityStatus provisioningState); + } + + /** + * The stage of the workspace definition allowing to specify RetentionInDays. + */ + interface WithRetentionInDays { + /** + * Specifies retentionInDays. + * @param retentionInDays The workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus + * @return the next definition stage + */ + WithCreate withRetentionInDays(Integer retentionInDays); + } + + /** + * The stage of the workspace definition allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the workspace + * @return the next definition stage + */ + WithCreate withSku(Sku sku); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, Resource.DefinitionWithTags, DefinitionStages.WithETag, DefinitionStages.WithProvisioningState, DefinitionStages.WithRetentionInDays, DefinitionStages.WithSku { + } + } + /** + * The template for a Workspace update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithETag, UpdateStages.WithProvisioningState, UpdateStages.WithRetentionInDays, UpdateStages.WithSku { + } + + /** + * Grouping of Workspace update stages. + */ + interface UpdateStages { + /** + * The stage of the workspace update allowing to specify ETag. + */ + interface WithETag { + /** + * Specifies eTag. + * @param eTag The ETag of the workspace + * @return the next update stage + */ + Update withETag(String eTag); + } + + /** + * The stage of the workspace update allowing to specify ProvisioningState. + */ + interface WithProvisioningState { + /** + * Specifies provisioningState. + * @param provisioningState The provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount' + * @return the next update stage + */ + Update withProvisioningState(EntityStatus provisioningState); + } + + /** + * The stage of the workspace update allowing to specify RetentionInDays. + */ + interface WithRetentionInDays { + /** + * Specifies retentionInDays. + * @param retentionInDays The workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus + * @return the next update stage + */ + Update withRetentionInDays(Integer retentionInDays); + } + + /** + * The stage of the workspace update allowing to specify Sku. + */ + interface WithSku { + /** + * Specifies sku. + * @param sku The SKU of the workspace + * @return the next update stage + */ + Update withSku(Sku sku); + } + + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspaces.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspaces.java new file mode 100644 index 0000000000000..ae28c2831fc4b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/Workspaces.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.v2015_11_01_preview; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import com.microsoft.azure.arm.resources.collection.SupportsDeletingByResourceGroup; +import com.microsoft.azure.arm.resources.collection.SupportsBatchDeletion; +import com.microsoft.azure.arm.resources.collection.SupportsGettingByResourceGroup; +import rx.Observable; +import com.microsoft.azure.arm.resources.collection.SupportsListingByResourceGroup; +import com.microsoft.azure.arm.collection.SupportsListing; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation.WorkspacesInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.IntelligencePack; +import rx.Completable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.UsageMetric; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.ManagementGroup; + +/** + * Type representing Workspaces. + */ +public interface Workspaces extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSharedKeysAsync(String resourceGroupName, String workspaceName); + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listIntelligencePacksAsync(String resourceGroupName, String workspaceName); + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable disableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable enableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName); + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String workspaceName); + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listManagementGroupsAsync(String resourceGroupName, String workspaceName); + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceImpl.java new file mode 100644 index 0000000000000..3a492847b4dc7 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceImpl.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSource; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSourceKind; + +class DataSourceImpl extends CreatableUpdatableImpl implements DataSource, DataSource.Definition, DataSource.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String dataSourceName; + + DataSourceImpl(String name, LogAnalyticsManager manager) { + super(name, new DataSourceInner()); + this.manager = manager; + // Set resource name + this.dataSourceName = name; + // + } + + DataSourceImpl(DataSourceInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.dataSourceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.dataSourceName = IdParsingUtils.getValueFromIdByName(inner.id(), "dataSources"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DataSourcesInner client = this.manager().inner().dataSources(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.dataSourceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public DataSourceKind kind() { + return this.inner().kind(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Object properties() { + return this.inner().properties(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public DataSourceImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + @Override + public DataSourceImpl withKind(DataSourceKind kind) { + this.inner().withKind(kind); + return this; + } + + @Override + public DataSourceImpl withProperties(Object properties) { + this.inner().withProperties(properties); + return this; + } + + @Override + public DataSourceImpl withETag(String eTag) { + this.inner().withETag(eTag); + return this; + } + + @Override + public DataSourceImpl withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceInner.java new file mode 100644 index 0000000000000..af380f98b85a6 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourceInner.java @@ -0,0 +1,130 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSourceKind; +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * Datasources under OMS Workspace. + */ +public class DataSourceInner extends ProxyResource { + /** + * The data source properties in raw json format, each kind of data source + * have it's own schema. + */ + @JsonProperty(value = "properties", required = true) + private Object properties; + + /** + * The ETag of the data source. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Possible values include: 'AzureActivityLog', 'ChangeTrackingPath', + * 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', + * 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', + * 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', + * 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', + * 'WindowsEvent', 'WindowsPerformanceCounter'. + */ + @JsonProperty(value = "kind", required = true) + private DataSourceKind kind; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the data source properties in raw json format, each kind of data source have it's own schema. + * + * @return the properties value + */ + public Object properties() { + return this.properties; + } + + /** + * Set the data source properties in raw json format, each kind of data source have it's own schema. + * + * @param properties the properties value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the ETag of the data source. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag of the data source. + * + * @param eTag the eTag value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + + /** + * Get possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'. + * + * @return the kind value + */ + public DataSourceKind kind() { + return this.kind; + } + + /** + * Set possible values include: 'AzureActivityLog', 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', 'ChangeTrackingDefaultRegistry', 'ChangeTrackingCustomRegistry', 'CustomLog', 'CustomLogCollection', 'GenericDataSource', 'IISLogs', 'LinuxPerformanceObject', 'LinuxPerformanceCollection', 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', 'WindowsPerformanceCounter'. + * + * @param kind the kind value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withKind(DataSourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the DataSourceInner object itself. + */ + public DataSourceInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesImpl.java new file mode 100644 index 0000000000000..ff7eae59a030e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSource; + +class DataSourcesImpl extends WrapperImpl implements DataSources { + private final LogAnalyticsManager manager; + + DataSourcesImpl(LogAnalyticsManager manager) { + super(manager.inner().dataSources()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public DataSourceImpl define(String name) { + return wrapModel(name); + } + + private DataSourceImpl wrapModel(DataSourceInner inner) { + return new DataSourceImpl(inner, manager()); + } + + private DataSourceImpl wrapModel(String name) { + return new DataSourceImpl(name, this.manager()); + } + + @Override + public Observable listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter) { + DataSourcesInner client = this.inner(); + return client.listByWorkspaceAsync(resourceGroupName, workspaceName, filter) + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public DataSource call(DataSourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + DataSourcesInner client = this.inner(); + return client.getAsync(resourceGroupName, workspaceName, dataSourceName) + .flatMap(new Func1>() { + @Override + public Observable call(DataSourceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((DataSource)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + DataSourcesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, workspaceName, dataSourceName).toCompletable(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesInner.java new file mode 100644 index 0000000000000..c002f10179b95 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/DataSourcesInner.java @@ -0,0 +1,746 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DataSources. + */ +public class DataSourcesInner { + /** The Retrofit service to perform REST calls. */ + private DataSourcesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of DataSourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DataSourcesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(DataSourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for DataSources to be + * used by Retrofit to perform actually REST calls. + */ + interface DataSourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @Body DataSourceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources get" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}") + Observable> get(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("dataSourceName") String dataSourceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("$filter") String filter, @Query("$skiptoken") String skiptoken, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources listByWorkspaceNext" }) + @GET + Observable> listByWorkspaceNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that will contain the datasource + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataSourceInner object if successful. + */ + public DataSourceInner createOrUpdate(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that will contain the datasource + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters), serviceCallback); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that will contain the datasource + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName, parameters).map(new Func1, DataSourceInner>() { + @Override + public DataSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a data source. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that will contain the datasource + * @param dataSourceName The name of the datasource resource. + * @param parameters The parameters required to create or update a datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName, DataSourceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.createOrUpdate(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = createOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String workspaceName, String dataSourceName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).toBlocking().single().body(); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName), serviceCallback); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a data source instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = deleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse deleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the DataSourceInner object if successful. + */ + public DataSourceInner get(String resourceGroupName, String workspaceName, String dataSourceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).toBlocking().single().body(); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String workspaceName, String dataSourceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName), serviceCallback); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable getAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + return getWithServiceResponseAsync(resourceGroupName, workspaceName, dataSourceName).map(new Func1, DataSourceInner>() { + @Override + public DataSourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a datasource instance. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace that contains the datasource. + * @param dataSourceName Name of the datasource + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DataSourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String workspaceName, String dataSourceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (dataSourceName == null) { + throw new IllegalArgumentException("Parameter dataSourceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.get(resourceGroupName, workspaceName, dataSourceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DataSourceInner> object if successful. + */ + public PagedList listByWorkspace(final String resourceGroupName, final String workspaceName, final String filter) { + ServiceResponse> response = listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName, filter) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String filter) { + return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final String workspaceName, final String filter) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + final String skiptoken = null; + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), filter, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DataSourceInner> object if successful. + */ + public PagedList listByWorkspace(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + ServiceResponse> response = listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable> listByWorkspaceAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + return listByWorkspaceWithServiceResponseAsync(resourceGroupName, workspaceName, filter, skiptoken) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The workspace that contains the data sources. + * @param filter The filter to apply on the operation. + * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable>> listByWorkspaceWithServiceResponseAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + return listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName, filter, skiptoken) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + ServiceResponse> * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + ServiceResponse> * @param workspaceName The workspace that contains the data sources. + ServiceResponse> * @param filter The filter to apply on the operation. + ServiceResponse> * @param skiptoken Starting point of the collection of data source instances. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceSinglePageAsync(final String resourceGroupName, final String workspaceName, final String filter, final String skiptoken) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByWorkspace(resourceGroupName, workspaceName, this.client.subscriptionId(), filter, skiptoken, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<DataSourceInner> object if successful. + */ + public PagedList listByWorkspaceNext(final String nextPageLink) { + ServiceResponse> response = listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByWorkspaceNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listByWorkspaceNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable> listByWorkspaceNextAsync(final String nextPageLink) { + return listByWorkspaceNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<DataSourceInner> object + */ + public Observable>> listByWorkspaceNextWithServiceResponseAsync(final String nextPageLink) { + return listByWorkspaceNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listByWorkspaceNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Gets the first page of data source instances in a workspace with the link to the next page. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<DataSourceInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listByWorkspaceNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listByWorkspaceNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByWorkspaceNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByWorkspaceNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IdParsingUtils.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..bdb1228c2bb38 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackImpl.java new file mode 100644 index 0000000000000..4158587cbcf24 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackImpl.java @@ -0,0 +1,45 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.IntelligencePack; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; + +class IntelligencePackImpl extends WrapperImpl implements IntelligencePack { + private final LogAnalyticsManager manager; + + IntelligencePackImpl(IntelligencePackInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public String displayName() { + return this.inner().displayName(); + } + + @Override + public Boolean enabled() { + return this.inner().enabled(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackInner.java new file mode 100644 index 0000000000000..219ad96f3f560 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/IntelligencePackInner.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Intelligence Pack containing a string name and boolean indicating if it's + * enabled. + */ +public class IntelligencePackInner { + /** + * The name of the intelligence pack. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The enabled boolean for the intelligence pack. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** + * The display name of the intelligence pack. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /** + * Get the name of the intelligence pack. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the intelligence pack. + * + * @param name the name value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the enabled boolean for the intelligence pack. + * + * @return the enabled value + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled boolean for the intelligence pack. + * + * @param enabled the enabled value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the display name of the intelligence pack. + * + * @return the displayName value + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the display name of the intelligence pack. + * + * @param displayName the displayName value to set + * @return the IntelligencePackInner object itself. + */ + public IntelligencePackInner withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceImpl.java new file mode 100644 index 0000000000000..51ef197dd97b1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceImpl.java @@ -0,0 +1,117 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.LinkedService; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import java.util.Map; + +class LinkedServiceImpl extends CreatableUpdatableImpl implements LinkedService, LinkedService.Definition, LinkedService.Update { + private final LogAnalyticsManager manager; + private String resourceGroupName; + private String workspaceName; + private String linkedServiceName; + + LinkedServiceImpl(String name, LogAnalyticsManager manager) { + super(name, new LinkedServiceInner()); + this.manager = manager; + // Set resource name + this.linkedServiceName = name; + // + } + + LinkedServiceImpl(LinkedServiceInner inner, LogAnalyticsManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.linkedServiceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourcegroups"); + this.workspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "workspaces"); + this.linkedServiceName = IdParsingUtils.getValueFromIdByName(inner.id(), "linkedServices"); + // + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.createOrUpdateAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + LinkedServicesInner client = this.manager().inner().linkedServices(); + return client.getAsync(this.resourceGroupName, this.workspaceName, this.linkedServiceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String resourceId() { + return this.inner().resourceId(); + } + + @Override + public Map tags() { + return this.inner().tags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @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 withTags(Map tags) { + this.inner().withTags(tags); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceInner.java new file mode 100644 index 0000000000000..1b74ec254f087 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServiceInner.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.v2015_11_01_preview.implementation; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * The top level Linked service resource container. + */ +@JsonFlatten +public class LinkedServiceInner extends ProxyResource { + /** + * The resource id of the resource that will be linked to the workspace. + */ + @JsonProperty(value = "properties.resourceId", required = true) + private String resourceId; + + /** + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the resource id of the resource that will be linked to the workspace. + * + * @return the resourceId value + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resource id of the resource that will be linked to the workspace. + * + * @param resourceId the resourceId value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get resource tags. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set resource tags. + * + * @param tags the tags value to set + * @return the LinkedServiceInner object itself. + */ + public LinkedServiceInner withTags(Map tags) { + this.tags = tags; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesImpl.java new file mode 100644 index 0000000000000..e6128322bd32b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.LinkedServices; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2015_11_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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LinkedServicesInner.java new file mode 100644 index 0000000000000..7dbe755d9e917 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_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.v2015_11_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.v2015_11_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.v2015_11_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.v2015_11_01_preview.LinkedServices listByWorkspace" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices") + Observable> listByWorkspace(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Create or update a linked service. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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 name of the resource group to get. The name is case insensitive. + * @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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LogAnalyticsManager.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/LogAnalyticsManager.java new file mode 100644 index 0000000000000..1da584646fe71 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_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.v2015_11_01_preview.LinkedServices; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.DataSources; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operations; +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 LinkedServices linkedServices; + private DataSources dataSources; + private Workspaces workspaces; + private Operations operations; + /** + * 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 LinkedServices. + */ + public LinkedServices linkedServices() { + if (this.linkedServices == null) { + this.linkedServices = new LinkedServicesImpl(this); + } + return this.linkedServices; + } + + /** + * @return Entry point to manage DataSources. + */ + public DataSources dataSources() { + if (this.dataSources == null) { + this.dataSources = new DataSourcesImpl(this); + } + return this.dataSources; + } + + /** + * @return Entry point to manage Workspaces. + */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(this); + } + return this.workspaces; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public 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-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupImpl.java new file mode 100644 index 0000000000000..a7fc68ff927f5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupImpl.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.ManagementGroup; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; + +class ManagementGroupImpl extends WrapperImpl implements ManagementGroup { + private final LogAnalyticsManager manager; + + ManagementGroupImpl(ManagementGroupInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public DateTime created() { + return this.inner().created(); + } + + @Override + public DateTime dataReceived() { + return this.inner().dataReceived(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public Boolean isGateway() { + return this.inner().isGateway(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public Integer serverCount() { + return this.inner().serverCount(); + } + + @Override + public String sku() { + return this.inner().sku(); + } + + @Override + public String version() { + return this.inner().version(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupInner.java new file mode 100644 index 0000000000000..09e53b6973525 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/ManagementGroupInner.java @@ -0,0 +1,229 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * A management group that is connected to a workspace. + */ +@JsonFlatten +public class ManagementGroupInner { + /** + * The number of servers connected to the management group. + */ + @JsonProperty(value = "properties.serverCount") + private Integer serverCount; + + /** + * Gets or sets a value indicating whether the management group is a + * gateway. + */ + @JsonProperty(value = "properties.isGateway") + private Boolean isGateway; + + /** + * The name of the management group. + */ + @JsonProperty(value = "properties.name") + private String name; + + /** + * The unique ID of the management group. + */ + @JsonProperty(value = "properties.id") + private String id; + + /** + * The datetime that the management group was created. + */ + @JsonProperty(value = "properties.created") + private DateTime created; + + /** + * The last datetime that the management group received data. + */ + @JsonProperty(value = "properties.dataReceived") + private DateTime dataReceived; + + /** + * The version of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.version") + private String version; + + /** + * The SKU of System Center that is managing the management group. + */ + @JsonProperty(value = "properties.sku") + private String sku; + + /** + * Get the number of servers connected to the management group. + * + * @return the serverCount value + */ + public Integer serverCount() { + return this.serverCount; + } + + /** + * Set the number of servers connected to the management group. + * + * @param serverCount the serverCount value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withServerCount(Integer serverCount) { + this.serverCount = serverCount; + return this; + } + + /** + * Get gets or sets a value indicating whether the management group is a gateway. + * + * @return the isGateway value + */ + public Boolean isGateway() { + return this.isGateway; + } + + /** + * Set gets or sets a value indicating whether the management group is a gateway. + * + * @param isGateway the isGateway value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withIsGateway(Boolean isGateway) { + this.isGateway = isGateway; + return this; + } + + /** + * Get the name of the management group. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the name of the management group. + * + * @param name the name value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the unique ID of the management group. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the unique ID of the management group. + * + * @param id the id value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the datetime that the management group was created. + * + * @return the created value + */ + public DateTime created() { + return this.created; + } + + /** + * Set the datetime that the management group was created. + * + * @param created the created value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withCreated(DateTime created) { + this.created = created; + return this; + } + + /** + * Get the last datetime that the management group received data. + * + * @return the dataReceived value + */ + public DateTime dataReceived() { + return this.dataReceived; + } + + /** + * Set the last datetime that the management group received data. + * + * @param dataReceived the dataReceived value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withDataReceived(DateTime dataReceived) { + this.dataReceived = dataReceived; + return this; + } + + /** + * Get the version of System Center that is managing the management group. + * + * @return the version value + */ + public String version() { + return this.version; + } + + /** + * Set the version of System Center that is managing the management group. + * + * @param version the version value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the SKU of System Center that is managing the management group. + * + * @return the sku value + */ + public String sku() { + return this.sku; + } + + /** + * Set the SKU of System Center that is managing the management group. + * + * @param sku the sku value to set + * @return the ManagementGroupInner object itself. + */ + public ManagementGroupInner withSku(String sku) { + this.sku = sku; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationImpl.java new file mode 100644 index 0000000000000..c5e015ffff3d9 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationImpl.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final LogAnalyticsManager manager; + OperationImpl(OperationInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationInner.java new file mode 100644 index 0000000000000..95d2dffdebfde --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationInner.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Supported operation of OperationalInsights resource provider. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** + * Get operation name: {provider}/{resource}/{operation}. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get display metadata associated with the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set display metadata associated with the operation. + * + * @param display the display value to set + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationStatusInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationStatusInner.java new file mode 100644 index 0000000000000..6958fa6b7e82c --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationStatusInner.java @@ -0,0 +1,174 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.ErrorResponse; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The status of operation. + */ +public class OperationStatusInner { + /** + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /** + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The start time of the operation. + */ + @JsonProperty(value = "startTime") + private String startTime; + + /** + * The end time of the operation. + */ + @JsonProperty(value = "endTime") + private String endTime; + + /** + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ErrorResponse error; + + /** + * Get the operation Id. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set the operation Id. + * + * @param id the id value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the operation name. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set the operation name. + * + * @param name the name value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the start time of the operation. + * + * @return the startTime value + */ + public String startTime() { + return this.startTime; + } + + /** + * Set the start time of the operation. + * + * @param startTime the startTime value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStartTime(String startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the end time of the operation. + * + * @return the endTime value + */ + public String endTime() { + return this.endTime; + } + + /** + * Set the end time of the operation. + * + * @param endTime the endTime value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withEndTime(String endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status of the operation. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the status of the operation. + * + * @param status the status value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error detail of the operation if any. + * + * @return the error value + */ + public ErrorResponse error() { + return this.error; + } + + /** + * Set the error detail of the operation if any. + * + * @param error the error value to set + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ErrorResponse error) { + this.error = error; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationalInsightsManagementClientImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationalInsightsManagementClientImpl.java new file mode 100644 index 0000000000000..d3b245f3b2eb5 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationalInsightsManagementClientImpl.java @@ -0,0 +1,358 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * Initializes a new instance of the OperationalInsightsManagementClientImpl class. + */ +public class OperationalInsightsManagementClientImpl extends AzureServiceClient { + /** The Retrofit service to perform REST calls. */ + private OperationalInsightsManagementClientService service; + /** 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; + } + + /** Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. */ + private String subscriptionId; + + /** + * Gets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public OperationalInsightsManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Client Api Version. */ + private String apiVersion; + + /** + * Gets 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 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 DataSourcesInner object to access its operations. + */ + private DataSourcesInner dataSources; + + /** + * Gets the DataSourcesInner object to access its operations. + * @return the DataSourcesInner object. + */ + public DataSourcesInner dataSources() { + return this.dataSources; + } + + /** + * The WorkspacesInner object to access its operations. + */ + private WorkspacesInner workspaces; + + /** + * Gets the WorkspacesInner object to access its operations. + * @return the WorkspacesInner object. + */ + public WorkspacesInner workspaces() { + return this.workspaces; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * Initializes an instance of 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 = "2015-11-01-preview"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.linkedServices = new LinkedServicesInner(restClient().retrofit(), this); + this.dataSources = new DataSourcesInner(restClient().retrofit(), this); + this.workspaces = new WorkspacesInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + initializeService(); + } + + /** + * 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", "2015-11-01-preview"); + } + + private void initializeService() { + service = restClient().retrofit().create(OperationalInsightsManagementClientService.class); + } + + /** + * The interface defining all the services for OperationalInsightsManagementClient to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationalInsightsManagementClientService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.OperationalInsightsManagementClient getAsyncOperationsStatus" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/locations/{location}/operationStatuses/{asyncOperationId}") + Observable> getAsyncOperationsStatus(@Path("location") String location, @Path("asyncOperationId") String asyncOperationId, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Get the status of an azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the OperationStatusInner object if successful. + */ + public OperationStatusInner getAsyncOperationsStatus(String location, String asyncOperationId) { + return getAsyncOperationsStatusWithServiceResponseAsync(location, asyncOperationId).toBlocking().single().body(); + } + + /** + * Get the status of an azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsyncOperationsStatusAsync(String location, String asyncOperationId, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getAsyncOperationsStatusWithServiceResponseAsync(location, asyncOperationId), serviceCallback); + } + + /** + * Get the status of an azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusInner object + */ + public Observable getAsyncOperationsStatusAsync(String location, String asyncOperationId) { + return getAsyncOperationsStatusWithServiceResponseAsync(location, asyncOperationId).map(new Func1, OperationStatusInner>() { + @Override + public OperationStatusInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Get the status of an azure asynchronous operation. + * + * @param location The region name of operation. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the OperationStatusInner object + */ + public Observable> getAsyncOperationsStatusWithServiceResponseAsync(String location, String asyncOperationId) { + if (location == null) { + throw new IllegalArgumentException("Parameter location is required and cannot be null."); + } + if (asyncOperationId == null) { + throw new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null."); + } + if (this.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null."); + } + if (this.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null."); + } + return service.getAsyncOperationsStatus(location, asyncOperationId, this.subscriptionId(), this.apiVersion(), this.acceptLanguage(), this.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getAsyncOperationsStatusDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getAsyncOperationsStatusDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.restClient().responseBuilderFactory().newInstance(this.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..3a71ecc917439 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsImpl.java @@ -0,0 +1,49 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final LogAnalyticsManager manager; + + OperationsImpl(LogAnalyticsManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsInner.java new file mode 100644 index 0000000000000..7199aa0a442e2 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/OperationsInner.java @@ -0,0 +1,283 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.AzureServiceFuture; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.ListOperationCallback; +import com.microsoft.azure.Page; +import com.microsoft.azure.PagedList; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Query; +import retrofit2.http.Url; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Operations. + */ +public class OperationsInner { + /** The Retrofit service to perform REST calls. */ + private OperationsService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of OperationsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public OperationsInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(OperationsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Operations to be + * used by Retrofit to perform actually REST calls. + */ + interface OperationsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operations list" }) + @GET("providers/Microsoft.OperationalInsights/operations") + Observable> list(@Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList list() { + ServiceResponse> response = listSinglePageAsync().toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listSinglePageAsync(), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync() + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listWithServiceResponseAsync() { + return listSinglePageAsync() + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listSinglePageAsync() { + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PagedList<OperationInner> object if successful. + */ + public PagedList listNext(final String nextPageLink) { + ServiceResponse> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); + return new PagedList(response.body()) { + @Override + public Page nextPage(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink).toBlocking().single().body(); + } + }; + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @param serviceFuture the ServiceFuture object tracking the Retrofit calls + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listNextAsync(final String nextPageLink, final ServiceFuture> serviceFuture, final ListOperationCallback serviceCallback) { + return AzureServiceFuture.fromPageResponse( + listNextSinglePageAsync(nextPageLink), + new Func1>>>() { + @Override + public Observable>> call(String nextPageLink) { + return listNextSinglePageAsync(nextPageLink); + } + }, + serviceCallback); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable> listNextAsync(final String nextPageLink) { + return listNextWithServiceResponseAsync(nextPageLink) + .map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PagedList<OperationInner> object + */ + public Observable>> listNextWithServiceResponseAsync(final String nextPageLink) { + return listNextSinglePageAsync(nextPageLink) + .concatMap(new Func1>, Observable>>>() { + @Override + public Observable>> call(ServiceResponse> page) { + String nextPageLink = page.body().nextPageLink(); + if (nextPageLink == null) { + return Observable.just(page); + } + return Observable.just(page).concatWith(listNextWithServiceResponseAsync(nextPageLink)); + } + }); + } + + /** + * Lists all of the available OperationalInsights Rest API operations. + * + ServiceResponse> * @param nextPageLink The NextLink from the previous successful call to List operation. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the PagedList<OperationInner> object wrapped in {@link ServiceResponse} if successful. + */ + public Observable>> listNextSinglePageAsync(final String nextPageLink) { + if (nextPageLink == null) { + throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); + } + String nextUrl = String.format("%s", nextPageLink); + return service.listNext(nextUrl, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listNextDelegate(response); + return Observable.just(new ServiceResponse>(result.body(), result.response())); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listNextDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl.java new file mode 100644 index 0000000000000..54fc7e03275ec --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl1.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/PageImpl1.java new file mode 100644 index 0000000000000..047ec742aa889 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysImpl.java new file mode 100644 index 0000000000000..24835e8c8c9fb --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysImpl.java @@ -0,0 +1,36 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.SharedKeys; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class SharedKeysImpl extends WrapperImpl implements SharedKeys { + private final LogAnalyticsManager manager; + SharedKeysImpl(SharedKeysInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + @Override + public String primarySharedKey() { + return this.inner().primarySharedKey(); + } + + @Override + public String secondarySharedKey() { + return this.inner().secondarySharedKey(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysInner.java new file mode 100644 index 0000000000000..ef2da794bda29 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/SharedKeysInner.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The shared keys for a workspace. + */ +public class SharedKeysInner { + /** + * The primary shared key of a workspace. + */ + @JsonProperty(value = "primarySharedKey") + private String primarySharedKey; + + /** + * The secondary shared key of a workspace. + */ + @JsonProperty(value = "secondarySharedKey") + private String secondarySharedKey; + + /** + * Get the primary shared key of a workspace. + * + * @return the primarySharedKey value + */ + public String primarySharedKey() { + return this.primarySharedKey; + } + + /** + * Set the primary shared key of a workspace. + * + * @param primarySharedKey the primarySharedKey value to set + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withPrimarySharedKey(String primarySharedKey) { + this.primarySharedKey = primarySharedKey; + return this; + } + + /** + * Get the secondary shared key of a workspace. + * + * @return the secondarySharedKey value + */ + public String secondarySharedKey() { + return this.secondarySharedKey; + } + + /** + * Set the secondary shared key of a workspace. + * + * @param secondarySharedKey the secondarySharedKey value to set + * @return the SharedKeysInner object itself. + */ + public SharedKeysInner withSecondarySharedKey(String secondarySharedKey) { + this.secondarySharedKey = secondarySharedKey; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricImpl.java new file mode 100644 index 0000000000000..809eabbb4bb34 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricImpl.java @@ -0,0 +1,62 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.UsageMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.MetricName; +import org.joda.time.DateTime; + +class UsageMetricImpl extends WrapperImpl implements UsageMetric { + private final LogAnalyticsManager manager; + + UsageMetricImpl(UsageMetricInner inner, LogAnalyticsManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public LogAnalyticsManager manager() { + return this.manager; + } + + + + @Override + public Double currentValue() { + return this.inner().currentValue(); + } + + @Override + public Double limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime nextResetTime() { + return this.inner().nextResetTime(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public String unit() { + return this.inner().unit(); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricInner.java new file mode 100644 index 0000000000000..dc8aedad676b4 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/UsageMetricInner.java @@ -0,0 +1,176 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.loganalytics.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.MetricName; +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric describing the usage of a resource. + */ +public class UsageMetricInner { + /** + * The name of the metric. + */ + @JsonProperty(value = "name") + private MetricName name; + + /** + * The units used for the metric. + */ + @JsonProperty(value = "unit") + private String unit; + + /** + * The current value of the metric. + */ + @JsonProperty(value = "currentValue") + private Double currentValue; + + /** + * The quota limit for the metric. + */ + @JsonProperty(value = "limit") + private Double limit; + + /** + * The time that the metric's value will reset. + */ + @JsonProperty(value = "nextResetTime") + private DateTime nextResetTime; + + /** + * The quota period that determines the length of time between value + * resets. + */ + @JsonProperty(value = "quotaPeriod") + private String quotaPeriod; + + /** + * Get the name of the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Set the name of the metric. + * + * @param name the name value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withName(MetricName name) { + this.name = name; + return this; + } + + /** + * Get the units used for the metric. + * + * @return the unit value + */ + public String unit() { + return this.unit; + } + + /** + * Set the units used for the metric. + * + * @param unit the unit value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the current value of the metric. + * + * @return the currentValue value + */ + public Double currentValue() { + return this.currentValue; + } + + /** + * Set the current value of the metric. + * + * @param currentValue the currentValue value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withCurrentValue(Double currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Get the quota limit for the metric. + * + * @return the limit value + */ + public Double limit() { + return this.limit; + } + + /** + * Set the quota limit for the metric. + * + * @param limit the limit value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withLimit(Double limit) { + this.limit = limit; + return this; + } + + /** + * Get the time that the metric's value will reset. + * + * @return the nextResetTime value + */ + public DateTime nextResetTime() { + return this.nextResetTime; + } + + /** + * Set the time that the metric's value will reset. + * + * @param nextResetTime the nextResetTime value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withNextResetTime(DateTime nextResetTime) { + this.nextResetTime = nextResetTime; + return this; + } + + /** + * Get the quota period that determines the length of time between value resets. + * + * @return the quotaPeriod value + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Set the quota period that determines the length of time between value resets. + * + * @param quotaPeriod the quotaPeriod value to set + * @return the UsageMetricInner object itself. + */ + public UsageMetricInner withQuotaPeriod(String quotaPeriod) { + this.quotaPeriod = quotaPeriod; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceImpl.java new file mode 100644 index 0000000000000..b6b82dceee70b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceImpl.java @@ -0,0 +1,107 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspace; +import rx.Observable; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.EntityStatus; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Sku; + +class WorkspaceImpl extends GroupableResourceCoreImpl implements Workspace, Workspace.Definition, Workspace.Update { + WorkspaceImpl(String name, WorkspaceInner inner, LogAnalyticsManager manager) { + super(name, inner, manager); + } + + @Override + public Observable createResourceAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + WorkspacesInner client = this.manager().inner().workspaces(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String customerId() { + return this.inner().customerId(); + } + + @Override + public String eTag() { + return this.inner().eTag(); + } + + @Override + public String portalUrl() { + return this.inner().portalUrl(); + } + + @Override + public EntityStatus provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public Integer retentionInDays() { + return this.inner().retentionInDays(); + } + + @Override + public Sku sku() { + return this.inner().sku(); + } + + @Override + public String source() { + return this.inner().source(); + } + + @Override + public WorkspaceImpl withETag(String eTag) { + this.inner().withETag(eTag); + return this; + } + + @Override + public WorkspaceImpl withProvisioningState(EntityStatus provisioningState) { + this.inner().withProvisioningState(provisioningState); + return this; + } + + @Override + public WorkspaceImpl withRetentionInDays(Integer retentionInDays) { + this.inner().withRetentionInDays(retentionInDays); + return this; + } + + @Override + public WorkspaceImpl withSku(Sku sku) { + this.inner().withSku(sku); + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceInner.java new file mode 100644 index 0000000000000..27ba11bd2aac1 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspaceInner.java @@ -0,0 +1,179 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.EntityStatus; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Sku; +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 Workspace resource container. + */ +@JsonFlatten +@SkipParentValidation +public class WorkspaceInner extends Resource { + /** + * The provisioning state of the workspace. Possible values include: + * 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', + * 'ProvisioningAccount'. + */ + @JsonProperty(value = "properties.provisioningState") + private EntityStatus provisioningState; + + /** + * This is a read-only legacy property. It is always set to 'Azure' by the + * service. Kept here for backward compatibility. + */ + @JsonProperty(value = "properties.source", access = JsonProperty.Access.WRITE_ONLY) + private String source; + + /** + * This is a read-only property. Represents the ID associated with the + * workspace. + */ + @JsonProperty(value = "properties.customerId", access = JsonProperty.Access.WRITE_ONLY) + private String customerId; + + /** + * This is a legacy property and is not used anymore. Kept here for + * backward compatibility. + */ + @JsonProperty(value = "properties.portalUrl", access = JsonProperty.Access.WRITE_ONLY) + private String portalUrl; + + /** + * The SKU of the workspace. + */ + @JsonProperty(value = "properties.sku") + private Sku sku; + + /** + * The workspace data retention in days. -1 means Unlimited retention for + * the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + */ + @JsonProperty(value = "properties.retentionInDays") + private Integer retentionInDays; + + /** + * The ETag of the workspace. + */ + @JsonProperty(value = "eTag") + private String eTag; + + /** + * Get the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount'. + * + * @return the provisioningState value + */ + public EntityStatus provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioning state of the workspace. Possible values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount'. + * + * @param provisioningState the provisioningState value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProvisioningState(EntityStatus provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get this is a read-only legacy property. It is always set to 'Azure' by the service. Kept here for backward compatibility. + * + * @return the source value + */ + public String source() { + return this.source; + } + + /** + * Get this is a read-only property. Represents the ID associated with the workspace. + * + * @return the customerId value + */ + public String customerId() { + return this.customerId; + } + + /** + * Get this is a legacy property and is not used anymore. Kept here for backward compatibility. + * + * @return the portalUrl value + */ + public String portalUrl() { + return this.portalUrl; + } + + /** + * Get the SKU of the workspace. + * + * @return the sku value + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the SKU of the workspace. + * + * @param sku the sku value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @return the retentionInDays value + */ + public Integer retentionInDays() { + return this.retentionInDays; + } + + /** + * Set the workspace data retention in days. -1 means Unlimited retention for the Unlimited Sku. 730 days is the maximum allowed for all other Skus. + * + * @param retentionInDays the retentionInDays value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withRetentionInDays(Integer retentionInDays) { + this.retentionInDays = retentionInDays; + return this; + } + + /** + * Get the ETag of the workspace. + * + * @return the eTag value + */ + public String eTag() { + return this.eTag; + } + + /** + * Set the ETag of the workspace. + * + * @param eTag the eTag value to set + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withETag(String eTag) { + this.eTag = eTag; + return this; + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesImpl.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesImpl.java new file mode 100644 index 0000000000000..1d9fef22d5848 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesImpl.java @@ -0,0 +1,233 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspace; +import rx.Observable; +import rx.Completable; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import com.microsoft.azure.arm.resources.ResourceUtilsCore; +import com.microsoft.azure.arm.utils.RXMapper; +import rx.functions.Func1; +import com.microsoft.azure.PagedList; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.SharedKeys; +import java.util.List; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.IntelligencePack; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.UsageMetric; +import com.microsoft.azure.management.loganalytics.v2015_11_01_preview.ManagementGroup; + +class WorkspacesImpl extends GroupableResourcesCoreImpl implements Workspaces { + protected WorkspacesImpl(LogAnalyticsManager manager) { + super(manager.inner().workspaces(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + WorkspacesInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + WorkspacesInner client = this.inner(); + return client.deleteAsync(resourceGroupName, name).toCompletable(); + } + + @Override + public Observable deleteByIdsAsync(Collection ids) { + if (ids == null || ids.isEmpty()) { + return Observable.empty(); + } + Collection> observables = new ArrayList<>(); + for (String id : ids) { + final String resourceGroupName = ResourceUtilsCore.groupFromResourceId(id); + final String name = ResourceUtilsCore.nameFromResourceId(id); + Observable o = RXMapper.map(this.inner().deleteAsync(resourceGroupName, name), id); + observables.add(o); + } + return Observable.mergeDelayError(observables); + } + + @Override + public Observable deleteByIdsAsync(String...ids) { + return this.deleteByIdsAsync(new ArrayList(Arrays.asList(ids))); + } + + @Override + public void deleteByIds(Collection ids) { + if (ids != null && !ids.isEmpty()) { + this.deleteByIdsAsync(ids).toBlocking().last(); + } + } + + @Override + public void deleteByIds(String...ids) { + this.deleteByIds(new ArrayList(Arrays.asList(ids))); + } + + @Override + public PagedList listByResourceGroup(String resourceGroupName) { + WorkspacesInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + WorkspacesInner client = this.inner(); + return client.listByResourceGroupAsync(resourceGroupName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Workspace call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + WorkspacesInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + WorkspacesInner client = this.inner(); + return client.listAsync() + .flatMap(new Func1, Observable>() { + @Override + public Observable call(Page innerPage) { + return Observable.from(innerPage.items()); + } + }) + .map(new Func1() { + @Override + public Workspace call(WorkspaceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public WorkspaceImpl define(String name) { + return wrapModel(name); + } + + @Override + public Observable getSharedKeysAsync(String resourceGroupName, String workspaceName) { + WorkspacesInner client = this.inner(); + return client.getSharedKeysAsync(resourceGroupName, workspaceName) + .map(new Func1() { + @Override + public SharedKeys call(SharedKeysInner inner) { + return new SharedKeysImpl(inner, manager()); + } + }); + } + + @Override + protected WorkspaceImpl wrapModel(WorkspaceInner inner) { + return new WorkspaceImpl(inner.name(), inner, manager()); + } + + @Override + protected WorkspaceImpl wrapModel(String name) { + return new WorkspaceImpl(name, new WorkspaceInner(), this.manager()); + } + + private IntelligencePackImpl wrapIntelligencePackModel(IntelligencePackInner inner) { + return new IntelligencePackImpl(inner, manager()); + } + + private UsageMetricImpl wrapUsageMetricModel(UsageMetricInner inner) { + return new UsageMetricImpl(inner, manager()); + } + + private ManagementGroupImpl wrapManagementGroupModel(ManagementGroupInner inner) { + return new ManagementGroupImpl(inner, manager()); + } + + @Override + public Observable listIntelligencePacksAsync(String resourceGroupName, String workspaceName) { + WorkspacesInner client = this.inner(); + return client.listIntelligencePacksAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public IntelligencePack call(IntelligencePackInner inner) { + return wrapIntelligencePackModel(inner); + } + }); + } + + @Override + public Completable disableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + WorkspacesInner client = this.inner(); + return client.disableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName).toCompletable(); + } + + @Override + public Completable enableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + WorkspacesInner client = this.inner(); + return client.enableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName).toCompletable(); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String workspaceName) { + WorkspacesInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public UsageMetric call(UsageMetricInner inner) { + return wrapUsageMetricModel(inner); + } + }); + } + + @Override + public Observable listManagementGroupsAsync(String resourceGroupName, String workspaceName) { + WorkspacesInner client = this.inner(); + return client.listManagementGroupsAsync(resourceGroupName, workspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public ManagementGroup call(ManagementGroupInner inner) { + return wrapManagementGroupModel(inner); + } + }); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesInner.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesInner.java new file mode 100644 index 0000000000000..30ff1a893352e --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/WorkspacesInner.java @@ -0,0 +1,1265 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT 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.v2015_11_01_preview.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.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.POST; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Workspaces. + */ +public class WorkspacesInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private WorkspacesService service; + /** The service client containing this operation class. */ + private OperationalInsightsManagementClientImpl client; + + /** + * Initializes an instance of WorkspacesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public WorkspacesInner(Retrofit retrofit, OperationalInsightsManagementClientImpl client) { + this.service = retrofit.create(WorkspacesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Workspaces to be + * used by Retrofit to perform actually REST calls. + */ + interface WorkspacesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces disableIntelligencePack" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable") + Observable> disableIntelligencePack(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("intelligencePackName") String intelligencePackName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces enableIntelligencePack" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable") + Observable> enableIntelligencePack(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("intelligencePackName") String intelligencePackName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces listIntelligencePacks" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/intelligencePacks") + Observable> listIntelligencePacks(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces getSharedKeys" }) + @POST("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/sharedKeys") + Observable> getSharedKeys(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces listUsages" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/usages") + Observable> listUsages(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces listManagementGroups" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/managementGroups") + Observable> listManagementGroups(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces") + Observable> listByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/workspaces") + Observable> list(@Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspaceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspaceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @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.v2015_11_01_preview.Workspaces getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> getByResourceGroup(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.loganalytics.v2015_11_01_preview.Workspaces update" }) + @PATCH("subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}") + Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("workspaceName") String workspaceName, @Path("subscriptionId") String subscriptionId, @Body WorkspaceInner parameters, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void disableIntelligencePack(String resourceGroupName, String workspaceName, String intelligencePackName) { + disableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).toBlocking().single().body(); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture disableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(disableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName), serviceCallback); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable disableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return disableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Disables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be disabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> disableIntelligencePackWithServiceResponseAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (intelligencePackName == null) { + throw new IllegalArgumentException("Parameter intelligencePackName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.disableIntelligencePack(resourceGroupName, workspaceName, intelligencePackName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = disableIntelligencePackDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse disableIntelligencePackDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void enableIntelligencePack(String resourceGroupName, String workspaceName, String intelligencePackName) { + enableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).toBlocking().single().body(); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture enableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(enableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName), serviceCallback); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable enableIntelligencePackAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + return enableIntelligencePackWithServiceResponseAsync(resourceGroupName, workspaceName, intelligencePackName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Enables an intelligence pack for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param intelligencePackName The name of the intelligence pack to be enabled. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> enableIntelligencePackWithServiceResponseAsync(String resourceGroupName, String workspaceName, String intelligencePackName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (intelligencePackName == null) { + throw new IllegalArgumentException("Parameter intelligencePackName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.enableIntelligencePack(resourceGroupName, workspaceName, intelligencePackName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = enableIntelligencePackDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse enableIntelligencePackDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<IntelligencePackInner> object if successful. + */ + public List listIntelligencePacks(String resourceGroupName, String workspaceName) { + return listIntelligencePacksWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listIntelligencePacksAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listIntelligencePacksWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IntelligencePackInner> object + */ + public Observable> listIntelligencePacksAsync(String resourceGroupName, String workspaceName) { + return listIntelligencePacksWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists all the intelligence packs possible and whether they are enabled or disabled for a given workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<IntelligencePackInner> object + */ + public Observable>> listIntelligencePacksWithServiceResponseAsync(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.listIntelligencePacks(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> clientResponse = listIntelligencePacksDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listIntelligencePacksDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the SharedKeysInner object if successful. + */ + public SharedKeysInner getSharedKeys(String resourceGroupName, String workspaceName) { + return getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getSharedKeysAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable getSharedKeysAsync(String resourceGroupName, String workspaceName) { + return getSharedKeysWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, SharedKeysInner>() { + @Override + public SharedKeysInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the shared keys for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SharedKeysInner object + */ + public Observable> getSharedKeysWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getSharedKeys(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSharedKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSharedKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<UsageMetricInner> object if successful. + */ + public List listUsages(String resourceGroupName, String workspaceName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listUsagesAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageMetricInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String workspaceName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of usage metrics for a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageMetricInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(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.listUsages(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 = listUsagesDelegate(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> listUsagesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the List<ManagementGroupInner> object if successful. + */ + public List listManagementGroups(String resourceGroupName, String workspaceName) { + return listManagementGroupsWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listManagementGroupsAsync(String resourceGroupName, String workspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listManagementGroupsWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ManagementGroupInner> object + */ + public Observable> listManagementGroupsAsync(String resourceGroupName, String workspaceName) { + return listManagementGroupsWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets a list of management groups connected to a workspace. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param workspaceName The name of the workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<ManagementGroupInner> object + */ + public Observable>> listManagementGroupsWithServiceResponseAsync(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.listManagementGroups(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 = listManagementGroupsDelegate(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> listManagementGroupsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @return the PagedList object if successful. + */ + public PagedList listByResourceGroup(String resourceGroupName) { + PageImpl page = new PageImpl<>(); + page.setItems(listByResourceGroupWithServiceResponseAsync(resourceGroupName).toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listByResourceGroupAsync(String resourceGroupName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByResourceGroupWithServiceResponseAsync(resourceGroupName), serviceCallback); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets workspaces in a resource group. + * + * @param resourceGroupName The name of the resource group to get. The name is case insensitive. + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listByResourceGroupWithServiceResponseAsync(String resourceGroupName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByResourceGroupDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the workspaces in a subscription. + * + * @return the PagedList object if successful. + */ + public PagedList list() { + PageImpl page = new PageImpl<>(); + page.setItems(listWithServiceResponseAsync().toBlocking().single().body()); + page.setNextPageLink(null); + return new PagedList(page) { + @Override + public Page nextPage(String nextPageLink) { + return null; + } + }; + } + + /** + * Gets the workspaces in a subscription. + * + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listAsync(final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listWithServiceResponseAsync(), serviceCallback); + } + + /** + * Gets the workspaces in a subscription. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable> listAsync() { + return listWithServiceResponseAsync().map(new Func1>, Page>() { + @Override + public Page call(ServiceResponse> response) { + PageImpl page = new PageImpl<>(); + page.setItems(response.body()); + return page; + } + }); + } + + /** + * Gets the workspaces in a subscription. + * + * @return the observable to the List<WorkspaceInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.list(this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listDelegate(response); + List items = null; + if (result.body() != null) { + items = result.body().items(); + } + ServiceResponse> clientResponse = new ServiceResponse>(items, result.response()); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse> listDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WorkspaceInner object if successful. + */ + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().last().body(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + Observable> observable = service.createOrUpdate(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WorkspaceInner object if successful. + */ + public WorkspaceInner beginCreateOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to create or update a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(201, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String workspaceName) { + deleteWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Deletes a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Deletes a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable deleteAsync(String resourceGroupName, String workspaceName) { + return deleteWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.delete(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = 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 workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WorkspaceInner object if successful. + */ + public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).toBlocking().single().body(); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String workspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName), serviceCallback); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, workspaceName).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a workspace instance. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName Name of the Log Analytics Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String workspaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(resourceGroupName, workspaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the WorkspaceInner object if successful. + */ + public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).toBlocking().single().body(); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters), serviceCallback); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable updateAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + return updateWithServiceResponseAsync(resourceGroupName, workspaceName, parameters).map(new Func1, WorkspaceInner>() { + @Override + public WorkspaceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates a workspace. + * + * @param resourceGroupName The resource group name of the workspace. + * @param workspaceName The name of the workspace. + * @param parameters The parameters required to patch a workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the WorkspaceInner object + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String workspaceName, WorkspaceInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (workspaceName == null) { + throw new IllegalArgumentException("Parameter workspaceName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Validator.validate(parameters); + return service.update(resourceGroupName, workspaceName, this.client.subscriptionId(), parameters, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = updateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse updateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/package-info.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/implementation/package-info.java new file mode 100644 index 0000000000000..55c7800bb2b7b --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview.implementation; diff --git a/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/package-info.java b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_01_preview/package-info.java new file mode 100644 index 0000000000000..d660ed7725928 --- /dev/null +++ b/sdk/loganalytics/mgmt-v2015_11_01_preview/src/main/java/com/microsoft/azure/management/loganalytics/v2015_11_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.v2015_11_01_preview;