From 5f6e05b9984acc3a8f10a7a94fb0388745e24db3 Mon Sep 17 00:00:00 2001 From: Azure SDK for Python bot Date: Tue, 19 Jun 2018 12:16:33 -0700 Subject: [PATCH] Generated from 6d9c73eb24e60d117da852b974504d93e47d1a3c (#2103) renaming older operation --- .../resource-manager/v2015_04_08/pom.xml | 133 + .../cosmos-db/v2015_04_08/Capability.java | 45 + ...lectionDatabasisDatabaseAccountMetric.java | 52 + ...abasisDatabaseAccountMetricDefinition.java | 46 + ...onDatabasisDatabaseAccountMetricModel.java | 52 + ...llectionDatabasisDatabaseAccountUsage.java | 45 + .../CollectionPartitionRegions.java | 31 + .../v2015_04_08/CollectionPartitions.java | 42 + .../v2015_04_08/CollectionRegions.java | 32 + .../cosmos-db/v2015_04_08/Collections.java | 57 + .../v2015_04_08/ConsistencyPolicy.java | 103 + .../v2015_04_08/DatabaseAccount.java | 234 ++ .../DatabaseAccountConnectionString.java | 47 + ...DatabaseAccountCreateUpdateParameters.java | 272 ++ .../v2015_04_08/DatabaseAccountKind.java | 44 + ...aseAccountListConnectionStringsResult.java | 26 + .../DatabaseAccountListKeysResult.java | 40 + ...DatabaseAccountListReadOnlyKeysResult.java | 30 + .../v2015_04_08/DatabaseAccountMetric.java | 52 + .../DatabaseAccountMetricDefinition.java | 46 + .../v2015_04_08/DatabaseAccountOfferType.java | 50 + .../DatabaseAccountPatchParameters.java | 73 + ...atabaseAccountRegenerateKeyParameters.java | 44 + .../v2015_04_08/DatabaseAccountRegions.java | 31 + .../v2015_04_08/DatabaseAccountUsage.java | 45 + .../v2015_04_08/DatabaseAccounts.java | 154 ++ .../cosmos-db/v2015_04_08/Databases.java | 54 + .../DatabasisDatabaseAccountMetric.java | 52 + ...abasisDatabaseAccountMetricDefinition.java | 46 + .../DatabasisDatabaseAccountUsage.java | 45 + .../v2015_04_08/DefaultConsistencyLevel.java | 62 + .../cosmos-db/v2015_04_08/ErrorResponse.java | 69 + .../v2015_04_08/ErrorResponseException.java | 44 + .../v2015_04_08/FailoverPolicies.java | 44 + .../cosmos-db/v2015_04_08/FailoverPolicy.java | 89 + .../cosmos-db/v2015_04_08/KeyKind.java | 47 + .../cosmos-db/v2015_04_08/Location.java | 130 + .../v2015_04_08/MetricAvailability.java | 47 + .../cosmos-db/v2015_04_08/MetricName.java | 47 + .../cosmos-db/v2015_04_08/MetricValue.java | 108 + .../cosmos-db/v2015_04_08/Operation.java | 30 + .../v2015_04_08/OperationDisplay.java | 121 + .../cosmos-db/v2015_04_08/Operations.java | 27 + .../PartitionKeyRangeIdRegions.java | 32 + .../v2015_04_08/PartitionKeyRangeIds.java | 31 + .../v2015_04_08/PartitionMetric.java | 62 + .../cosmos-db/v2015_04_08/PartitionUsage.java | 55 + .../v2015_04_08/PercentileMetric.java | 52 + .../v2015_04_08/PercentileMetricValue.java | 122 + .../v2015_04_08/PercentileSourceTargets.java | 32 + .../v2015_04_08/PercentileTargets.java | 31 + .../cosmos-db/v2015_04_08/Percentiles.java | 30 + .../v2015_04_08/PrimaryAggregationType.java | 53 + .../v2015_04_08/RegionForOnlineOffline.java | 43 + .../cosmos-db/v2015_04_08/UnitType.java | 56 + .../v2015_04_08/VirtualNetworkRule.java | 44 + ...isDatabaseAccountMetricDefinitionImpl.java | 60 + ...ionDatabasisDatabaseAccountMetricImpl.java | 65 + ...tabasisDatabaseAccountMetricModelImpl.java | 65 + ...tionDatabasisDatabaseAccountUsageImpl.java | 57 + .../CollectionPartitionRegionsImpl.java | 49 + .../CollectionPartitionRegionsInner.java | 180 ++ .../CollectionPartitionsImpl.java | 68 + .../CollectionPartitionsInner.java | 385 +++ .../implementation/CollectionRegionsImpl.java | 53 + .../CollectionRegionsInner.java | 180 ++ .../implementation/CollectionsImpl.java | 99 + .../implementation/CollectionsInner.java | 494 ++++ .../implementation/CosmosDBImpl.java | 364 +++ .../implementation/DatabaseAccountImpl.java | 204 ++ .../implementation/DatabaseAccountInner.java | 321 +++ ...ccountListConnectionStringsResultImpl.java | 33 + ...countListConnectionStringsResultInner.java | 45 + .../DatabaseAccountListKeysResultImpl.java | 46 + .../DatabaseAccountListKeysResultInner.java | 79 + ...baseAccountListReadOnlyKeysResultImpl.java | 36 + ...aseAccountListReadOnlyKeysResultInner.java | 47 + .../DatabaseAccountMetricDefinitionImpl.java | 60 + .../DatabaseAccountMetricImpl.java | 65 + .../DatabaseAccountRegionsImpl.java | 49 + .../DatabaseAccountRegionsInner.java | 166 ++ .../DatabaseAccountUsageImpl.java | 57 + .../implementation/DatabaseAccountsImpl.java | 291 ++ .../implementation/DatabaseAccountsInner.java | 2408 +++++++++++++++++ .../implementation/DatabasesImpl.java | 99 + .../implementation/DatabasesInner.java | 466 ++++ ...isDatabaseAccountMetricDefinitionImpl.java | 60 + .../DatabasisDatabaseAccountMetricImpl.java | 65 + .../DatabasisDatabaseAccountUsageImpl.java | 57 + .../implementation/DocumentDBManager.java | 243 ++ .../implementation/IdParsingUtils.java | 57 + .../implementation/MetricDefinitionInner.java | 111 + .../implementation/MetricInner.java | 125 + .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 283 ++ .../v2015_04_08/implementation/PageImpl.java | 75 + .../v2015_04_08/implementation/PageImpl1.java | 75 + .../PartitionKeyRangeIdRegionsImpl.java | 49 + .../PartitionKeyRangeIdRegionsInner.java | 187 ++ .../PartitionKeyRangeIdsImpl.java | 49 + .../PartitionKeyRangeIdsInner.java | 180 ++ .../implementation/PartitionMetricImpl.java | 71 + .../implementation/PartitionMetricInner.java | 47 + .../implementation/PartitionUsageImpl.java | 63 + .../implementation/PartitionUsageInner.java | 47 + .../implementation/PercentileMetricImpl.java | 61 + .../implementation/PercentileMetricInner.java | 125 + .../PercentileSourceTargetsImpl.java | 49 + .../PercentileSourceTargetsInner.java | 173 ++ .../implementation/PercentileTargetsImpl.java | 49 + .../PercentileTargetsInner.java | 166 ++ .../implementation/PercentilesImpl.java | 49 + .../implementation/PercentilesInner.java | 159 ++ .../implementation/UsageInner.java | 107 + .../implementation/package-info.java | 11 + .../cosmos-db/v2015_04_08/package-info.java | 11 + 118 files changed, 13082 insertions(+) create mode 100644 cosmos-db/resource-manager/v2015_04_08/pom.xml create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Capability.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetric.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricDefinition.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricModel.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountUsage.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitionRegions.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitions.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionRegions.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Collections.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ConsistencyPolicy.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccount.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountConnectionString.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountCreateUpdateParameters.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountKind.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListConnectionStringsResult.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListKeysResult.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListReadOnlyKeysResult.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetric.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetricDefinition.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountOfferType.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountPatchParameters.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegenerateKeyParameters.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegions.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountUsage.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccounts.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Databases.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetric.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetricDefinition.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountUsage.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DefaultConsistencyLevel.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponse.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponseException.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicies.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicy.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/KeyKind.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Location.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricAvailability.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricName.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricValue.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operation.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/OperationDisplay.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operations.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIdRegions.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIds.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionMetric.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionUsage.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetric.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetricValue.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileSourceTargets.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileTargets.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Percentiles.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PrimaryAggregationType.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/RegionForOnlineOffline.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/UnitType.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/VirtualNetworkRule.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CosmosDBImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricDefinitionImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountUsageImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountUsageImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DocumentDBManager.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/IdParsingUtils.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricDefinitionInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl1.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesImpl.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/UsageInner.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/package-info.java create mode 100644 cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/package-info.java diff --git a/cosmos-db/resource-manager/v2015_04_08/pom.xml b/cosmos-db/resource-manager/v2015_04_08/pom.xml new file mode 100644 index 0000000000000..af83e8984e8f8 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + com.microsoft.azure.cosmos-db.v2015_04_08 + + com.microsoft.azure + azure-arm-parent + 0.0.2-beta + ../../../pom.xml + + azure-mgmt-documentdb + 1.0.0-beta + jar + Microsoft Azure SDK for DocumentDB Management + This package contains Microsoft DocumentDB Management SDK. + https://github.com/Azure/azure-libraries-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-libraries-for-java + scm:git:git@github.com:Azure/azure-libraries-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 + + + + + + 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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Capability.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Capability.java new file mode 100644 index 0000000000000..5f48b1e6fd22a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Capability.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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB capability object. + */ +public class Capability { + /** + * Name of the Cosmos DB capability. For example, "name": + * "EnableCassandra". Current values also include "EnableTable" and + * "EnableGremlin". + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + * + * @param name the name value to set + * @return the Capability object itself. + */ + public Capability withName(String name) { + this.name = name; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetric.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetric.java new file mode 100644 index 0000000000000..897d666368646 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetric.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing CollectionDatabasisDatabaseAccountMetric. + */ +public interface CollectionDatabasisDatabaseAccountMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricDefinition.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..916f43af31a76 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import java.util.List; + +/** + * Type representing CollectionDatabasisDatabaseAccountMetricDefinition. + */ +public interface CollectionDatabasisDatabaseAccountMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricModel.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricModel.java new file mode 100644 index 0000000000000..66b46cea67de6 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountMetricModel.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing CollectionDatabasisDatabaseAccountMetricModel. + */ +public interface CollectionDatabasisDatabaseAccountMetricModel extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountUsage.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountUsage.java new file mode 100644 index 0000000000000..6ea9b10609d5a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionDatabasisDatabaseAccountUsage.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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; + +/** + * Type representing CollectionDatabasisDatabaseAccountUsage. + */ +public interface CollectionDatabasisDatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitionRegions.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitionRegions.java new file mode 100644 index 0000000000000..5bc5d8fd826d3 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitionRegions.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; + +/** + * Type representing CollectionPartitionRegions. + */ +public interface CollectionPartitionRegions { + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitions.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitions.java new file mode 100644 index 0000000000000..44d0161e5a2bc --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionPartitions.java @@ -0,0 +1,42 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; + +/** + * Type representing CollectionPartitions. + */ +public interface CollectionPartitions { + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionRegions.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionRegions.java new file mode 100644 index 0000000000000..d23bb83443c48 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/CollectionRegions.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricModel; + +/** + * Type representing CollectionRegions. + */ +public interface CollectionRegions { + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Collections.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Collections.java new file mode 100644 index 0000000000000..99c1dbfbce823 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Collections.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.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountUsage; + +/** + * Type representing Collections. + */ +public interface Collections { + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid); + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter); + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ConsistencyPolicy.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ConsistencyPolicy.java new file mode 100644 index 0000000000000..223cfa194564d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ConsistencyPolicy.java @@ -0,0 +1,103 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The consistency policy for the Cosmos DB database account. + */ +public class ConsistencyPolicy { + /** + * The default consistency level and configuration settings of the Cosmos + * DB account. Possible values include: 'Eventual', 'Session', + * 'BoundedStaleness', 'Strong', 'ConsistentPrefix'. + */ + @JsonProperty(value = "defaultConsistencyLevel", required = true) + private DefaultConsistencyLevel defaultConsistencyLevel; + + /** + * When used with the Bounded Staleness consistency level, this value + * represents the number of stale requests tolerated. Accepted range for + * this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy + * is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxStalenessPrefix") + private Long maxStalenessPrefix; + + /** + * When used with the Bounded Staleness consistency level, this value + * represents the time amount of staleness (in seconds) tolerated. Accepted + * range for this value is 5 - 86400. Required when + * defaultConsistencyPolicy is set to 'BoundedStaleness'. + */ + @JsonProperty(value = "maxIntervalInSeconds") + private Integer maxIntervalInSeconds; + + /** + * Get the default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix'. + * + * @return the defaultConsistencyLevel value + */ + public DefaultConsistencyLevel defaultConsistencyLevel() { + return this.defaultConsistencyLevel; + } + + /** + * Set the default consistency level and configuration settings of the Cosmos DB account. Possible values include: 'Eventual', 'Session', 'BoundedStaleness', 'Strong', 'ConsistentPrefix'. + * + * @param defaultConsistencyLevel the defaultConsistencyLevel value to set + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withDefaultConsistencyLevel(DefaultConsistencyLevel defaultConsistencyLevel) { + this.defaultConsistencyLevel = defaultConsistencyLevel; + return this; + } + + /** + * Get when used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxStalenessPrefix value + */ + public Long maxStalenessPrefix() { + return this.maxStalenessPrefix; + } + + /** + * Set when used with the Bounded Staleness consistency level, this value represents the number of stale requests tolerated. Accepted range for this value is 1 – 2,147,483,647. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxStalenessPrefix the maxStalenessPrefix value to set + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxStalenessPrefix(Long maxStalenessPrefix) { + this.maxStalenessPrefix = maxStalenessPrefix; + return this; + } + + /** + * Get when used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @return the maxIntervalInSeconds value + */ + public Integer maxIntervalInSeconds() { + return this.maxIntervalInSeconds; + } + + /** + * Set when used with the Bounded Staleness consistency level, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 5 - 86400. Required when defaultConsistencyPolicy is set to 'BoundedStaleness'. + * + * @param maxIntervalInSeconds the maxIntervalInSeconds value to set + * @return the ConsistencyPolicy object itself. + */ + public ConsistencyPolicy withMaxIntervalInSeconds(Integer maxIntervalInSeconds) { + this.maxIntervalInSeconds = maxIntervalInSeconds; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccount.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccount.java new file mode 100644 index 0000000000000..532bd64416cc1 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccount.java @@ -0,0 +1,234 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +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.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountInner; + +/** + * Type representing DatabaseAccount. + */ +public interface DatabaseAccount extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the capabilities value. + */ + List capabilities(); + + /** + * @return the consistencyPolicy value. + */ + ConsistencyPolicy consistencyPolicy(); + + /** + * @return the databaseAccountOfferType value. + */ + DatabaseAccountOfferType databaseAccountOfferType(); + + /** + * @return the documentEndpoint value. + */ + String documentEndpoint(); + + /** + * @return the enableAutomaticFailover value. + */ + Boolean enableAutomaticFailover(); + + /** + * @return the failoverPolicies value. + */ + List failoverPolicies(); + + /** + * @return the ipRangeFilter value. + */ + String ipRangeFilter(); + + /** + * @return the isVirtualNetworkFilterEnabled value. + */ + Boolean isVirtualNetworkFilterEnabled(); + + /** + * @return the kind value. + */ + DatabaseAccountKind kind(); + + /** + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * @return the readLocations value. + */ + List readLocations(); + + /** + * @return the virtualNetworkRules value. + */ + List virtualNetworkRules(); + + /** + * @return the writeLocations value. + */ + List writeLocations(); + + /** + * The entirety of the DatabaseAccount definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithDatabaseAccountOfferType, DefinitionStages.WithLocations, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseAccount definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseAccount definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the DatabaseAccount definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the databaseaccount definition allowing to specify DatabaseAccountOfferType. + */ + interface WithDatabaseAccountOfferType { + /** + * Specifies databaseAccountOfferType. + */ + WithLocations withDatabaseAccountOfferType(String databaseAccountOfferType); + } + + /** + * The stage of the databaseaccount definition allowing to specify Locations. + */ + interface WithLocations { + /** + * Specifies locations. + */ + WithCreate withLocations(List locations); + } + + /** + * The stage of the databaseaccount update allowing to specify Capabilities. + */ + interface WithCapabilities { + /** + * Specifies capabilities. + */ + WithCreate withCapabilities(List capabilities); + } + + /** + * The stage of the databaseaccount update allowing to specify ConsistencyPolicy. + */ + interface WithConsistencyPolicy { + /** + * Specifies consistencyPolicy. + */ + WithCreate withConsistencyPolicy(ConsistencyPolicy consistencyPolicy); + } + + /** + * The stage of the databaseaccount update allowing to specify EnableAutomaticFailover. + */ + interface WithEnableAutomaticFailover { + /** + * Specifies enableAutomaticFailover. + */ + WithCreate withEnableAutomaticFailover(Boolean enableAutomaticFailover); + } + + /** + * The stage of the databaseaccount update allowing to specify IpRangeFilter. + */ + interface WithIpRangeFilter { + /** + * Specifies ipRangeFilter. + */ + WithCreate withIpRangeFilter(String ipRangeFilter); + } + + /** + * The stage of the databaseaccount update allowing to specify IsVirtualNetworkFilterEnabled. + */ + interface WithIsVirtualNetworkFilterEnabled { + /** + * Specifies isVirtualNetworkFilterEnabled. + */ + WithCreate withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled); + } + + /** + * The stage of the databaseaccount update allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + */ + WithCreate withKind(DatabaseAccountKind kind); + } + + /** + * The stage of the databaseaccount update allowing to specify VirtualNetworkRules. + */ + interface WithVirtualNetworkRules { + /** + * Specifies virtualNetworkRules. + */ + WithCreate withVirtualNetworkRules(List virtualNetworkRules); + } + + /** + * 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.WithCapabilities, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { + } + } + /** + * The template for a DatabaseAccount update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithCapabilities { + } + + /** + * Grouping of DatabaseAccount update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseaccount {0} allowing to specify Capabilities. + */ + interface WithCapabilities { + /** + * Specifies capabilities. + */ + Update withCapabilities(List capabilities); + } + + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountConnectionString.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountConnectionString.java new file mode 100644 index 0000000000000..c35cf1b75d7b6 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountConnectionString.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Connection string for the Cosmos DB account. + */ +public class DatabaseAccountConnectionString { + /** + * Value of the connection string. + */ + @JsonProperty(value = "connectionString", access = JsonProperty.Access.WRITE_ONLY) + private String connectionString; + + /** + * Description of the connection string. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get value of the connection string. + * + * @return the connectionString value + */ + public String connectionString() { + return this.connectionString; + } + + /** + * Get description of the connection string. + * + * @return the description value + */ + public String description() { + return this.description; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountCreateUpdateParameters.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountCreateUpdateParameters.java new file mode 100644 index 0000000000000..fe980959cf4e5 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,272 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * Parameters to create and update Cosmos DB database accounts. + */ +@JsonFlatten +public class DatabaseAccountCreateUpdateParameters extends Resource { + /** + * Indicates the type of database account. This can only be set at database + * account creation. Possible values include: 'GlobalDocumentDB', + * 'MongoDB', 'Parse'. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /** + * The consistency policy for the Cosmos DB account. + */ + @JsonProperty(value = "properties.consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /** + * An array that contains the georeplication locations enabled for the + * Cosmos DB account. + */ + @JsonProperty(value = "properties.locations", required = true) + private List locations; + + /** + * The databaseAccountOfferType property. + */ + @JsonProperty(value = "properties.databaseAccountOfferType", required = true) + private String databaseAccountOfferType; + + /** + * Cosmos DB Firewall Support: This value specifies the set of IP addresses + * or IP address ranges in CIDR form to be included as the allowed list of + * client IPs for a given database account. IP addresses/ranges must be + * comma separated and must not contain any spaces. + */ + @JsonProperty(value = "properties.ipRangeFilter") + private String ipRangeFilter; + + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /** + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Creates an instance of DatabaseAccountCreateUpdateParameters class. + * @param locations an array that contains the georeplication locations enabled for the Cosmos DB account. + */ + public DatabaseAccountCreateUpdateParameters() { + databaseAccountOfferType = "Standard"; + } + + /** + * Get indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. + * + * @return the kind value + */ + public DatabaseAccountKind kind() { + return this.kind; + } + + /** + * Set indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. + * + * @param kind the kind value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withKind(DatabaseAccountKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the consistency policy for the Cosmos DB account. + * + * @return the consistencyPolicy value + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistency policy for the Cosmos DB account. + * + * @param consistencyPolicy the consistencyPolicy value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get an array that contains the georeplication locations enabled for the Cosmos DB account. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * Set an array that contains the georeplication locations enabled for the Cosmos DB account. + * + * @param locations the locations value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the databaseAccountOfferType value. + * + * @return the databaseAccountOfferType value + */ + public String databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Set the databaseAccountOfferType value. + * + * @param databaseAccountOfferType the databaseAccountOfferType value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDatabaseAccountOfferType(String databaseAccountOfferType) { + this.databaseAccountOfferType = databaseAccountOfferType; + return this; + } + + /** + * Get cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + * + * @return the ipRangeFilter value + */ + public String ipRangeFilter() { + return this.ipRangeFilter; + } + + /** + * Set cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + * + * @param ipRangeFilter the ipRangeFilter value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withIpRangeFilter(String ipRangeFilter) { + this.ipRangeFilter = ipRangeFilter; + return this; + } + + /** + * Get flag to indicate whether to enable/disable Virtual Network ACL rules. + * + * @return the isVirtualNetworkFilterEnabled value + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set flag to indicate whether to enable/disable Virtual Network ACL rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get list of Cosmos DB capabilities for the account. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set list of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get list of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set list of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountKind.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountKind.java new file mode 100644 index 0000000000000..001f40c9e6365 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountKind.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.cosmos-db.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DatabaseAccountKind. + */ +public final class DatabaseAccountKind extends ExpandableStringEnum { + /** Static value GlobalDocumentDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind GLOBAL_DOCUMENT_DB = fromString("GlobalDocumentDB"); + + /** Static value MongoDB for DatabaseAccountKind. */ + public static final DatabaseAccountKind MONGO_DB = fromString("MongoDB"); + + /** Static value Parse for DatabaseAccountKind. */ + public static final DatabaseAccountKind PARSE = fromString("Parse"); + + /** + * Creates or finds a DatabaseAccountKind from its string representation. + * @param name a name to look for + * @return the corresponding DatabaseAccountKind + */ + @JsonCreator + public static DatabaseAccountKind fromString(String name) { + return fromString(name, DatabaseAccountKind.class); + } + + /** + * @return known DatabaseAccountKind values + */ + public static Collection values() { + return values(DatabaseAccountKind.class); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListConnectionStringsResult.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListConnectionStringsResult.java new file mode 100644 index 0000000000000..edd328792eae8 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListConnectionStringsResult.java @@ -0,0 +1,26 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountListConnectionStringsResultInner; +import java.util.List; + +/** + * Type representing DatabaseAccountListConnectionStringsResult. + */ +public interface DatabaseAccountListConnectionStringsResult extends HasInner, HasManager { + /** + * @return the connectionStrings value. + */ + List connectionStrings(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListKeysResult.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListKeysResult.java new file mode 100644 index 0000000000000..d4fb27b659ea4 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListKeysResult.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountListKeysResultInner; + +/** + * Type representing DatabaseAccountListKeysResult. + */ +public interface DatabaseAccountListKeysResult extends HasInner, HasManager { + /** + * @return the primaryMasterKey value. + */ + String primaryMasterKey(); + + /** + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * @return the secondaryMasterKey value. + */ + String secondaryMasterKey(); + + /** + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListReadOnlyKeysResult.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListReadOnlyKeysResult.java new file mode 100644 index 0000000000000..6031fad7ee498 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountListReadOnlyKeysResult.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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountListReadOnlyKeysResultInner; + +/** + * Type representing DatabaseAccountListReadOnlyKeysResult. + */ +public interface DatabaseAccountListReadOnlyKeysResult extends HasInner, HasManager { + /** + * @return the primaryReadonlyMasterKey value. + */ + String primaryReadonlyMasterKey(); + + /** + * @return the secondaryReadonlyMasterKey value. + */ + String secondaryReadonlyMasterKey(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetric.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetric.java new file mode 100644 index 0000000000000..b8174a1392185 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetric.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing DatabaseAccountMetric. + */ +public interface DatabaseAccountMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetricDefinition.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..1c12fa0ca0b6b --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import java.util.List; + +/** + * Type representing DatabaseAccountMetricDefinition. + */ +public interface DatabaseAccountMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountOfferType.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountOfferType.java new file mode 100644 index 0000000000000..b2b0b26b70c8c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountOfferType.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DatabaseAccountOfferType. + */ +public enum DatabaseAccountOfferType { + /** Enum value Standard. */ + STANDARD("Standard"); + + /** The actual serialized value for a DatabaseAccountOfferType instance. */ + private String value; + + DatabaseAccountOfferType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DatabaseAccountOfferType instance. + * + * @param value the serialized value to parse. + * @return the parsed DatabaseAccountOfferType object, or null if unable to parse. + */ + @JsonCreator + public static DatabaseAccountOfferType fromString(String value) { + DatabaseAccountOfferType[] items = DatabaseAccountOfferType.values(); + for (DatabaseAccountOfferType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountPatchParameters.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountPatchParameters.java new file mode 100644 index 0000000000000..e2e10171c5000 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountPatchParameters.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.cosmos-db.v2015_04_08; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters for patching Azure Cosmos DB database account properties. + */ +@JsonFlatten +public class DatabaseAccountPatchParameters { + /** + * The tags property. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * Get the tags value. + * + * @return the tags value + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags value. + * + * @param tags the tags value to set + * @return the DatabaseAccountPatchParameters object itself. + */ + public DatabaseAccountPatchParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get list of Cosmos DB capabilities for the account. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set list of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountPatchParameters object itself. + */ + public DatabaseAccountPatchParameters withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegenerateKeyParameters.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..a52c3ab932ef7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegenerateKeyParameters.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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Parameters to regenerate the keys within the database account. + */ +public class DatabaseAccountRegenerateKeyParameters { + /** + * The access key to regenerate. Possible values include: 'primary', + * 'secondary', 'primaryReadonly', 'secondaryReadonly'. + */ + @JsonProperty(value = "keyKind", required = true) + private KeyKind keyKind; + + /** + * Get the access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly'. + * + * @return the keyKind value + */ + public KeyKind keyKind() { + return this.keyKind; + } + + /** + * Set the access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly'. + * + * @param keyKind the keyKind value to set + * @return the DatabaseAccountRegenerateKeyParameters object itself. + */ + public DatabaseAccountRegenerateKeyParameters withKeyKind(KeyKind keyKind) { + this.keyKind = keyKind; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegions.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegions.java new file mode 100644 index 0000000000000..3d924259b5f03 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountRegions.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountRegionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing DatabaseAccountRegions. + */ +public interface DatabaseAccountRegions extends HasInner { + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountUsage.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountUsage.java new file mode 100644 index 0000000000000..29e37687b25f1 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccountUsage.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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; + +/** + * Type representing DatabaseAccountUsage. + */ +public interface DatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccounts.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccounts.java new file mode 100644 index 0000000000000..a64a58c68d768 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabaseAccounts.java @@ -0,0 +1,154 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +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 rx.Completable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DatabaseAccountsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountUsage; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetricDefinition; + +/** + * Type representing DatabaseAccounts. + */ +public interface DatabaseAccounts extends SupportsCreating, SupportsDeletingByResourceGroup, SupportsBatchDeletion, SupportsGettingByResourceGroup, SupportsListingByResourceGroup, SupportsListing, HasInner { + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies); + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listKeysAsync(String resourceGroupName, String accountName); + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listConnectionStringsAsync(String resourceGroupName, String accountName); + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable offlineRegionAsync(String resourceGroupName, String accountName, String region); + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable onlineRegionAsync(String resourceGroupName, String accountName, String region); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listReadOnlyKeysAsync(String resourceGroupName, String accountName); + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind); + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getReadOnlyKeysAsync(String resourceGroupName, String accountName); + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable checkNameExistsAsync(String accountName); + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String filter); + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String accountName); + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Databases.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Databases.java new file mode 100644 index 0000000000000..6a07bd09e472a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Databases.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.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountUsage; + +/** + * Type representing Databases. + */ +public interface Databases { + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid); + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter); + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetric.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetric.java new file mode 100644 index 0000000000000..ee27458356087 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetric.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing DatabasisDatabaseAccountMetric. + */ +public interface DatabasisDatabaseAccountMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetricDefinition.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..c01ef6429652d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountMetricDefinition.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import java.util.List; + +/** + * Type representing DatabasisDatabaseAccountMetricDefinition. + */ +public interface DatabasisDatabaseAccountMetricDefinition extends HasInner, HasManager { + /** + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the primaryAggregationType value. + */ + PrimaryAggregationType primaryAggregationType(); + + /** + * @return the resourceUri value. + */ + String resourceUri(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountUsage.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountUsage.java new file mode 100644 index 0000000000000..5f69db1380023 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DatabasisDatabaseAccountUsage.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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; + +/** + * Type representing DatabasisDatabaseAccountUsage. + */ +public interface DatabasisDatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DefaultConsistencyLevel.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DefaultConsistencyLevel.java new file mode 100644 index 0000000000000..7be483f437d26 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/DefaultConsistencyLevel.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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Defines values for DefaultConsistencyLevel. + */ +public enum DefaultConsistencyLevel { + /** Enum value Eventual. */ + EVENTUAL("Eventual"), + + /** Enum value Session. */ + SESSION("Session"), + + /** Enum value BoundedStaleness. */ + BOUNDED_STALENESS("BoundedStaleness"), + + /** Enum value Strong. */ + STRONG("Strong"), + + /** Enum value ConsistentPrefix. */ + CONSISTENT_PREFIX("ConsistentPrefix"); + + /** The actual serialized value for a DefaultConsistencyLevel instance. */ + private String value; + + DefaultConsistencyLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DefaultConsistencyLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed DefaultConsistencyLevel object, or null if unable to parse. + */ + @JsonCreator + public static DefaultConsistencyLevel fromString(String value) { + DefaultConsistencyLevel[] items = DefaultConsistencyLevel.values(); + for (DefaultConsistencyLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponse.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponse.java new file mode 100644 index 0000000000000..4d458b5422cc3 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * 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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponseException.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponseException.java new file mode 100644 index 0000000000000..abb3a9cb0573c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/ErrorResponseException.java @@ -0,0 +1,44 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicies.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicies.java new file mode 100644 index 0000000000000..9db9867ded6c9 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicies.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.cosmos-db.v2015_04_08; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The list of new failover policies for the failover priority change. + */ +public class FailoverPolicies { + /** + * List of failover policies. + */ + @JsonProperty(value = "failoverPolicies", required = true) + private List failoverPolicies; + + /** + * Get list of failover policies. + * + * @return the failoverPolicies value + */ + public List failoverPolicies() { + return this.failoverPolicies; + } + + /** + * Set list of failover policies. + * + * @param failoverPolicies the failoverPolicies value to set + * @return the FailoverPolicies object itself. + */ + public FailoverPolicies withFailoverPolicies(List failoverPolicies) { + this.failoverPolicies = failoverPolicies; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicy.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicy.java new file mode 100644 index 0000000000000..3bc62bed0c3ca --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/FailoverPolicy.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The failover policy for a given region of a database account. + */ +public class FailoverPolicy { + /** + * The unique identifier of the region in which the database account + * replicates to. Example: + * &lt;accountName&gt;-&lt;locationName&gt;. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the region in which the database account exists. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /** + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** + * Get the unique identifier of the region in which the database account replicates to. Example: &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name of the region in which the database account exists. + * + * @return the locationName value + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the name of the region in which the database account exists. + * + * @param locationName the locationName value to set + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set + * @return the FailoverPolicy object itself. + */ + public FailoverPolicy withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/KeyKind.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/KeyKind.java new file mode 100644 index 0000000000000..ac5ee0b351f2d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/KeyKind.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for KeyKind. + */ +public final class KeyKind extends ExpandableStringEnum { + /** Static value primary for KeyKind. */ + public static final KeyKind PRIMARY = fromString("primary"); + + /** Static value secondary for KeyKind. */ + public static final KeyKind SECONDARY = fromString("secondary"); + + /** Static value primaryReadonly for KeyKind. */ + public static final KeyKind PRIMARY_READONLY = fromString("primaryReadonly"); + + /** Static value secondaryReadonly for KeyKind. */ + public static final KeyKind SECONDARY_READONLY = fromString("secondaryReadonly"); + + /** + * Creates or finds a KeyKind from its string representation. + * @param name a name to look for + * @return the corresponding KeyKind + */ + @JsonCreator + public static KeyKind fromString(String name) { + return fromString(name, KeyKind.class); + } + + /** + * @return known KeyKind values + */ + public static Collection values() { + return values(KeyKind.class); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Location.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Location.java new file mode 100644 index 0000000000000..affa2f501b993 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Location.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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A region in which the Azure Cosmos DB database account is deployed. + */ +public class Location { + /** + * The unique identifier of the region within the database account. + * Example: &lt;accountName&gt;-&lt;locationName&gt;. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * The name of the region. + */ + @JsonProperty(value = "locationName") + private String locationName; + + /** + * The connection endpoint for the specific region. Example: + * https://&lt;accountName&gt;-&lt;locationName&gt;.documents.azure.com:443/. + */ + @JsonProperty(value = "documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /** + * The provisioningState property. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /** + * The failover priority of the region. A failover priority of 0 indicates + * a write region. The maximum value for a failover priority = (total + * number of regions - 1). Failover priority values must be unique for each + * of the regions in which the database account exists. + */ + @JsonProperty(value = "failoverPriority") + private Integer failoverPriority; + + /** + * Get the unique identifier of the region within the database account. Example: &lt;accountName&gt;-&lt;locationName&gt;. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Get the name of the region. + * + * @return the locationName value + */ + public String locationName() { + return this.locationName; + } + + /** + * Set the name of the region. + * + * @param locationName the locationName value to set + * @return the Location object itself. + */ + public Location withLocationName(String locationName) { + this.locationName = locationName; + return this; + } + + /** + * Get the connection endpoint for the specific region. Example: https://&lt;accountName&gt;-&lt;locationName&gt;.documents.azure.com:443/. + * + * @return the documentEndpoint value + */ + public String documentEndpoint() { + return this.documentEndpoint; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the Location object itself. + */ + public Location withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @return the failoverPriority value + */ + public Integer failoverPriority() { + return this.failoverPriority; + } + + /** + * Set the failover priority of the region. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param failoverPriority the failoverPriority value to set + * @return the Location object itself. + */ + public Location withFailoverPriority(Integer failoverPriority) { + this.failoverPriority = failoverPriority; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricAvailability.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricAvailability.java new file mode 100644 index 0000000000000..e9a253a857d24 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricAvailability.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The availability of the metric. + */ +public class MetricAvailability { + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The retention for the metric values. + */ + @JsonProperty(value = "retention", access = JsonProperty.Access.WRITE_ONLY) + private String retention; + + /** + * Get the time grain to be used to summarize the metric values. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the retention for the metric values. + * + * @return the retention value + */ + public String retention() { + return this.retention; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricName.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricName.java new file mode 100644 index 0000000000000..f166385190dd0 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricName.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A metric name. + */ +public class MetricName { + /** + * The name of the metric. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /** + * The friendly name of the metric. + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the name of the metric. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Get the friendly name of the metric. + * + * @return the localizedValue value + */ + public String localizedValue() { + return this.localizedValue; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricValue.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricValue.java new file mode 100644 index 0000000000000..2ff691fe1d278 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/MetricValue.java @@ -0,0 +1,108 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import org.joda.time.DateTime; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents metrics values. + */ +public class MetricValue { + /** + * The number of values for the metric. + */ + @JsonProperty(value = "_count", access = JsonProperty.Access.WRITE_ONLY) + private Double _count; + + /** + * The average value of the metric. + */ + @JsonProperty(value = "average", access = JsonProperty.Access.WRITE_ONLY) + private Double average; + + /** + * The max value of the metric. + */ + @JsonProperty(value = "maximum", access = JsonProperty.Access.WRITE_ONLY) + private Double maximum; + + /** + * The min value of the metric. + */ + @JsonProperty(value = "minimum", access = JsonProperty.Access.WRITE_ONLY) + private Double minimum; + + /** + * The metric timestamp (ISO-8601 format). + */ + @JsonProperty(value = "timestamp", access = JsonProperty.Access.WRITE_ONLY) + private DateTime timestamp; + + /** + * The total value of the metric. + */ + @JsonProperty(value = "total", access = JsonProperty.Access.WRITE_ONLY) + private Double total; + + /** + * Get the number of values for the metric. + * + * @return the _count value + */ + public Double _count() { + return this._count; + } + + /** + * Get the average value of the metric. + * + * @return the average value + */ + public Double average() { + return this.average; + } + + /** + * Get the max value of the metric. + * + * @return the maximum value + */ + public Double maximum() { + return this.maximum; + } + + /** + * Get the min value of the metric. + * + * @return the minimum value + */ + public Double minimum() { + return this.minimum; + } + + /** + * Get the metric timestamp (ISO-8601 format). + * + * @return the timestamp value + */ + public DateTime timestamp() { + return this.timestamp; + } + + /** + * Get the total value of the metric. + * + * @return the total value + */ + public Double total() { + return this.total; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operation.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operation.java new file mode 100644 index 0000000000000..936a76b02a13d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/OperationDisplay.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/OperationDisplay.java new file mode 100644 index 0000000000000..91232c0a70ba9 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/OperationDisplay.java @@ -0,0 +1,121 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The object that represents the operation. + */ +public class OperationDisplay { + /** + * Service provider: Microsoft.ResourceProvider. + */ + @JsonProperty(value = "Provider") + private String provider; + + /** + * Resource on which the operation is performed: Profile, endpoint, etc. + */ + @JsonProperty(value = "Resource") + private String resource; + + /** + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "Operation") + private String operation; + + /** + * Description of operation. + */ + @JsonProperty(value = "Description") + private String description; + + /** + * Get service provider: Microsoft.ResourceProvider. + * + * @return the provider value + */ + public String provider() { + return this.provider; + } + + /** + * Set service provider: Microsoft.ResourceProvider. + * + * @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: Profile, endpoint, etc. + * + * @return the resource value + */ + public String resource() { + return this.resource; + } + + /** + * Set resource on which the operation is performed: Profile, endpoint, etc. + * + * @param resource the resource value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get operation type: Read, write, delete, etc. + * + * @return the operation value + */ + public String operation() { + return this.operation; + } + + /** + * Set operation type: Read, write, delete, etc. + * + * @param operation the operation value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get description of operation. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set description of operation. + * + * @param description the description value to set + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operations.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Operations.java new file mode 100644 index 0000000000000..2c5b8aa7d90c8 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.OperationsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Operations. + */ +public interface Operations extends HasInner { + /** + * Lists all of the available Cosmos DB Resource Provider operations. + * + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listAsync(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIdRegions.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIdRegions.java new file mode 100644 index 0000000000000..4422ca65f0c2a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIdRegions.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; + +/** + * Type representing PartitionKeyRangeIdRegions. + */ +public interface PartitionKeyRangeIdRegions { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIds.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIds.java new file mode 100644 index 0000000000000..29c038ee8587a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionKeyRangeIds.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; + +/** + * Type representing PartitionKeyRangeIds. + */ +public interface PartitionKeyRangeIds { + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionMetric.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionMetric.java new file mode 100644 index 0000000000000..17d56b422f605 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionMetric.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.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PartitionMetricInner; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing PartitionMetric. + */ +public interface PartitionMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the partitionId value. + */ + String partitionId(); + + /** + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionUsage.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionUsage.java new file mode 100644 index 0000000000000..f94855f5f7535 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PartitionUsage.java @@ -0,0 +1,55 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PartitionUsageInner; + +/** + * Type representing PartitionUsage. + */ +public interface PartitionUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * @return the limit value. + */ + Integer limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the partitionId value. + */ + String partitionId(); + + /** + * @return the partitionKeyRangeId value. + */ + String partitionKeyRangeId(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetric.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetric.java new file mode 100644 index 0000000000000..10f7600089a6c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetric.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.DocumentDBManager; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PercentileMetricInner; +import org.joda.time.DateTime; +import java.util.List; + +/** + * Type representing PercentileMetric. + */ +public interface PercentileMetric extends HasInner, HasManager { + /** + * @return the endTime value. + */ + DateTime endTime(); + + /** + * @return the metricValues value. + */ + List metricValues(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the startTime value. + */ + DateTime startTime(); + + /** + * @return the timeGrain value. + */ + String timeGrain(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetricValue.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetricValue.java new file mode 100644 index 0000000000000..1feb712dac570 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileMetricValue.java @@ -0,0 +1,122 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Represents percentile metrics values. + */ +public class PercentileMetricValue extends MetricValue { + /** + * The 10th percentile value for the metric. + */ + @JsonProperty(value = "P10", access = JsonProperty.Access.WRITE_ONLY) + private Double p10; + + /** + * The 25th percentile value for the metric. + */ + @JsonProperty(value = "P25", access = JsonProperty.Access.WRITE_ONLY) + private Double p25; + + /** + * The 50th percentile value for the metric. + */ + @JsonProperty(value = "P50", access = JsonProperty.Access.WRITE_ONLY) + private Double p50; + + /** + * The 75th percentile value for the metric. + */ + @JsonProperty(value = "P75", access = JsonProperty.Access.WRITE_ONLY) + private Double p75; + + /** + * The 90th percentile value for the metric. + */ + @JsonProperty(value = "P90", access = JsonProperty.Access.WRITE_ONLY) + private Double p90; + + /** + * The 95th percentile value for the metric. + */ + @JsonProperty(value = "P95", access = JsonProperty.Access.WRITE_ONLY) + private Double p95; + + /** + * The 99th percentile value for the metric. + */ + @JsonProperty(value = "P99", access = JsonProperty.Access.WRITE_ONLY) + private Double p99; + + /** + * Get the 10th percentile value for the metric. + * + * @return the p10 value + */ + public Double p10() { + return this.p10; + } + + /** + * Get the 25th percentile value for the metric. + * + * @return the p25 value + */ + public Double p25() { + return this.p25; + } + + /** + * Get the 50th percentile value for the metric. + * + * @return the p50 value + */ + public Double p50() { + return this.p50; + } + + /** + * Get the 75th percentile value for the metric. + * + * @return the p75 value + */ + public Double p75() { + return this.p75; + } + + /** + * Get the 90th percentile value for the metric. + * + * @return the p90 value + */ + public Double p90() { + return this.p90; + } + + /** + * Get the 95th percentile value for the metric. + * + * @return the p95 value + */ + public Double p95() { + return this.p95; + } + + /** + * Get the 99th percentile value for the metric. + * + * @return the p99 value + */ + public Double p99() { + return this.p99; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileSourceTargets.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileSourceTargets.java new file mode 100644 index 0000000000000..0e4fbe900c50a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileSourceTargets.java @@ -0,0 +1,32 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PercentileSourceTargetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PercentileSourceTargets. + */ +public interface PercentileSourceTargets extends HasInner { + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileTargets.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileTargets.java new file mode 100644 index 0000000000000..7250a44778cce --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PercentileTargets.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PercentileTargetsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PercentileTargets. + */ +public interface PercentileTargets extends HasInner { + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Percentiles.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Percentiles.java new file mode 100644 index 0000000000000..7bbdd343a086e --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/Percentiles.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.cosmos-db.v2015_04_08; + +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation.PercentilesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing Percentiles. + */ +public interface Percentiles extends HasInner { + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMetricsAsync(String resourceGroupName, String accountName, String filter); + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PrimaryAggregationType.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PrimaryAggregationType.java new file mode 100644 index 0000000000000..10fd91bbbe02c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/PrimaryAggregationType.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.cosmos-db.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PrimaryAggregationType. + */ +public final class PrimaryAggregationType extends ExpandableStringEnum { + /** Static value None for PrimaryAggregationType. */ + public static final PrimaryAggregationType NONE = fromString("None"); + + /** Static value Average for PrimaryAggregationType. */ + public static final PrimaryAggregationType AVERAGE = fromString("Average"); + + /** Static value Total for PrimaryAggregationType. */ + public static final PrimaryAggregationType TOTAL = fromString("Total"); + + /** Static value Minimimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMIMUM = fromString("Minimimum"); + + /** Static value Maximum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MAXIMUM = fromString("Maximum"); + + /** Static value Last for PrimaryAggregationType. */ + public static final PrimaryAggregationType LAST = fromString("Last"); + + /** + * Creates or finds a PrimaryAggregationType from its string representation. + * @param name a name to look for + * @return the corresponding PrimaryAggregationType + */ + @JsonCreator + public static PrimaryAggregationType fromString(String name) { + return fromString(name, PrimaryAggregationType.class); + } + + /** + * @return known PrimaryAggregationType values + */ + public static Collection values() { + return values(PrimaryAggregationType.class); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/RegionForOnlineOffline.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/RegionForOnlineOffline.java new file mode 100644 index 0000000000000..560cef1b9e603 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/RegionForOnlineOffline.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB region to online or offline. + */ +public class RegionForOnlineOffline { + /** + * Cosmos DB region, with spaces between words and each word capitalized. + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** + * Get cosmos DB region, with spaces between words and each word capitalized. + * + * @return the region value + */ + public String region() { + return this.region; + } + + /** + * Set cosmos DB region, with spaces between words and each word capitalized. + * + * @param region the region value to set + * @return the RegionForOnlineOffline object itself. + */ + public RegionForOnlineOffline withRegion(String region) { + this.region = region; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/UnitType.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/UnitType.java new file mode 100644 index 0000000000000..67b70827d2ecd --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/UnitType.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.cosmos-db.v2015_04_08; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for UnitType. + */ +public final class UnitType extends ExpandableStringEnum { + /** Static value Count for UnitType. */ + public static final UnitType COUNT = fromString("Count"); + + /** Static value Bytes for UnitType. */ + public static final UnitType BYTES = fromString("Bytes"); + + /** Static value Seconds for UnitType. */ + public static final UnitType SECONDS = fromString("Seconds"); + + /** Static value Percent for UnitType. */ + public static final UnitType PERCENT = fromString("Percent"); + + /** Static value CountPerSecond for UnitType. */ + public static final UnitType COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for UnitType. */ + public static final UnitType BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Milliseconds for UnitType. */ + public static final UnitType MILLISECONDS = fromString("Milliseconds"); + + /** + * Creates or finds a UnitType from its string representation. + * @param name a name to look for + * @return the corresponding UnitType + */ + @JsonCreator + public static UnitType fromString(String name) { + return fromString(name, UnitType.class); + } + + /** + * @return known UnitType values + */ + public static Collection values() { + return values(UnitType.class); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/VirtualNetworkRule.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/VirtualNetworkRule.java new file mode 100644 index 0000000000000..8a94b03a938b9 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/VirtualNetworkRule.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.cosmos-db.v2015_04_08; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Virtual Network ACL Rule object. + */ +public class VirtualNetworkRule { + /** + * Resource ID of a subnet, for example: + * /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource ID of a subnet, for example: /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}. + * + * @param id the id value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withId(String id) { + this.id = id; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..3ef17ebf39ae7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricAvailability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PrimaryAggregationType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class CollectionDatabasisDatabaseAccountMetricDefinitionImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetricDefinition { + private final DocumentDBManager manager; + + CollectionDatabasisDatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..96133a83ed0c7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class CollectionDatabasisDatabaseAccountMetricImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetric { + private final DocumentDBManager manager; + + CollectionDatabasisDatabaseAccountMetricImpl(MetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java new file mode 100644 index 0000000000000..1ca8dd067373f --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricModel; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class CollectionDatabasisDatabaseAccountMetricModelImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetricModel { + private final DocumentDBManager manager; + + CollectionDatabasisDatabaseAccountMetricModelImpl(MetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..5884b0e9482ae --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionDatabasisDatabaseAccountUsageImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class CollectionDatabasisDatabaseAccountUsageImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountUsage { + private final DocumentDBManager manager; + + CollectionDatabasisDatabaseAccountUsageImpl(UsageInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsImpl.java new file mode 100644 index 0000000000000..615996fef6549 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitionRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionMetric; + +class CollectionPartitionRegionsImpl extends WrapperImpl implements CollectionPartitionRegions { + private final DocumentDBManager manager; + + CollectionPartitionRegionsImpl(DocumentDBManager manager) { + super(manager.inner().collectionPartitionRegions()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + CollectionPartitionRegionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PartitionMetric call(PartitionMetricInner inner) { + return new PartitionMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsInner.java new file mode 100644 index 0000000000000..dbf53351d450f --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionRegionsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionPartitionRegions. + */ +public class CollectionPartitionRegionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionPartitionRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionPartitionRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionPartitionRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionPartitionRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionPartitionRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionPartitionRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitionRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection and region, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsImpl.java new file mode 100644 index 0000000000000..1a25f0e56903f --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsImpl.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionUsage; + +class CollectionPartitionsImpl extends WrapperImpl implements CollectionPartitions { + private final DocumentDBManager manager; + + CollectionPartitionsImpl(DocumentDBManager manager) { + super(manager.inner().collectionPartitions()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + CollectionPartitionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PartitionMetric call(PartitionMetricInner inner) { + return new PartitionMetricImpl(inner, manager()); + } + }); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + CollectionPartitionsInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PartitionUsage call(PartitionUsageInner inner) { + return new PartitionUsageImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsInner.java new file mode 100644 index 0000000000000..5a51af2112953 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionPartitionsInner.java @@ -0,0 +1,385 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionPartitions. + */ +public class CollectionPartitionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionPartitionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionPartitionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionPartitionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionPartitionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionPartitions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionPartitionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.CollectionPartitions listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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<PartitionUsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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 accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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 filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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<PartitionUsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection, split by partition. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionUsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, 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); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsImpl.java new file mode 100644 index 0000000000000..6be410b043a9c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsImpl.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. + * abc + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionRegions; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricModel; + +class CollectionRegionsImpl extends WrapperImpl implements CollectionRegions { + private final DocumentDBManager manager; + + CollectionRegionsImpl(DocumentDBManager manager) { + super(manager.inner().collectionRegions()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + private CollectionDatabasisDatabaseAccountMetricModelImpl wrapCollectionDatabasisDatabaseAccountMetricModelModel(MetricInner inner) { + return new CollectionDatabasisDatabaseAccountMetricModelImpl(inner, manager()); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + CollectionRegionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CollectionDatabasisDatabaseAccountMetricModel call(MetricInner inner) { + return wrapCollectionDatabasisDatabaseAccountMetricModelModel(inner); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsInner.java new file mode 100644 index 0000000000000..1ee6de96ba05e --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionRegionsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CollectionRegions. + */ +public class CollectionRegionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for CollectionRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account, collection and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsImpl.java new file mode 100644 index 0000000000000..ee462f4c651e0 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsImpl.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Collections; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionDatabasisDatabaseAccountUsage; + +class CollectionsImpl extends WrapperImpl implements Collections { + private final DocumentDBManager manager; + + CollectionsImpl(DocumentDBManager manager) { + super(manager.inner().collections()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + private CollectionDatabasisDatabaseAccountMetricDefinitionImpl wrapCollectionDatabasisDatabaseAccountMetricDefinitionModel(MetricDefinitionInner inner) { + return new CollectionDatabasisDatabaseAccountMetricDefinitionImpl(inner, manager()); + } + + private CollectionDatabasisDatabaseAccountMetricImpl wrapCollectionDatabasisDatabaseAccountMetricModel(MetricInner inner) { + return new CollectionDatabasisDatabaseAccountMetricImpl(inner, manager()); + } + + private CollectionDatabasisDatabaseAccountUsageImpl wrapCollectionDatabasisDatabaseAccountUsageModel(UsageInner inner) { + return new CollectionDatabasisDatabaseAccountUsageImpl(inner, manager()); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + CollectionsInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid, collectionRid) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CollectionDatabasisDatabaseAccountMetricDefinition call(MetricDefinitionInner inner) { + return wrapCollectionDatabasisDatabaseAccountMetricDefinitionModel(inner); + } + }); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + CollectionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CollectionDatabasisDatabaseAccountMetric call(MetricInner inner) { + return wrapCollectionDatabasisDatabaseAccountMetricModel(inner); + } + }); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + CollectionsInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, accountName, databaseRid, collectionRid) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CollectionDatabasisDatabaseAccountUsage call(UsageInner inner) { + return wrapCollectionDatabasisDatabaseAccountUsageModel(inner); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsInner.java new file mode 100644 index 0000000000000..11f962869f4cd --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CollectionsInner.java @@ -0,0 +1,494 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Collections. + */ +public class CollectionsInner { + /** The Retrofit service to perform REST calls. */ + private CollectionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of CollectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CollectionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(CollectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for Collections to be + * used by Retrofit to perform actually REST calls. + */ + interface CollectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.Collections listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.Collections listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.Collections listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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 accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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 filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 accountName, String databaseRid, String collectionRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent storage data) for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), filter, 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); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid), serviceCallback); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(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> listMetricDefinitionsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CosmosDBImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CosmosDBImpl.java new file mode 100644 index 0000000000000..9deefa15f9edf --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/CosmosDBImpl.java @@ -0,0 +1,364 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.AzureClient; +import com.microsoft.azure.AzureServiceClient; +import com.microsoft.rest.credentials.ServiceClientCredentials; +import com.microsoft.rest.RestClient; + +/** + * Initializes a new instance of the CosmosDBImpl class. + */ +public class CosmosDBImpl extends AzureServiceClient { + /** the {@link AzureClient} used for long running operations. */ + private AzureClient azureClient; + + /** + * Gets the {@link AzureClient} used for long running operations. + * @return the azure client; + */ + public AzureClient getAzureClient() { + return this.azureClient; + } + + /** Azure subscription ID. */ + private String subscriptionId; + + /** + * Gets Azure subscription ID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Sets Azure subscription ID. + * + * @param subscriptionId the subscriptionId value. + * @return the service client itself + */ + public CosmosDBImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** Version of the API to be used with the client request. The current version is 2015-04-08. */ + private String apiVersion; + + /** + * Gets Version of the API to be used with the client request. The current version is 2015-04-08. + * + * @return the apiVersion value. + */ + public String apiVersion() { + return this.apiVersion; + } + + /** Gets or sets the preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets Gets or sets the preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets Gets or sets the preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CosmosDBImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets Gets or sets the retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets Gets or 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 CosmosDBImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** 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 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 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 CosmosDBImpl withGenerateClientRequestId(boolean generateClientRequestId) { + this.generateClientRequestId = generateClientRequestId; + return this; + } + + /** + * The DatabaseAccountsInner object to access its operations. + */ + private DatabaseAccountsInner databaseAccounts; + + /** + * Gets the DatabaseAccountsInner object to access its operations. + * @return the DatabaseAccountsInner object. + */ + public DatabaseAccountsInner databaseAccounts() { + return this.databaseAccounts; + } + + /** + * The OperationsInner object to access its operations. + */ + private OperationsInner operations; + + /** + * Gets the OperationsInner object to access its operations. + * @return the OperationsInner object. + */ + public OperationsInner operations() { + return this.operations; + } + + /** + * The DatabasesInner object to access its operations. + */ + private DatabasesInner databases; + + /** + * Gets the DatabasesInner object to access its operations. + * @return the DatabasesInner object. + */ + public DatabasesInner databases() { + return this.databases; + } + + /** + * The CollectionsInner object to access its operations. + */ + private CollectionsInner collections; + + /** + * Gets the CollectionsInner object to access its operations. + * @return the CollectionsInner object. + */ + public CollectionsInner collections() { + return this.collections; + } + + /** + * The CollectionRegionsInner object to access its operations. + */ + private CollectionRegionsInner collectionRegions; + + /** + * Gets the CollectionRegionsInner object to access its operations. + * @return the CollectionRegionsInner object. + */ + public CollectionRegionsInner collectionRegions() { + return this.collectionRegions; + } + + /** + * The DatabaseAccountRegionsInner object to access its operations. + */ + private DatabaseAccountRegionsInner databaseAccountRegions; + + /** + * Gets the DatabaseAccountRegionsInner object to access its operations. + * @return the DatabaseAccountRegionsInner object. + */ + public DatabaseAccountRegionsInner databaseAccountRegions() { + return this.databaseAccountRegions; + } + + /** + * The PercentileSourceTargetsInner object to access its operations. + */ + private PercentileSourceTargetsInner percentileSourceTargets; + + /** + * Gets the PercentileSourceTargetsInner object to access its operations. + * @return the PercentileSourceTargetsInner object. + */ + public PercentileSourceTargetsInner percentileSourceTargets() { + return this.percentileSourceTargets; + } + + /** + * The PercentileTargetsInner object to access its operations. + */ + private PercentileTargetsInner percentileTargets; + + /** + * Gets the PercentileTargetsInner object to access its operations. + * @return the PercentileTargetsInner object. + */ + public PercentileTargetsInner percentileTargets() { + return this.percentileTargets; + } + + /** + * The PercentilesInner object to access its operations. + */ + private PercentilesInner percentiles; + + /** + * Gets the PercentilesInner object to access its operations. + * @return the PercentilesInner object. + */ + public PercentilesInner percentiles() { + return this.percentiles; + } + + /** + * The CollectionPartitionRegionsInner object to access its operations. + */ + private CollectionPartitionRegionsInner collectionPartitionRegions; + + /** + * Gets the CollectionPartitionRegionsInner object to access its operations. + * @return the CollectionPartitionRegionsInner object. + */ + public CollectionPartitionRegionsInner collectionPartitionRegions() { + return this.collectionPartitionRegions; + } + + /** + * The CollectionPartitionsInner object to access its operations. + */ + private CollectionPartitionsInner collectionPartitions; + + /** + * Gets the CollectionPartitionsInner object to access its operations. + * @return the CollectionPartitionsInner object. + */ + public CollectionPartitionsInner collectionPartitions() { + return this.collectionPartitions; + } + + /** + * The PartitionKeyRangeIdsInner object to access its operations. + */ + private PartitionKeyRangeIdsInner partitionKeyRangeIds; + + /** + * Gets the PartitionKeyRangeIdsInner object to access its operations. + * @return the PartitionKeyRangeIdsInner object. + */ + public PartitionKeyRangeIdsInner partitionKeyRangeIds() { + return this.partitionKeyRangeIds; + } + + /** + * The PartitionKeyRangeIdRegionsInner object to access its operations. + */ + private PartitionKeyRangeIdRegionsInner partitionKeyRangeIdRegions; + + /** + * Gets the PartitionKeyRangeIdRegionsInner object to access its operations. + * @return the PartitionKeyRangeIdRegionsInner object. + */ + public PartitionKeyRangeIdRegionsInner partitionKeyRangeIdRegions() { + return this.partitionKeyRangeIdRegions; + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param credentials the management credentials for Azure + */ + public CosmosDBImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CosmosDBImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of CosmosDB client. + * + * @param restClient the REST client to connect to Azure. + */ + public CosmosDBImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + this.apiVersion = "2015-04-08"; + this.acceptLanguage = "en-US"; + this.longRunningOperationRetryTimeout = 30; + this.generateClientRequestId = true; + this.databaseAccounts = new DatabaseAccountsInner(restClient().retrofit(), this); + this.operations = new OperationsInner(restClient().retrofit(), this); + this.databases = new DatabasesInner(restClient().retrofit(), this); + this.collections = new CollectionsInner(restClient().retrofit(), this); + this.collectionRegions = new CollectionRegionsInner(restClient().retrofit(), this); + this.databaseAccountRegions = new DatabaseAccountRegionsInner(restClient().retrofit(), this); + this.percentileSourceTargets = new PercentileSourceTargetsInner(restClient().retrofit(), this); + this.percentileTargets = new PercentileTargetsInner(restClient().retrofit(), this); + this.percentiles = new PercentilesInner(restClient().retrofit(), this); + this.collectionPartitionRegions = new CollectionPartitionRegionsInner(restClient().retrofit(), this); + this.collectionPartitions = new CollectionPartitionsInner(restClient().retrofit(), this); + this.partitionKeyRangeIds = new PartitionKeyRangeIdsInner(restClient().retrofit(), this); + this.partitionKeyRangeIdRegions = new PartitionKeyRangeIdRegionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s)", super.userAgent(), "CosmosDB", "2015-04-08"); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountImpl.java new file mode 100644 index 0000000000000..0d65a47f0af85 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountImpl.java @@ -0,0 +1,204 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccount; +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountPatchParameters; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountCreateUpdateParameters; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Capability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.ConsistencyPolicy; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountOfferType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.FailoverPolicy; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountKind; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Location; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.VirtualNetworkRule; +import rx.functions.Func1; + +class DatabaseAccountImpl extends GroupableResourceCoreImpl implements DatabaseAccount, DatabaseAccount.Definition, DatabaseAccount.Update { + private DatabaseAccountCreateUpdateParameters createParameter; + private DatabaseAccountPatchParameters updateParameter; + DatabaseAccountImpl(String name, DatabaseAccountInner inner, DocumentDBManager manager) { + super(name, inner, manager); + this.createParameter = new DatabaseAccountCreateUpdateParameters(); + this.updateParameter = new DatabaseAccountPatchParameters(); + } + + @Override + public Observable createResourceAsync() { + DatabaseAccountsInner client = this.manager().inner().databaseAccounts(); + this.createParameter.withLocation(inner().location()); + this.createParameter.withTags(inner().getTags()); + return client.createOrUpdateAsync(this.resourceGroupName(), this.name(), this.createParameter) + .map(new Func1() { + @Override + public DatabaseAccountInner call(DatabaseAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseAccountsInner client = this.manager().inner().databaseAccounts(); + return client.patchAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public DatabaseAccountInner call(DatabaseAccountInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + DatabaseAccountsInner client = this.manager().inner().databaseAccounts(); + return client.getByResourceGroupAsync(this.resourceGroupName(), this.name()); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createParameter = new DatabaseAccountCreateUpdateParameters(); + this.updateParameter = new DatabaseAccountPatchParameters(); + } + + @Override + public List capabilities() { + return this.inner().capabilities(); + } + + @Override + public ConsistencyPolicy consistencyPolicy() { + return this.inner().consistencyPolicy(); + } + + @Override + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.inner().databaseAccountOfferType(); + } + + @Override + public String documentEndpoint() { + return this.inner().documentEndpoint(); + } + + @Override + public Boolean enableAutomaticFailover() { + return this.inner().enableAutomaticFailover(); + } + + @Override + public List failoverPolicies() { + return this.inner().failoverPolicies(); + } + + @Override + public String ipRangeFilter() { + return this.inner().ipRangeFilter(); + } + + @Override + public Boolean isVirtualNetworkFilterEnabled() { + return this.inner().isVirtualNetworkFilterEnabled(); + } + + @Override + public DatabaseAccountKind kind() { + return this.inner().kind(); + } + + @Override + public String provisioningState() { + return this.inner().provisioningState(); + } + + @Override + public List readLocations() { + return this.inner().readLocations(); + } + + @Override + public List virtualNetworkRules() { + return this.inner().virtualNetworkRules(); + } + + @Override + public List writeLocations() { + return this.inner().writeLocations(); + } + + @Override + public DatabaseAccountImpl withDatabaseAccountOfferType(String databaseAccountOfferType) { + this.createParameter.withDatabaseAccountOfferType(databaseAccountOfferType); + return this; + } + + @Override + public DatabaseAccountImpl withLocations(List locations) { + this.createParameter.withLocations(locations); + return this; + } + + @Override + public DatabaseAccountImpl withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.createParameter.withConsistencyPolicy(consistencyPolicy); + return this; + } + + @Override + public DatabaseAccountImpl withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.createParameter.withEnableAutomaticFailover(enableAutomaticFailover); + return this; + } + + @Override + public DatabaseAccountImpl withIpRangeFilter(String ipRangeFilter) { + this.createParameter.withIpRangeFilter(ipRangeFilter); + return this; + } + + @Override + public DatabaseAccountImpl withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.createParameter.withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + return this; + } + + @Override + public DatabaseAccountImpl withKind(DatabaseAccountKind kind) { + this.createParameter.withKind(kind); + return this; + } + + @Override + public DatabaseAccountImpl withVirtualNetworkRules(List virtualNetworkRules) { + this.createParameter.withVirtualNetworkRules(virtualNetworkRules); + return this; + } + + @Override + public DatabaseAccountImpl withCapabilities(List capabilities) { + if (isInCreateMode()) { + this.createParameter.withCapabilities(capabilities); + } else { + this.updateParameter.withCapabilities(capabilities); + } + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountInner.java new file mode 100644 index 0000000000000..737a85bd5830d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountInner.java @@ -0,0 +1,321 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountKind; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountOfferType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.ConsistencyPolicy; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Capability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Location; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.FailoverPolicy; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.VirtualNetworkRule; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.Resource; + +/** + * An Azure Cosmos DB database account. + */ +@JsonFlatten +public class DatabaseAccountInner extends Resource { + /** + * Indicates the type of database account. This can only be set at database + * account creation. Possible values include: 'GlobalDocumentDB', + * 'MongoDB', 'Parse'. + */ + @JsonProperty(value = "kind") + private DatabaseAccountKind kind; + + /** + * The provisioningState property. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /** + * The connection endpoint for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.documentEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String documentEndpoint; + + /** + * The offer type for the Cosmos DB database account. Default value: + * Standard. Possible values include: 'Standard'. + */ + @JsonProperty(value = "properties.databaseAccountOfferType", access = JsonProperty.Access.WRITE_ONLY) + private DatabaseAccountOfferType databaseAccountOfferType; + + /** + * Cosmos DB Firewall Support: This value specifies the set of IP addresses + * or IP address ranges in CIDR form to be included as the allowed list of + * client IPs for a given database account. IP addresses/ranges must be + * comma separated and must not contain any spaces. + */ + @JsonProperty(value = "properties.ipRangeFilter") + private String ipRangeFilter; + + /** + * Flag to indicate whether to enable/disable Virtual Network ACL rules. + */ + @JsonProperty(value = "properties.isVirtualNetworkFilterEnabled") + private Boolean isVirtualNetworkFilterEnabled; + + /** + * Enables automatic failover of the write region in the rare event that + * the region is unavailable due to an outage. Automatic failover will + * result in a new write region for the account and is chosen based on the + * failover priorities configured for the account. + */ + @JsonProperty(value = "properties.enableAutomaticFailover") + private Boolean enableAutomaticFailover; + + /** + * The consistency policy for the Cosmos DB database account. + */ + @JsonProperty(value = "properties.consistencyPolicy") + private ConsistencyPolicy consistencyPolicy; + + /** + * List of Cosmos DB capabilities for the account. + */ + @JsonProperty(value = "properties.capabilities") + private List capabilities; + + /** + * An array that contains the write location for the Cosmos DB account. + */ + @JsonProperty(value = "properties.writeLocations", access = JsonProperty.Access.WRITE_ONLY) + private List writeLocations; + + /** + * An array that contains of the read locations enabled for the Cosmos DB + * account. + */ + @JsonProperty(value = "properties.readLocations", access = JsonProperty.Access.WRITE_ONLY) + private List readLocations; + + /** + * An array that contains the regions ordered by their failover priorities. + */ + @JsonProperty(value = "properties.failoverPolicies", access = JsonProperty.Access.WRITE_ONLY) + private List failoverPolicies; + + /** + * List of Virtual Network ACL rules configured for the Cosmos DB account. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Get indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. + * + * @return the kind value + */ + public DatabaseAccountKind kind() { + return this.kind; + } + + /** + * Set indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse'. + * + * @param kind the kind value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withKind(DatabaseAccountKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the provisioningState value. + * + * @return the provisioningState value + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState value. + * + * @param provisioningState the provisioningState value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the connection endpoint for the Cosmos DB database account. + * + * @return the documentEndpoint value + */ + public String documentEndpoint() { + return this.documentEndpoint; + } + + /** + * Get the offer type for the Cosmos DB database account. Default value: Standard. Possible values include: 'Standard'. + * + * @return the databaseAccountOfferType value + */ + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Get cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + * + * @return the ipRangeFilter value + */ + public String ipRangeFilter() { + return this.ipRangeFilter; + } + + /** + * Set cosmos DB Firewall Support: This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. IP addresses/ranges must be comma separated and must not contain any spaces. + * + * @param ipRangeFilter the ipRangeFilter value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withIpRangeFilter(String ipRangeFilter) { + this.ipRangeFilter = ipRangeFilter; + return this; + } + + /** + * Get flag to indicate whether to enable/disable Virtual Network ACL rules. + * + * @return the isVirtualNetworkFilterEnabled value + */ + public Boolean isVirtualNetworkFilterEnabled() { + return this.isVirtualNetworkFilterEnabled; + } + + /** + * Set flag to indicate whether to enable/disable Virtual Network ACL rules. + * + * @param isVirtualNetworkFilterEnabled the isVirtualNetworkFilterEnabled value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + this.isVirtualNetworkFilterEnabled = isVirtualNetworkFilterEnabled; + return this; + } + + /** + * Get enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + * + * @return the enableAutomaticFailover value + */ + public Boolean enableAutomaticFailover() { + return this.enableAutomaticFailover; + } + + /** + * Set enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. + * + * @param enableAutomaticFailover the enableAutomaticFailover value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + this.enableAutomaticFailover = enableAutomaticFailover; + return this; + } + + /** + * Get the consistency policy for the Cosmos DB database account. + * + * @return the consistencyPolicy value + */ + public ConsistencyPolicy consistencyPolicy() { + return this.consistencyPolicy; + } + + /** + * Set the consistency policy for the Cosmos DB database account. + * + * @param consistencyPolicy the consistencyPolicy value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + this.consistencyPolicy = consistencyPolicy; + return this; + } + + /** + * Get list of Cosmos DB capabilities for the account. + * + * @return the capabilities value + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Set list of Cosmos DB capabilities for the account. + * + * @param capabilities the capabilities value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get an array that contains the write location for the Cosmos DB account. + * + * @return the writeLocations value + */ + public List writeLocations() { + return this.writeLocations; + } + + /** + * Get an array that contains of the read locations enabled for the Cosmos DB account. + * + * @return the readLocations value + */ + public List readLocations() { + return this.readLocations; + } + + /** + * Get an array that contains the regions ordered by their failover priorities. + * + * @return the failoverPolicies value + */ + public List failoverPolicies() { + return this.failoverPolicies; + } + + /** + * Get list of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set list of Virtual Network ACL rules configured for the Cosmos DB account. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the DatabaseAccountInner object itself. + */ + public DatabaseAccountInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..50ca1f9f56edc --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultImpl.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountListConnectionStringsResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountConnectionString; + +class DatabaseAccountListConnectionStringsResultImpl extends WrapperImpl implements DatabaseAccountListConnectionStringsResult { + private final DocumentDBManager manager; + DatabaseAccountListConnectionStringsResultImpl(DatabaseAccountListConnectionStringsResultInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public List connectionStrings() { + return this.inner().connectionStrings(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..2e70c062331f5 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListConnectionStringsResultInner.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.cosmos-db.v2015_04_08.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountConnectionString; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The connection strings for the given database account. + */ +public class DatabaseAccountListConnectionStringsResultInner { + /** + * An array that contains the connection strings for the Cosmos DB account. + */ + @JsonProperty(value = "connectionStrings") + private List connectionStrings; + + /** + * Get an array that contains the connection strings for the Cosmos DB account. + * + * @return the connectionStrings value + */ + public List connectionStrings() { + return this.connectionStrings; + } + + /** + * Set an array that contains the connection strings for the Cosmos DB account. + * + * @param connectionStrings the connectionStrings value to set + * @return the DatabaseAccountListConnectionStringsResultInner object itself. + */ + public DatabaseAccountListConnectionStringsResultInner withConnectionStrings(List connectionStrings) { + this.connectionStrings = connectionStrings; + return this; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultImpl.java new file mode 100644 index 0000000000000..9cd9cd2ea6d3b --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultImpl.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountListKeysResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseAccountListKeysResultImpl extends WrapperImpl implements DatabaseAccountListKeysResult { + private final DocumentDBManager manager; + DatabaseAccountListKeysResultImpl(DatabaseAccountListKeysResultInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public String primaryMasterKey() { + return this.inner().primaryMasterKey(); + } + + @Override + public String primaryReadonlyMasterKey() { + return this.inner().primaryReadonlyMasterKey(); + } + + @Override + public String secondaryMasterKey() { + return this.inner().secondaryMasterKey(); + } + + @Override + public String secondaryReadonlyMasterKey() { + return this.inner().secondaryReadonlyMasterKey(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java new file mode 100644 index 0000000000000..8fe4bf34c80d1 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListKeysResultInner.java @@ -0,0 +1,79 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * The access keys for the given database account. + */ +@JsonFlatten +public class DatabaseAccountListKeysResultInner { + /** + * Base 64 encoded value of the primary read-write key. + */ + @JsonProperty(value = "primaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryMasterKey; + + /** + * Base 64 encoded value of the secondary read-write key. + */ + @JsonProperty(value = "secondaryMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryMasterKey; + + /** + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "properties.primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /** + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "properties.secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** + * Get base 64 encoded value of the primary read-write key. + * + * @return the primaryMasterKey value + */ + public String primaryMasterKey() { + return this.primaryMasterKey; + } + + /** + * Get base 64 encoded value of the secondary read-write key. + * + * @return the secondaryMasterKey value + */ + public String secondaryMasterKey() { + return this.secondaryMasterKey; + } + + /** + * Get base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java new file mode 100644 index 0000000000000..17602ca714557 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountListReadOnlyKeysResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseAccountListReadOnlyKeysResultImpl extends WrapperImpl implements DatabaseAccountListReadOnlyKeysResult { + private final DocumentDBManager manager; + DatabaseAccountListReadOnlyKeysResultImpl(DatabaseAccountListReadOnlyKeysResultInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public String primaryReadonlyMasterKey() { + return this.inner().primaryReadonlyMasterKey(); + } + + @Override + public String secondaryReadonlyMasterKey() { + return this.inner().secondaryReadonlyMasterKey(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultInner.java new file mode 100644 index 0000000000000..13145a4ac95a1 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountListReadOnlyKeysResultInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The read-only access keys for the given database account. + */ +public class DatabaseAccountListReadOnlyKeysResultInner { + /** + * Base 64 encoded value of the primary read-only key. + */ + @JsonProperty(value = "primaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String primaryReadonlyMasterKey; + + /** + * Base 64 encoded value of the secondary read-only key. + */ + @JsonProperty(value = "secondaryReadonlyMasterKey", access = JsonProperty.Access.WRITE_ONLY) + private String secondaryReadonlyMasterKey; + + /** + * Get base 64 encoded value of the primary read-only key. + * + * @return the primaryReadonlyMasterKey value + */ + public String primaryReadonlyMasterKey() { + return this.primaryReadonlyMasterKey; + } + + /** + * Get base 64 encoded value of the secondary read-only key. + * + * @return the secondaryReadonlyMasterKey value + */ + public String secondaryReadonlyMasterKey() { + return this.secondaryReadonlyMasterKey; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricDefinitionImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..07e3c84c37a65 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricAvailability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PrimaryAggregationType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabaseAccountMetricDefinitionImpl extends WrapperImpl implements DatabaseAccountMetricDefinition { + private final DocumentDBManager manager; + + DatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..7b9edef7c2881 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountMetricImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabaseAccountMetricImpl extends WrapperImpl implements DatabaseAccountMetric { + private final DocumentDBManager manager; + + DatabaseAccountMetricImpl(MetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsImpl.java new file mode 100644 index 0000000000000..ea42e593b0889 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetric; + +class DatabaseAccountRegionsImpl extends WrapperImpl implements DatabaseAccountRegions { + private final DocumentDBManager manager; + + DatabaseAccountRegionsImpl(DocumentDBManager manager) { + super(manager.inner().databaseAccountRegions()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String filter) { + DatabaseAccountRegionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, region, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseAccountMetric call(MetricInner inner) { + return new DatabaseAccountMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsInner.java new file mode 100644 index 0000000000000..02348d38b02b8 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountRegionsInner.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in DatabaseAccountRegions. + */ +public class DatabaseAccountRegionsInner { + /** The Retrofit service to perform REST calls. */ + private DatabaseAccountRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of DatabaseAccountRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAccountRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(DatabaseAccountRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAccountRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAccountRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountUsageImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..0eadbce7e69ee --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountUsageImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabaseAccountUsageImpl extends WrapperImpl implements DatabaseAccountUsage { + private final DocumentDBManager manager; + + DatabaseAccountUsageImpl(UsageInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsImpl.java new file mode 100644 index 0000000000000..a31ebe305b0c7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsImpl.java @@ -0,0 +1,291 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccount; +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.cosmos-db.v2015_04_08.DatabaseAccountListKeysResult; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountListConnectionStringsResult; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountListReadOnlyKeysResult; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.FailoverPolicy; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.KeyKind; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountUsage; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountMetricDefinition; + +class DatabaseAccountsImpl extends GroupableResourcesCoreImpl implements DatabaseAccounts { + protected DatabaseAccountsImpl(DocumentDBManager manager) { + super(manager.inner().databaseAccounts(), manager); + } + + @Override + protected Observable getInnerAsync(String resourceGroupName, String name) { + DatabaseAccountsInner client = this.inner(); + return client.getByResourceGroupAsync(resourceGroupName, name); + } + + @Override + protected Completable deleteInnerAsync(String resourceGroupName, String name) { + DatabaseAccountsInner 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) { + DatabaseAccountsInner client = this.inner(); + return this.wrapList(client.listByResourceGroup(resourceGroupName)); + } + + @Override + public Observable listByResourceGroupAsync(String resourceGroupName) { + DatabaseAccountsInner 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 DatabaseAccount call(DatabaseAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public PagedList list() { + DatabaseAccountsInner client = this.inner(); + return this.wrapList(client.list()); + } + + @Override + public Observable listAsync() { + DatabaseAccountsInner 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 DatabaseAccount call(DatabaseAccountInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public DatabaseAccountImpl define(String name) { + return wrapModel(name); + } + + @Override + public Completable failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { + DatabaseAccountsInner client = this.inner(); + return client.failoverPriorityChangeAsync(resourceGroupName, accountName, failoverPolicies).toCompletable(); + } + + @Override + public Observable listKeysAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.listKeysAsync(resourceGroupName, accountName) + .map(new Func1() { + @Override + public DatabaseAccountListKeysResult call(DatabaseAccountListKeysResultInner inner) { + return new DatabaseAccountListKeysResultImpl(inner, manager()); + } + }); + } + + @Override + public Observable listConnectionStringsAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.listConnectionStringsAsync(resourceGroupName, accountName) + .map(new Func1() { + @Override + public DatabaseAccountListConnectionStringsResult call(DatabaseAccountListConnectionStringsResultInner inner) { + return new DatabaseAccountListConnectionStringsResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable offlineRegionAsync(String resourceGroupName, String accountName, String region) { + DatabaseAccountsInner client = this.inner(); + return client.offlineRegionAsync(resourceGroupName, accountName, region).toCompletable(); + } + + @Override + public Completable onlineRegionAsync(String resourceGroupName, String accountName, String region) { + DatabaseAccountsInner client = this.inner(); + return client.onlineRegionAsync(resourceGroupName, accountName, region).toCompletable(); + } + + @Override + public Observable listReadOnlyKeysAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.listReadOnlyKeysAsync(resourceGroupName, accountName) + .map(new Func1() { + @Override + public DatabaseAccountListReadOnlyKeysResult call(DatabaseAccountListReadOnlyKeysResultInner inner) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + DatabaseAccountsInner client = this.inner(); + return client.regenerateKeyAsync(resourceGroupName, accountName, keyKind).toCompletable(); + } + + @Override + protected DatabaseAccountImpl wrapModel(DatabaseAccountInner inner) { + return new DatabaseAccountImpl(inner.name(), inner, manager()); + } + + @Override + protected DatabaseAccountImpl wrapModel(String name) { + return new DatabaseAccountImpl(name, new DatabaseAccountInner(), this.manager()); + } + + private DatabaseAccountMetricImpl wrapDatabaseAccountMetricModel(MetricInner inner) { + return new DatabaseAccountMetricImpl(inner, manager()); + } + + private DatabaseAccountUsageImpl wrapDatabaseAccountUsageModel(UsageInner inner) { + return new DatabaseAccountUsageImpl(inner, manager()); + } + + private DatabaseAccountMetricDefinitionImpl wrapDatabaseAccountMetricDefinitionModel(MetricDefinitionInner inner) { + return new DatabaseAccountMetricDefinitionImpl(inner, manager()); + } + + @Override + public Observable getReadOnlyKeysAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.getReadOnlyKeysAsync(resourceGroupName, accountName) + .map(new Func1() { + @Override + public DatabaseAccountListReadOnlyKeysResult call(DatabaseAccountListReadOnlyKeysResultInner inner) { + return new DatabaseAccountListReadOnlyKeysResultImpl(inner, manager()); + } + }); + } + + @Override + public Completable checkNameExistsAsync(String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.checkNameExistsAsync(accountName).toCompletable(); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String filter) { + DatabaseAccountsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseAccountMetric call(MetricInner inner) { + return wrapDatabaseAccountMetricModel(inner); + } + }); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseAccountUsage call(UsageInner inner) { + return wrapDatabaseAccountUsageModel(inner); + } + }); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabaseAccountMetricDefinition call(MetricDefinitionInner inner) { + return wrapDatabaseAccountMetricDefinitionModel(inner); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsInner.java new file mode 100644 index 0000000000000..6e686885fa0d4 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabaseAccountsInner.java @@ -0,0 +1,2408 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.collection.InnerSupportsGet; +import com.microsoft.azure.arm.collection.InnerSupportsDelete; +import com.microsoft.azure.arm.collection.InnerSupportsListing; +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountCreateUpdateParameters; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountPatchParameters; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountRegenerateKeyParameters; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.ErrorResponseException; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.FailoverPolicies; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.FailoverPolicy; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.KeyKind; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.RegionForOnlineOffline; +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.HEAD; +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 DatabaseAccounts. + */ +public class DatabaseAccountsInner implements InnerSupportsGet, InnerSupportsDelete, InnerSupportsListing { + /** The Retrofit service to perform REST calls. */ + private DatabaseAccountsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of DatabaseAccountsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabaseAccountsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(DatabaseAccountsService.class); + this.client = client; + } + + /** + * The interface defining all the services for DatabaseAccounts to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabaseAccountsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts getByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> getByResourceGroup(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts patch" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> patch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountPatchParameters updateParameters, @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.cosmos-db.v2015_04_08.DatabaseAccounts beginPatch" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> beginPatch(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountPatchParameters updateParameters, @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.cosmos-db.v2015_04_08.DatabaseAccounts createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountCreateUpdateParameters createUpdateParameters, @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.cosmos-db.v2015_04_08.DatabaseAccounts beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountCreateUpdateParameters createUpdateParameters, @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.cosmos-db.v2015_04_08.DatabaseAccounts delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts failoverPriorityChange" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange") + Observable> failoverPriorityChange(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body FailoverPolicies failoverParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts beginFailoverPriorityChange" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange") + Observable> beginFailoverPriorityChange(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body FailoverPolicies failoverParameters, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts list" }) + @GET("subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts") + 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.cosmos-db.v2015_04_08.DatabaseAccounts listByResourceGroup" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts") + 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.cosmos-db.v2015_04_08.DatabaseAccounts listKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys") + Observable> listKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts listConnectionStrings" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings") + Observable> listConnectionStrings(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts offlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion") + Observable> offlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOffline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts beginOfflineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion") + Observable> beginOfflineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOffline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts onlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion") + Observable> onlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOnline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts beginOnlineRegion" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion") + Observable> beginOnlineRegion(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body RegionForOnlineOffline regionParameterForOnline, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts getReadOnlyKeys" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys") + Observable> getReadOnlyKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts listReadOnlyKeys" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys") + Observable> listReadOnlyKeys(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts regenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey") + Observable> regenerateKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseAccountRegenerateKeyParameters keyToRegenerate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts beginRegenerateKey" }) + @POST("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey") + Observable> beginRegenerateKey(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Body DatabaseAccountRegenerateKeyParameters keyToRegenerate, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccounts checkNameExists" }) + @HEAD("providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}") + Observable> checkNameExists(@Path("accountName") String accountName, @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.cosmos-db.v2015_04_08.DatabaseAccounts listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.DatabaseAccounts listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.DatabaseAccounts listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountInner object if successful. + */ + public DatabaseAccountInner getByResourceGroup(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getByResourceGroupAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountInner>() { + @Override + public DatabaseAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Retrieves the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable> getByResourceGroupWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, accountName, 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); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @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 DatabaseAccountInner object if successful. + */ + public DatabaseAccountInner patch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().last().body(); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @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 patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable patchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return patchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountInner>() { + @Override + public DatabaseAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> patchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); + } + Validator.validate(updateParameters); + Observable> observable = service.patch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @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 DatabaseAccountInner object if successful. + */ + public DatabaseAccountInner beginPatch(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().single().body(); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @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 beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable beginPatchAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + return beginPatchWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountInner>() { + @Override + public DatabaseAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Patches the properties of an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param updateParameters The tags parameter to patch for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable> beginPatchWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountPatchParameters updateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); + } + Validator.validate(updateParameters); + return service.beginPatch(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), updateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginPatchDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginPatchDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @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 DatabaseAccountInner object if successful. + */ + public DatabaseAccountInner createOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().last().body(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @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 accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters), serviceCallback); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1, DatabaseAccountInner>() { + @Override + public DatabaseAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (createUpdateParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null."); + } + Validator.validate(createUpdateParameters); + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), createUpdateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @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 DatabaseAccountInner object if successful. + */ + public DatabaseAccountInner beginCreateOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().single().body(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @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 accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters), serviceCallback); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1, DatabaseAccountInner>() { + @Override + public DatabaseAccountInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param createUpdateParameters The parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (createUpdateParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null."); + } + Validator.validate(createUpdateParameters); + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), createUpdateParameters, 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()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 accountName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture deleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginDelete(String resourceGroupName, String accountName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginDeleteAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @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 failoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { + failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().last().body(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @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 failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies), serviceCallback); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable failoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { + return failoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> failoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } + Validator.validate(failoverPolicies); + FailoverPolicies failoverParameters = new FailoverPolicies(); + failoverParameters.withFailoverPolicies(failoverPolicies); + Observable> observable = service.failoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @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 beginFailoverPriorityChange(String resourceGroupName, String accountName, List failoverPolicies) { + beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).toBlocking().single().body(); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @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 beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies), serviceCallback); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginFailoverPriorityChangeAsync(String resourceGroupName, String accountName, List failoverPolicies) { + return beginFailoverPriorityChangeWithServiceResponseAsync(resourceGroupName, accountName, failoverPolicies).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Changes the failover priority for the Azure Cosmos DB database account. A failover priority of 0 indicates a write region. The maximum value for a failover priority = (total number of regions - 1). Failover priority values must be unique for each of the regions in which the database account exists. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param failoverPolicies List of failover policies. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginFailoverPriorityChangeWithServiceResponseAsync(String resourceGroupName, String accountName, List failoverPolicies) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } + Validator.validate(failoverPolicies); + FailoverPolicies failoverParameters = new FailoverPolicies(); + failoverParameters.withFailoverPolicies(failoverPolicies); + return service.beginFailoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), failoverParameters, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginFailoverPriorityChangeDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginFailoverPriorityChangeDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the 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; + } + }; + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the 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); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @return the observable to the List<DatabaseAccountInner> 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; + } + }); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the subscription. + * + * @return the observable to the List<DatabaseAccountInner> 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); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName Name of an Azure resource group. + * @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; + } + }; + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName Name of an Azure resource group. + * @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); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName Name of an Azure resource group. + * @return the observable to the List<DatabaseAccountInner> 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; + } + }); + } + + /** + * Lists all the Azure Cosmos DB database accounts available under the given resource group. + * + * @param resourceGroupName Name of an Azure resource group. + * @return the observable to the List<DatabaseAccountInner> 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); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountListKeysResultInner object if successful. + */ + public DatabaseAccountListKeysResultInner listKeys(String resourceGroupName, String accountName) { + return listKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListKeysResultInner object + */ + public Observable listKeysAsync(String resourceGroupName, String accountName) { + return listKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListKeysResultInner>() { + @Override + public DatabaseAccountListKeysResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListKeysResultInner object + */ + public Observable> listKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listKeysDelegate(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 the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountListConnectionStringsResultInner object if successful. + */ + public DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName) { + return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listConnectionStringsAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListConnectionStringsResultInner object + */ + public Observable listConnectionStringsAsync(String resourceGroupName, String accountName) { + return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListConnectionStringsResultInner>() { + @Override + public DatabaseAccountListConnectionStringsResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the connection strings for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListConnectionStringsResultInner object + */ + public Observable> listConnectionStringsWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listConnectionStrings(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listConnectionStringsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listConnectionStringsDelegate(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); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void offlineRegion(String resourceGroupName, String accountName, String region) { + offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @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 offlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable offlineRegionAsync(String resourceGroupName, String accountName, String region) { + return offlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> offlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + Observable> observable = service.offlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOffline, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginOfflineRegion(String resourceGroupName, String accountName, String region) { + beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().single().body(); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @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 beginOfflineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginOfflineRegionAsync(String resourceGroupName, String accountName, String region) { + return beginOfflineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Offline the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginOfflineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + return service.beginOfflineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOffline, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginOfflineRegionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginOfflineRegionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void onlineRegion(String resourceGroupName, String accountName, String region) { + onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().last().body(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @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 onlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable onlineRegionAsync(String resourceGroupName, String accountName, String region) { + return onlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> onlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + Observable> observable = service.onlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOnline, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void beginOnlineRegion(String resourceGroupName, String accountName, String region) { + beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).toBlocking().single().body(); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @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 beginOnlineRegionAsync(String resourceGroupName, String accountName, String region, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region), serviceCallback); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginOnlineRegionAsync(String resourceGroupName, String accountName, String region) { + return beginOnlineRegionWithServiceResponseAsync(resourceGroupName, accountName, region).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Online the specified region for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginOnlineRegionWithServiceResponseAsync(String resourceGroupName, String accountName, String region) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + return service.beginOnlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), regionParameterForOnline, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginOnlineRegionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginOnlineRegionDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountListReadOnlyKeysResultInner object if successful. + */ + public DatabaseAccountListReadOnlyKeysResultInner getReadOnlyKeys(String resourceGroupName, String accountName) { + return getReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getReadOnlyKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable getReadOnlyKeysAsync(String resourceGroupName, String accountName) { + return getReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListReadOnlyKeysResultInner>() { + @Override + public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable> getReadOnlyKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.getReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getReadOnlyKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getReadOnlyKeysDelegate(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 the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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 DatabaseAccountListReadOnlyKeysResultInner object if successful. + */ + public DatabaseAccountListReadOnlyKeysResultInner listReadOnlyKeys(String resourceGroupName, String accountName) { + return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture listReadOnlyKeysAsync(String resourceGroupName, String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable listReadOnlyKeysAsync(String resourceGroupName, String accountName) { + return listReadOnlyKeysWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountListReadOnlyKeysResultInner>() { + @Override + public DatabaseAccountListReadOnlyKeysResultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Lists the read-only access keys for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountListReadOnlyKeysResultInner object + */ + public Observable> listReadOnlyKeysWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = listReadOnlyKeysDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse listReadOnlyKeysDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 regenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { + regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().last().body(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable regenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + return regenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> regenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 beginRegenerateKey(String resourceGroupName, String accountName, KeyKind keyKind) { + beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).toBlocking().single().body(); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @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 beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind), serviceCallback); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Regenerates an access key for the specified Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginRegenerateKeyWithServiceResponseAsync(String resourceGroupName, String accountName, KeyKind keyKind) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), keyToRegenerate, this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginRegenerateKeyDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginRegenerateKeyDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @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 boolean object if successful. + */ + public boolean checkNameExists(String accountName) { + return checkNameExistsWithServiceResponseAsync(accountName).toBlocking().single().body(); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture checkNameExistsAsync(String accountName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(checkNameExistsWithServiceResponseAsync(accountName), serviceCallback); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable checkNameExistsAsync(String accountName) { + return checkNameExistsWithServiceResponseAsync(accountName).map(new Func1, Boolean>() { + @Override + public Boolean call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and the '-' character, and must be between 3 and 50 characters. + * + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the Boolean object + */ + public Observable> checkNameExistsWithServiceResponseAsync(String accountName) { + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.checkNameExists(accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = checkNameExistsDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse checkNameExistsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(404, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .buildEmpty(response); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listUsagesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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 filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, 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); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @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<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture> listMetricDefinitionsAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(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> listMetricDefinitionsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..9ce867caee3a5 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesImpl.java @@ -0,0 +1,99 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * abc + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Databases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountUsage; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final DocumentDBManager manager; + + DatabasesImpl(DocumentDBManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + private DatabasisDatabaseAccountMetricDefinitionImpl wrapDatabasisDatabaseAccountMetricDefinitionModel(MetricDefinitionInner inner) { + return new DatabasisDatabaseAccountMetricDefinitionImpl(inner, manager()); + } + + private DatabasisDatabaseAccountMetricImpl wrapDatabasisDatabaseAccountMetricModel(MetricInner inner) { + return new DatabasisDatabaseAccountMetricImpl(inner, manager()); + } + + private DatabasisDatabaseAccountUsageImpl wrapDatabasisDatabaseAccountUsageModel(UsageInner inner) { + return new DatabasisDatabaseAccountUsageImpl(inner, manager()); + } + + @Override + public Observable listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid) { + DatabasesInner client = this.inner(); + return client.listMetricDefinitionsAsync(resourceGroupName, accountName, databaseRid) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisDatabaseAccountMetricDefinition call(MetricDefinitionInner inner) { + return wrapDatabasisDatabaseAccountMetricDefinitionModel(inner); + } + }); + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + DatabasesInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, databaseRid, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisDatabaseAccountMetric call(MetricInner inner) { + return wrapDatabasisDatabaseAccountMetricModel(inner); + } + }); + } + + @Override + public Observable listUsagesAsync(String resourceGroupName, String accountName, String databaseRid) { + DatabasesInner client = this.inner(); + return client.listUsagesAsync(resourceGroupName, accountName, databaseRid) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public DatabasisDatabaseAccountUsage call(UsageInner inner) { + return wrapDatabasisDatabaseAccountUsageModel(inner); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..dc99f97bd8baa --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasesInner.java @@ -0,0 +1,466 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Databases. + */ +public class DatabasesInner { + /** The Retrofit service to perform REST calls. */ + private DatabasesService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of DatabasesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public DatabasesInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(DatabasesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Databases to be + * used by Retrofit to perform actually REST calls. + */ + interface DatabasesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.Databases listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.Databases listUsages" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages") + Observable> listUsages(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Query("$filter") String filter, @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.cosmos-db.v2015_04_08.Databases listMetricDefinitions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions") + Observable> listMetricDefinitions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<MetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account and database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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 accountName, String databaseRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid 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 filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, 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); + } + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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<UsageInner> object if successful. + */ + public List listUsages(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).toBlocking().single().body(); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @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 accountName, String databaseRid, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter), serviceCallback); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable> listUsagesAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + return listUsagesWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the usages (most recent data) for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param filter An OData filter expression that describes a subset of usages to return. The supported parameter is name.value (name of the metric, can have an or of multiple names). + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<UsageInner> object + */ + public Observable>> listUsagesWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid 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(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), filter, 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); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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<MetricDefinitionInner> object if successful. + */ + public List listMetricDefinitions(String resourceGroupName, String accountName, String databaseRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).toBlocking().single().body(); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @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> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid), serviceCallback); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable> listMetricDefinitionsAsync(String resourceGroupName, String accountName, String databaseRid) { + return listMetricDefinitionsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves metric defintions for the given database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MetricDefinitionInner> object + */ + public Observable>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid 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.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricDefinitionsDelegate(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> listMetricDefinitionsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..169df0ce9046e --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java @@ -0,0 +1,60 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricAvailability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PrimaryAggregationType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabasisDatabaseAccountMetricDefinitionImpl extends WrapperImpl implements DatabasisDatabaseAccountMetricDefinition { + private final DocumentDBManager manager; + + DatabasisDatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public List metricAvailabilities() { + return this.inner().metricAvailabilities(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public PrimaryAggregationType primaryAggregationType() { + return this.inner().primaryAggregationType(); + } + + @Override + public String resourceUri() { + return this.inner().resourceUri(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..3cc1eec84725e --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountMetricImpl.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabasisDatabaseAccountMetricImpl extends WrapperImpl implements DatabasisDatabaseAccountMetric { + private final DocumentDBManager manager; + + DatabasisDatabaseAccountMetricImpl(MetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountUsageImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..89db8a395af26 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DatabasisDatabaseAccountUsageImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabasisDatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class DatabasisDatabaseAccountUsageImpl extends WrapperImpl implements DatabasisDatabaseAccountUsage { + private final DocumentDBManager manager; + + DatabasisDatabaseAccountUsageImpl(UsageInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DocumentDBManager.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DocumentDBManager.java new file mode 100644 index 0000000000000..d3ec802efcbc7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/DocumentDBManager.java @@ -0,0 +1,243 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.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.cosmos-db.v2015_04_08.DatabaseAccounts; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Operations; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Databases; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Collections; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionRegions; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.DatabaseAccountRegions; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileSourceTargets; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileTargets; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Percentiles; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitionRegions; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.CollectionPartitions; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIds; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIdRegions; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure DocumentDB resource management. + */ +public final class DocumentDBManager extends ManagerCore { + private DatabaseAccounts databaseAccounts; + private Operations operations; + private Databases databases; + private Collections collections; + private CollectionRegions collectionRegions; + private DatabaseAccountRegions databaseAccountRegions; + private PercentileSourceTargets percentileSourceTargets; + private PercentileTargets percentileTargets; + private Percentiles percentiles; + private CollectionPartitionRegions collectionPartitionRegions; + private CollectionPartitions collectionPartitions; + private PartitionKeyRangeIds partitionKeyRangeIds; + private PartitionKeyRangeIdRegions partitionKeyRangeIdRegions; + /** + * Get a Configurable instance that can be used to create DocumentDBManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new DocumentDBManager.ConfigurableImpl(); + } + /** + * Creates an instance of DocumentDBManager that exposes DocumentDB resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the DocumentDBManager + */ + public static DocumentDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new DocumentDBManager(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 DocumentDBManager that exposes DocumentDB resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the DocumentDBManager + */ + public static DocumentDBManager authenticate(RestClient restClient, String subscriptionId) { + return new DocumentDBManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of DocumentDBManager that exposes DocumentDB management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing DocumentDB management API entry points that work across subscriptions + */ + DocumentDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId); + } + + /** + * @return Entry point to manage DatabaseAccounts. + */ + public DatabaseAccounts databaseAccounts() { + if (this.databaseAccounts == null) { + this.databaseAccounts = new DatabaseAccountsImpl(this); + } + return this.databaseAccounts; + } + + /** + * @return Entry point to manage Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(this); + } + return this.operations; + } + + /** + * @return Entry point to manage Databases. + */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(this); + } + return this.databases; + } + + /** + * @return Entry point to manage Collections. + */ + public Collections collections() { + if (this.collections == null) { + this.collections = new CollectionsImpl(this); + } + return this.collections; + } + + /** + * @return Entry point to manage CollectionRegions. + */ + public CollectionRegions collectionRegions() { + if (this.collectionRegions == null) { + this.collectionRegions = new CollectionRegionsImpl(this); + } + return this.collectionRegions; + } + + /** + * @return Entry point to manage DatabaseAccountRegions. + */ + public DatabaseAccountRegions databaseAccountRegions() { + if (this.databaseAccountRegions == null) { + this.databaseAccountRegions = new DatabaseAccountRegionsImpl(this); + } + return this.databaseAccountRegions; + } + + /** + * @return Entry point to manage PercentileSourceTargets. + */ + public PercentileSourceTargets percentileSourceTargets() { + if (this.percentileSourceTargets == null) { + this.percentileSourceTargets = new PercentileSourceTargetsImpl(this); + } + return this.percentileSourceTargets; + } + + /** + * @return Entry point to manage PercentileTargets. + */ + public PercentileTargets percentileTargets() { + if (this.percentileTargets == null) { + this.percentileTargets = new PercentileTargetsImpl(this); + } + return this.percentileTargets; + } + + /** + * @return Entry point to manage Percentiles. + */ + public Percentiles percentiles() { + if (this.percentiles == null) { + this.percentiles = new PercentilesImpl(this); + } + return this.percentiles; + } + + /** + * @return Entry point to manage CollectionPartitionRegions. + */ + public CollectionPartitionRegions collectionPartitionRegions() { + if (this.collectionPartitionRegions == null) { + this.collectionPartitionRegions = new CollectionPartitionRegionsImpl(this); + } + return this.collectionPartitionRegions; + } + + /** + * @return Entry point to manage CollectionPartitions. + */ + public CollectionPartitions collectionPartitions() { + if (this.collectionPartitions == null) { + this.collectionPartitions = new CollectionPartitionsImpl(this); + } + return this.collectionPartitions; + } + + /** + * @return Entry point to manage PartitionKeyRangeIds. + */ + public PartitionKeyRangeIds partitionKeyRangeIds() { + if (this.partitionKeyRangeIds == null) { + this.partitionKeyRangeIds = new PartitionKeyRangeIdsImpl(this); + } + return this.partitionKeyRangeIds; + } + + /** + * @return Entry point to manage PartitionKeyRangeIdRegions. + */ + public PartitionKeyRangeIdRegions partitionKeyRangeIdRegions() { + if (this.partitionKeyRangeIdRegions == null) { + this.partitionKeyRangeIdRegions = new PartitionKeyRangeIdRegionsImpl(this); + } + return this.partitionKeyRangeIdRegions; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public DocumentDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return DocumentDBManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private DocumentDBManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new CosmosDBImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/IdParsingUtils.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..b224dbc1c4bae --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricDefinitionInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricDefinitionInner.java new file mode 100644 index 0000000000000..b01a4559f79b0 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricDefinitionInner.java @@ -0,0 +1,111 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricAvailability; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PrimaryAggregationType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a metric. + */ +public class MetricDefinitionInner { + /** + * The list of metric availabilities for the account. + */ + @JsonProperty(value = "metricAvailabilities", access = JsonProperty.Access.WRITE_ONLY) + private List metricAvailabilities; + + /** + * The primary aggregation type of the metric. Possible values include: + * 'None', 'Average', 'Total', 'Minimimum', 'Maximum', 'Last'. + */ + @JsonProperty(value = "primaryAggregationType", access = JsonProperty.Access.WRITE_ONLY) + private PrimaryAggregationType primaryAggregationType; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The resource uri of the database. + */ + @JsonProperty(value = "resourceUri", access = JsonProperty.Access.WRITE_ONLY) + private String resourceUri; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * Get the list of metric availabilities for the account. + * + * @return the metricAvailabilities value + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Get the primary aggregation type of the metric. Possible values include: 'None', 'Average', 'Total', 'Minimimum', 'Maximum', 'Last'. + * + * @return the primaryAggregationType value + */ + public PrimaryAggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @param unit the unit value to set + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the resource uri of the database. + * + * @return the resourceUri value + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricInner.java new file mode 100644 index 0000000000000..bf659187c738b --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/MetricInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Metric data. + */ +public class MetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the start time for the metric (ISO-8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the end time for the metric (ISO-8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the time grain to be used to summarize the metric values. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @param unit the unit value to set + * @return the MetricInner object itself. + */ + public MetricInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the metric values for the specified time window and timestep. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationImpl.java new file mode 100644 index 0000000000000..ae037e83bf30c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final DocumentDBManager manager; + OperationImpl(OperationInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationInner.java new file mode 100644 index 0000000000000..76e3bbd5a9e05 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API operation. + */ +public class OperationInner { + /** + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name") + private String name; + + /** + * The object that represents 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 the object that represents the operation. + * + * @return the display value + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the object that represents 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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..114855e31c0cd --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final DocumentDBManager manager; + + OperationsImpl(DocumentDBManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public DocumentDBManager 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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/OperationsInner.java new file mode 100644 index 0000000000000..775ef420f6374 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.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 CosmosDBImpl 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, CosmosDBImpl 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.cosmos-db.v2015_04_08.Operations list" }) + @GET("providers/Microsoft.DocumentDB/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.cosmos-db.v2015_04_08.Operations listNext" }) + @GET + Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists all of the available Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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 Cosmos DB Resource Provider 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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl.java new file mode 100644 index 0000000000000..6ac3295c6b92a --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl1.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PageImpl1.java new file mode 100644 index 0000000000000..3fbe49cdf7a20 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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.cosmos-db.v2015_04_08.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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsImpl.java new file mode 100644 index 0000000000000..bf3ea71d40455 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIdRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionMetric; + +class PartitionKeyRangeIdRegionsImpl extends WrapperImpl implements PartitionKeyRangeIdRegions { + private final DocumentDBManager manager; + + PartitionKeyRangeIdRegionsImpl(DocumentDBManager manager) { + super(manager.inner().partitionKeyRangeIdRegions()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + PartitionKeyRangeIdRegionsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PartitionMetric call(PartitionMetricInner inner) { + return new PartitionMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsInner.java new file mode 100644 index 0000000000000..08d1d4ca9bb1d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdRegionsInner.java @@ -0,0 +1,187 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PartitionKeyRangeIdRegions. + */ +public class PartitionKeyRangeIdRegionsInner { + /** The Retrofit service to perform REST calls. */ + private PartitionKeyRangeIdRegionsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdRegionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PartitionKeyRangeIdRegionsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PartitionKeyRangeIdRegionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PartitionKeyRangeIdRegions to be + * used by Retrofit to perform actually REST calls. + */ + interface PartitionKeyRangeIdRegionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIdRegions listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("region") String region, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Path("partitionKeyRangeId") String partitionKeyRangeId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id and region. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param region Cosmos DB region, with spaces between words and each word capitalized. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String region, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (partitionKeyRangeId == null) { + throw new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsImpl.java new file mode 100644 index 0000000000000..5269ff5fc5bb4 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIds; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionMetric; + +class PartitionKeyRangeIdsImpl extends WrapperImpl implements PartitionKeyRangeIds { + private final DocumentDBManager manager; + + PartitionKeyRangeIdsImpl(DocumentDBManager manager) { + super(manager.inner().partitionKeyRangeIds()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + PartitionKeyRangeIdsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PartitionMetric call(PartitionMetricInner inner) { + return new PartitionMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsInner.java new file mode 100644 index 0000000000000..4978508b21a80 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionKeyRangeIdsInner.java @@ -0,0 +1,180 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PartitionKeyRangeIds. + */ +public class PartitionKeyRangeIdsInner { + /** The Retrofit service to perform REST calls. */ + private PartitionKeyRangeIdsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PartitionKeyRangeIdsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PartitionKeyRangeIdsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PartitionKeyRangeIdsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PartitionKeyRangeIds to be + * used by Retrofit to perform actually REST calls. + */ + interface PartitionKeyRangeIdsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionKeyRangeIds listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseRid") String databaseRid, @Path("collectionRid") String collectionRid, @Path("partitionKeyRangeId") String partitionKeyRangeId, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PartitionMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given partition key range id. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseRid Cosmos DB database rid. + * @param collectionRid Cosmos DB collection rid. + * @param partitionKeyRangeId Partition Key Range Id for which to get data. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PartitionMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (databaseRid == null) { + throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null."); + } + if (collectionRid == null) { + throw new IllegalArgumentException("Parameter collectionRid is required and cannot be null."); + } + if (partitionKeyRangeId == null) { + throw new IllegalArgumentException("Parameter partitionKeyRangeId is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricImpl.java new file mode 100644 index 0000000000000..ae70c027b311c --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class PartitionMetricImpl extends WrapperImpl implements PartitionMetric { + private final DocumentDBManager manager; + PartitionMetricImpl(PartitionMetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public String partitionId() { + return this.inner().partitionId(); + } + + @Override + public String partitionKeyRangeId() { + return this.inner().partitionKeyRangeId(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricInner.java new file mode 100644 index 0000000000000..00cf800151376 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionMetricInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The metric values for a single partition. + */ +public class PartitionMetricInner extends MetricInner { + /** + * The parition id (GUID identifier) of the metric values. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /** + * The partition key range id (integer identifier) of the metric values. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the parition id (GUID identifier) of the metric values. + * + * @return the partitionId value + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partition key range id (integer identifier) of the metric values. + * + * @return the partitionKeyRangeId value + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageImpl.java new file mode 100644 index 0000000000000..bad246a258b74 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageImpl.java @@ -0,0 +1,63 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PartitionUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class PartitionUsageImpl extends WrapperImpl implements PartitionUsage { + private final DocumentDBManager manager; + PartitionUsageImpl(PartitionUsageInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Integer currentValue() { + return this.inner().currentValue(); + } + + @Override + public Integer limit() { + return this.inner().limit(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public String partitionId() { + return this.inner().partitionId(); + } + + @Override + public String partitionKeyRangeId() { + return this.inner().partitionKeyRangeId(); + } + + @Override + public String quotaPeriod() { + return this.inner().quotaPeriod(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageInner.java new file mode 100644 index 0000000000000..c458affc85818 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PartitionUsageInner.java @@ -0,0 +1,47 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The partition level usage data for a usage request. + */ +public class PartitionUsageInner extends UsageInner { + /** + * The parition id (GUID identifier) of the usages. + */ + @JsonProperty(value = "partitionId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionId; + + /** + * The partition key range id (integer identifier) of the usages. + */ + @JsonProperty(value = "partitionKeyRangeId", access = JsonProperty.Access.WRITE_ONLY) + private String partitionKeyRangeId; + + /** + * Get the parition id (GUID identifier) of the usages. + * + * @return the partitionId value + */ + public String partitionId() { + return this.partitionId; + } + + /** + * Get the partition key range id (integer identifier) of the usages. + * + * @return the partitionKeyRangeId value + */ + public String partitionKeyRangeId() { + return this.partitionKeyRangeId; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricImpl.java new file mode 100644 index 0000000000000..57ff802c9917b --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetricValue; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; + +class PercentileMetricImpl extends WrapperImpl implements PercentileMetric { + private final DocumentDBManager manager; + PercentileMetricImpl(PercentileMetricInner inner, DocumentDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public DateTime endTime() { + return this.inner().endTime(); + } + + @Override + public List metricValues() { + return this.inner().metricValues(); + } + + @Override + public MetricName name() { + return this.inner().name(); + } + + @Override + public DateTime startTime() { + return this.inner().startTime(); + } + + @Override + public String timeGrain() { + return this.inner().timeGrain(); + } + + @Override + public UnitType unit() { + return this.inner().unit(); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricInner.java new file mode 100644 index 0000000000000..2806785adcfb4 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileMetricInner.java @@ -0,0 +1,125 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetricValue; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Percentile Metric data. + */ +public class PercentileMetricInner { + /** + * The start time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime startTime; + + /** + * The end time for the metric (ISO-8601 format). + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private DateTime endTime; + + /** + * The time grain to be used to summarize the metric values. + */ + @JsonProperty(value = "timeGrain", access = JsonProperty.Access.WRITE_ONLY) + private String timeGrain; + + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The percentile metric values for the specified time window and timestep. + */ + @JsonProperty(value = "metricValues", access = JsonProperty.Access.WRITE_ONLY) + private List metricValues; + + /** + * Get the start time for the metric (ISO-8601 format). + * + * @return the startTime value + */ + public DateTime startTime() { + return this.startTime; + } + + /** + * Get the end time for the metric (ISO-8601 format). + * + * @return the endTime value + */ + public DateTime endTime() { + return this.endTime; + } + + /** + * Get the time grain to be used to summarize the metric values. + * + * @return the timeGrain value + */ + public String timeGrain() { + return this.timeGrain; + } + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @param unit the unit value to set + * @return the PercentileMetricInner object itself. + */ + public PercentileMetricInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the percentile metric values for the specified time window and timestep. + * + * @return the metricValues value + */ + public List metricValues() { + return this.metricValues; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsImpl.java new file mode 100644 index 0000000000000..77544966c2936 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileSourceTargets; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetric; + +class PercentileSourceTargetsImpl extends WrapperImpl implements PercentileSourceTargets { + private final DocumentDBManager manager; + + PercentileSourceTargetsImpl(DocumentDBManager manager) { + super(manager.inner().percentileSourceTargets()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + PercentileSourceTargetsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PercentileMetric call(PercentileMetricInner inner) { + return new PercentileMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsInner.java new file mode 100644 index 0000000000000..014b0b5706a7f --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileSourceTargetsInner.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PercentileSourceTargets. + */ +public class PercentileSourceTargetsInner { + /** The Retrofit service to perform REST calls. */ + private PercentileSourceTargetsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentileSourceTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentileSourceTargetsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentileSourceTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PercentileSourceTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentileSourceTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileSourceTargets listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("sourceRegion") String sourceRegion, @Path("targetRegion") String targetRegion, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, sourceRegion, targetRegion, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param sourceRegion Source region from which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String sourceRegion, String targetRegion, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (sourceRegion == null) { + throw new IllegalArgumentException("Parameter sourceRegion is required and cannot be null."); + } + if (targetRegion == null) { + throw new IllegalArgumentException("Parameter targetRegion is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, sourceRegion, targetRegion, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsImpl.java new file mode 100644 index 0000000000000..eb5d1e8932676 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileTargets; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetric; + +class PercentileTargetsImpl extends WrapperImpl implements PercentileTargets { + private final DocumentDBManager manager; + + PercentileTargetsImpl(DocumentDBManager manager) { + super(manager.inner().percentileTargets()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter) { + PercentileTargetsInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, targetRegion, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PercentileMetric call(PercentileMetricInner inner) { + return new PercentileMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsInner.java new file mode 100644 index 0000000000000..e8631830aa4e7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentileTargetsInner.java @@ -0,0 +1,166 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PercentileTargets. + */ +public class PercentileTargetsInner { + /** The Retrofit service to perform REST calls. */ + private PercentileTargetsService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentileTargetsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentileTargetsInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentileTargetsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PercentileTargets to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentileTargetsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileTargets listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("targetRegion") String targetRegion, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String targetRegion, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, targetRegion, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param targetRegion Target region to which data is written. Cosmos DB region, with spaces between words and each word capitalized. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String targetRegion, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (targetRegion == null) { + throw new IllegalArgumentException("Parameter targetRegion is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, targetRegion, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesImpl.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesImpl.java new file mode 100644 index 0000000000000..a042502ca0a27 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesImpl.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.Percentiles; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.PercentileMetric; + +class PercentilesImpl extends WrapperImpl implements Percentiles { + private final DocumentDBManager manager; + + PercentilesImpl(DocumentDBManager manager) { + super(manager.inner().percentiles()); + this.manager = manager; + } + + public DocumentDBManager manager() { + return this.manager; + } + + @Override + public Observable listMetricsAsync(String resourceGroupName, String accountName, String filter) { + PercentilesInner client = this.inner(); + return client.listMetricsAsync(resourceGroupName, accountName, filter) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PercentileMetric call(PercentileMetricInner inner) { + return new PercentileMetricImpl(inner, manager()); + } + }); + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesInner.java new file mode 100644 index 0000000000000..52307da2a0bce --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/PercentilesInner.java @@ -0,0 +1,159 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.Path; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in Percentiles. + */ +public class PercentilesInner { + /** The Retrofit service to perform REST calls. */ + private PercentilesService service; + /** The service client containing this operation class. */ + private CosmosDBImpl client; + + /** + * Initializes an instance of PercentilesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PercentilesInner(Retrofit retrofit, CosmosDBImpl client) { + this.service = retrofit.create(PercentilesService.class); + this.client = client; + } + + /** + * The interface defining all the services for Percentiles to be + * used by Retrofit to perform actually REST calls. + */ + interface PercentilesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmos-db.v2015_04_08.Percentiles listMetrics" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics") + Observable> listMetrics(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Query("$filter") String filter, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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<PercentileMetricInner> object if successful. + */ + public List listMetrics(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).toBlocking().single().body(); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @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> listMetricsAsync(String resourceGroupName, String accountName, String filter, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter), serviceCallback); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable> listMetricsAsync(String resourceGroupName, String accountName, String filter) { + return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, filter).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PercentileMetricInner> object + */ + public Observable>> listMetricsWithServiceResponseAsync(String resourceGroupName, String accountName, String filter) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, this.client.apiVersion(), filter, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMetricsDelegate(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> listMetricsDelegate(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/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/UsageInner.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/UsageInner.java new file mode 100644 index 0000000000000..0b272e14ff4d7 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/UsageInner.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.cosmos-db.v2015_04_08.implementation; + +import com.microsoft.azure.management.cosmos-db.v2015_04_08.UnitType; +import com.microsoft.azure.management.cosmos-db.v2015_04_08.MetricName; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The usage data for a usage request. + */ +public class UsageInner { + /** + * The unit of the metric. Possible values include: 'Count', 'Bytes', + * 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', + * 'Milliseconds'. + */ + @JsonProperty(value = "unit") + private UnitType unit; + + /** + * The name information for the metric. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private MetricName name; + + /** + * The quota period used to summarize the usage values. + */ + @JsonProperty(value = "quotaPeriod", access = JsonProperty.Access.WRITE_ONLY) + private String quotaPeriod; + + /** + * Maximum value for this metric. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /** + * Current value for this metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /** + * Get the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @return the unit value + */ + public UnitType unit() { + return this.unit; + } + + /** + * Set the unit of the metric. Possible values include: 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond', 'BytesPerSecond', 'Milliseconds'. + * + * @param unit the unit value to set + * @return the UsageInner object itself. + */ + public UsageInner withUnit(UnitType unit) { + this.unit = unit; + return this; + } + + /** + * Get the name information for the metric. + * + * @return the name value + */ + public MetricName name() { + return this.name; + } + + /** + * Get the quota period used to summarize the usage values. + * + * @return the quotaPeriod value + */ + public String quotaPeriod() { + return this.quotaPeriod; + } + + /** + * Get maximum value for this metric. + * + * @return the limit value + */ + public Integer limit() { + return this.limit; + } + + /** + * Get current value for this metric. + * + * @return the currentValue value + */ + public Integer currentValue() { + return this.currentValue; + } + +} diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/package-info.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/implementation/package-info.java new file mode 100644 index 0000000000000..0e84b1d69e50d --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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 CosmosDB. + * Azure Cosmos DB Database Service Resource Provider REST API. + */ +package com.microsoft.azure.management.cosmos-db.v2015_04_08.implementation; diff --git a/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/package-info.java b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/package-info.java new file mode 100644 index 0000000000000..fb75908d1ea52 --- /dev/null +++ b/cosmos-db/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmos-db/v2015_04_08/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 CosmosDB. + * Azure Cosmos DB Database Service Resource Provider REST API. + */ +package com.microsoft.azure.management.cosmos-db.v2015_04_08;