From 858c34b7198c125e122381a0580af951e3e4b0a6 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 24 Feb 2020 06:01:44 +0000 Subject: [PATCH] Generated from 9e2bc77a7c3398f5eb36a300178c1eccb619636a fix: rename cosmosdb output folder to cosmos --- sdk/cosmos/mgmt-v2019_12_12/pom.xml | 135 + .../v2019_12_12/ARMProxyResource.java | 18 + .../v2019_12_12/ARMResourceProperties.java | 17 + .../AutoUpgradePolicyResource.java | 44 + .../AutopilotSettingsResource.java | 85 + .../v2019_12_12/AzureEntityResource.java | 34 + .../cosmosdb/v2019_12_12/Capability.java | 45 + ...ssandraKeyspaceCreateUpdateParameters.java | 72 + ...assandraKeyspaceGetPropertiesResource.java | 90 + .../CassandraKeyspaceGetResults.java | 164 + .../CassandraKeyspaceResource.java | 43 + .../v2019_12_12/CassandraPartitionKey.java | 43 + .../v2019_12_12/CassandraResources.java | 149 + .../cosmosdb/v2019_12_12/CassandraSchema.java | 96 + .../CassandraTableCreateUpdateParameters.java | 72 + .../CassandraTableGetPropertiesResource.java | 142 + .../v2019_12_12/CassandraTableGetResults.java | 165 + .../v2019_12_12/CassandraTableResource.java | 95 + .../cosmosdb/v2019_12_12/ClusterKey.java | 70 + ...lectionDatabasisDatabaseAccountMetric.java | 52 + ...abasisDatabaseAccountMetricDefinition.java | 46 + ...onDatabasisDatabaseAccountMetricModel.java | 52 + ...llectionDatabasisDatabaseAccountUsage.java | 45 + .../CollectionPartitionRegions.java | 31 + .../v2019_12_12/CollectionPartitions.java | 42 + .../v2019_12_12/CollectionRegions.java | 32 + .../cosmosdb/v2019_12_12/Collections.java | 57 + .../cosmosdb/v2019_12_12/Column.java | 69 + .../cosmosdb/v2019_12_12/CompositePath.java | 71 + .../v2019_12_12/CompositePathSortOrder.java | 41 + .../v2019_12_12/ConflictResolutionMode.java | 41 + .../v2019_12_12/ConflictResolutionPolicy.java | 96 + .../cosmosdb/v2019_12_12/ConnectorOffer.java | 38 + .../v2019_12_12/ConsistencyPolicy.java | 103 + .../v2019_12_12/ContainerPartitionKey.java | 98 + .../v2019_12_12/CreateUpdateOptions.java | 72 + .../cosmosdb/v2019_12_12/DataType.java | 53 + .../DatabaseAccountConnectionString.java | 47 + ...DatabaseAccountCreateUpdateParameters.java | 403 ++ .../DatabaseAccountGetResults.java | 476 +++ .../v2019_12_12/DatabaseAccountKind.java | 44 + ...aseAccountListConnectionStringsResult.java | 26 + .../DatabaseAccountListKeysResult.java | 40 + ...DatabaseAccountListReadOnlyKeysResult.java | 30 + .../v2019_12_12/DatabaseAccountMetric.java | 52 + .../DatabaseAccountMetricDefinition.java | 46 + .../v2019_12_12/DatabaseAccountOfferType.java | 50 + ...atabaseAccountRegenerateKeyParameters.java | 44 + .../v2019_12_12/DatabaseAccountRegions.java | 31 + .../DatabaseAccountUpdateParameters.java | 394 ++ .../v2019_12_12/DatabaseAccountUsage.java | 45 + .../v2019_12_12/DatabaseAccounts.java | 154 + .../cosmosdb/v2019_12_12/Databases.java | 54 + .../DatabasisDatabaseAccountMetric.java | 52 + ...abasisDatabaseAccountMetricDefinition.java | 46 + .../DatabasisDatabaseAccountUsage.java | 45 + .../v2019_12_12/DefaultConsistencyLevel.java | 62 + .../cosmosdb/v2019_12_12/ErrorResponse.java | 69 + .../v2019_12_12/ErrorResponseException.java | 44 + .../cosmosdb/v2019_12_12/ExcludedPath.java | 44 + .../ExtendedResourceProperties.java | 65 + .../v2019_12_12/FailoverPolicies.java | 44 + .../cosmosdb/v2019_12_12/FailoverPolicy.java | 89 + ...GremlinDatabaseCreateUpdateParameters.java | 72 + .../GremlinDatabaseGetPropertiesResource.java | 90 + .../GremlinDatabaseGetResults.java | 164 + .../v2019_12_12/GremlinDatabaseResource.java | 43 + .../GremlinGraphCreateUpdateParameters.java | 72 + .../GremlinGraphGetPropertiesResource.java | 224 + .../v2019_12_12/GremlinGraphGetResults.java | 165 + .../v2019_12_12/GremlinGraphResource.java | 177 + .../v2019_12_12/GremlinResources.java | 149 + .../cosmosdb/v2019_12_12/IncludedPath.java | 71 + .../cosmosdb/v2019_12_12/IndexKind.java | 44 + .../cosmosdb/v2019_12_12/Indexes.java | 98 + .../cosmosdb/v2019_12_12/IndexingMode.java | 44 + .../cosmosdb/v2019_12_12/IndexingPolicy.java | 175 + .../cosmosdb/v2019_12_12/KeyKind.java | 47 + .../cosmosdb/v2019_12_12/Location.java | 157 + .../v2019_12_12/MetricAvailability.java | 47 + .../cosmosdb/v2019_12_12/MetricName.java | 47 + .../cosmosdb/v2019_12_12/MetricValue.java | 108 + ...ngoDBCollectionCreateUpdateParameters.java | 72 + ...ongoDBCollectionGetPropertiesResource.java | 144 + .../MongoDBCollectionGetResults.java | 165 + .../MongoDBCollectionResource.java | 97 + ...MongoDBDatabaseCreateUpdateParameters.java | 72 + .../MongoDBDatabaseGetPropertiesResource.java | 90 + .../MongoDBDatabaseGetResults.java | 164 + .../v2019_12_12/MongoDBDatabaseResource.java | 43 + .../v2019_12_12/MongoDBResources.java | 149 + .../cosmosdb/v2019_12_12/MongoIndex.java | 69 + .../cosmosdb/v2019_12_12/MongoIndexKeys.java | 44 + .../v2019_12_12/MongoIndexOptions.java | 69 + .../cosmosdb/v2019_12_12/Operation.java | 30 + .../v2019_12_12/OperationDisplay.java | 121 + .../cosmosdb/v2019_12_12/Operations.java | 27 + .../PartitionKeyRangeIdRegions.java | 32 + .../v2019_12_12/PartitionKeyRangeIds.java | 31 + .../cosmosdb/v2019_12_12/PartitionKind.java | 41 + .../cosmosdb/v2019_12_12/PartitionMetric.java | 62 + .../cosmosdb/v2019_12_12/PartitionUsage.java | 55 + .../v2019_12_12/PercentileMetric.java | 52 + .../v2019_12_12/PercentileMetricValue.java | 122 + .../v2019_12_12/PercentileSourceTargets.java | 32 + .../v2019_12_12/PercentileTargets.java | 31 + .../cosmosdb/v2019_12_12/Percentiles.java | 30 + .../v2019_12_12/PrimaryAggregationType.java | 53 + .../PrivateEndpointConnection.java | 146 + .../PrivateEndpointConnections.java | 53 + .../v2019_12_12/PrivateEndpointProperty.java | 43 + .../v2019_12_12/PrivateLinkResource.java | 48 + .../v2019_12_12/PrivateLinkResources.java | 40 + ...ateLinkServiceConnectionStateProperty.java | 85 + .../v2019_12_12/RegionForOnlineOffline.java | 43 + .../cosmosdb/v2019_12_12/SpatialSpec.java | 71 + .../cosmosdb/v2019_12_12/SpatialType.java | 47 + .../SqlContainerCreateUpdateParameters.java | 72 + .../SqlContainerGetPropertiesResource.java | 224 + .../v2019_12_12/SqlContainerGetResults.java | 165 + .../v2019_12_12/SqlContainerResource.java | 177 + .../SqlDatabaseCreateUpdateParameters.java | 72 + .../SqlDatabaseGetPropertiesResource.java | 144 + .../v2019_12_12/SqlDatabaseGetResults.java | 164 + .../v2019_12_12/SqlDatabaseResource.java | 43 + .../cosmosdb/v2019_12_12/SqlResources.java | 287 ++ ...StoredProcedureCreateUpdateParameters.java | 72 + ...lStoredProcedureGetPropertiesResource.java | 116 + .../SqlStoredProcedureGetResults.java | 166 + .../SqlStoredProcedureResource.java | 69 + .../SqlTriggerCreateUpdateParameters.java | 72 + .../SqlTriggerGetPropertiesResource.java | 169 + .../v2019_12_12/SqlTriggerGetResults.java | 166 + .../v2019_12_12/SqlTriggerResource.java | 122 + ...DefinedFunctionCreateUpdateParameters.java | 72 + ...rDefinedFunctionGetPropertiesResource.java | 116 + .../SqlUserDefinedFunctionGetResults.java | 166 + .../SqlUserDefinedFunctionResource.java | 69 + .../TableCreateUpdateParameters.java | 73 + .../TableGetPropertiesResource.java | 90 + .../cosmosdb/v2019_12_12/TableGetResults.java | 165 + .../cosmosdb/v2019_12_12/TableResources.java | 81 + .../v2019_12_12/ThroughputPolicyResource.java | 70 + ...roughputSettingsGetPropertiesResource.java | 148 + .../ThroughputSettingsGetResults.java | 51 + .../ThroughputSettingsResource.java | 102 + .../ThroughputSettingsUpdateParameters.java | 45 + .../v2019_12_12/TriggerOperation.java | 50 + .../cosmosdb/v2019_12_12/TriggerType.java | 41 + .../cosmosdb/v2019_12_12/UniqueKey.java | 46 + .../cosmosdb/v2019_12_12/UniqueKeyPolicy.java | 46 + .../cosmosdb/v2019_12_12/UnitType.java | 56 + .../v2019_12_12/VirtualNetworkRule.java | 71 + .../CassandraKeyspaceGetResultsImpl.java | 159 + .../CassandraKeyspaceGetResultsInner.java | 47 + .../CassandraResourcesImpl.java | 206 + .../CassandraResourcesInner.java | 1797 ++++++++ .../CassandraTableGetResultsImpl.java | 162 + .../CassandraTableGetResultsInner.java | 47 + ...isDatabaseAccountMetricDefinitionImpl.java | 60 + ...ionDatabasisDatabaseAccountMetricImpl.java | 65 + ...tabasisDatabaseAccountMetricModelImpl.java | 65 + ...tionDatabasisDatabaseAccountUsageImpl.java | 57 + .../CollectionPartitionRegionsImpl.java | 49 + .../CollectionPartitionRegionsInner.java | 178 + .../CollectionPartitionsImpl.java | 68 + .../CollectionPartitionsInner.java | 379 ++ .../implementation/CollectionRegionsImpl.java | 53 + .../CollectionRegionsInner.java | 178 + .../implementation/CollectionsImpl.java | 99 + .../implementation/CollectionsInner.java | 486 +++ .../CosmosDBManagementClientImpl.java | 472 +++ .../implementation/CosmosDBManager.java | 327 ++ .../DatabaseAccountGetResultsImpl.java | 309 ++ .../DatabaseAccountGetResultsInner.java | 470 +++ ...ccountListConnectionStringsResultImpl.java | 33 + ...countListConnectionStringsResultInner.java | 45 + .../DatabaseAccountListKeysResultImpl.java | 46 + .../DatabaseAccountListKeysResultInner.java | 47 + ...baseAccountListReadOnlyKeysResultImpl.java | 36 + ...aseAccountListReadOnlyKeysResultInner.java | 47 + .../DatabaseAccountMetricDefinitionImpl.java | 60 + .../DatabaseAccountMetricImpl.java | 65 + .../DatabaseAccountRegionsImpl.java | 49 + .../DatabaseAccountRegionsInner.java | 164 + .../DatabaseAccountUsageImpl.java | 57 + .../implementation/DatabaseAccountsImpl.java | 291 ++ .../implementation/DatabaseAccountsInner.java | 2356 +++++++++++ .../implementation/DatabasesImpl.java | 99 + .../implementation/DatabasesInner.java | 458 ++ ...isDatabaseAccountMetricDefinitionImpl.java | 60 + .../DatabasisDatabaseAccountMetricImpl.java | 65 + .../DatabasisDatabaseAccountUsageImpl.java | 57 + .../GremlinDatabaseGetResultsImpl.java | 159 + .../GremlinDatabaseGetResultsInner.java | 47 + .../GremlinGraphGetResultsImpl.java | 162 + .../GremlinGraphGetResultsInner.java | 47 + .../implementation/GremlinResourcesImpl.java | 206 + .../implementation/GremlinResourcesInner.java | 1797 ++++++++ .../implementation/IdParsingUtils.java | 57 + .../implementation/MetricDefinitionInner.java | 111 + .../implementation/MetricInner.java | 125 + .../MongoDBCollectionGetResultsImpl.java | 162 + .../MongoDBCollectionGetResultsInner.java | 47 + .../MongoDBDatabaseGetResultsImpl.java | 159 + .../MongoDBDatabaseGetResultsInner.java | 47 + .../implementation/MongoDBResourcesImpl.java | 206 + .../implementation/MongoDBResourcesInner.java | 1797 ++++++++ .../implementation/OperationImpl.java | 37 + .../implementation/OperationInner.java | 70 + .../implementation/OperationsImpl.java | 49 + .../implementation/OperationsInner.java | 281 ++ .../v2019_12_12/implementation/PageImpl.java | 75 + .../v2019_12_12/implementation/PageImpl1.java | 75 + .../PartitionKeyRangeIdRegionsImpl.java | 49 + .../PartitionKeyRangeIdRegionsInner.java | 185 + .../PartitionKeyRangeIdsImpl.java | 49 + .../PartitionKeyRangeIdsInner.java | 178 + .../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 | 171 + .../implementation/PercentileTargetsImpl.java | 49 + .../PercentileTargetsInner.java | 164 + .../implementation/PercentilesImpl.java | 49 + .../implementation/PercentilesInner.java | 157 + .../PrivateEndpointConnectionImpl.java | 118 + .../PrivateEndpointConnectionInner.java | 74 + .../PrivateEndpointConnectionsImpl.java | 85 + .../PrivateEndpointConnectionsInner.java | 612 +++ .../PrivateLinkResourceImpl.java | 69 + .../PrivateLinkResourceInner.java | 51 + .../PrivateLinkResourcesImpl.java | 69 + .../PrivateLinkResourcesInner.java | 245 ++ .../SqlContainerGetResultsImpl.java | 162 + .../SqlContainerGetResultsInner.java | 47 + .../SqlDatabaseGetResultsImpl.java | 159 + .../SqlDatabaseGetResultsInner.java | 47 + .../implementation/SqlResourcesImpl.java | 398 ++ .../implementation/SqlResourcesInner.java | 3702 +++++++++++++++++ .../SqlStoredProcedureGetResultsImpl.java | 165 + .../SqlStoredProcedureGetResultsInner.java | 47 + .../SqlTriggerGetResultsImpl.java | 165 + .../SqlTriggerGetResultsInner.java | 47 + .../SqlUserDefinedFunctionGetResultsImpl.java | 165 + ...SqlUserDefinedFunctionGetResultsInner.java | 47 + .../implementation/TableGetResultsImpl.java | 158 + .../implementation/TableGetResultsInner.java | 47 + .../implementation/TableResourceInner.java | 43 + .../implementation/TableResourcesImpl.java | 119 + .../implementation/TableResourcesInner.java | 898 ++++ .../ThroughputSettingsGetResultsImpl.java | 58 + .../ThroughputSettingsGetResultsInner.java | 47 + .../implementation/UsageInner.java | 107 + .../implementation/package-info.java | 11 + .../cosmosdb/v2019_12_12/package-info.java | 11 + 260 files changed, 38410 insertions(+) create mode 100644 sdk/cosmos/mgmt-v2019_12_12/pom.xml create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMProxyResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMResourceProperties.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutoUpgradePolicyResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutopilotSettingsResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AzureEntityResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Capability.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraPartitionKey.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraSchema.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ClusterKey.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetric.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricDefinition.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricModel.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountUsage.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitionRegions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionRegions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Collections.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Column.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePath.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePathSortOrder.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionMode.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionPolicy.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConnectorOffer.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConsistencyPolicy.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ContainerPartitionKey.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CreateUpdateOptions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DataType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountConnectionString.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountKind.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListConnectionStringsResult.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListKeysResult.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListReadOnlyKeysResult.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetric.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetricDefinition.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountOfferType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegenerateKeyParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUsage.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccounts.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Databases.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetric.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetricDefinition.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountUsage.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DefaultConsistencyLevel.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponse.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponseException.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExcludedPath.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExtendedResourceProperties.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicies.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicy.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IncludedPath.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexKind.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Indexes.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingMode.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingPolicy.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/KeyKind.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Location.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricAvailability.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricName.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricValue.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndex.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexKeys.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexOptions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operation.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/OperationDisplay.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operations.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIdRegions.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIds.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKind.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionMetric.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionUsage.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetric.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetricValue.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileSourceTargets.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileTargets.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Percentiles.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrimaryAggregationType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnection.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnections.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointProperty.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/RegionForOnlineOffline.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialSpec.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableCreateUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableResources.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputPolicyResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetPropertiesResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetResults.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsResource.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsUpdateParameters.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerOperation.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKey.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKeyPolicy.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UnitType.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/VirtualNetworkRule.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManagementClientImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManager.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricDefinitionImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountUsageImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountUsageImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/IdParsingUtils.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricDefinitionInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl1.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourceInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsImpl.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/UsageInner.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/package-info.java create mode 100644 sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/package-info.java diff --git a/sdk/cosmos/mgmt-v2019_12_12/pom.xml b/sdk/cosmos/mgmt-v2019_12_12/pom.xml new file mode 100644 index 0000000000000..c314cc1c0c305 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/pom.xml @@ -0,0 +1,135 @@ + + + 4.0.0 + com.microsoft.azure.cosmosdb.v2019_12_12 + + com.microsoft.azure + azure-arm-parent + 1.1.0 + ../../../pom.management.xml + + azure-mgmt-cosmosdb + 1.0.0-beta + jar + Microsoft Azure SDK for CosmosDB Management + This package contains Microsoft CosmosDB Management SDK. + https://github.com/Azure/azure-sdk-for-java + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + scm:git:https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + UTF-8 + + + + + microsoft + Microsoft + + + + + com.microsoft.azure + azure-client-runtime + + + com.microsoft.azure + azure-arm-client-runtime + + + junit + junit + test + + + com.microsoft.azure + azure-client-authentication + test + + + com.microsoft.azure + azure-mgmt-resources + test + + + com.microsoft.azure + azure-arm-client-runtime + test-jar + test + + 1.6.5 + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + 3.1 + + 1.7 + 1.7 + + + com.microsoft.azure.management.apigeneration.LangDefinitionProcessor + + + true + true + + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.8 + + *.implementation.*;*.utils.*;com.microsoft.schemas._2003._10.serialization;*.blob.core.search + + + /** +
* Copyright (c) Microsoft Corporation. All rights reserved. +
* Licensed under the MIT License. See License.txt in the project root for +
* license information. +
*/ + ]]> +
+
+
+
+
+
diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMProxyResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMProxyResource.java new file mode 100644 index 0000000000000..9cf7b28067148 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMProxyResource.java @@ -0,0 +1,18 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a ARM proxy resource. It will have + * everything other than required location and tags. + */ +public class ARMProxyResource extends ProxyResource { +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMResourceProperties.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMResourceProperties.java new file mode 100644 index 0000000000000..dcf4de6fd8086 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ARMResourceProperties.java @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.Resource; + +/** + * The core properties of ARM resources. + */ +public class ARMResourceProperties extends Resource { +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutoUpgradePolicyResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutoUpgradePolicyResource.java new file mode 100644 index 0000000000000..7c88507d6176a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutoUpgradePolicyResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource auto-upgrade policy. + */ +public class AutoUpgradePolicyResource { + /** + * Represents throughput policy which service must adhere to for + * auto-upgrade. + */ + @JsonProperty(value = "throughputPolicy") + private ThroughputPolicyResource throughputPolicy; + + /** + * Get represents throughput policy which service must adhere to for auto-upgrade. + * + * @return the throughputPolicy value + */ + public ThroughputPolicyResource throughputPolicy() { + return this.throughputPolicy; + } + + /** + * Set represents throughput policy which service must adhere to for auto-upgrade. + * + * @param throughputPolicy the throughputPolicy value to set + * @return the AutoUpgradePolicyResource object itself. + */ + public AutoUpgradePolicyResource withThroughputPolicy(ThroughputPolicyResource throughputPolicy) { + this.throughputPolicy = throughputPolicy; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutopilotSettingsResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutopilotSettingsResource.java new file mode 100644 index 0000000000000..e737fb8929ca6 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AutopilotSettingsResource.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB autopilot settings object. + */ +public class AutopilotSettingsResource { + /** + * Represents max throughput an autopilot container can operate at. + */ + @JsonProperty(value = "maxThroughput", required = true) + private int maxThroughput; + + /** + * Cosmos DB resource auto-upgrade policy. + */ + @JsonProperty(value = "autoUpgradePolicy") + private AutoUpgradePolicyResource autoUpgradePolicy; + + /** + * Represents target max throughput an autopilot container should operate + * at once offer is no longer in pending state. + */ + @JsonProperty(value = "targetMaxThroughput", access = JsonProperty.Access.WRITE_ONLY) + private Integer targetMaxThroughput; + + /** + * Get represents max throughput an autopilot container can operate at. + * + * @return the maxThroughput value + */ + public int maxThroughput() { + return this.maxThroughput; + } + + /** + * Set represents max throughput an autopilot container can operate at. + * + * @param maxThroughput the maxThroughput value to set + * @return the AutopilotSettingsResource object itself. + */ + public AutopilotSettingsResource withMaxThroughput(int maxThroughput) { + this.maxThroughput = maxThroughput; + return this; + } + + /** + * Get cosmos DB resource auto-upgrade policy. + * + * @return the autoUpgradePolicy value + */ + public AutoUpgradePolicyResource autoUpgradePolicy() { + return this.autoUpgradePolicy; + } + + /** + * Set cosmos DB resource auto-upgrade policy. + * + * @param autoUpgradePolicy the autoUpgradePolicy value to set + * @return the AutopilotSettingsResource object itself. + */ + public AutopilotSettingsResource withAutoUpgradePolicy(AutoUpgradePolicyResource autoUpgradePolicy) { + this.autoUpgradePolicy = autoUpgradePolicy; + return this; + } + + /** + * Get represents target max throughput an autopilot container should operate at once offer is no longer in pending state. + * + * @return the targetMaxThroughput value + */ + public Integer targetMaxThroughput() { + return this.targetMaxThroughput; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AzureEntityResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AzureEntityResource.java new file mode 100644 index 0000000000000..8c52362b1a32c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/AzureEntityResource.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.ProxyResource; + +/** + * The resource model definition for a Azure Resource Manager resource with an + * etag. + */ +public class AzureEntityResource extends ProxyResource { + /** + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get resource Etag. + * + * @return the etag value + */ + public String etag() { + return this.etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Capability.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Capability.java new file mode 100644 index 0000000000000..8c767267cff09 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceCreateUpdateParameters.java new file mode 100644 index 0000000000000..b1784b49b3133 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB Cassandra keyspace. + */ +@JsonFlatten +public class CassandraKeyspaceCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a Cassandra keyspace. + */ + @JsonProperty(value = "properties.resource", required = true) + private CassandraKeyspaceResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a Cassandra keyspace. + * + * @return the resource value + */ + public CassandraKeyspaceResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a Cassandra keyspace. + * + * @param resource the resource value to set + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withResource(CassandraKeyspaceResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the CassandraKeyspaceCreateUpdateParameters object itself. + */ + public CassandraKeyspaceCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetPropertiesResource.java new file mode 100644 index 0000000000000..42e5e45e2775c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetPropertiesResource.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CassandraKeyspaceGetPropertiesResource model. + */ +public class CassandraKeyspaceGetPropertiesResource { + /** + * Name of the Cosmos DB Cassandra keyspace. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB Cassandra keyspace. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Cassandra keyspace. + * + * @param id the id value to set + * @return the CassandraKeyspaceGetPropertiesResource object itself. + */ + public CassandraKeyspaceGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetResults.java new file mode 100644 index 0000000000000..dc85bea72e475 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceGetResults.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CassandraKeyspaceGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing CassandraKeyspaceGetResults. + */ +public interface CassandraKeyspaceGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + CassandraKeyspaceGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the CassandraKeyspaceGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of CassandraKeyspaceGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CassandraKeyspaceGetResults definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the cassandrakeyspacegetresults definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithLocation withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the cassandrakeyspacegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the cassandrakeyspacegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the cassandrakeyspacegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a Cassandra keyspace + * @return the next definition stage + */ + WithCreate withResource(CassandraKeyspaceResource resource); + } + + /** + * The stage of the cassandrakeyspacegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a CassandraKeyspaceGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of CassandraKeyspaceGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the cassandrakeyspacegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceResource.java new file mode 100644 index 0000000000000..811dcda94e593 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraKeyspaceResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra keyspace resource object. + */ +public class CassandraKeyspaceResource { + /** + * Name of the Cosmos DB Cassandra keyspace. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get name of the Cosmos DB Cassandra keyspace. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Cassandra keyspace. + * + * @param id the id value to set + * @return the CassandraKeyspaceResource object itself. + */ + public CassandraKeyspaceResource withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraPartitionKey.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraPartitionKey.java new file mode 100644 index 0000000000000..565f810da2c6a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraPartitionKey.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra table partition key. + */ +public class CassandraPartitionKey { + /** + * Name of the Cosmos DB Cassandra table partition key. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get name of the Cosmos DB Cassandra table partition key. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Cosmos DB Cassandra table partition key. + * + * @param name the name value to set + * @return the CassandraPartitionKey object itself. + */ + public CassandraPartitionKey withName(String name) { + this.name = name; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraResources.java new file mode 100644 index 0000000000000..814efc8e704d1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraResources.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceGetResults; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableGetResults; + +/** + * Type representing CassandraResources. + */ +public interface CassandraResources { + /** + * Begins definition for a new CassandraKeyspace resource. + * @param name resource name. + * @return the first stage of the new CassandraKeyspace definition. + */ + CassandraKeyspaceGetResults.DefinitionStages.Blank defineCassandraKeyspace(String name); + + /** + * Begins definition for a new Table resource. + * @param name resource name. + * @return the first stage of the new Table definition. + */ + CassandraTableGetResults.DefinitionStages.Blank defineTable(String name); + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Lists the Cassandra keyspaces under 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 + */ + Observable listCassandraKeyspacesAsync(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName); + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName); + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraSchema.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraSchema.java new file mode 100644 index 0000000000000..a1386a7b52419 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraSchema.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra table schema. + */ +public class CassandraSchema { + /** + * List of Cassandra table columns. + */ + @JsonProperty(value = "columns") + private List columns; + + /** + * List of partition key. + */ + @JsonProperty(value = "partitionKeys") + private List partitionKeys; + + /** + * List of cluster key. + */ + @JsonProperty(value = "clusterKeys") + private List clusterKeys; + + /** + * Get list of Cassandra table columns. + * + * @return the columns value + */ + public List columns() { + return this.columns; + } + + /** + * Set list of Cassandra table columns. + * + * @param columns the columns value to set + * @return the CassandraSchema object itself. + */ + public CassandraSchema withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Get list of partition key. + * + * @return the partitionKeys value + */ + public List partitionKeys() { + return this.partitionKeys; + } + + /** + * Set list of partition key. + * + * @param partitionKeys the partitionKeys value to set + * @return the CassandraSchema object itself. + */ + public CassandraSchema withPartitionKeys(List partitionKeys) { + this.partitionKeys = partitionKeys; + return this; + } + + /** + * Get list of cluster key. + * + * @return the clusterKeys value + */ + public List clusterKeys() { + return this.clusterKeys; + } + + /** + * Set list of cluster key. + * + * @param clusterKeys the clusterKeys value to set + * @return the CassandraSchema object itself. + */ + public CassandraSchema withClusterKeys(List clusterKeys) { + this.clusterKeys = clusterKeys; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableCreateUpdateParameters.java new file mode 100644 index 0000000000000..f64841f603b63 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB Cassandra table. + */ +@JsonFlatten +public class CassandraTableCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a Cassandra table. + */ + @JsonProperty(value = "properties.resource", required = true) + private CassandraTableResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a Cassandra table. + * + * @return the resource value + */ + public CassandraTableResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a Cassandra table. + * + * @param resource the resource value to set + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withResource(CassandraTableResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the CassandraTableCreateUpdateParameters object itself. + */ + public CassandraTableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetPropertiesResource.java new file mode 100644 index 0000000000000..126c498696858 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetPropertiesResource.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CassandraTableGetPropertiesResource model. + */ +public class CassandraTableGetPropertiesResource { + /** + * Name of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Time to live of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * Schema of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "schema") + private CassandraSchema schema; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB Cassandra table. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Cassandra table. + * + * @param id the id value to set + * @return the CassandraTableGetPropertiesResource object itself. + */ + public CassandraTableGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get time to live of the Cosmos DB Cassandra table. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set time to live of the Cosmos DB Cassandra table. + * + * @param defaultTtl the defaultTtl value to set + * @return the CassandraTableGetPropertiesResource object itself. + */ + public CassandraTableGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get schema of the Cosmos DB Cassandra table. + * + * @return the schema value + */ + public CassandraSchema schema() { + return this.schema; + } + + /** + * Set schema of the Cosmos DB Cassandra table. + * + * @param schema the schema value to set + * @return the CassandraTableGetPropertiesResource object itself. + */ + public CassandraTableGetPropertiesResource withSchema(CassandraSchema schema) { + this.schema = schema; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetResults.java new file mode 100644 index 0000000000000..c9ee4742b738e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableGetResults.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CassandraTableGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing CassandraTableGetResults. + */ +public interface CassandraTableGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + CassandraTableGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the CassandraTableGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithCassandraKeyspace, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of CassandraTableGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a CassandraTableGetResults definition. + */ + interface Blank extends WithCassandraKeyspace { + } + + /** + * The stage of the cassandratablegetresults definition allowing to specify CassandraKeyspace. + */ + interface WithCassandraKeyspace { + /** + * Specifies resourceGroupName, accountName, keyspaceName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param keyspaceName Cosmos DB keyspace name + * @return the next definition stage + */ + WithLocation withExistingCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName); + } + + /** + * The stage of the cassandratablegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the cassandratablegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the cassandratablegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a Cassandra table + * @return the next definition stage + */ + WithCreate withResource(CassandraTableResource resource); + } + + /** + * The stage of the cassandratablegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a CassandraTableGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of CassandraTableGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the cassandratablegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableResource.java new file mode 100644 index 0000000000000..e65c7e7f1e0ba --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CassandraTableResource.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra table resource object. + */ +public class CassandraTableResource { + /** + * Name of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Time to live of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * Schema of the Cosmos DB Cassandra table. + */ + @JsonProperty(value = "schema") + private CassandraSchema schema; + + /** + * Get name of the Cosmos DB Cassandra table. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Cassandra table. + * + * @param id the id value to set + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get time to live of the Cosmos DB Cassandra table. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set time to live of the Cosmos DB Cassandra table. + * + * @param defaultTtl the defaultTtl value to set + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get schema of the Cosmos DB Cassandra table. + * + * @return the schema value + */ + public CassandraSchema schema() { + return this.schema; + } + + /** + * Set schema of the Cosmos DB Cassandra table. + * + * @param schema the schema value to set + * @return the CassandraTableResource object itself. + */ + public CassandraTableResource withSchema(CassandraSchema schema) { + this.schema = schema; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ClusterKey.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ClusterKey.java new file mode 100644 index 0000000000000..39120993b25a0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ClusterKey.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra table cluster key. + */ +public class ClusterKey { + /** + * Name of the Cosmos DB Cassandra table cluster key. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Order of the Cosmos DB Cassandra table cluster key, only support "Asc" + * and "Desc". + */ + @JsonProperty(value = "orderBy") + private String orderBy; + + /** + * Get name of the Cosmos DB Cassandra table cluster key. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Cosmos DB Cassandra table cluster key. + * + * @param name the name value to set + * @return the ClusterKey object itself. + */ + public ClusterKey withName(String name) { + this.name = name; + return this; + } + + /** + * Get order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @return the orderBy value + */ + public String orderBy() { + return this.orderBy; + } + + /** + * Set order of the Cosmos DB Cassandra table cluster key, only support "Asc" and "Desc". + * + * @param orderBy the orderBy value to set + * @return the ClusterKey object itself. + */ + public ClusterKey withOrderBy(String orderBy) { + this.orderBy = orderBy; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetric.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetric.java new file mode 100644 index 0000000000000..d46a12a61cf19 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricDefinition.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..693cc6d8b949b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricModel.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountMetricModel.java new file mode 100644 index 0000000000000..d428c69601934 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountUsage.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionDatabasisDatabaseAccountUsage.java new file mode 100644 index 0000000000000..fe8b141064fd3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; + +/** + * Type representing CollectionDatabasisDatabaseAccountUsage. + */ +public interface CollectionDatabasisDatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Long currentValue(); + + /** + * @return the limit value. + */ + Long limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitionRegions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitionRegions.java new file mode 100644 index 0000000000000..0a9e5a6a3adab --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionPartitions.java new file mode 100644 index 0000000000000..b066c0fb34518 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionRegions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CollectionRegions.java new file mode 100644 index 0000000000000..5b41dc51ee08a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Collections.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Collections.java new file mode 100644 index 0000000000000..3a12b8a2c1d86 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountUsage; + +/** + * Type representing Collections. + */ +public interface Collections { + /** + * Retrieves metric definitions 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Column.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Column.java new file mode 100644 index 0000000000000..1a6d309ea889b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Column.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Cassandra table column. + */ +public class Column { + /** + * Name of the Cosmos DB Cassandra table column. + */ + @JsonProperty(value = "name") + private String name; + + /** + * Type of the Cosmos DB Cassandra table column. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get name of the Cosmos DB Cassandra table column. + * + * @return the name value + */ + public String name() { + return this.name; + } + + /** + * Set name of the Cosmos DB Cassandra table column. + * + * @param name the name value to set + * @return the Column object itself. + */ + public Column withName(String name) { + this.name = name; + return this; + } + + /** + * Get type of the Cosmos DB Cassandra table column. + * + * @return the type value + */ + public String type() { + return this.type; + } + + /** + * Set type of the Cosmos DB Cassandra table column. + * + * @param type the type value to set + * @return the Column object itself. + */ + public Column withType(String type) { + this.type = type; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePath.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePath.java new file mode 100644 index 0000000000000..ae3d3e7bc4dc2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePath.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The CompositePath model. + */ +public class CompositePath { + /** + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*). + */ + @JsonProperty(value = "path") + private String path; + + /** + * Sort order for composite paths. Possible values include: 'Ascending', + * 'Descending'. + */ + @JsonProperty(value = "order") + private CompositePathSortOrder order; + + /** + * Get the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @param path the path value to set + * @return the CompositePath object itself. + */ + public CompositePath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get sort order for composite paths. Possible values include: 'Ascending', 'Descending'. + * + * @return the order value + */ + public CompositePathSortOrder order() { + return this.order; + } + + /** + * Set sort order for composite paths. Possible values include: 'Ascending', 'Descending'. + * + * @param order the order value to set + * @return the CompositePath object itself. + */ + public CompositePath withOrder(CompositePathSortOrder order) { + this.order = order; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePathSortOrder.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePathSortOrder.java new file mode 100644 index 0000000000000..554e850ca092d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CompositePathSortOrder.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for CompositePathSortOrder. + */ +public final class CompositePathSortOrder extends ExpandableStringEnum { + /** Static value Ascending for CompositePathSortOrder. */ + public static final CompositePathSortOrder ASCENDING = fromString("Ascending"); + + /** Static value Descending for CompositePathSortOrder. */ + public static final CompositePathSortOrder DESCENDING = fromString("Descending"); + + /** + * Creates or finds a CompositePathSortOrder from its string representation. + * @param name a name to look for + * @return the corresponding CompositePathSortOrder + */ + @JsonCreator + public static CompositePathSortOrder fromString(String name) { + return fromString(name, CompositePathSortOrder.class); + } + + /** + * @return known CompositePathSortOrder values + */ + public static Collection values() { + return values(CompositePathSortOrder.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionMode.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionMode.java new file mode 100644 index 0000000000000..1a75627ac8bac --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionMode.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConflictResolutionMode. + */ +public final class ConflictResolutionMode extends ExpandableStringEnum { + /** Static value LastWriterWins for ConflictResolutionMode. */ + public static final ConflictResolutionMode LAST_WRITER_WINS = fromString("LastWriterWins"); + + /** Static value Custom for ConflictResolutionMode. */ + public static final ConflictResolutionMode CUSTOM = fromString("Custom"); + + /** + * Creates or finds a ConflictResolutionMode from its string representation. + * @param name a name to look for + * @return the corresponding ConflictResolutionMode + */ + @JsonCreator + public static ConflictResolutionMode fromString(String name) { + return fromString(name, ConflictResolutionMode.class); + } + + /** + * @return known ConflictResolutionMode values + */ + public static Collection values() { + return values(ConflictResolutionMode.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionPolicy.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionPolicy.java new file mode 100644 index 0000000000000..9757b313db289 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConflictResolutionPolicy.java @@ -0,0 +1,96 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The conflict resolution policy for the container. + */ +public class ConflictResolutionPolicy { + /** + * Indicates the conflict resolution mode. Possible values include: + * 'LastWriterWins', 'Custom'. + */ + @JsonProperty(value = "mode") + private ConflictResolutionMode mode; + + /** + * The conflict resolution path in the case of LastWriterWins mode. + */ + @JsonProperty(value = "conflictResolutionPath") + private String conflictResolutionPath; + + /** + * The procedure to resolve conflicts in the case of custom mode. + */ + @JsonProperty(value = "conflictResolutionProcedure") + private String conflictResolutionProcedure; + + /** + * Get indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom'. + * + * @return the mode value + */ + public ConflictResolutionMode mode() { + return this.mode; + } + + /** + * Set indicates the conflict resolution mode. Possible values include: 'LastWriterWins', 'Custom'. + * + * @param mode the mode value to set + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withMode(ConflictResolutionMode mode) { + this.mode = mode; + return this; + } + + /** + * Get the conflict resolution path in the case of LastWriterWins mode. + * + * @return the conflictResolutionPath value + */ + public String conflictResolutionPath() { + return this.conflictResolutionPath; + } + + /** + * Set the conflict resolution path in the case of LastWriterWins mode. + * + * @param conflictResolutionPath the conflictResolutionPath value to set + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionPath(String conflictResolutionPath) { + this.conflictResolutionPath = conflictResolutionPath; + return this; + } + + /** + * Get the procedure to resolve conflicts in the case of custom mode. + * + * @return the conflictResolutionProcedure value + */ + public String conflictResolutionProcedure() { + return this.conflictResolutionProcedure; + } + + /** + * Set the procedure to resolve conflicts in the case of custom mode. + * + * @param conflictResolutionProcedure the conflictResolutionProcedure value to set + * @return the ConflictResolutionPolicy object itself. + */ + public ConflictResolutionPolicy withConflictResolutionProcedure(String conflictResolutionProcedure) { + this.conflictResolutionProcedure = conflictResolutionProcedure; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConnectorOffer.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConnectorOffer.java new file mode 100644 index 0000000000000..cadde4759aed9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConnectorOffer.java @@ -0,0 +1,38 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for ConnectorOffer. + */ +public final class ConnectorOffer extends ExpandableStringEnum { + /** Static value Small for ConnectorOffer. */ + public static final ConnectorOffer SMALL = fromString("Small"); + + /** + * Creates or finds a ConnectorOffer from its string representation. + * @param name a name to look for + * @return the corresponding ConnectorOffer + */ + @JsonCreator + public static ConnectorOffer fromString(String name) { + return fromString(name, ConnectorOffer.class); + } + + /** + * @return known ConnectorOffer values + */ + public static Collection values() { + return values(ConnectorOffer.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConsistencyPolicy.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ConsistencyPolicy.java new file mode 100644 index 0000000000000..bb7ee6a73abb3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ContainerPartitionKey.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ContainerPartitionKey.java new file mode 100644 index 0000000000000..456fd4669af3e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ContainerPartitionKey.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The configuration of the partition key to be used for partitioning data into + * multiple partitions. + */ +public class ContainerPartitionKey { + /** + * List of paths using which data within the container can be partitioned. + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Indicates the kind of algorithm used for partitioning. Possible values + * include: 'Hash', 'Range'. + */ + @JsonProperty(value = "kind") + private PartitionKind kind; + + /** + * Indicates the version of the partition key definition. + */ + @JsonProperty(value = "version") + private Integer version; + + /** + * Get list of paths using which data within the container can be partitioned. + * + * @return the paths value + */ + public List paths() { + return this.paths; + } + + /** + * Set list of paths using which data within the container can be partitioned. + * + * @param paths the paths value to set + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withPaths(List paths) { + this.paths = paths; + return this; + } + + /** + * Get indicates the kind of algorithm used for partitioning. Possible values include: 'Hash', 'Range'. + * + * @return the kind value + */ + public PartitionKind kind() { + return this.kind; + } + + /** + * Set indicates the kind of algorithm used for partitioning. Possible values include: 'Hash', 'Range'. + * + * @param kind the kind value to set + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withKind(PartitionKind kind) { + this.kind = kind; + return this; + } + + /** + * Get indicates the version of the partition key definition. + * + * @return the version value + */ + public Integer version() { + return this.version; + } + + /** + * Set indicates the version of the partition key definition. + * + * @param version the version value to set + * @return the ContainerPartitionKey object itself. + */ + public ContainerPartitionKey withVersion(Integer version) { + this.version = version; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CreateUpdateOptions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CreateUpdateOptions.java new file mode 100644 index 0000000000000..6b967dc767162 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/CreateUpdateOptions.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * CreateUpdateOptions are a list of key-value pairs that describe the + * resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" + * and "Throughput". + */ +public class CreateUpdateOptions { + /** + * Unmatched properties from the message are deserialized this collection. + */ + @JsonProperty(value = "") + private Map additionalProperties; + + /** + * Request Units per second. For example, "throughput": "10000". + */ + @JsonProperty(value = "throughput") + private String throughput; + + /** + * Get unmatched properties from the message are deserialized this collection. + * + * @return the additionalProperties value + */ + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set unmatched properties from the message are deserialized this collection. + * + * @param additionalProperties the additionalProperties value to set + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + /** + * Get request Units per second. For example, "throughput": "10000". + * + * @return the throughput value + */ + public String throughput() { + return this.throughput; + } + + /** + * Set request Units per second. For example, "throughput": "10000". + * + * @param throughput the throughput value to set + * @return the CreateUpdateOptions object itself. + */ + public CreateUpdateOptions withThroughput(String throughput) { + this.throughput = throughput; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DataType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DataType.java new file mode 100644 index 0000000000000..cea4037c86438 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DataType.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.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DataType. + */ +public final class DataType extends ExpandableStringEnum { + /** Static value String for DataType. */ + public static final DataType STRING = fromString("String"); + + /** Static value Number for DataType. */ + public static final DataType NUMBER = fromString("Number"); + + /** Static value Point for DataType. */ + public static final DataType POINT = fromString("Point"); + + /** Static value Polygon for DataType. */ + public static final DataType POLYGON = fromString("Polygon"); + + /** Static value LineString for DataType. */ + public static final DataType LINE_STRING = fromString("LineString"); + + /** Static value MultiPolygon for DataType. */ + public static final DataType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a DataType from its string representation. + * @param name a name to look for + * @return the corresponding DataType + */ + @JsonCreator + public static DataType fromString(String name) { + return fromString(name, DataType.class); + } + + /** + * @return known DataType values + */ + public static Collection values() { + return values(DataType.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountConnectionString.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountConnectionString.java new file mode 100644 index 0000000000000..a1059720ceb1b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountCreateUpdateParameters.java new file mode 100644 index 0000000000000..97eef12f0ba28 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountCreateUpdateParameters.java @@ -0,0 +1,403 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB database accounts. + */ +@JsonFlatten +public class DatabaseAccountCreateUpdateParameters extends ARMResourceProperties { + /** + * 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 offer type for the database. + */ + @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; + + /** + * Enables the account to write in multiple locations. + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /** + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys. + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /** + * The URI of the key vault. + */ + @JsonProperty(value = "properties.keyVaultKeyUri") + private String keyVaultKeyUri; + + /** + * 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 offer type for the database. + * + * @return the databaseAccountOfferType value + */ + public String databaseAccountOfferType() { + return this.databaseAccountOfferType; + } + + /** + * Set the offer type for the database. + * + * @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; + } + + /** + * Get enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the URI of the key vault. + * + * @return the keyVaultKeyUri value + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set + * @return the DatabaseAccountCreateUpdateParameters object itself. + */ + public DatabaseAccountCreateUpdateParameters withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountGetResults.java new file mode 100644 index 0000000000000..378f4d433a102 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountGetResults.java @@ -0,0 +1,476 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +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.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.DatabaseAccountGetResultsInner; + +/** + * Type representing DatabaseAccountGetResults. + */ +public interface DatabaseAccountGetResults extends HasInner, Resource, GroupableResourceCore, HasResourceGroup, Refreshable, Updatable, HasManager { + /** + * @return the capabilities value. + */ + List capabilities(); + + /** + * @return the connectorOffer value. + */ + ConnectorOffer connectorOffer(); + + /** + * @return the consistencyPolicy value. + */ + ConsistencyPolicy consistencyPolicy(); + + /** + * @return the databaseAccountOfferType value. + */ + DatabaseAccountOfferType databaseAccountOfferType(); + + /** + * @return the disableKeyBasedMetadataWriteAccess value. + */ + Boolean disableKeyBasedMetadataWriteAccess(); + + /** + * @return the documentEndpoint value. + */ + String documentEndpoint(); + + /** + * @return the enableAutomaticFailover value. + */ + Boolean enableAutomaticFailover(); + + /** + * @return the enableCassandraConnector value. + */ + Boolean enableCassandraConnector(); + + /** + * @return the enableMultipleWriteLocations value. + */ + Boolean enableMultipleWriteLocations(); + + /** + * @return the failoverPolicies value. + */ + List failoverPolicies(); + + /** + * @return the ipRangeFilter value. + */ + String ipRangeFilter(); + + /** + * @return the isVirtualNetworkFilterEnabled value. + */ + Boolean isVirtualNetworkFilterEnabled(); + + /** + * @return the keyVaultKeyUri value. + */ + String keyVaultKeyUri(); + + /** + * @return the kind value. + */ + DatabaseAccountKind kind(); + + /** + * @return the locations value. + */ + List locations(); + + /** + * @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 DatabaseAccountGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithDatabaseAccountOfferType, DefinitionStages.WithLocations, DefinitionStages.WithCreate { + } + + /** + * Grouping of DatabaseAccountGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a DatabaseAccountGetResults definition. + */ + interface Blank extends GroupableResourceCore.DefinitionWithRegion { + } + + /** + * The stage of the DatabaseAccountGetResults definition allowing to specify the resource group. + */ + interface WithGroup extends GroupableResourceCore.DefinitionStages.WithGroup { + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify DatabaseAccountOfferType. + */ + interface WithDatabaseAccountOfferType { + /** + * Specifies databaseAccountOfferType. + * @param databaseAccountOfferType The offer type for the database + * @return the next definition stage +*/ + WithLocations withDatabaseAccountOfferType(String databaseAccountOfferType); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify Locations. + */ + interface WithLocations { + /** + * Specifies locations. + * @param locations An array that contains the georeplication locations enabled for the Cosmos DB account + * @return the next definition stage +*/ + WithCreate withLocations(List locations); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify Capabilities. + */ + interface WithCapabilities { + /** + * Specifies capabilities. + * @param capabilities List of Cosmos DB capabilities for the account + * @return the next definition stage + */ + WithCreate withCapabilities(List capabilities); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify ConnectorOffer. + */ + interface WithConnectorOffer { + /** + * Specifies connectorOffer. + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' + * @return the next definition stage + */ + WithCreate withConnectorOffer(ConnectorOffer connectorOffer); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify ConsistencyPolicy. + */ + interface WithConsistencyPolicy { + /** + * Specifies consistencyPolicy. + * @param consistencyPolicy The consistency policy for the Cosmos DB account + * @return the next definition stage + */ + WithCreate withConsistencyPolicy(ConsistencyPolicy consistencyPolicy); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify DisableKeyBasedMetadataWriteAccess. + */ + interface WithDisableKeyBasedMetadataWriteAccess { + /** + * Specifies disableKeyBasedMetadataWriteAccess. + * @param disableKeyBasedMetadataWriteAccess Disable write operations on metadata resources (databases, containers, throughput) via account keys + * @return the next definition stage + */ + WithCreate withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify EnableAutomaticFailover. + */ + interface WithEnableAutomaticFailover { + /** + * Specifies enableAutomaticFailover. + * @param enableAutomaticFailover 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 next definition stage + */ + WithCreate withEnableAutomaticFailover(Boolean enableAutomaticFailover); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify EnableCassandraConnector. + */ + interface WithEnableCassandraConnector { + /** + * Specifies enableCassandraConnector. + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account + * @return the next definition stage + */ + WithCreate withEnableCassandraConnector(Boolean enableCassandraConnector); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify EnableMultipleWriteLocations. + */ + interface WithEnableMultipleWriteLocations { + /** + * Specifies enableMultipleWriteLocations. + * @param enableMultipleWriteLocations Enables the account to write in multiple locations + * @return the next definition stage + */ + WithCreate withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify IpRangeFilter. + */ + interface WithIpRangeFilter { + /** + * Specifies ipRangeFilter. + * @param ipRangeFilter 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 next definition stage + */ + WithCreate withIpRangeFilter(String ipRangeFilter); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify IsVirtualNetworkFilterEnabled. + */ + interface WithIsVirtualNetworkFilterEnabled { + /** + * Specifies isVirtualNetworkFilterEnabled. + * @param isVirtualNetworkFilterEnabled Flag to indicate whether to enable/disable Virtual Network ACL rules + * @return the next definition stage + */ + WithCreate withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify KeyVaultKeyUri. + */ + interface WithKeyVaultKeyUri { + /** + * Specifies keyVaultKeyUri. + * @param keyVaultKeyUri The URI of the key vault + * @return the next definition stage + */ + WithCreate withKeyVaultKeyUri(String keyVaultKeyUri); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify Kind. + */ + interface WithKind { + /** + * Specifies kind. + * @param kind Indicates the type of database account. This can only be set at database account creation. Possible values include: 'GlobalDocumentDB', 'MongoDB', 'Parse' + * @return the next definition stage + */ + WithCreate withKind(DatabaseAccountKind kind); + } + + /** + * The stage of the databaseaccountgetresults definition allowing to specify VirtualNetworkRules. + */ + interface WithVirtualNetworkRules { + /** + * Specifies virtualNetworkRules. + * @param virtualNetworkRules List of Virtual Network ACL rules configured for the Cosmos DB account + * @return the next definition stage + */ + 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.WithConnectorOffer, DefinitionStages.WithConsistencyPolicy, DefinitionStages.WithDisableKeyBasedMetadataWriteAccess, DefinitionStages.WithEnableAutomaticFailover, DefinitionStages.WithEnableCassandraConnector, DefinitionStages.WithEnableMultipleWriteLocations, DefinitionStages.WithIpRangeFilter, DefinitionStages.WithIsVirtualNetworkFilterEnabled, DefinitionStages.WithKeyVaultKeyUri, DefinitionStages.WithKind, DefinitionStages.WithVirtualNetworkRules { + } + } + /** + * The template for a DatabaseAccountGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, Resource.UpdateWithTags, UpdateStages.WithCapabilities, UpdateStages.WithConnectorOffer, UpdateStages.WithConsistencyPolicy, UpdateStages.WithDisableKeyBasedMetadataWriteAccess, UpdateStages.WithEnableAutomaticFailover, UpdateStages.WithEnableCassandraConnector, UpdateStages.WithEnableMultipleWriteLocations, UpdateStages.WithIpRangeFilter, UpdateStages.WithIsVirtualNetworkFilterEnabled, UpdateStages.WithKeyVaultKeyUri, UpdateStages.WithLocations, UpdateStages.WithVirtualNetworkRules { + } + + /** + * Grouping of DatabaseAccountGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the databaseaccountgetresults update allowing to specify Capabilities. + */ + interface WithCapabilities { + /** + * Specifies capabilities. + * @param capabilities List of Cosmos DB capabilities for the account + * @return the next update stage + */ + Update withCapabilities(List capabilities); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify ConnectorOffer. + */ + interface WithConnectorOffer { + /** + * Specifies connectorOffer. + * @param connectorOffer The cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small' + * @return the next update stage + */ + Update withConnectorOffer(ConnectorOffer connectorOffer); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify ConsistencyPolicy. + */ + interface WithConsistencyPolicy { + /** + * Specifies consistencyPolicy. + * @param consistencyPolicy The consistency policy for the Cosmos DB account + * @return the next update stage + */ + Update withConsistencyPolicy(ConsistencyPolicy consistencyPolicy); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify DisableKeyBasedMetadataWriteAccess. + */ + interface WithDisableKeyBasedMetadataWriteAccess { + /** + * Specifies disableKeyBasedMetadataWriteAccess. + * @param disableKeyBasedMetadataWriteAccess Disable write operations on metadata resources (databases, containers, throughput) via account keys + * @return the next update stage + */ + Update withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify EnableAutomaticFailover. + */ + interface WithEnableAutomaticFailover { + /** + * Specifies enableAutomaticFailover. + * @param enableAutomaticFailover 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 next update stage + */ + Update withEnableAutomaticFailover(Boolean enableAutomaticFailover); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify EnableCassandraConnector. + */ + interface WithEnableCassandraConnector { + /** + * Specifies enableCassandraConnector. + * @param enableCassandraConnector Enables the cassandra connector on the Cosmos DB C* account + * @return the next update stage + */ + Update withEnableCassandraConnector(Boolean enableCassandraConnector); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify EnableMultipleWriteLocations. + */ + interface WithEnableMultipleWriteLocations { + /** + * Specifies enableMultipleWriteLocations. + * @param enableMultipleWriteLocations Enables the account to write in multiple locations + * @return the next update stage + */ + Update withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify IpRangeFilter. + */ + interface WithIpRangeFilter { + /** + * Specifies ipRangeFilter. + * @param ipRangeFilter 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 next update stage + */ + Update withIpRangeFilter(String ipRangeFilter); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify IsVirtualNetworkFilterEnabled. + */ + interface WithIsVirtualNetworkFilterEnabled { + /** + * Specifies isVirtualNetworkFilterEnabled. + * @param isVirtualNetworkFilterEnabled Flag to indicate whether to enable/disable Virtual Network ACL rules + * @return the next update stage + */ + Update withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify KeyVaultKeyUri. + */ + interface WithKeyVaultKeyUri { + /** + * Specifies keyVaultKeyUri. + * @param keyVaultKeyUri The URI of the key vault + * @return the next update stage + */ + Update withKeyVaultKeyUri(String keyVaultKeyUri); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify Locations. + */ + interface WithLocations { + /** + * Specifies locations. + * @param locations An array that contains the georeplication locations enabled for the Cosmos DB account + * @return the next update stage + */ + Update withLocations(List locations); + } + + /** + * The stage of the databaseaccountgetresults update allowing to specify VirtualNetworkRules. + */ + interface WithVirtualNetworkRules { + /** + * Specifies virtualNetworkRules. + * @param virtualNetworkRules List of Virtual Network ACL rules configured for the Cosmos DB account + * @return the next update stage + */ + Update withVirtualNetworkRules(List virtualNetworkRules); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountKind.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountKind.java new file mode 100644 index 0000000000000..9376b4db5519a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListConnectionStringsResult.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListConnectionStringsResult.java new file mode 100644 index 0000000000000..38c3ecc922f36 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.DatabaseAccountListConnectionStringsResultInner; +import java.util.List; + +/** + * Type representing DatabaseAccountListConnectionStringsResult. + */ +public interface DatabaseAccountListConnectionStringsResult extends HasInner, HasManager { + /** + * @return the connectionStrings value. + */ + List connectionStrings(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListKeysResult.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListKeysResult.java new file mode 100644 index 0000000000000..ec88c5bc43471 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListReadOnlyKeysResult.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountListReadOnlyKeysResult.java new file mode 100644 index 0000000000000..be27de369817f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetric.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetric.java new file mode 100644 index 0000000000000..da0e33d14ee00 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetricDefinition.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..f845fe52891ed --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountOfferType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountOfferType.java new file mode 100644 index 0000000000000..f4b702350c33a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegenerateKeyParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegenerateKeyParameters.java new file mode 100644 index 0000000000000..8b79b583d1849 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountRegions.java new file mode 100644 index 0000000000000..3d2e22b0f1228 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUpdateParameters.java new file mode 100644 index 0000000000000..da2979040ff05 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUpdateParameters.java @@ -0,0 +1,394 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +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 DatabaseAccountUpdateParameters { + /** + * The tags property. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * The location of the resource group to which the resource belongs. + */ + @JsonProperty(value = "location") + private String location; + + /** + * 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") + private List locations; + + /** + * 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; + + /** + * Enables the account to write in multiple locations. + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /** + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys. + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /** + * The URI of the key vault. + */ + @JsonProperty(value = "properties.keyVaultKeyUri") + private String keyVaultKeyUri; + + /** + * 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the location of the resource group to which the resource belongs. + * + * @return the location value + */ + public String location() { + return this.location; + } + + /** + * Set the location of the resource group to which the resource belongs. + * + * @param location the location value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withLocation(String location) { + this.location = location; + 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withLocations(List locations) { + this.locations = locations; + 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters 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 DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the URI of the key vault. + * + * @return the keyVaultKeyUri value + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set + * @return the DatabaseAccountUpdateParameters object itself. + */ + public DatabaseAccountUpdateParameters withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUsage.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccountUsage.java new file mode 100644 index 0000000000000..4da1d0ddc317a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; + +/** + * Type representing DatabaseAccountUsage. + */ +public interface DatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Long currentValue(); + + /** + * @return the limit value. + */ + Long limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccounts.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabaseAccounts.java new file mode 100644 index 0000000000000..f7e21454e65dc --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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.cosmosdb.v2019_12_12.implementation.DatabaseAccountsInner; +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountUsage; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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 + */ + Observable 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 definitions 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Databases.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Databases.java new file mode 100644 index 0000000000000..9330f88cca655 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountUsage; + +/** + * Type representing Databases. + */ +public interface Databases { + /** + * Retrieves metric definitions 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetric.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetric.java new file mode 100644 index 0000000000000..7699931604406 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetricDefinition.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountMetricDefinition.java new file mode 100644 index 0000000000000..5a2726ec28671 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MetricDefinitionInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountUsage.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DatabasisDatabaseAccountUsage.java new file mode 100644 index 0000000000000..7e38067822662 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.UsageInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; + +/** + * Type representing DatabasisDatabaseAccountUsage. + */ +public interface DatabasisDatabaseAccountUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Long currentValue(); + + /** + * @return the limit value. + */ + Long limit(); + + /** + * @return the name value. + */ + MetricName name(); + + /** + * @return the quotaPeriod value. + */ + String quotaPeriod(); + + /** + * @return the unit value. + */ + UnitType unit(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DefaultConsistencyLevel.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/DefaultConsistencyLevel.java new file mode 100644 index 0000000000000..815c47baf8000 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponse.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponse.java new file mode 100644 index 0000000000000..f07417df240d0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponseException.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ErrorResponseException.java new file mode 100644 index 0000000000000..08b328d3f9ee8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.rest.RestException; +import okhttp3.ResponseBody; +import retrofit2.Response; + +/** + * Exception thrown for an invalid response with ErrorResponse information. + */ +public class ErrorResponseException extends RestException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + */ + public ErrorResponseException(final String message, final Response response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available + * @param response the HTTP response + * @param body the deserialized response body + */ + public ErrorResponseException(final String message, final Response response, final ErrorResponse body) { + super(message, response, body); + } + + @Override + public ErrorResponse body() { + return (ErrorResponse) super.body(); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExcludedPath.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExcludedPath.java new file mode 100644 index 0000000000000..033a6d474b167 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExcludedPath.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ExcludedPath model. + */ +public class ExcludedPath { + /** + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*). + */ + @JsonProperty(value = "path") + private String path; + + /** + * Get the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @param path the path value to set + * @return the ExcludedPath object itself. + */ + public ExcludedPath withPath(String path) { + this.path = path; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExtendedResourceProperties.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExtendedResourceProperties.java new file mode 100644 index 0000000000000..285982fcfe037 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ExtendedResourceProperties.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The system generated resource properties associated with SQL databases, SQL + * containers, Gremlin databases and Gremlin graphs. + */ +public class ExtendedResourceProperties { + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicies.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicies.java new file mode 100644 index 0000000000000..d170df68d136f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicy.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/FailoverPolicy.java new file mode 100644 index 0000000000000..2283f239429cb --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..697bf477563a7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB Gremlin database. + */ +@JsonFlatten +public class GremlinDatabaseCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a Gremlin database. + */ + @JsonProperty(value = "properties.resource", required = true) + private GremlinDatabaseResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a Gremlin database. + * + * @return the resource value + */ + public GremlinDatabaseResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a Gremlin database. + * + * @param resource the resource value to set + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withResource(GremlinDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the GremlinDatabaseCreateUpdateParameters object itself. + */ + public GremlinDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..97579578dd05b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetPropertiesResource.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The GremlinDatabaseGetPropertiesResource model. + */ +public class GremlinDatabaseGetPropertiesResource { + /** + * Name of the Cosmos DB Gremlin database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB Gremlin database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Gremlin database. + * + * @param id the id value to set + * @return the GremlinDatabaseGetPropertiesResource object itself. + */ + public GremlinDatabaseGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetResults.java new file mode 100644 index 0000000000000..61b50688b61b8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseGetResults.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.GremlinDatabaseGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing GremlinDatabaseGetResults. + */ +public interface GremlinDatabaseGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + GremlinDatabaseGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GremlinDatabaseGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of GremlinDatabaseGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GremlinDatabaseGetResults definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the gremlindatabasegetresults definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithLocation withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the gremlindatabasegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the gremlindatabasegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the gremlindatabasegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a Gremlin database + * @return the next definition stage + */ + WithCreate withResource(GremlinDatabaseResource resource); + } + + /** + * The stage of the gremlindatabasegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a GremlinDatabaseGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of GremlinDatabaseGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the gremlindatabasegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseResource.java new file mode 100644 index 0000000000000..9b3213db9ca77 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinDatabaseResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Gremlin database resource object. + */ +public class GremlinDatabaseResource { + /** + * Name of the Cosmos DB Gremlin database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get name of the Cosmos DB Gremlin database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Gremlin database. + * + * @param id the id value to set + * @return the GremlinDatabaseResource object itself. + */ + public GremlinDatabaseResource withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphCreateUpdateParameters.java new file mode 100644 index 0000000000000..178d4b1bfa4f7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB Gremlin graph. + */ +@JsonFlatten +public class GremlinGraphCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a Gremlin graph. + */ + @JsonProperty(value = "properties.resource", required = true) + private GremlinGraphResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a Gremlin graph. + * + * @return the resource value + */ + public GremlinGraphResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a Gremlin graph. + * + * @param resource the resource value to set + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withResource(GremlinGraphResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the GremlinGraphCreateUpdateParameters object itself. + */ + public GremlinGraphCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetPropertiesResource.java new file mode 100644 index 0000000000000..3a15d7103970f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetPropertiesResource.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The GremlinGraphGetPropertiesResource model. + */ +public class GremlinGraphGetPropertiesResource { + /** + * Name of the Cosmos DB Gremlin graph. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the graph. + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /** + * The configuration of the partition key to be used for partitioning data + * into multiple partitions. + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /** + * Default time to live. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /** + * The conflict resolution policy for the graph. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB Gremlin graph. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Gremlin graph. + * + * @param id the id value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + * + * @return the indexingPolicy value + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + * + * @param indexingPolicy the indexingPolicy value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @return the partitionKey value + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @param partitionKey the partitionKey value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get default time to live. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set default time to live. + * + * @param defaultTtl the defaultTtl value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflict resolution policy for the graph. + * + * @return the conflictResolutionPolicy value + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflict resolution policy for the graph. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the GremlinGraphGetPropertiesResource object itself. + */ + public GremlinGraphGetPropertiesResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetResults.java new file mode 100644 index 0000000000000..c4a81b9fd1219 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphGetResults.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.GremlinGraphGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing GremlinGraphGetResults. + */ +public interface GremlinGraphGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + GremlinGraphGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the GremlinGraphGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGremlinDatabasis, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of GremlinGraphGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a GremlinGraphGetResults definition. + */ + interface Blank extends WithGremlinDatabasis { + } + + /** + * The stage of the gremlingraphgetresults definition allowing to specify GremlinDatabasis. + */ + interface WithGremlinDatabasis { + /** + * Specifies resourceGroupName, accountName, databaseName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @return the next definition stage + */ + WithLocation withExistingGremlinDatabasis(String resourceGroupName, String accountName, String databaseName); + } + + /** + * The stage of the gremlingraphgetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the gremlingraphgetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the gremlingraphgetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a Gremlin graph + * @return the next definition stage + */ + WithCreate withResource(GremlinGraphResource resource); + } + + /** + * The stage of the gremlingraphgetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a GremlinGraphGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of GremlinGraphGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the gremlingraphgetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphResource.java new file mode 100644 index 0000000000000..d8d29097ae32f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinGraphResource.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB Gremlin graph resource object. + */ +public class GremlinGraphResource { + /** + * Name of the Cosmos DB Gremlin graph. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the graph. + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /** + * The configuration of the partition key to be used for partitioning data + * into multiple partitions. + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /** + * Default time to live. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /** + * The conflict resolution policy for the graph. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * Get name of the Cosmos DB Gremlin graph. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB Gremlin graph. + * + * @param id the id value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + * + * @return the indexingPolicy value + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the graph. + * + * @param indexingPolicy the indexingPolicy value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @return the partitionKey value + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @param partitionKey the partitionKey value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get default time to live. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set default time to live. + * + * @param defaultTtl the defaultTtl value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflict resolution policy for the graph. + * + * @return the conflictResolutionPolicy value + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflict resolution policy for the graph. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the GremlinGraphResource object itself. + */ + public GremlinGraphResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinResources.java new file mode 100644 index 0000000000000..98c55076b37d2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/GremlinResources.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseGetResults; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphGetResults; + +/** + * Type representing GremlinResources. + */ +public interface GremlinResources { + /** + * Begins definition for a new GremlinDatabasis resource. + * @param name resource name. + * @return the first stage of the new GremlinDatabasis definition. + */ + GremlinDatabaseGetResults.DefinitionStages.Blank defineGremlinDatabasis(String name); + + /** + * Begins definition for a new Graph resource. + * @param name resource name. + * @return the first stage of the new Graph definition. + */ + GremlinGraphGetResults.DefinitionStages.Blank defineGraph(String name); + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the Gremlin databases under 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 + */ + Observable listGremlinDatabasesAsync(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName); + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IncludedPath.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IncludedPath.java new file mode 100644 index 0000000000000..3d20b4633b55e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IncludedPath.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.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The paths that are included in indexing. + */ +public class IncludedPath { + /** + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*). + */ + @JsonProperty(value = "path") + private String path; + + /** + * List of indexes for this path. + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** + * Get the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @param path the path value to set + * @return the IncludedPath object itself. + */ + public IncludedPath withPath(String path) { + this.path = path; + return this; + } + + /** + * Get list of indexes for this path. + * + * @return the indexes value + */ + public List indexes() { + return this.indexes; + } + + /** + * Set list of indexes for this path. + * + * @param indexes the indexes value to set + * @return the IncludedPath object itself. + */ + public IncludedPath withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexKind.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexKind.java new file mode 100644 index 0000000000000..b1092324dd735 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexKind.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.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IndexKind. + */ +public final class IndexKind extends ExpandableStringEnum { + /** Static value Hash for IndexKind. */ + public static final IndexKind HASH = fromString("Hash"); + + /** Static value Range for IndexKind. */ + public static final IndexKind RANGE = fromString("Range"); + + /** Static value Spatial for IndexKind. */ + public static final IndexKind SPATIAL = fromString("Spatial"); + + /** + * Creates or finds a IndexKind from its string representation. + * @param name a name to look for + * @return the corresponding IndexKind + */ + @JsonCreator + public static IndexKind fromString(String name) { + return fromString(name, IndexKind.class); + } + + /** + * @return known IndexKind values + */ + public static Collection values() { + return values(IndexKind.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Indexes.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Indexes.java new file mode 100644 index 0000000000000..ab88bae82a4dd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Indexes.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The indexes for the path. + */ +public class Indexes { + /** + * The datatype for which the indexing behavior is applied to. Possible + * values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', + * 'MultiPolygon'. + */ + @JsonProperty(value = "dataType") + private DataType dataType; + + /** + * The precision of the index. -1 is maximum precision. + */ + @JsonProperty(value = "precision") + private Integer precision; + + /** + * Indicates the type of index. Possible values include: 'Hash', 'Range', + * 'Spatial'. + */ + @JsonProperty(value = "kind") + private IndexKind kind; + + /** + * Get the datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon'. + * + * @return the dataType value + */ + public DataType dataType() { + return this.dataType; + } + + /** + * Set the datatype for which the indexing behavior is applied to. Possible values include: 'String', 'Number', 'Point', 'Polygon', 'LineString', 'MultiPolygon'. + * + * @param dataType the dataType value to set + * @return the Indexes object itself. + */ + public Indexes withDataType(DataType dataType) { + this.dataType = dataType; + return this; + } + + /** + * Get the precision of the index. -1 is maximum precision. + * + * @return the precision value + */ + public Integer precision() { + return this.precision; + } + + /** + * Set the precision of the index. -1 is maximum precision. + * + * @param precision the precision value to set + * @return the Indexes object itself. + */ + public Indexes withPrecision(Integer precision) { + this.precision = precision; + return this; + } + + /** + * Get indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial'. + * + * @return the kind value + */ + public IndexKind kind() { + return this.kind; + } + + /** + * Set indicates the type of index. Possible values include: 'Hash', 'Range', 'Spatial'. + * + * @param kind the kind value to set + * @return the Indexes object itself. + */ + public Indexes withKind(IndexKind kind) { + this.kind = kind; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingMode.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingMode.java new file mode 100644 index 0000000000000..e189e465eebd5 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingMode.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.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for IndexingMode. + */ +public final class IndexingMode extends ExpandableStringEnum { + /** Static value Consistent for IndexingMode. */ + public static final IndexingMode CONSISTENT = fromString("Consistent"); + + /** Static value Lazy for IndexingMode. */ + public static final IndexingMode LAZY = fromString("Lazy"); + + /** Static value None for IndexingMode. */ + public static final IndexingMode NONE = fromString("None"); + + /** + * Creates or finds a IndexingMode from its string representation. + * @param name a name to look for + * @return the corresponding IndexingMode + */ + @JsonCreator + public static IndexingMode fromString(String name) { + return fromString(name, IndexingMode.class); + } + + /** + * @return known IndexingMode values + */ + public static Collection values() { + return values(IndexingMode.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingPolicy.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingPolicy.java new file mode 100644 index 0000000000000..5cf994b24a229 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/IndexingPolicy.java @@ -0,0 +1,175 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB indexing policy. + */ +public class IndexingPolicy { + /** + * Indicates if the indexing policy is automatic. + */ + @JsonProperty(value = "automatic") + private Boolean automatic; + + /** + * Indicates the indexing mode. Possible values include: 'Consistent', + * 'Lazy', 'None'. + */ + @JsonProperty(value = "indexingMode") + private IndexingMode indexingMode; + + /** + * List of paths to include in the indexing. + */ + @JsonProperty(value = "includedPaths") + private List includedPaths; + + /** + * List of paths to exclude from indexing. + */ + @JsonProperty(value = "excludedPaths") + private List excludedPaths; + + /** + * List of composite path list. + */ + @JsonProperty(value = "compositeIndexes") + private List> compositeIndexes; + + /** + * List of spatial specifics. + */ + @JsonProperty(value = "spatialIndexes") + private List spatialIndexes; + + /** + * Get indicates if the indexing policy is automatic. + * + * @return the automatic value + */ + public Boolean automatic() { + return this.automatic; + } + + /** + * Set indicates if the indexing policy is automatic. + * + * @param automatic the automatic value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withAutomatic(Boolean automatic) { + this.automatic = automatic; + return this; + } + + /** + * Get indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None'. + * + * @return the indexingMode value + */ + public IndexingMode indexingMode() { + return this.indexingMode; + } + + /** + * Set indicates the indexing mode. Possible values include: 'Consistent', 'Lazy', 'None'. + * + * @param indexingMode the indexingMode value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIndexingMode(IndexingMode indexingMode) { + this.indexingMode = indexingMode; + return this; + } + + /** + * Get list of paths to include in the indexing. + * + * @return the includedPaths value + */ + public List includedPaths() { + return this.includedPaths; + } + + /** + * Set list of paths to include in the indexing. + * + * @param includedPaths the includedPaths value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withIncludedPaths(List includedPaths) { + this.includedPaths = includedPaths; + return this; + } + + /** + * Get list of paths to exclude from indexing. + * + * @return the excludedPaths value + */ + public List excludedPaths() { + return this.excludedPaths; + } + + /** + * Set list of paths to exclude from indexing. + * + * @param excludedPaths the excludedPaths value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withExcludedPaths(List excludedPaths) { + this.excludedPaths = excludedPaths; + return this; + } + + /** + * Get list of composite path list. + * + * @return the compositeIndexes value + */ + public List> compositeIndexes() { + return this.compositeIndexes; + } + + /** + * Set list of composite path list. + * + * @param compositeIndexes the compositeIndexes value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withCompositeIndexes(List> compositeIndexes) { + this.compositeIndexes = compositeIndexes; + return this; + } + + /** + * Get list of spatial specifics. + * + * @return the spatialIndexes value + */ + public List spatialIndexes() { + return this.spatialIndexes; + } + + /** + * Set list of spatial specifics. + * + * @param spatialIndexes the spatialIndexes value to set + * @return the IndexingPolicy object itself. + */ + public IndexingPolicy withSpatialIndexes(List spatialIndexes) { + this.spatialIndexes = spatialIndexes; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/KeyKind.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/KeyKind.java new file mode 100644 index 0000000000000..32b18b1ef42c4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Location.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Location.java new file mode 100644 index 0000000000000..eda7e45540035 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Location.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +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; + + /** + * Flag to indicate whether or not this region is an AvailabilityZone + * region. + */ + @JsonProperty(value = "isZoneRedundant") + private Boolean isZoneRedundant; + + /** + * 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; + } + + /** + * Get flag to indicate whether or not this region is an AvailabilityZone region. + * + * @return the isZoneRedundant value + */ + public Boolean isZoneRedundant() { + return this.isZoneRedundant; + } + + /** + * Set flag to indicate whether or not this region is an AvailabilityZone region. + * + * @param isZoneRedundant the isZoneRedundant value to set + * @return the Location object itself. + */ + public Location withIsZoneRedundant(Boolean isZoneRedundant) { + this.isZoneRedundant = isZoneRedundant; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricAvailability.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricAvailability.java new file mode 100644 index 0000000000000..af4e750d1f97d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricName.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricName.java new file mode 100644 index 0000000000000..4e7386b8d698a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricValue.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MetricValue.java new file mode 100644 index 0000000000000..2e68fcea56eb7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionCreateUpdateParameters.java new file mode 100644 index 0000000000000..cfb5ba7236ad3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB MongoDB collection. + */ +@JsonFlatten +public class MongoDBCollectionCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a MongoDB collection. + */ + @JsonProperty(value = "properties.resource", required = true) + private MongoDBCollectionResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a MongoDB collection. + * + * @return the resource value + */ + public MongoDBCollectionResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a MongoDB collection. + * + * @param resource the resource value to set + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withResource(MongoDBCollectionResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the MongoDBCollectionCreateUpdateParameters object itself. + */ + public MongoDBCollectionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetPropertiesResource.java new file mode 100644 index 0000000000000..b6880010e65b3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetPropertiesResource.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MongoDBCollectionGetPropertiesResource model. + */ +public class MongoDBCollectionGetPropertiesResource { + /** + * Name of the Cosmos DB MongoDB collection. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A key-value pair of shard keys to be applied for the request. + */ + @JsonProperty(value = "shardKey") + private Map shardKey; + + /** + * List of index keys. + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB MongoDB collection. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB MongoDB collection. + * + * @param id the id value to set + * @return the MongoDBCollectionGetPropertiesResource object itself. + */ + public MongoDBCollectionGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a key-value pair of shard keys to be applied for the request. + * + * @return the shardKey value + */ + public Map shardKey() { + return this.shardKey; + } + + /** + * Set a key-value pair of shard keys to be applied for the request. + * + * @param shardKey the shardKey value to set + * @return the MongoDBCollectionGetPropertiesResource object itself. + */ + public MongoDBCollectionGetPropertiesResource withShardKey(Map shardKey) { + this.shardKey = shardKey; + return this; + } + + /** + * Get list of index keys. + * + * @return the indexes value + */ + public List indexes() { + return this.indexes; + } + + /** + * Set list of index keys. + * + * @param indexes the indexes value to set + * @return the MongoDBCollectionGetPropertiesResource object itself. + */ + public MongoDBCollectionGetPropertiesResource withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetResults.java new file mode 100644 index 0000000000000..7adfc851e5d21 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionGetResults.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MongoDBCollectionGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing MongoDBCollectionGetResults. + */ +public interface MongoDBCollectionGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + MongoDBCollectionGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the MongoDBCollectionGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithMongodbDatabasis, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of MongoDBCollectionGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a MongoDBCollectionGetResults definition. + */ + interface Blank extends WithMongodbDatabasis { + } + + /** + * The stage of the mongodbcollectiongetresults definition allowing to specify MongodbDatabasis. + */ + interface WithMongodbDatabasis { + /** + * Specifies resourceGroupName, accountName, databaseName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @return the next definition stage + */ + WithLocation withExistingMongodbDatabasis(String resourceGroupName, String accountName, String databaseName); + } + + /** + * The stage of the mongodbcollectiongetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the mongodbcollectiongetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the mongodbcollectiongetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a MongoDB collection + * @return the next definition stage + */ + WithCreate withResource(MongoDBCollectionResource resource); + } + + /** + * The stage of the mongodbcollectiongetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a MongoDBCollectionGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of MongoDBCollectionGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the mongodbcollectiongetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionResource.java new file mode 100644 index 0000000000000..fcd0809b50ced --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBCollectionResource.java @@ -0,0 +1,97 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Map; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB MongoDB collection resource object. + */ +public class MongoDBCollectionResource { + /** + * Name of the Cosmos DB MongoDB collection. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A key-value pair of shard keys to be applied for the request. + */ + @JsonProperty(value = "shardKey") + private Map shardKey; + + /** + * List of index keys. + */ + @JsonProperty(value = "indexes") + private List indexes; + + /** + * Get name of the Cosmos DB MongoDB collection. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB MongoDB collection. + * + * @param id the id value to set + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a key-value pair of shard keys to be applied for the request. + * + * @return the shardKey value + */ + public Map shardKey() { + return this.shardKey; + } + + /** + * Set a key-value pair of shard keys to be applied for the request. + * + * @param shardKey the shardKey value to set + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withShardKey(Map shardKey) { + this.shardKey = shardKey; + return this; + } + + /** + * Get list of index keys. + * + * @return the indexes value + */ + public List indexes() { + return this.indexes; + } + + /** + * Set list of index keys. + * + * @param indexes the indexes value to set + * @return the MongoDBCollectionResource object itself. + */ + public MongoDBCollectionResource withIndexes(List indexes) { + this.indexes = indexes; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..84fe83178413d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB MongoDB database. + */ +@JsonFlatten +public class MongoDBDatabaseCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a MongoDB database. + */ + @JsonProperty(value = "properties.resource", required = true) + private MongoDBDatabaseResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a MongoDB database. + * + * @return the resource value + */ + public MongoDBDatabaseResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a MongoDB database. + * + * @param resource the resource value to set + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withResource(MongoDBDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the MongoDBDatabaseCreateUpdateParameters object itself. + */ + public MongoDBDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..0f737965803b1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetPropertiesResource.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The MongoDBDatabaseGetPropertiesResource model. + */ +public class MongoDBDatabaseGetPropertiesResource { + /** + * Name of the Cosmos DB MongoDB database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB MongoDB database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB MongoDB database. + * + * @param id the id value to set + * @return the MongoDBDatabaseGetPropertiesResource object itself. + */ + public MongoDBDatabaseGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetResults.java new file mode 100644 index 0000000000000..de8b6a3834830 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseGetResults.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.MongoDBDatabaseGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing MongoDBDatabaseGetResults. + */ +public interface MongoDBDatabaseGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + MongoDBDatabaseGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the MongoDBDatabaseGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of MongoDBDatabaseGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a MongoDBDatabaseGetResults definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the mongodbdatabasegetresults definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithLocation withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the mongodbdatabasegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the mongodbdatabasegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the mongodbdatabasegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a MongoDB database + * @return the next definition stage + */ + WithCreate withResource(MongoDBDatabaseResource resource); + } + + /** + * The stage of the mongodbdatabasegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a MongoDBDatabaseGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of MongoDBDatabaseGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the mongodbdatabasegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseResource.java new file mode 100644 index 0000000000000..50652318a8fb1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBDatabaseResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB MongoDB database resource object. + */ +public class MongoDBDatabaseResource { + /** + * Name of the Cosmos DB MongoDB database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get name of the Cosmos DB MongoDB database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB MongoDB database. + * + * @param id the id value to set + * @return the MongoDBDatabaseResource object itself. + */ + public MongoDBDatabaseResource withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBResources.java new file mode 100644 index 0000000000000..24322a31f5d79 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoDBResources.java @@ -0,0 +1,149 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseGetResults; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionGetResults; + +/** + * Type representing MongoDBResources. + */ +public interface MongoDBResources { + /** + * Begins definition for a new MongodbDatabasis resource. + * @param name resource name. + * @return the first stage of the new MongodbDatabasis definition. + */ + MongoDBDatabaseGetResults.DefinitionStages.Blank defineMongodbDatabasis(String name); + + /** + * Begins definition for a new Collection resource. + * @param name resource name. + * @return the first stage of the new Collection definition. + */ + MongoDBCollectionGetResults.DefinitionStages.Blank defineCollection(String name); + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the MongoDB databases under 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 + */ + Observable listMongoDBDatabasesAsync(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName); + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndex.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndex.java new file mode 100644 index 0000000000000..ba56e3a332f8b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndex.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB MongoDB collection index key. + */ +public class MongoIndex { + /** + * Cosmos DB MongoDB collection index keys. + */ + @JsonProperty(value = "key") + private MongoIndexKeys key; + + /** + * Cosmos DB MongoDB collection index key options. + */ + @JsonProperty(value = "options") + private MongoIndexOptions options; + + /** + * Get cosmos DB MongoDB collection index keys. + * + * @return the key value + */ + public MongoIndexKeys key() { + return this.key; + } + + /** + * Set cosmos DB MongoDB collection index keys. + * + * @param key the key value to set + * @return the MongoIndex object itself. + */ + public MongoIndex withKey(MongoIndexKeys key) { + this.key = key; + return this; + } + + /** + * Get cosmos DB MongoDB collection index key options. + * + * @return the options value + */ + public MongoIndexOptions options() { + return this.options; + } + + /** + * Set cosmos DB MongoDB collection index key options. + * + * @param options the options value to set + * @return the MongoIndex object itself. + */ + public MongoIndex withOptions(MongoIndexOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexKeys.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexKeys.java new file mode 100644 index 0000000000000..1005bf9103871 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexKeys.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.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB MongoDB collection resource object. + */ +public class MongoIndexKeys { + /** + * List of keys for each MongoDB collection in the Azure Cosmos DB service. + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Get list of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @return the keys value + */ + public List keys() { + return this.keys; + } + + /** + * Set list of keys for each MongoDB collection in the Azure Cosmos DB service. + * + * @param keys the keys value to set + * @return the MongoIndexKeys object itself. + */ + public MongoIndexKeys withKeys(List keys) { + this.keys = keys; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexOptions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexOptions.java new file mode 100644 index 0000000000000..b84bcf60b032f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/MongoIndexOptions.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB MongoDB collection index options. + */ +public class MongoIndexOptions { + /** + * Expire after seconds. + */ + @JsonProperty(value = "expireAfterSeconds") + private Integer expireAfterSeconds; + + /** + * Is unique or not. + */ + @JsonProperty(value = "unique") + private Boolean unique; + + /** + * Get expire after seconds. + * + * @return the expireAfterSeconds value + */ + public Integer expireAfterSeconds() { + return this.expireAfterSeconds; + } + + /** + * Set expire after seconds. + * + * @param expireAfterSeconds the expireAfterSeconds value to set + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withExpireAfterSeconds(Integer expireAfterSeconds) { + this.expireAfterSeconds = expireAfterSeconds; + return this; + } + + /** + * Get is unique or not. + * + * @return the unique value + */ + public Boolean unique() { + return this.unique; + } + + /** + * Set is unique or not. + * + * @param unique the unique value to set + * @return the MongoIndexOptions object itself. + */ + public MongoIndexOptions withUnique(Boolean unique) { + this.unique = unique; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operation.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operation.java new file mode 100644 index 0000000000000..576519ddf2c61 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.OperationInner; + +/** + * Type representing Operation. + */ +public interface Operation extends HasInner, HasManager { + /** + * @return the display value. + */ + OperationDisplay display(); + + /** + * @return the name value. + */ + String name(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/OperationDisplay.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/OperationDisplay.java new file mode 100644 index 0000000000000..20007e56869e3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operations.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Operations.java new file mode 100644 index 0000000000000..5660621ca5f23 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIdRegions.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIdRegions.java new file mode 100644 index 0000000000000..dd00ee5a52d42 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIds.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKeyRangeIds.java new file mode 100644 index 0000000000000..e554c814d2934 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKind.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKind.java new file mode 100644 index 0000000000000..69dbaa532fbba --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionKind.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for PartitionKind. + */ +public final class PartitionKind extends ExpandableStringEnum { + /** Static value Hash for PartitionKind. */ + public static final PartitionKind HASH = fromString("Hash"); + + /** Static value Range for PartitionKind. */ + public static final PartitionKind RANGE = fromString("Range"); + + /** + * Creates or finds a PartitionKind from its string representation. + * @param name a name to look for + * @return the corresponding PartitionKind + */ + @JsonCreator + public static PartitionKind fromString(String name) { + return fromString(name, PartitionKind.class); + } + + /** + * @return known PartitionKind values + */ + public static Collection values() { + return values(PartitionKind.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionMetric.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionMetric.java new file mode 100644 index 0000000000000..89bca2d1d87e0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionUsage.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PartitionUsage.java new file mode 100644 index 0000000000000..01870923b1286 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.PartitionUsageInner; + +/** + * Type representing PartitionUsage. + */ +public interface PartitionUsage extends HasInner, HasManager { + /** + * @return the currentValue value. + */ + Long currentValue(); + + /** + * @return the limit value. + */ + Long 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetric.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetric.java new file mode 100644 index 0000000000000..b576a2e605ef6 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetricValue.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileMetricValue.java new file mode 100644 index 0000000000000..c52bd1f76a8a7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileSourceTargets.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileSourceTargets.java new file mode 100644 index 0000000000000..ac2bedb22f73c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileTargets.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PercentileTargets.java new file mode 100644 index 0000000000000..e7f0fb31045cc --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Percentiles.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/Percentiles.java new file mode 100644 index 0000000000000..b34225d9f1a95 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrimaryAggregationType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrimaryAggregationType.java new file mode 100644 index 0000000000000..d7a4ee380f50a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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 Minimum for PrimaryAggregationType. */ + public static final PrimaryAggregationType MINIMUM = fromString("Minimum"); + + /** 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnection.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..5171ac2376797 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnection.java @@ -0,0 +1,146 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.PrivateEndpointConnectionInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; + +/** + * Type representing PrivateEndpointConnection. + */ +public interface PrivateEndpointConnection extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the PrivateEndpointConnection definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithCreate { + } + + /** + * Grouping of PrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a PrivateEndpointConnection definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the privateendpointconnection definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName The name of the resource group. The name is case insensitive + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithCreate withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the privateendpointconnection definition allowing to specify PrivateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies privateEndpoint. + * @param privateEndpoint Private endpoint which the connection belongs to + * @return the next definition stage + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + + /** + * The stage of the privateendpointconnection definition allowing to specify PrivateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies privateLinkServiceConnectionState. + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection + * @return the next definition stage + */ + WithCreate withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + } + } + /** + * The template for a PrivateEndpointConnection update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + } + + /** + * Grouping of PrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the privateendpointconnection update allowing to specify PrivateEndpoint. + */ + interface WithPrivateEndpoint { + /** + * Specifies privateEndpoint. + * @param privateEndpoint Private endpoint which the connection belongs to + * @return the next update stage + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + + /** + * The stage of the privateendpointconnection update allowing to specify PrivateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies privateLinkServiceConnectionState. + * @param privateLinkServiceConnectionState Connection State of the Private Endpoint Connection + * @return the next update stage + */ + Update withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnections.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..520b69c5bc4dd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointConnections.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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.collection.SupportsCreating; +import rx.Completable; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.PrivateEndpointConnectionsInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PrivateEndpointConnections. + */ +public interface PrivateEndpointConnections extends SupportsCreating, HasInner { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName); + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listByDatabaseAccountAsync(String resourceGroupName, String accountName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointProperty.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..f4d3a8bb569a4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateEndpointProperty.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Private endpoint which the connection belongs to. + */ +public class PrivateEndpointProperty { + /** + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get resource id of the private endpoint. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource id of the private endpoint. + * + * @param id the id value to set + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResource.java new file mode 100644 index 0000000000000..72f85698411e4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResource.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.PrivateLinkResourceInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.List; + +/** + * Type representing PrivateLinkResource. + */ +public interface PrivateLinkResource extends HasInner, Indexable, Refreshable, HasManager { + /** + * @return the groupId value. + */ + String groupId(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResources.java new file mode 100644 index 0000000000000..4fc657af11f8f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkResources.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.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.PrivateLinkResourcesInner; +import com.microsoft.azure.arm.model.HasInner; + +/** + * Type representing PrivateLinkResources. + */ +public interface PrivateLinkResources extends HasInner { + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getAsync(String resourceGroupName, String accountName, String groupName); + + /** + * Gets the private link resources that need to be created for a Cosmos DB 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 listByDatabaseAccountAsync(String resourceGroupName, String accountName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkServiceConnectionStateProperty.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..0538409702075 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Connection State of the Private Endpoint Connection. + */ +public class PrivateLinkServiceConnectionStateProperty { + /** + * The private link service connection status. + */ + @JsonProperty(value = "status") + private String status; + + /** + * The private link service connection description. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Any action that is required beyond basic workflow (approve/ reject/ + * disconnect). + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the private link service connection status. + * + * @return the status value + */ + public String status() { + return this.status; + } + + /** + * Set the private link service connection status. + * + * @param status the status value to set + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the private link service connection description. + * + * @return the description value + */ + public String description() { + return this.description; + } + + /** + * Set the private link service connection description. + * + * @param description the description value to set + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get any action that is required beyond basic workflow (approve/ reject/ disconnect). + * + * @return the actionsRequired value + */ + public String actionsRequired() { + return this.actionsRequired; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/RegionForOnlineOffline.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/RegionForOnlineOffline.java new file mode 100644 index 0000000000000..9d82519c07fcd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialSpec.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialSpec.java new file mode 100644 index 0000000000000..0e7b11c71bf18 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialSpec.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.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SpatialSpec model. + */ +public class SpatialSpec { + /** + * The path for which the indexing behavior applies to. Index paths + * typically start with root and end with wildcard (/path/*). + */ + @JsonProperty(value = "path") + private String path; + + /** + * List of path's spatial type. + */ + @JsonProperty(value = "types") + private List types; + + /** + * Get the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @return the path value + */ + public String path() { + return this.path; + } + + /** + * Set the path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*). + * + * @param path the path value to set + * @return the SpatialSpec object itself. + */ + public SpatialSpec withPath(String path) { + this.path = path; + return this; + } + + /** + * Get list of path's spatial type. + * + * @return the types value + */ + public List types() { + return this.types; + } + + /** + * Set list of path's spatial type. + * + * @param types the types value to set + * @return the SpatialSpec object itself. + */ + public SpatialSpec withTypes(List types) { + this.types = types; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialType.java new file mode 100644 index 0000000000000..acc58019dd732 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SpatialType.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.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for SpatialType. + */ +public final class SpatialType extends ExpandableStringEnum { + /** Static value Point for SpatialType. */ + public static final SpatialType POINT = fromString("Point"); + + /** Static value LineString for SpatialType. */ + public static final SpatialType LINE_STRING = fromString("LineString"); + + /** Static value Polygon for SpatialType. */ + public static final SpatialType POLYGON = fromString("Polygon"); + + /** Static value MultiPolygon for SpatialType. */ + public static final SpatialType MULTI_POLYGON = fromString("MultiPolygon"); + + /** + * Creates or finds a SpatialType from its string representation. + * @param name a name to look for + * @return the corresponding SpatialType + */ + @JsonCreator + public static SpatialType fromString(String name) { + return fromString(name, SpatialType.class); + } + + /** + * @return known SpatialType values + */ + public static Collection values() { + return values(SpatialType.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerCreateUpdateParameters.java new file mode 100644 index 0000000000000..88584f47b731a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB container. + */ +@JsonFlatten +public class SqlContainerCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a container. + */ + @JsonProperty(value = "properties.resource", required = true) + private SqlContainerResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a container. + * + * @return the resource value + */ + public SqlContainerResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a container. + * + * @param resource the resource value to set + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withResource(SqlContainerResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the SqlContainerCreateUpdateParameters object itself. + */ + public SqlContainerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetPropertiesResource.java new file mode 100644 index 0000000000000..f1174fb672276 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetPropertiesResource.java @@ -0,0 +1,224 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SqlContainerGetPropertiesResource model. + */ +public class SqlContainerGetPropertiesResource { + /** + * Name of the Cosmos DB SQL container. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the container. + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /** + * The configuration of the partition key to be used for partitioning data + * into multiple partitions. + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /** + * Default time to live. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /** + * The conflict resolution policy for the container. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB SQL container. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL container. + * + * @param id the id value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + * + * @return the indexingPolicy value + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + * + * @param indexingPolicy the indexingPolicy value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @return the partitionKey value + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @param partitionKey the partitionKey value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get default time to live. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set default time to live. + * + * @param defaultTtl the defaultTtl value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflict resolution policy for the container. + * + * @return the conflictResolutionPolicy value + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflict resolution policy for the container. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the SqlContainerGetPropertiesResource object itself. + */ + public SqlContainerGetPropertiesResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetResults.java new file mode 100644 index 0000000000000..24530bd9a31c1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerGetResults.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.SqlContainerGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing SqlContainerGetResults. + */ +public interface SqlContainerGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + SqlContainerGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SqlContainerGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithSqlDatabasis, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of SqlContainerGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SqlContainerGetResults definition. + */ + interface Blank extends WithSqlDatabasis { + } + + /** + * The stage of the sqlcontainergetresults definition allowing to specify SqlDatabasis. + */ + interface WithSqlDatabasis { + /** + * Specifies resourceGroupName, accountName, databaseName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @return the next definition stage + */ + WithLocation withExistingSqlDatabasis(String resourceGroupName, String accountName, String databaseName); + } + + /** + * The stage of the sqlcontainergetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the sqlcontainergetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the sqlcontainergetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a container + * @return the next definition stage + */ + WithCreate withResource(SqlContainerResource resource); + } + + /** + * The stage of the sqlcontainergetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a SqlContainerGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of SqlContainerGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the sqlcontainergetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerResource.java new file mode 100644 index 0000000000000..f3866c994f70c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlContainerResource.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB SQL container resource object. + */ +public class SqlContainerResource { + /** + * Name of the Cosmos DB SQL container. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * The configuration of the indexing policy. By default, the indexing is + * automatic for all document paths within the container. + */ + @JsonProperty(value = "indexingPolicy") + private IndexingPolicy indexingPolicy; + + /** + * The configuration of the partition key to be used for partitioning data + * into multiple partitions. + */ + @JsonProperty(value = "partitionKey") + private ContainerPartitionKey partitionKey; + + /** + * Default time to live. + */ + @JsonProperty(value = "defaultTtl") + private Integer defaultTtl; + + /** + * The unique key policy configuration for specifying uniqueness + * constraints on documents in the collection in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "uniqueKeyPolicy") + private UniqueKeyPolicy uniqueKeyPolicy; + + /** + * The conflict resolution policy for the container. + */ + @JsonProperty(value = "conflictResolutionPolicy") + private ConflictResolutionPolicy conflictResolutionPolicy; + + /** + * Get name of the Cosmos DB SQL container. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL container. + * + * @param id the id value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + * + * @return the indexingPolicy value + */ + public IndexingPolicy indexingPolicy() { + return this.indexingPolicy; + } + + /** + * Set the configuration of the indexing policy. By default, the indexing is automatic for all document paths within the container. + * + * @param indexingPolicy the indexingPolicy value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withIndexingPolicy(IndexingPolicy indexingPolicy) { + this.indexingPolicy = indexingPolicy; + return this; + } + + /** + * Get the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @return the partitionKey value + */ + public ContainerPartitionKey partitionKey() { + return this.partitionKey; + } + + /** + * Set the configuration of the partition key to be used for partitioning data into multiple partitions. + * + * @param partitionKey the partitionKey value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withPartitionKey(ContainerPartitionKey partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get default time to live. + * + * @return the defaultTtl value + */ + public Integer defaultTtl() { + return this.defaultTtl; + } + + /** + * Set default time to live. + * + * @param defaultTtl the defaultTtl value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withDefaultTtl(Integer defaultTtl) { + this.defaultTtl = defaultTtl; + return this; + } + + /** + * Get the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeyPolicy value + */ + public UniqueKeyPolicy uniqueKeyPolicy() { + return this.uniqueKeyPolicy; + } + + /** + * Set the unique key policy configuration for specifying uniqueness constraints on documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeyPolicy the uniqueKeyPolicy value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withUniqueKeyPolicy(UniqueKeyPolicy uniqueKeyPolicy) { + this.uniqueKeyPolicy = uniqueKeyPolicy; + return this; + } + + /** + * Get the conflict resolution policy for the container. + * + * @return the conflictResolutionPolicy value + */ + public ConflictResolutionPolicy conflictResolutionPolicy() { + return this.conflictResolutionPolicy; + } + + /** + * Set the conflict resolution policy for the container. + * + * @param conflictResolutionPolicy the conflictResolutionPolicy value to set + * @return the SqlContainerResource object itself. + */ + public SqlContainerResource withConflictResolutionPolicy(ConflictResolutionPolicy conflictResolutionPolicy) { + this.conflictResolutionPolicy = conflictResolutionPolicy; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseCreateUpdateParameters.java new file mode 100644 index 0000000000000..ed8ac7cd2d3b0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB SQL database. + */ +@JsonFlatten +public class SqlDatabaseCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a SQL database. + */ + @JsonProperty(value = "properties.resource", required = true) + private SqlDatabaseResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a SQL database. + * + * @return the resource value + */ + public SqlDatabaseResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a SQL database. + * + * @param resource the resource value to set + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withResource(SqlDatabaseResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the SqlDatabaseCreateUpdateParameters object itself. + */ + public SqlDatabaseCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetPropertiesResource.java new file mode 100644 index 0000000000000..07f4b7c791b9c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetPropertiesResource.java @@ -0,0 +1,144 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SqlDatabaseGetPropertiesResource model. + */ +public class SqlDatabaseGetPropertiesResource { + /** + * Name of the Cosmos DB SQL database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * A system generated property that specified the addressable path of the + * collections resource. + */ + @JsonProperty(value = "_colls") + private String _colls; + + /** + * A system generated property that specifies the addressable path of the + * users resource. + */ + @JsonProperty(value = "_users") + private String _users; + + /** + * Get name of the Cosmos DB SQL database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL database. + * + * @param id the id value to set + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + + /** + * Get a system generated property that specified the addressable path of the collections resource. + * + * @return the _colls value + */ + public String _colls() { + return this._colls; + } + + /** + * Set a system generated property that specified the addressable path of the collections resource. + * + * @param _colls the _colls value to set + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource with_colls(String _colls) { + this._colls = _colls; + return this; + } + + /** + * Get a system generated property that specifies the addressable path of the users resource. + * + * @return the _users value + */ + public String _users() { + return this._users; + } + + /** + * Set a system generated property that specifies the addressable path of the users resource. + * + * @param _users the _users value to set + * @return the SqlDatabaseGetPropertiesResource object itself. + */ + public SqlDatabaseGetPropertiesResource with_users(String _users) { + this._users = _users; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetResults.java new file mode 100644 index 0000000000000..48beb28d32b4b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseGetResults.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.SqlDatabaseGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing SqlDatabaseGetResults. + */ +public interface SqlDatabaseGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + SqlDatabaseGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SqlDatabaseGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of SqlDatabaseGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SqlDatabaseGetResults definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the sqldatabasegetresults definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithLocation withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the sqldatabasegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the sqldatabasegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the sqldatabasegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a SQL database + * @return the next definition stage + */ + WithCreate withResource(SqlDatabaseResource resource); + } + + /** + * The stage of the sqldatabasegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a SqlDatabaseGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of SqlDatabaseGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the sqldatabasegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseResource.java new file mode 100644 index 0000000000000..d249606939fc8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlDatabaseResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB SQL database resource object. + */ +public class SqlDatabaseResource { + /** + * Name of the Cosmos DB SQL database. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get name of the Cosmos DB SQL database. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL database. + * + * @param id the id value to set + * @return the SqlDatabaseResource object itself. + */ + public SqlDatabaseResource withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlResources.java new file mode 100644 index 0000000000000..0387d6d896bfe --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlResources.java @@ -0,0 +1,287 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseGetResults; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerGetResults; + +/** + * Type representing SqlResources. + */ +public interface SqlResources { + /** + * Begins definition for a new SqlDatabasis resource. + * @param name resource name. + * @return the first stage of the new SqlDatabasis definition. + */ + SqlDatabaseGetResults.DefinitionStages.Blank defineSqlDatabasis(String name); + + /** + * Begins definition for a new Container resource. + * @param name resource name. + * @return the first stage of the new Container definition. + */ + SqlContainerGetResults.DefinitionStages.Blank defineContainer(String name); + + /** + * Begins definition for a new StoredProcedure resource. + * @param name resource name. + * @return the first stage of the new StoredProcedure definition. + */ + SqlStoredProcedureGetResults.DefinitionStages.Blank defineStoredProcedure(String name); + + /** + * Begins definition for a new UserDefinedFunction resource. + * @param name resource name. + * @return the first stage of the new UserDefinedFunction definition. + */ + SqlUserDefinedFunctionGetResults.DefinitionStages.Blank defineUserDefinedFunction(String name); + + /** + * Begins definition for a new Trigger resource. + * @param name resource name. + * @return the first stage of the new Trigger definition. + */ + SqlTriggerGetResults.DefinitionStages.Blank defineTrigger(String name); + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Lists the SQL databases under 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 + */ + Observable listSqlDatabasesAsync(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters); + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName); + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName); + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSqlStoredProceduresAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName); + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName); + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSqlUserDefinedFunctionsAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName); + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable listSqlTriggersAsync(String resourceGroupName, String accountName, String databaseName, String containerName); + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureCreateUpdateParameters.java new file mode 100644 index 0000000000000..0cea6d09fdef7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB storedProcedure. + */ +@JsonFlatten +public class SqlStoredProcedureCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a storedProcedure. + */ + @JsonProperty(value = "properties.resource", required = true) + private SqlStoredProcedureResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a storedProcedure. + * + * @return the resource value + */ + public SqlStoredProcedureResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a storedProcedure. + * + * @param resource the resource value to set + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withResource(SqlStoredProcedureResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the SqlStoredProcedureCreateUpdateParameters object itself. + */ + public SqlStoredProcedureCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetPropertiesResource.java new file mode 100644 index 0000000000000..7aa91e74d01c4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetPropertiesResource.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SqlStoredProcedureGetPropertiesResource model. + */ +public class SqlStoredProcedureGetPropertiesResource { + /** + * Name of the Cosmos DB SQL storedProcedure. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the Stored Procedure. + */ + @JsonProperty(value = "body") + private String body; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB SQL storedProcedure. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL storedProcedure. + * + * @param id the id value to set + * @return the SqlStoredProcedureGetPropertiesResource object itself. + */ + public SqlStoredProcedureGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the Stored Procedure. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the Stored Procedure. + * + * @param body the body value to set + * @return the SqlStoredProcedureGetPropertiesResource object itself. + */ + public SqlStoredProcedureGetPropertiesResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetResults.java new file mode 100644 index 0000000000000..308f0d57c3e1a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureGetResults.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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.SqlStoredProcedureGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing SqlStoredProcedureGetResults. + */ +public interface SqlStoredProcedureGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + SqlStoredProcedureGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SqlStoredProcedureGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithContainer, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of SqlStoredProcedureGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SqlStoredProcedureGetResults definition. + */ + interface Blank extends WithContainer { + } + + /** + * The stage of the sqlstoredproceduregetresults definition allowing to specify Container. + */ + interface WithContainer { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @param containerName Cosmos DB container name + * @return the next definition stage + */ + WithLocation withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + } + + /** + * The stage of the sqlstoredproceduregetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the sqlstoredproceduregetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the sqlstoredproceduregetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a storedProcedure + * @return the next definition stage + */ + WithCreate withResource(SqlStoredProcedureResource resource); + } + + /** + * The stage of the sqlstoredproceduregetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a SqlStoredProcedureGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of SqlStoredProcedureGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the sqlstoredproceduregetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureResource.java new file mode 100644 index 0000000000000..b059e42543161 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlStoredProcedureResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB SQL storedProcedure resource object. + */ +public class SqlStoredProcedureResource { + /** + * Name of the Cosmos DB SQL storedProcedure. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the Stored Procedure. + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get name of the Cosmos DB SQL storedProcedure. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL storedProcedure. + * + * @param id the id value to set + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the Stored Procedure. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the Stored Procedure. + * + * @param body the body value to set + * @return the SqlStoredProcedureResource object itself. + */ + public SqlStoredProcedureResource withBody(String body) { + this.body = body; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerCreateUpdateParameters.java new file mode 100644 index 0000000000000..f04b763664efd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB trigger. + */ +@JsonFlatten +public class SqlTriggerCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a trigger. + */ + @JsonProperty(value = "properties.resource", required = true) + private SqlTriggerResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a trigger. + * + * @return the resource value + */ + public SqlTriggerResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a trigger. + * + * @param resource the resource value to set + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withResource(SqlTriggerResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the SqlTriggerCreateUpdateParameters object itself. + */ + public SqlTriggerCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetPropertiesResource.java new file mode 100644 index 0000000000000..6bd89dfd91d21 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetPropertiesResource.java @@ -0,0 +1,169 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SqlTriggerGetPropertiesResource model. + */ +public class SqlTriggerGetPropertiesResource { + /** + * Name of the Cosmos DB SQL trigger. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the Trigger. + */ + @JsonProperty(value = "body") + private String body; + + /** + * Type of the Trigger. Possible values include: 'Pre', 'Post'. + */ + @JsonProperty(value = "triggerType") + private TriggerType triggerType; + + /** + * The operation the trigger is associated with. Possible values include: + * 'All', 'Create', 'Update', 'Delete', 'Replace'. + */ + @JsonProperty(value = "triggerOperation") + private TriggerOperation triggerOperation; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB SQL trigger. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL trigger. + * + * @param id the id value to set + * @return the SqlTriggerGetPropertiesResource object itself. + */ + public SqlTriggerGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the Trigger. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the Trigger. + * + * @param body the body value to set + * @return the SqlTriggerGetPropertiesResource object itself. + */ + public SqlTriggerGetPropertiesResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get type of the Trigger. Possible values include: 'Pre', 'Post'. + * + * @return the triggerType value + */ + public TriggerType triggerType() { + return this.triggerType; + } + + /** + * Set type of the Trigger. Possible values include: 'Pre', 'Post'. + * + * @param triggerType the triggerType value to set + * @return the SqlTriggerGetPropertiesResource object itself. + */ + public SqlTriggerGetPropertiesResource withTriggerType(TriggerType triggerType) { + this.triggerType = triggerType; + return this; + } + + /** + * Get the operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace'. + * + * @return the triggerOperation value + */ + public TriggerOperation triggerOperation() { + return this.triggerOperation; + } + + /** + * Set the operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace'. + * + * @param triggerOperation the triggerOperation value to set + * @return the SqlTriggerGetPropertiesResource object itself. + */ + public SqlTriggerGetPropertiesResource withTriggerOperation(TriggerOperation triggerOperation) { + this.triggerOperation = triggerOperation; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetResults.java new file mode 100644 index 0000000000000..56e306635a4d2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerGetResults.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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.SqlTriggerGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing SqlTriggerGetResults. + */ +public interface SqlTriggerGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + SqlTriggerGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SqlTriggerGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithContainer, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of SqlTriggerGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SqlTriggerGetResults definition. + */ + interface Blank extends WithContainer { + } + + /** + * The stage of the sqltriggergetresults definition allowing to specify Container. + */ + interface WithContainer { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @param containerName Cosmos DB container name + * @return the next definition stage + */ + WithLocation withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + } + + /** + * The stage of the sqltriggergetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the sqltriggergetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the sqltriggergetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a trigger + * @return the next definition stage + */ + WithCreate withResource(SqlTriggerResource resource); + } + + /** + * The stage of the sqltriggergetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a SqlTriggerGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of SqlTriggerGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the sqltriggergetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerResource.java new file mode 100644 index 0000000000000..f446fc8a15ae9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlTriggerResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB SQL trigger resource object. + */ +public class SqlTriggerResource { + /** + * Name of the Cosmos DB SQL trigger. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the Trigger. + */ + @JsonProperty(value = "body") + private String body; + + /** + * Type of the Trigger. Possible values include: 'Pre', 'Post'. + */ + @JsonProperty(value = "triggerType") + private TriggerType triggerType; + + /** + * The operation the trigger is associated with. Possible values include: + * 'All', 'Create', 'Update', 'Delete', 'Replace'. + */ + @JsonProperty(value = "triggerOperation") + private TriggerOperation triggerOperation; + + /** + * Get name of the Cosmos DB SQL trigger. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL trigger. + * + * @param id the id value to set + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the Trigger. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the Trigger. + * + * @param body the body value to set + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get type of the Trigger. Possible values include: 'Pre', 'Post'. + * + * @return the triggerType value + */ + public TriggerType triggerType() { + return this.triggerType; + } + + /** + * Set type of the Trigger. Possible values include: 'Pre', 'Post'. + * + * @param triggerType the triggerType value to set + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerType(TriggerType triggerType) { + this.triggerType = triggerType; + return this; + } + + /** + * Get the operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace'. + * + * @return the triggerOperation value + */ + public TriggerOperation triggerOperation() { + return this.triggerOperation; + } + + /** + * Set the operation the trigger is associated with. Possible values include: 'All', 'Create', 'Update', 'Delete', 'Replace'. + * + * @param triggerOperation the triggerOperation value to set + * @return the SqlTriggerResource object itself. + */ + public SqlTriggerResource withTriggerOperation(TriggerOperation triggerOperation) { + this.triggerOperation = triggerOperation; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionCreateUpdateParameters.java new file mode 100644 index 0000000000000..477c26db0a7f4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionCreateUpdateParameters.java @@ -0,0 +1,72 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB userDefinedFunction. + */ +@JsonFlatten +public class SqlUserDefinedFunctionCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a userDefinedFunction. + */ + @JsonProperty(value = "properties.resource", required = true) + private SqlUserDefinedFunctionResource resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a userDefinedFunction. + * + * @return the resource value + */ + public SqlUserDefinedFunctionResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a userDefinedFunction. + * + * @param resource the resource value to set + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withResource(SqlUserDefinedFunctionResource resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the SqlUserDefinedFunctionCreateUpdateParameters object itself. + */ + public SqlUserDefinedFunctionCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetPropertiesResource.java new file mode 100644 index 0000000000000..97bb120f4c8d8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetPropertiesResource.java @@ -0,0 +1,116 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The SqlUserDefinedFunctionGetPropertiesResource model. + */ +public class SqlUserDefinedFunctionGetPropertiesResource { + /** + * Name of the Cosmos DB SQL userDefinedFunction. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the User Defined Function. + */ + @JsonProperty(value = "body") + private String body; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB SQL userDefinedFunction. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL userDefinedFunction. + * + * @param id the id value to set + * @return the SqlUserDefinedFunctionGetPropertiesResource object itself. + */ + public SqlUserDefinedFunctionGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the User Defined Function. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the User Defined Function. + * + * @param body the body value to set + * @return the SqlUserDefinedFunctionGetPropertiesResource object itself. + */ + public SqlUserDefinedFunctionGetPropertiesResource withBody(String body) { + this.body = body; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetResults.java new file mode 100644 index 0000000000000..910c0dcbddfbb --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionGetResults.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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.SqlUserDefinedFunctionGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import java.util.Map; + +/** + * Type representing SqlUserDefinedFunctionGetResults. + */ +public interface SqlUserDefinedFunctionGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + SqlUserDefinedFunctionGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the SqlUserDefinedFunctionGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithContainer, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of SqlUserDefinedFunctionGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a SqlUserDefinedFunctionGetResults definition. + */ + interface Blank extends WithContainer { + } + + /** + * The stage of the sqluserdefinedfunctiongetresults definition allowing to specify Container. + */ + interface WithContainer { + /** + * Specifies resourceGroupName, accountName, databaseName, containerName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @param databaseName Cosmos DB database name + * @param containerName Cosmos DB container name + * @return the next definition stage + */ + WithLocation withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName); + } + + /** + * The stage of the sqluserdefinedfunctiongetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the sqluserdefinedfunctiongetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the sqluserdefinedfunctiongetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a userDefinedFunction + * @return the next definition stage + */ + WithCreate withResource(SqlUserDefinedFunctionResource resource); + } + + /** + * The stage of the sqluserdefinedfunctiongetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a SqlUserDefinedFunctionGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of SqlUserDefinedFunctionGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the sqluserdefinedfunctiongetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionResource.java new file mode 100644 index 0000000000000..d20adf4c898ee --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/SqlUserDefinedFunctionResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB SQL userDefinedFunction resource object. + */ +public class SqlUserDefinedFunctionResource { + /** + * Name of the Cosmos DB SQL userDefinedFunction. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Body of the User Defined Function. + */ + @JsonProperty(value = "body") + private String body; + + /** + * Get name of the Cosmos DB SQL userDefinedFunction. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB SQL userDefinedFunction. + * + * @param id the id value to set + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get body of the User Defined Function. + * + * @return the body value + */ + public String body() { + return this.body; + } + + /** + * Set body of the User Defined Function. + * + * @param body the body value to set + * @return the SqlUserDefinedFunctionResource object itself. + */ + public SqlUserDefinedFunctionResource withBody(String body) { + this.body = body; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableCreateUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableCreateUpdateParameters.java new file mode 100644 index 0000000000000..569d6df0a78b9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableCreateUpdateParameters.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.cosmosdb.v2019_12_12; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.TableResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to create and update Cosmos DB Table. + */ +@JsonFlatten +public class TableCreateUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a Table. + */ + @JsonProperty(value = "properties.resource", required = true) + private TableResourceInner resource; + + /** + * A key-value pair of options to be applied for the request. This + * corresponds to the headers sent with the request. + */ + @JsonProperty(value = "properties.options", required = true) + private CreateUpdateOptions options; + + /** + * Get the standard JSON format of a Table. + * + * @return the resource value + */ + public TableResourceInner resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a Table. + * + * @param resource the resource value to set + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withResource(TableResourceInner resource) { + this.resource = resource; + return this; + } + + /** + * Get a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @return the options value + */ + public CreateUpdateOptions options() { + return this.options; + } + + /** + * Set a key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. + * + * @param options the options value to set + * @return the TableCreateUpdateParameters object itself. + */ + public TableCreateUpdateParameters withOptions(CreateUpdateOptions options) { + this.options = options; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetPropertiesResource.java new file mode 100644 index 0000000000000..f4b3a490f9e01 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetPropertiesResource.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The TableGetPropertiesResource model. + */ +public class TableGetPropertiesResource { + /** + * Name of the Cosmos DB table. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get name of the Cosmos DB table. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB table. + * + * @param id the id value to set + * @return the TableGetPropertiesResource object itself. + */ + public TableGetPropertiesResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetResults.java new file mode 100644 index 0000000000000..558bc4226cffc --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableGetResults.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.TableGetResultsInner; +import com.microsoft.azure.arm.model.Indexable; +import com.microsoft.azure.arm.model.Refreshable; +import com.microsoft.azure.arm.model.Updatable; +import com.microsoft.azure.arm.model.Appliable; +import com.microsoft.azure.arm.model.Creatable; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.TableResourceInner; +import java.util.Map; + +/** + * Type representing TableGetResults. + */ +public interface TableGetResults extends HasInner, Indexable, Refreshable, Updatable, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + TableGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + + /** + * The entirety of the TableGetResults definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithDatabaseAccount, DefinitionStages.WithLocation, DefinitionStages.WithOptions, DefinitionStages.WithResource, DefinitionStages.WithCreate { + } + + /** + * Grouping of TableGetResults definition stages. + */ + interface DefinitionStages { + /** + * The first stage of a TableGetResults definition. + */ + interface Blank extends WithDatabaseAccount { + } + + /** + * The stage of the tablegetresults definition allowing to specify DatabaseAccount. + */ + interface WithDatabaseAccount { + /** + * Specifies resourceGroupName, accountName. + * @param resourceGroupName Name of an Azure resource group + * @param accountName Cosmos DB database account name + * @return the next definition stage + */ + WithLocation withExistingDatabaseAccount(String resourceGroupName, String accountName); + } + + /** + * The stage of the tablegetresults definition allowing to specify Location. + */ + interface WithLocation { + /** + * Specifies location. + * @param location the location parameter value + * @return the next definition stage + */ + WithOptions withLocation(String location); + } + + /** + * The stage of the tablegetresults definition allowing to specify Options. + */ + interface WithOptions { + /** + * Specifies options. + * @param options A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request + * @return the next definition stage + */ + WithResource withOptions(CreateUpdateOptions options); + } + + /** + * The stage of the tablegetresults definition allowing to specify Resource. + */ + interface WithResource { + /** + * Specifies resource. + * @param resource The standard JSON format of a Table + * @return the next definition stage + */ + WithCreate withResource(TableResourceInner resource); + } + + /** + * The stage of the tablegetresults definition allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next definition stage + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the definition which contains all the minimum required inputs for + * the resource to be created (via {@link WithCreate#create()}), but also allows + * for any other optional settings to be specified. + */ + interface WithCreate extends Creatable, DefinitionStages.WithTags { + } + } + /** + * The template for a TableGetResults update operation, containing all the settings that can be modified. + */ + interface Update extends Appliable, UpdateStages.WithTags { + } + + /** + * Grouping of TableGetResults update stages. + */ + interface UpdateStages { + /** + * The stage of the tablegetresults update allowing to specify Tags. + */ + interface WithTags { + /** + * Specifies tags. + * @param tags the tags parameter value + * @return the next update stage + */ + Update withTags(Map tags); + } + + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableResources.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableResources.java new file mode 100644 index 0000000000000..c11370734b098 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TableResources.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableGetResults; +import rx.Completable; + +/** + * Type representing TableResources. + */ +public interface TableResources { + /** + * Begins definition for a new Table resource. + * @param name resource name. + * @return the first stage of the new Table definition. + */ + TableGetResults.DefinitionStages.Blank defineTable(String name); + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getTableAsync(String resourceGroupName, String accountName, String tableName); + + /** + * Lists the Tables under 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 + */ + Observable listTablesAsync(String resourceGroupName, String accountName); + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Completable deleteTableAsync(String resourceGroupName, String accountName, String tableName); + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getTableThroughputAsync(String resourceGroupName, String accountName, String tableName); + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable updateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputPolicyResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputPolicyResource.java new file mode 100644 index 0000000000000..73cf68a81b0fc --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputPolicyResource.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource throughput policy. + */ +public class ThroughputPolicyResource { + /** + * Determines whether the ThroughputPolicy is active or not. + */ + @JsonProperty(value = "isEnabled") + private Boolean isEnabled; + + /** + * Represents the percentage by which throughput can increase every time + * throughput policy kicks in. + */ + @JsonProperty(value = "incrementPercent") + private Integer incrementPercent; + + /** + * Get determines whether the ThroughputPolicy is active or not. + * + * @return the isEnabled value + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set determines whether the ThroughputPolicy is active or not. + * + * @param isEnabled the isEnabled value to set + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get represents the percentage by which throughput can increase every time throughput policy kicks in. + * + * @return the incrementPercent value + */ + public Integer incrementPercent() { + return this.incrementPercent; + } + + /** + * Set represents the percentage by which throughput can increase every time throughput policy kicks in. + * + * @param incrementPercent the incrementPercent value to set + * @return the ThroughputPolicyResource object itself. + */ + public ThroughputPolicyResource withIncrementPercent(Integer incrementPercent) { + this.incrementPercent = incrementPercent; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetPropertiesResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetPropertiesResource.java new file mode 100644 index 0000000000000..b2d19df2103a0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetPropertiesResource.java @@ -0,0 +1,148 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The ThroughputSettingsGetPropertiesResource model. + */ +public class ThroughputSettingsGetPropertiesResource { + /** + * Value of the Cosmos DB resource throughput. Either throughput is + * required or autopilotSettings is required, but not both. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /** + * Cosmos DB resource for Autopilot settings. Either throughput is required + * or autopilotSettings is required, but not both. + */ + @JsonProperty(value = "autopilotSettings") + private AutopilotSettingsResource autopilotSettings; + + /** + * The minimum throughput of the resource. + */ + @JsonProperty(value = "minimumThroughput", access = JsonProperty.Access.WRITE_ONLY) + private String minimumThroughput; + + /** + * The throughput replace is pending. + */ + @JsonProperty(value = "offerReplacePending", access = JsonProperty.Access.WRITE_ONLY) + private String offerReplacePending; + + /** + * A system generated property. A unique identifier. + */ + @JsonProperty(value = "_rid", access = JsonProperty.Access.WRITE_ONLY) + private String _rid; + + /** + * A system generated property that denotes the last updated timestamp of + * the resource. + */ + @JsonProperty(value = "_ts", access = JsonProperty.Access.WRITE_ONLY) + private Object _ts; + + /** + * A system generated property representing the resource etag required for + * optimistic concurrency control. + */ + @JsonProperty(value = "_etag", access = JsonProperty.Access.WRITE_ONLY) + private String _etag; + + /** + * Get value of the Cosmos DB resource throughput. Either throughput is required or autopilotSettings is required, but not both. + * + * @return the throughput value + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set value of the Cosmos DB resource throughput. Either throughput is required or autopilotSettings is required, but not both. + * + * @param throughput the throughput value to set + * @return the ThroughputSettingsGetPropertiesResource object itself. + */ + public ThroughputSettingsGetPropertiesResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get cosmos DB resource for Autopilot settings. Either throughput is required or autopilotSettings is required, but not both. + * + * @return the autopilotSettings value + */ + public AutopilotSettingsResource autopilotSettings() { + return this.autopilotSettings; + } + + /** + * Set cosmos DB resource for Autopilot settings. Either throughput is required or autopilotSettings is required, but not both. + * + * @param autopilotSettings the autopilotSettings value to set + * @return the ThroughputSettingsGetPropertiesResource object itself. + */ + public ThroughputSettingsGetPropertiesResource withAutopilotSettings(AutopilotSettingsResource autopilotSettings) { + this.autopilotSettings = autopilotSettings; + return this; + } + + /** + * Get the minimum throughput of the resource. + * + * @return the minimumThroughput value + */ + public String minimumThroughput() { + return this.minimumThroughput; + } + + /** + * Get the throughput replace is pending. + * + * @return the offerReplacePending value + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + + /** + * Get a system generated property. A unique identifier. + * + * @return the _rid value + */ + public String _rid() { + return this._rid; + } + + /** + * Get a system generated property that denotes the last updated timestamp of the resource. + * + * @return the _ts value + */ + public Object _ts() { + return this._ts; + } + + /** + * Get a system generated property representing the resource etag required for optimistic concurrency control. + * + * @return the _etag value + */ + public String _etag() { + return this._etag; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetResults.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetResults.java new file mode 100644 index 0000000000000..470ddb2408934 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsGetResults.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.CosmosDBManager; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation.ThroughputSettingsGetResultsInner; +import java.util.Map; + +/** + * Type representing ThroughputSettingsGetResults. + */ +public interface ThroughputSettingsGetResults extends HasInner, HasManager { + /** + * @return the id value. + */ + String id(); + + /** + * @return the location value. + */ + String location(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the resource value. + */ + ThroughputSettingsGetPropertiesResource resource(); + + /** + * @return the tags value. + */ + Map tags(); + + /** + * @return the type value. + */ + String type(); + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsResource.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsResource.java new file mode 100644 index 0000000000000..01320f65d00b0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsResource.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB resource throughput object. Either throughput is required or + * autopilotSettings is required, but not both. + */ +public class ThroughputSettingsResource { + /** + * Value of the Cosmos DB resource throughput. Either throughput is + * required or autopilotSettings is required, but not both. + */ + @JsonProperty(value = "throughput") + private Integer throughput; + + /** + * Cosmos DB resource for Autopilot settings. Either throughput is required + * or autopilotSettings is required, but not both. + */ + @JsonProperty(value = "autopilotSettings") + private AutopilotSettingsResource autopilotSettings; + + /** + * The minimum throughput of the resource. + */ + @JsonProperty(value = "minimumThroughput", access = JsonProperty.Access.WRITE_ONLY) + private String minimumThroughput; + + /** + * The throughput replace is pending. + */ + @JsonProperty(value = "offerReplacePending", access = JsonProperty.Access.WRITE_ONLY) + private String offerReplacePending; + + /** + * Get value of the Cosmos DB resource throughput. Either throughput is required or autopilotSettings is required, but not both. + * + * @return the throughput value + */ + public Integer throughput() { + return this.throughput; + } + + /** + * Set value of the Cosmos DB resource throughput. Either throughput is required or autopilotSettings is required, but not both. + * + * @param throughput the throughput value to set + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withThroughput(Integer throughput) { + this.throughput = throughput; + return this; + } + + /** + * Get cosmos DB resource for Autopilot settings. Either throughput is required or autopilotSettings is required, but not both. + * + * @return the autopilotSettings value + */ + public AutopilotSettingsResource autopilotSettings() { + return this.autopilotSettings; + } + + /** + * Set cosmos DB resource for Autopilot settings. Either throughput is required or autopilotSettings is required, but not both. + * + * @param autopilotSettings the autopilotSettings value to set + * @return the ThroughputSettingsResource object itself. + */ + public ThroughputSettingsResource withAutopilotSettings(AutopilotSettingsResource autopilotSettings) { + this.autopilotSettings = autopilotSettings; + return this; + } + + /** + * Get the minimum throughput of the resource. + * + * @return the minimumThroughput value + */ + public String minimumThroughput() { + return this.minimumThroughput; + } + + /** + * Get the throughput replace is pending. + * + * @return the offerReplacePending value + */ + public String offerReplacePending() { + return this.offerReplacePending; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsUpdateParameters.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsUpdateParameters.java new file mode 100644 index 0000000000000..c628c0c551b6d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/ThroughputSettingsUpdateParameters.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.cosmosdb.v2019_12_12; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; + +/** + * Parameters to update Cosmos DB resource throughput. + */ +@JsonFlatten +public class ThroughputSettingsUpdateParameters extends ARMResourceProperties { + /** + * The standard JSON format of a resource throughput. + */ + @JsonProperty(value = "properties.resource", required = true) + private ThroughputSettingsResource resource; + + /** + * Get the standard JSON format of a resource throughput. + * + * @return the resource value + */ + public ThroughputSettingsResource resource() { + return this.resource; + } + + /** + * Set the standard JSON format of a resource throughput. + * + * @param resource the resource value to set + * @return the ThroughputSettingsUpdateParameters object itself. + */ + public ThroughputSettingsUpdateParameters withResource(ThroughputSettingsResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerOperation.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerOperation.java new file mode 100644 index 0000000000000..0fa45c1fe1a98 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerOperation.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.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TriggerOperation. + */ +public final class TriggerOperation extends ExpandableStringEnum { + /** Static value All for TriggerOperation. */ + public static final TriggerOperation ALL = fromString("All"); + + /** Static value Create for TriggerOperation. */ + public static final TriggerOperation CREATE = fromString("Create"); + + /** Static value Update for TriggerOperation. */ + public static final TriggerOperation UPDATE = fromString("Update"); + + /** Static value Delete for TriggerOperation. */ + public static final TriggerOperation DELETE = fromString("Delete"); + + /** Static value Replace for TriggerOperation. */ + public static final TriggerOperation REPLACE = fromString("Replace"); + + /** + * Creates or finds a TriggerOperation from its string representation. + * @param name a name to look for + * @return the corresponding TriggerOperation + */ + @JsonCreator + public static TriggerOperation fromString(String name) { + return fromString(name, TriggerOperation.class); + } + + /** + * @return known TriggerOperation values + */ + public static Collection values() { + return values(TriggerOperation.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerType.java new file mode 100644 index 0000000000000..11e318a3987a4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/TriggerType.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for TriggerType. + */ +public final class TriggerType extends ExpandableStringEnum { + /** Static value Pre for TriggerType. */ + public static final TriggerType PRE = fromString("Pre"); + + /** Static value Post for TriggerType. */ + public static final TriggerType POST = fromString("Post"); + + /** + * Creates or finds a TriggerType from its string representation. + * @param name a name to look for + * @return the corresponding TriggerType + */ + @JsonCreator + public static TriggerType fromString(String name) { + return fromString(name, TriggerType.class); + } + + /** + * @return known TriggerType values + */ + public static Collection values() { + return values(TriggerType.class); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKey.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKey.java new file mode 100644 index 0000000000000..2ce1cb185ca68 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKey.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.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The unique key on that enforces uniqueness constraint on documents in the + * collection in the Azure Cosmos DB service. + */ +public class UniqueKey { + /** + * List of paths must be unique for each document in the Azure Cosmos DB + * service. + */ + @JsonProperty(value = "paths") + private List paths; + + /** + * Get list of paths must be unique for each document in the Azure Cosmos DB service. + * + * @return the paths value + */ + public List paths() { + return this.paths; + } + + /** + * Set list of paths must be unique for each document in the Azure Cosmos DB service. + * + * @param paths the paths value to set + * @return the UniqueKey object itself. + */ + public UniqueKey withPaths(List paths) { + this.paths = paths; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKeyPolicy.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKeyPolicy.java new file mode 100644 index 0000000000000..944e29c8a93cb --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UniqueKeyPolicy.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.cosmosdb.v2019_12_12; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The unique key policy configuration for specifying uniqueness constraints on + * documents in the collection in the Azure Cosmos DB service. + */ +public class UniqueKeyPolicy { + /** + * List of unique keys on that enforces uniqueness constraint on documents + * in the collection in the Azure Cosmos DB service. + */ + @JsonProperty(value = "uniqueKeys") + private List uniqueKeys; + + /** + * Get list of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + * + * @return the uniqueKeys value + */ + public List uniqueKeys() { + return this.uniqueKeys; + } + + /** + * Set list of unique keys on that enforces uniqueness constraint on documents in the collection in the Azure Cosmos DB service. + * + * @param uniqueKeys the uniqueKeys value to set + * @return the UniqueKeyPolicy object itself. + */ + public UniqueKeyPolicy withUniqueKeys(List uniqueKeys) { + this.uniqueKeys = uniqueKeys; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UnitType.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/UnitType.java new file mode 100644 index 0000000000000..cdbc202484485 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12; + +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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/VirtualNetworkRule.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/VirtualNetworkRule.java new file mode 100644 index 0000000000000..fc3920b41c27d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/VirtualNetworkRule.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.cosmosdb.v2019_12_12; + +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; + + /** + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "ignoreMissingVNetServiceEndpoint") + private Boolean ignoreMissingVNetServiceEndpoint; + + /** + * 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; + } + + /** + * Get create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @return the ignoreMissingVNetServiceEndpoint value + */ + public Boolean ignoreMissingVNetServiceEndpoint() { + return this.ignoreMissingVNetServiceEndpoint; + } + + /** + * Set create firewall rule before the virtual network has vnet service endpoint enabled. + * + * @param ignoreMissingVNetServiceEndpoint the ignoreMissingVNetServiceEndpoint value to set + * @return the VirtualNetworkRule object itself. + */ + public VirtualNetworkRule withIgnoreMissingVNetServiceEndpoint(Boolean ignoreMissingVNetServiceEndpoint) { + this.ignoreMissingVNetServiceEndpoint = ignoreMissingVNetServiceEndpoint; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsImpl.java new file mode 100644 index 0000000000000..ee6e1fd43a960 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceResource; +import rx.functions.Func1; + +class CassandraKeyspaceGetResultsImpl extends CreatableUpdatableImpl implements CassandraKeyspaceGetResults, CassandraKeyspaceGetResults.Definition, CassandraKeyspaceGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String keyspaceName; + private CassandraKeyspaceCreateUpdateParameters createOrUpdateParameter; + + CassandraKeyspaceGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new CassandraKeyspaceGetResultsInner()); + this.manager = manager; + // Set resource name + this.keyspaceName = name; + // + this.createOrUpdateParameter = new CassandraKeyspaceCreateUpdateParameters(); + } + + CassandraKeyspaceGetResultsImpl(CassandraKeyspaceGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.keyspaceName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.keyspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "cassandraKeyspaces"); + // + this.createOrUpdateParameter = new CassandraKeyspaceCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.createUpdateCassandraKeyspaceAsync(this.resourceGroupName, this.accountName, this.keyspaceName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public CassandraKeyspaceGetResultsInner call(CassandraKeyspaceGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.createUpdateCassandraKeyspaceAsync(this.resourceGroupName, this.accountName, this.keyspaceName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public CassandraKeyspaceGetResultsInner call(CassandraKeyspaceGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.getCassandraKeyspaceAsync(this.resourceGroupName, this.accountName, this.keyspaceName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new CassandraKeyspaceCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CassandraKeyspaceGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CassandraKeyspaceGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public CassandraKeyspaceGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public CassandraKeyspaceGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public CassandraKeyspaceGetResultsImpl withResource(CassandraKeyspaceResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public CassandraKeyspaceGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsInner.java new file mode 100644 index 0000000000000..4114580448cb6 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraKeyspaceGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB Cassandra keyspace. + */ +@JsonFlatten +public class CassandraKeyspaceGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private CassandraKeyspaceGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public CassandraKeyspaceGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the CassandraKeyspaceGetResultsInner object itself. + */ + public CassandraKeyspaceGetResultsInner withResource(CassandraKeyspaceGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesImpl.java new file mode 100644 index 0000000000000..c8b2e74543128 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesImpl.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraResources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceGetResults; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableGetResults; + +class CassandraResourcesImpl extends WrapperImpl implements CassandraResources { + private final CosmosDBManager manager; + + CassandraResourcesImpl(CosmosDBManager manager) { + super(manager.inner().cassandraResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public CassandraKeyspaceGetResultsImpl defineCassandraKeyspace(String name) { + return wrapCassandraKeyspaceModel(name); + } + + @Override + public CassandraTableGetResultsImpl defineTable(String name) { + return wrapTableModel(name); + } + + private CassandraKeyspaceGetResultsImpl wrapCassandraKeyspaceModel(String name) { + return new CassandraKeyspaceGetResultsImpl(name, this.manager()); + } + + private CassandraTableGetResultsImpl wrapTableModel(String name) { + return new CassandraTableGetResultsImpl(name, this.manager()); + } + + private CassandraKeyspaceGetResultsImpl wrapCassandraKeyspaceGetResultsModel(CassandraKeyspaceGetResultsInner inner) { + return new CassandraKeyspaceGetResultsImpl(inner, manager()); + } + + private CassandraTableGetResultsImpl wrapCassandraTableGetResultsModel(CassandraTableGetResultsInner inner) { + return new CassandraTableGetResultsImpl(inner, manager()); + } + + private Observable getCassandraKeyspaceGetResultsInnerUsingCassandraResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String keyspaceName = IdParsingUtils.getValueFromIdByName(id, "cassandraKeyspaces"); + CassandraResourcesInner client = this.inner(); + return client.getCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName); + } + + private Observable getCassandraTableGetResultsInnerUsingCassandraResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String keyspaceName = IdParsingUtils.getValueFromIdByName(id, "cassandraKeyspaces"); + String tableName = IdParsingUtils.getValueFromIdByName(id, "tables"); + CassandraResourcesInner client = this.inner(); + return client.getCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName); + } + + @Override + public Observable getCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.getCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName) + .flatMap(new Func1>() { + @Override + public Observable call(CassandraKeyspaceGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CassandraKeyspaceGetResults)wrapCassandraKeyspaceGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listCassandraKeyspacesAsync(String resourceGroupName, String accountName) { + CassandraResourcesInner client = this.inner(); + return client.listCassandraKeyspacesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CassandraKeyspaceGetResults call(CassandraKeyspaceGetResultsInner inner) { + return wrapCassandraKeyspaceGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.deleteCassandraKeyspaceAsync(resourceGroupName, accountName, keyspaceName).toCompletable(); + } + + @Override + public Observable getCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.getCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + CassandraResourcesInner client = this.inner(); + return client.updateCassandraKeyspaceThroughputAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraResourcesInner client = this.inner(); + return client.getCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + CassandraResourcesInner client = this.inner(); + return client.updateCassandraTableThroughputAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraResourcesInner client = this.inner(); + return client.getCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName) + .flatMap(new Func1>() { + @Override + public Observable call(CassandraTableGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((CassandraTableGetResults)wrapCassandraTableGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName) { + CassandraResourcesInner client = this.inner(); + return client.listCassandraTablesAsync(resourceGroupName, accountName, keyspaceName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public CassandraTableGetResults call(CassandraTableGetResultsInner inner) { + return wrapCassandraTableGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + CassandraResourcesInner client = this.inner(); + return client.deleteCassandraTableAsync(resourceGroupName, accountName, keyspaceName, tableName).toCompletable(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesInner.java new file mode 100644 index 0000000000000..f58b972ebee7c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraResourcesInner.java @@ -0,0 +1,1797 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraKeyspaceCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in CassandraResources. + */ +public class CassandraResourcesInner { + /** The Retrofit service to perform REST calls. */ + private CassandraResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of CassandraResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public CassandraResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(CassandraResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for CassandraResources to be + * used by Retrofit to perform actually REST calls. + */ + interface CassandraResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraResources listCassandraKeyspaces" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces") + Observable> listCassandraKeyspaces(@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.cosmosdb.v2019_12_12.CassandraResources getCassandraKeyspace" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + Observable> getCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @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.cosmosdb.v2019_12_12.CassandraResources createUpdateCassandraKeyspace" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + Observable> createUpdateCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Body CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, @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.cosmosdb.v2019_12_12.CassandraResources beginCreateUpdateCassandraKeyspace" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}") + Observable> beginCreateUpdateCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Body CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, @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.cosmosdb.v2019_12_12.CassandraResources deleteCassandraKeyspace" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", method = "DELETE", hasBody = true) + Observable> deleteCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @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.cosmosdb.v2019_12_12.CassandraResources beginDeleteCassandraKeyspace" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}", method = "DELETE", hasBody = true) + Observable> beginDeleteCassandraKeyspace(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @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.cosmosdb.v2019_12_12.CassandraResources getCassandraKeyspaceThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + Observable> getCassandraKeyspaceThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @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.cosmosdb.v2019_12_12.CassandraResources updateCassandraKeyspaceThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + Observable> updateCassandraKeyspaceThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.CassandraResources beginUpdateCassandraKeyspaceThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/throughputSettings/default") + Observable> beginUpdateCassandraKeyspaceThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.CassandraResources listCassandraTables" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables") + Observable> listCassandraTables(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @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.cosmosdb.v2019_12_12.CassandraResources getCassandraTable" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + Observable> getCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.CassandraResources createUpdateCassandraTable" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + Observable> createUpdateCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, @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.cosmosdb.v2019_12_12.CassandraResources beginCreateUpdateCassandraTable" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}") + Observable> beginCreateUpdateCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, @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.cosmosdb.v2019_12_12.CassandraResources deleteCassandraTable" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", method = "DELETE", hasBody = true) + Observable> deleteCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.CassandraResources beginDeleteCassandraTable" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}", method = "DELETE", hasBody = true) + Observable> beginDeleteCassandraTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.CassandraResources getCassandraTableThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") + Observable> getCassandraTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.CassandraResources updateCassandraTableThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") + Observable> updateCassandraTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.CassandraResources beginUpdateCassandraTableThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/tables/{tableName}/throughputSettings/default") + Observable> beginUpdateCassandraTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("keyspaceName") String keyspaceName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the Cassandra keyspaces under 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 List<CassandraKeyspaceGetResultsInner> object if successful. + */ + public List listCassandraKeyspaces(String resourceGroupName, String accountName) { + return listCassandraKeyspacesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the Cassandra keyspaces under 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> listCassandraKeyspacesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listCassandraKeyspacesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the Cassandra keyspaces under 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 List<CassandraKeyspaceGetResultsInner> object + */ + public Observable> listCassandraKeyspacesAsync(String resourceGroupName, String accountName) { + return listCassandraKeyspacesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Cassandra keyspaces under 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 List<CassandraKeyspaceGetResultsInner> object + */ + public Observable>> listCassandraKeyspacesWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-12-12"; + return service.listCassandraKeyspaces(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCassandraKeyspacesDelegate(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> listCassandraKeyspacesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 CassandraKeyspaceGetResultsInner object if successful. + */ + public CassandraKeyspaceGetResultsInner getCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 getCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraKeyspaceGetResultsInner object + */ + public Observable getCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, CassandraKeyspaceGetResultsInner>() { + @Override + public CassandraKeyspaceGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraKeyspaceGetResultsInner object + */ + public Observable> getCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraKeyspaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraKeyspaceDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @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 CassandraKeyspaceGetResultsInner object if successful. + */ + public CassandraKeyspaceGetResultsInner createUpdateCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return createUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @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 createUpdateCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return createUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).map(new Func1, CassandraKeyspaceGetResultsInner>() { + @Override + public CassandraKeyspaceGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (createUpdateCassandraKeyspaceParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraKeyspaceParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, createUpdateCassandraKeyspaceParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @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 CassandraKeyspaceGetResultsInner object if successful. + */ + public CassandraKeyspaceGetResultsInner beginCreateUpdateCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @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 beginCreateUpdateCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraKeyspaceGetResultsInner object + */ + public Observable beginCreateUpdateCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + return beginCreateUpdateCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, createUpdateCassandraKeyspaceParameters).map(new Func1, CassandraKeyspaceGetResultsInner>() { + @Override + public CassandraKeyspaceGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param createUpdateCassandraKeyspaceParameters The parameters to provide for the current Cassandra keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraKeyspaceGetResultsInner object + */ + public Observable> beginCreateUpdateCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, CassandraKeyspaceCreateUpdateParameters createUpdateCassandraKeyspaceParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (createUpdateCassandraKeyspaceParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraKeyspaceParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraKeyspaceParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, createUpdateCassandraKeyspaceParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateCassandraKeyspaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateCassandraKeyspaceDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 deleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + deleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return deleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 beginDeleteCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + beginDeleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 beginDeleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteCassandraKeyspaceAsync(String resourceGroupName, String accountName, String keyspaceName) { + return beginDeleteCassandraKeyspaceWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteCassandraKeyspaceWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteCassandraKeyspace(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteCassandraKeyspaceDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteCassandraKeyspaceDelegate(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); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getCassandraKeyspaceThroughput(String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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 getCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName) { + return getCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra Keyspace under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getCassandraKeyspaceThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getCassandraKeyspaceThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraKeyspaceThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraKeyspaceThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateCassandraKeyspaceThroughput(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @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 updateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateCassandraKeyspaceThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateCassandraKeyspaceThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateCassandraKeyspaceThroughput(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @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 beginUpdateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateCassandraKeyspaceThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraKeyspaceThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra Keyspace. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra Keyspace. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateCassandraKeyspaceThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateCassandraKeyspaceThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateCassandraKeyspaceThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateCassandraKeyspaceThroughputDelegate(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); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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<CassandraTableGetResultsInner> object if successful. + */ + public List listCassandraTables(String resourceGroupName, String accountName, String keyspaceName) { + return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).toBlocking().single().body(); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace 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> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName), serviceCallback); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<CassandraTableGetResultsInner> object + */ + public Observable> listCassandraTablesAsync(String resourceGroupName, String accountName, String keyspaceName) { + return listCassandraTablesWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<CassandraTableGetResultsInner> object + */ + public Observable>> listCassandraTablesWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listCassandraTables(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listCassandraTablesDelegate(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> listCassandraTablesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 CassandraTableGetResultsInner object if successful. + */ + public CassandraTableGetResultsInner getCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable getCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, CassandraTableGetResultsInner>() { + @Override + public CassandraTableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Cassandra table under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable> getCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraTableDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @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 CassandraTableGetResultsInner object if successful. + */ + public CassandraTableGetResultsInner createUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return createUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + @Override + public CassandraTableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateCassandraTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraTableParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @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 CassandraTableGetResultsInner object if successful. + */ + public CassandraTableGetResultsInner beginCreateUpdateCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable beginCreateUpdateCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + return beginCreateUpdateCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, createUpdateCassandraTableParameters).map(new Func1, CassandraTableGetResultsInner>() { + @Override + public CassandraTableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Cassandra Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param createUpdateCassandraTableParameters The parameters to provide for the current Cassandra Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the CassandraTableGetResultsInner object + */ + public Observable> beginCreateUpdateCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, CassandraTableCreateUpdateParameters createUpdateCassandraTableParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateCassandraTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateCassandraTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateCassandraTableParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, createUpdateCassandraTableParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateCassandraTableDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 deleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return deleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 beginDeleteCassandraTable(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteCassandraTableAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return beginDeleteCassandraTableWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteCassandraTableWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteCassandraTable(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteCassandraTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteCassandraTableDelegate(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); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table 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 getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName), serviceCallback); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + return getCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the Cassandra table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getCassandraTableThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getCassandraTableThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateCassandraTableThroughput(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateCassandraTableThroughputAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateCassandraTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, keyspaceName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Cassandra table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param keyspaceName Cosmos DB keyspace name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Cassandra table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateCassandraTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String keyspaceName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (keyspaceName == null) { + throw new IllegalArgumentException("Parameter keyspaceName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateCassandraTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, keyspaceName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateCassandraTableThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateCassandraTableThroughputDelegate(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); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsImpl.java new file mode 100644 index 0000000000000..ec58ccce14f8c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableResource; +import rx.functions.Func1; + +class CassandraTableGetResultsImpl extends CreatableUpdatableImpl implements CassandraTableGetResults, CassandraTableGetResults.Definition, CassandraTableGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String keyspaceName; + private String tableName; + private CassandraTableCreateUpdateParameters createOrUpdateParameter; + + CassandraTableGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new CassandraTableGetResultsInner()); + this.manager = manager; + // Set resource name + this.tableName = name; + // + this.createOrUpdateParameter = new CassandraTableCreateUpdateParameters(); + } + + CassandraTableGetResultsImpl(CassandraTableGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.tableName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.keyspaceName = IdParsingUtils.getValueFromIdByName(inner.id(), "cassandraKeyspaces"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + // + this.createOrUpdateParameter = new CassandraTableCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.createUpdateCassandraTableAsync(this.resourceGroupName, this.accountName, this.keyspaceName, this.tableName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public CassandraTableGetResultsInner call(CassandraTableGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.createUpdateCassandraTableAsync(this.resourceGroupName, this.accountName, this.keyspaceName, this.tableName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public CassandraTableGetResultsInner call(CassandraTableGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + CassandraResourcesInner client = this.manager().inner().cassandraResources(); + return client.getCassandraTableAsync(this.resourceGroupName, this.accountName, this.keyspaceName, this.tableName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new CassandraTableCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public CassandraTableGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public CassandraTableGetResultsImpl withExistingCassandraKeyspace(String resourceGroupName, String accountName, String keyspaceName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.keyspaceName = keyspaceName; + return this; + } + + @Override + public CassandraTableGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public CassandraTableGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public CassandraTableGetResultsImpl withResource(CassandraTableResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public CassandraTableGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsInner.java new file mode 100644 index 0000000000000..709b9a15a364b --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CassandraTableGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraTableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB Cassandra table. + */ +@JsonFlatten +public class CassandraTableGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private CassandraTableGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public CassandraTableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the CassandraTableGetResultsInner object itself. + */ + public CassandraTableGetResultsInner withResource(CassandraTableGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..35fe008e63574 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricAvailability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrimaryAggregationType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class CollectionDatabasisDatabaseAccountMetricDefinitionImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetricDefinition { + private final CosmosDBManager manager; + + CollectionDatabasisDatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..8331f26b99449 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.MetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class CollectionDatabasisDatabaseAccountMetricImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetric { + private final CosmosDBManager manager; + + CollectionDatabasisDatabaseAccountMetricImpl(MetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountMetricModelImpl.java new file mode 100644 index 0000000000000..09955f9a992ad --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.MetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class CollectionDatabasisDatabaseAccountMetricModelImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountMetricModel { + private final CosmosDBManager manager; + + CollectionDatabasisDatabaseAccountMetricModelImpl(MetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionDatabasisDatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..929085bf11c21 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class CollectionDatabasisDatabaseAccountUsageImpl extends WrapperImpl implements CollectionDatabasisDatabaseAccountUsage { + private final CosmosDBManager manager; + + CollectionDatabasisDatabaseAccountUsageImpl(UsageInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + + + @Override + public Long currentValue() { + return this.inner().currentValue(); + } + + @Override + public Long 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsImpl.java new file mode 100644 index 0000000000000..723876783d653 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionPartitionRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionMetric; + +class CollectionPartitionRegionsImpl extends WrapperImpl implements CollectionPartitionRegions { + private final CosmosDBManager manager; + + CollectionPartitionRegionsImpl(CosmosDBManager manager) { + super(manager.inner().collectionPartitionRegions()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsInner.java new file mode 100644 index 0000000000000..4cc2d51da4dd3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionRegionsInner.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsImpl.java new file mode 100644 index 0000000000000..d04aad232a901 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionPartitions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionUsage; + +class CollectionPartitionsImpl extends WrapperImpl implements CollectionPartitions { + private final CosmosDBManager manager; + + CollectionPartitionsImpl(CosmosDBManager manager) { + super(manager.inner().collectionPartitions()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsInner.java new file mode 100644 index 0000000000000..1028cba0b751a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionPartitionsInner.java @@ -0,0 +1,379 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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."); + } + final String apiVersion = "2019-12-12"; + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsImpl.java new file mode 100644 index 0000000000000..09a1aa8084a86 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionRegions; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetricModel; + +class CollectionRegionsImpl extends WrapperImpl implements CollectionRegions { + private final CosmosDBManager manager; + + CollectionRegionsImpl(CosmosDBManager manager) { + super(manager.inner().collectionRegions()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsInner.java new file mode 100644 index 0000000000000..b8d2db6e9ee5e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionRegionsInner.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsImpl.java new file mode 100644 index 0000000000000..71200737c4afa --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Collections; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionDatabasisDatabaseAccountUsage; + +class CollectionsImpl extends WrapperImpl implements Collections { + private final CosmosDBManager manager; + + CollectionsImpl(CosmosDBManager manager) { + super(manager.inner().collections()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsInner.java new file mode 100644 index 0000000000000..641ac5d486272 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CollectionsInner.java @@ -0,0 +1,486 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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."); + } + final String apiVersion = "2019-12-12"; + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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 definitions 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 definitions 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 definitions 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 definitions 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."); + } + final String apiVersion = "2019-12-12"; + return service.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManagementClientImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManagementClientImpl.java new file mode 100644 index 0000000000000..c1b4728b90be2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManagementClientImpl.java @@ -0,0 +1,472 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl class. + */ +public class CosmosDBManagementClientImpl 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 CosmosDBManagementClientImpl withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** The ID of the target subscription. */ + private String subscriptionId1; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId1 value. + */ + public String subscriptionId1() { + return this.subscriptionId1; + } + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId1 the subscriptionId1 value. + * @return the service client itself + */ + public CosmosDBManagementClientImpl withSubscriptionId1(String subscriptionId1) { + this.subscriptionId1 = subscriptionId1; + return this; + } + + /** The preferred language for the response. */ + private String acceptLanguage; + + /** + * Gets The preferred language for the response. + * + * @return the acceptLanguage value. + */ + public String acceptLanguage() { + return this.acceptLanguage; + } + + /** + * Sets The preferred language for the response. + * + * @param acceptLanguage the acceptLanguage value. + * @return the service client itself + */ + public CosmosDBManagementClientImpl withAcceptLanguage(String acceptLanguage) { + this.acceptLanguage = acceptLanguage; + return this; + } + + /** The retry timeout in seconds for Long Running Operations. Default value is 30. */ + private int longRunningOperationRetryTimeout; + + /** + * Gets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @return the longRunningOperationRetryTimeout value. + */ + public int longRunningOperationRetryTimeout() { + return this.longRunningOperationRetryTimeout; + } + + /** + * Sets The retry timeout in seconds for Long Running Operations. Default value is 30. + * + * @param longRunningOperationRetryTimeout the longRunningOperationRetryTimeout value. + * @return the service client itself + */ + public CosmosDBManagementClientImpl withLongRunningOperationRetryTimeout(int longRunningOperationRetryTimeout) { + this.longRunningOperationRetryTimeout = longRunningOperationRetryTimeout; + return this; + } + + /** Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. */ + private boolean generateClientRequestId; + + /** + * Gets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @return the generateClientRequestId value. + */ + public boolean generateClientRequestId() { + return this.generateClientRequestId; + } + + /** + * Sets Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true. + * + * @param generateClientRequestId the generateClientRequestId value. + * @return the service client itself + */ + public CosmosDBManagementClientImpl 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; + } + + /** + * The SqlResourcesInner object to access its operations. + */ + private SqlResourcesInner sqlResources; + + /** + * Gets the SqlResourcesInner object to access its operations. + * @return the SqlResourcesInner object. + */ + public SqlResourcesInner sqlResources() { + return this.sqlResources; + } + + /** + * The MongoDBResourcesInner object to access its operations. + */ + private MongoDBResourcesInner mongoDBResources; + + /** + * Gets the MongoDBResourcesInner object to access its operations. + * @return the MongoDBResourcesInner object. + */ + public MongoDBResourcesInner mongoDBResources() { + return this.mongoDBResources; + } + + /** + * The TableResourcesInner object to access its operations. + */ + private TableResourcesInner tableResources; + + /** + * Gets the TableResourcesInner object to access its operations. + * @return the TableResourcesInner object. + */ + public TableResourcesInner tableResources() { + return this.tableResources; + } + + /** + * The CassandraResourcesInner object to access its operations. + */ + private CassandraResourcesInner cassandraResources; + + /** + * Gets the CassandraResourcesInner object to access its operations. + * @return the CassandraResourcesInner object. + */ + public CassandraResourcesInner cassandraResources() { + return this.cassandraResources; + } + + /** + * The GremlinResourcesInner object to access its operations. + */ + private GremlinResourcesInner gremlinResources; + + /** + * Gets the GremlinResourcesInner object to access its operations. + * @return the GremlinResourcesInner object. + */ + public GremlinResourcesInner gremlinResources() { + return this.gremlinResources; + } + + /** + * The PrivateLinkResourcesInner object to access its operations. + */ + private PrivateLinkResourcesInner privateLinkResources; + + /** + * Gets the PrivateLinkResourcesInner object to access its operations. + * @return the PrivateLinkResourcesInner object. + */ + public PrivateLinkResourcesInner privateLinkResources() { + return this.privateLinkResources; + } + + /** + * The PrivateEndpointConnectionsInner object to access its operations. + */ + private PrivateEndpointConnectionsInner privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsInner object to access its operations. + * @return the PrivateEndpointConnectionsInner object. + */ + public PrivateEndpointConnectionsInner privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Initializes an instance of CosmosDBManagementClient client. + * + * @param credentials the management credentials for Azure + */ + public CosmosDBManagementClientImpl(ServiceClientCredentials credentials) { + this("https://management.azure.com", credentials); + } + + /** + * Initializes an instance of CosmosDBManagementClient client. + * + * @param baseUrl the base URL of the host + * @param credentials the management credentials for Azure + */ + public CosmosDBManagementClientImpl(String baseUrl, ServiceClientCredentials credentials) { + super(baseUrl, credentials); + initialize(); + } + + /** + * Initializes an instance of CosmosDBManagementClient client. + * + * @param restClient the REST client to connect to Azure. + */ + public CosmosDBManagementClientImpl(RestClient restClient) { + super(restClient); + initialize(); + } + + protected void initialize() { + 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.sqlResources = new SqlResourcesInner(restClient().retrofit(), this); + this.mongoDBResources = new MongoDBResourcesInner(restClient().retrofit(), this); + this.tableResources = new TableResourcesInner(restClient().retrofit(), this); + this.cassandraResources = new CassandraResourcesInner(restClient().retrofit(), this); + this.gremlinResources = new GremlinResourcesInner(restClient().retrofit(), this); + this.privateLinkResources = new PrivateLinkResourcesInner(restClient().retrofit(), this); + this.privateEndpointConnections = new PrivateEndpointConnectionsInner(restClient().retrofit(), this); + this.azureClient = new AzureClient(this); + } + + /** + * Gets the User-Agent header for the client. + * + * @return the user agent string. + */ + @Override + public String userAgent() { + return String.format("%s (%s, %s, auto-generated)", super.userAgent(), "CosmosDBManagementClient", "2019-12-12"); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManager.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManager.java new file mode 100644 index 0000000000000..65ad284c9088f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/CosmosDBManager.java @@ -0,0 +1,327 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.DatabaseAccounts; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Operations; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Databases; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Collections; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionRegions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountRegions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileSourceTargets; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileTargets; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Percentiles; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionPartitionRegions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CollectionPartitions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionKeyRangeIds; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionKeyRangeIdRegions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CassandraResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkResources; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnections; +import com.microsoft.azure.arm.resources.implementation.AzureConfigurableCoreImpl; +import com.microsoft.azure.arm.resources.implementation.ManagerCore; + +/** + * Entry point to Azure CosmosDB resource management. + */ +public final class CosmosDBManager 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; + private SqlResources sqlResources; + private MongoDBResources mongoDBResources; + private TableResources tableResources; + private CassandraResources cassandraResources; + private GremlinResources gremlinResources; + private PrivateLinkResources privateLinkResources; + private PrivateEndpointConnections privateEndpointConnections; + /** + * Get a Configurable instance that can be used to create CosmosDBManager with optional configuration. + * + * @return the instance allowing configurations + */ + public static Configurable configure() { + return new CosmosDBManager.ConfigurableImpl(); + } + /** + * Creates an instance of CosmosDBManager that exposes CosmosDB resource management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the CosmosDBManager + */ + public static CosmosDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return new CosmosDBManager(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 CosmosDBManager that exposes CosmosDB resource management API entry points. + * + * @param restClient the RestClient to be used for API calls. + * @param subscriptionId the subscription UUID + * @return the CosmosDBManager + */ + public static CosmosDBManager authenticate(RestClient restClient, String subscriptionId) { + return new CosmosDBManager(restClient, subscriptionId); + } + /** + * The interface allowing configurations to be set. + */ + public interface Configurable extends AzureConfigurable { + /** + * Creates an instance of CosmosDBManager that exposes CosmosDB management API entry points. + * + * @param credentials the credentials to use + * @param subscriptionId the subscription UUID + * @return the interface exposing CosmosDB management API entry points that work across subscriptions + */ + CosmosDBManager 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; + } + + /** + * @return Entry point to manage SqlResources. + */ + public SqlResources sqlResources() { + if (this.sqlResources == null) { + this.sqlResources = new SqlResourcesImpl(this); + } + return this.sqlResources; + } + + /** + * @return Entry point to manage MongoDBResources. + */ + public MongoDBResources mongoDBResources() { + if (this.mongoDBResources == null) { + this.mongoDBResources = new MongoDBResourcesImpl(this); + } + return this.mongoDBResources; + } + + /** + * @return Entry point to manage TableResources. + */ + public TableResources tableResources() { + if (this.tableResources == null) { + this.tableResources = new TableResourcesImpl(this); + } + return this.tableResources; + } + + /** + * @return Entry point to manage CassandraResources. + */ + public CassandraResources cassandraResources() { + if (this.cassandraResources == null) { + this.cassandraResources = new CassandraResourcesImpl(this); + } + return this.cassandraResources; + } + + /** + * @return Entry point to manage GremlinResources. + */ + public GremlinResources gremlinResources() { + if (this.gremlinResources == null) { + this.gremlinResources = new GremlinResourcesImpl(this); + } + return this.gremlinResources; + } + + /** + * @return Entry point to manage PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(this); + } + return this.privateLinkResources; + } + + /** + * @return Entry point to manage PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this); + } + return this.privateEndpointConnections; + } + + /** + * The implementation for Configurable interface. + */ + private static final class ConfigurableImpl extends AzureConfigurableCoreImpl implements Configurable { + public CosmosDBManager authenticate(AzureTokenCredentials credentials, String subscriptionId) { + return CosmosDBManager.authenticate(buildRestClient(credentials), subscriptionId); + } + } + private CosmosDBManager(RestClient restClient, String subscriptionId) { + super( + restClient, + subscriptionId, + new CosmosDBManagementClientImpl(restClient).withSubscriptionId(subscriptionId)); + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsImpl.java new file mode 100644 index 0000000000000..a58af4135c2dd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsImpl.java @@ -0,0 +1,309 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.resources.models.implementation.GroupableResourceCoreImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountGetResults; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountUpdateParameters; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Capability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ConnectorOffer; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ConsistencyPolicy; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountOfferType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.FailoverPolicy; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountKind; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Location; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.VirtualNetworkRule; +import rx.functions.Func1; + +class DatabaseAccountGetResultsImpl extends GroupableResourceCoreImpl implements DatabaseAccountGetResults, DatabaseAccountGetResults.Definition, DatabaseAccountGetResults.Update { + private DatabaseAccountCreateUpdateParameters createParameter; + private DatabaseAccountUpdateParameters updateParameter; + DatabaseAccountGetResultsImpl(String name, DatabaseAccountGetResultsInner inner, CosmosDBManager manager) { + super(name, inner, manager); + this.createParameter = new DatabaseAccountCreateUpdateParameters(); + this.updateParameter = new DatabaseAccountUpdateParameters(); + } + + @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 DatabaseAccountGetResultsInner call(DatabaseAccountGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + DatabaseAccountsInner client = this.manager().inner().databaseAccounts(); + return client.updateAsync(this.resourceGroupName(), this.name(), this.updateParameter) + .map(new Func1() { + @Override + public DatabaseAccountGetResultsInner call(DatabaseAccountGetResultsInner 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 DatabaseAccountUpdateParameters(); + } + + @Override + public List capabilities() { + return this.inner().capabilities(); + } + + @Override + public ConnectorOffer connectorOffer() { + return this.inner().connectorOffer(); + } + + @Override + public ConsistencyPolicy consistencyPolicy() { + return this.inner().consistencyPolicy(); + } + + @Override + public DatabaseAccountOfferType databaseAccountOfferType() { + return this.inner().databaseAccountOfferType(); + } + + @Override + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.inner().disableKeyBasedMetadataWriteAccess(); + } + + @Override + public String documentEndpoint() { + return this.inner().documentEndpoint(); + } + + @Override + public Boolean enableAutomaticFailover() { + return this.inner().enableAutomaticFailover(); + } + + @Override + public Boolean enableCassandraConnector() { + return this.inner().enableCassandraConnector(); + } + + @Override + public Boolean enableMultipleWriteLocations() { + return this.inner().enableMultipleWriteLocations(); + } + + @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 String keyVaultKeyUri() { + return this.inner().keyVaultKeyUri(); + } + + @Override + public DatabaseAccountKind kind() { + return this.inner().kind(); + } + + @Override + public List locations() { + return this.inner().locations(); + } + + @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 DatabaseAccountGetResultsImpl withDatabaseAccountOfferType(String databaseAccountOfferType) { + this.createParameter.withDatabaseAccountOfferType(databaseAccountOfferType); + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withKind(DatabaseAccountKind kind) { + this.createParameter.withKind(kind); + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withLocations(List locations) { + if (isInCreateMode()) { + this.createParameter.withLocations(locations); + } else { + this.updateParameter.withLocations(locations); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withCapabilities(List capabilities) { + if (isInCreateMode()) { + this.createParameter.withCapabilities(capabilities); + } else { + this.updateParameter.withCapabilities(capabilities); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withConnectorOffer(ConnectorOffer connectorOffer) { + if (isInCreateMode()) { + this.createParameter.withConnectorOffer(connectorOffer); + } else { + this.updateParameter.withConnectorOffer(connectorOffer); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withConsistencyPolicy(ConsistencyPolicy consistencyPolicy) { + if (isInCreateMode()) { + this.createParameter.withConsistencyPolicy(consistencyPolicy); + } else { + this.updateParameter.withConsistencyPolicy(consistencyPolicy); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess) { + if (isInCreateMode()) { + this.createParameter.withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + } else { + this.updateParameter.withDisableKeyBasedMetadataWriteAccess(disableKeyBasedMetadataWriteAccess); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withEnableAutomaticFailover(Boolean enableAutomaticFailover) { + if (isInCreateMode()) { + this.createParameter.withEnableAutomaticFailover(enableAutomaticFailover); + } else { + this.updateParameter.withEnableAutomaticFailover(enableAutomaticFailover); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withEnableCassandraConnector(Boolean enableCassandraConnector) { + if (isInCreateMode()) { + this.createParameter.withEnableCassandraConnector(enableCassandraConnector); + } else { + this.updateParameter.withEnableCassandraConnector(enableCassandraConnector); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + if (isInCreateMode()) { + this.createParameter.withEnableMultipleWriteLocations(enableMultipleWriteLocations); + } else { + this.updateParameter.withEnableMultipleWriteLocations(enableMultipleWriteLocations); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withIpRangeFilter(String ipRangeFilter) { + if (isInCreateMode()) { + this.createParameter.withIpRangeFilter(ipRangeFilter); + } else { + this.updateParameter.withIpRangeFilter(ipRangeFilter); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withIsVirtualNetworkFilterEnabled(Boolean isVirtualNetworkFilterEnabled) { + if (isInCreateMode()) { + this.createParameter.withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + } else { + this.updateParameter.withIsVirtualNetworkFilterEnabled(isVirtualNetworkFilterEnabled); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withKeyVaultKeyUri(String keyVaultKeyUri) { + if (isInCreateMode()) { + this.createParameter.withKeyVaultKeyUri(keyVaultKeyUri); + } else { + this.updateParameter.withKeyVaultKeyUri(keyVaultKeyUri); + } + return this; + } + + @Override + public DatabaseAccountGetResultsImpl withVirtualNetworkRules(List virtualNetworkRules) { + if (isInCreateMode()) { + this.createParameter.withVirtualNetworkRules(virtualNetworkRules); + } else { + this.updateParameter.withVirtualNetworkRules(virtualNetworkRules); + } + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsInner.java new file mode 100644 index 0000000000000..5fcbed3740df9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountGetResultsInner.java @@ -0,0 +1,470 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountKind; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountOfferType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ConsistencyPolicy; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Capability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Location; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.FailoverPolicy; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.VirtualNetworkRule; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ConnectorOffer; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB database account. + */ +@JsonFlatten +public class DatabaseAccountGetResultsInner extends ARMResourceProperties { + /** + * 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 all of the locations enabled for the Cosmos DB + * account. + */ + @JsonProperty(value = "properties.locations", access = JsonProperty.Access.WRITE_ONLY) + private List locations; + + /** + * 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; + + /** + * Enables the account to write in multiple locations. + */ + @JsonProperty(value = "properties.enableMultipleWriteLocations") + private Boolean enableMultipleWriteLocations; + + /** + * Enables the cassandra connector on the Cosmos DB C* account. + */ + @JsonProperty(value = "properties.enableCassandraConnector") + private Boolean enableCassandraConnector; + + /** + * The cassandra connector offer type for the Cosmos DB database C* + * account. Possible values include: 'Small'. + */ + @JsonProperty(value = "properties.connectorOffer") + private ConnectorOffer connectorOffer; + + /** + * Disable write operations on metadata resources (databases, containers, + * throughput) via account keys. + */ + @JsonProperty(value = "properties.disableKeyBasedMetadataWriteAccess") + private Boolean disableKeyBasedMetadataWriteAccess; + + /** + * The URI of the key vault. + */ + @JsonProperty(value = "properties.keyVaultKeyUri") + private String keyVaultKeyUri; + + /** + * 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner 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 all of the locations enabled for the Cosmos DB account. + * + * @return the locations value + */ + public List locations() { + return this.locations; + } + + /** + * 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 DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get enables the account to write in multiple locations. + * + * @return the enableMultipleWriteLocations value + */ + public Boolean enableMultipleWriteLocations() { + return this.enableMultipleWriteLocations; + } + + /** + * Set enables the account to write in multiple locations. + * + * @param enableMultipleWriteLocations the enableMultipleWriteLocations value to set + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableMultipleWriteLocations(Boolean enableMultipleWriteLocations) { + this.enableMultipleWriteLocations = enableMultipleWriteLocations; + return this; + } + + /** + * Get enables the cassandra connector on the Cosmos DB C* account. + * + * @return the enableCassandraConnector value + */ + public Boolean enableCassandraConnector() { + return this.enableCassandraConnector; + } + + /** + * Set enables the cassandra connector on the Cosmos DB C* account. + * + * @param enableCassandraConnector the enableCassandraConnector value to set + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withEnableCassandraConnector(Boolean enableCassandraConnector) { + this.enableCassandraConnector = enableCassandraConnector; + return this; + } + + /** + * Get the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @return the connectorOffer value + */ + public ConnectorOffer connectorOffer() { + return this.connectorOffer; + } + + /** + * Set the cassandra connector offer type for the Cosmos DB database C* account. Possible values include: 'Small'. + * + * @param connectorOffer the connectorOffer value to set + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withConnectorOffer(ConnectorOffer connectorOffer) { + this.connectorOffer = connectorOffer; + return this; + } + + /** + * Get disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @return the disableKeyBasedMetadataWriteAccess value + */ + public Boolean disableKeyBasedMetadataWriteAccess() { + return this.disableKeyBasedMetadataWriteAccess; + } + + /** + * Set disable write operations on metadata resources (databases, containers, throughput) via account keys. + * + * @param disableKeyBasedMetadataWriteAccess the disableKeyBasedMetadataWriteAccess value to set + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withDisableKeyBasedMetadataWriteAccess(Boolean disableKeyBasedMetadataWriteAccess) { + this.disableKeyBasedMetadataWriteAccess = disableKeyBasedMetadataWriteAccess; + return this; + } + + /** + * Get the URI of the key vault. + * + * @return the keyVaultKeyUri value + */ + public String keyVaultKeyUri() { + return this.keyVaultKeyUri; + } + + /** + * Set the URI of the key vault. + * + * @param keyVaultKeyUri the keyVaultKeyUri value to set + * @return the DatabaseAccountGetResultsInner object itself. + */ + public DatabaseAccountGetResultsInner withKeyVaultKeyUri(String keyVaultKeyUri) { + this.keyVaultKeyUri = keyVaultKeyUri; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultImpl.java new file mode 100644 index 0000000000000..f4eeb40e8a57c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountListConnectionStringsResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountConnectionString; + +class DatabaseAccountListConnectionStringsResultImpl extends WrapperImpl implements DatabaseAccountListConnectionStringsResult { + private final CosmosDBManager manager; + DatabaseAccountListConnectionStringsResultImpl(DatabaseAccountListConnectionStringsResultInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public List connectionStrings() { + return this.inner().connectionStrings(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListConnectionStringsResultInner.java new file mode 100644 index 0000000000000..faf8e8d0d9703 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultImpl.java new file mode 100644 index 0000000000000..4bdbe9bd5895a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountListKeysResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseAccountListKeysResultImpl extends WrapperImpl implements DatabaseAccountListKeysResult { + private final CosmosDBManager manager; + DatabaseAccountListKeysResultImpl(DatabaseAccountListKeysResultInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultInner.java new file mode 100644 index 0000000000000..ecbf3e7cdfad2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListKeysResultInner.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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The access keys for the given database account. + */ +public class DatabaseAccountListKeysResultInner extends DatabaseAccountListReadOnlyKeysResultInner { + /** + * 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; + + /** + * 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; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultImpl.java new file mode 100644 index 0000000000000..3b02fe519d178 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountListReadOnlyKeysResult; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; + +class DatabaseAccountListReadOnlyKeysResultImpl extends WrapperImpl implements DatabaseAccountListReadOnlyKeysResult { + private final CosmosDBManager manager; + DatabaseAccountListReadOnlyKeysResultImpl(DatabaseAccountListReadOnlyKeysResultInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public String primaryReadonlyMasterKey() { + return this.inner().primaryReadonlyMasterKey(); + } + + @Override + public String secondaryReadonlyMasterKey() { + return this.inner().secondaryReadonlyMasterKey(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountListReadOnlyKeysResultInner.java new file mode 100644 index 0000000000000..2af58370ff411 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricDefinitionImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..6e99e74a4bbab --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricAvailability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrimaryAggregationType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabaseAccountMetricDefinitionImpl extends WrapperImpl implements DatabaseAccountMetricDefinition { + private final CosmosDBManager manager; + + DatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..68a327c4046a1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.MetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabaseAccountMetricImpl extends WrapperImpl implements DatabaseAccountMetric { + private final CosmosDBManager manager; + + DatabaseAccountMetricImpl(MetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsImpl.java new file mode 100644 index 0000000000000..1ad0e0254ef60 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountMetric; + +class DatabaseAccountRegionsImpl extends WrapperImpl implements DatabaseAccountRegions { + private final CosmosDBManager manager; + + DatabaseAccountRegionsImpl(CosmosDBManager manager) { + super(manager.inner().databaseAccountRegions()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsInner.java new file mode 100644 index 0000000000000..518b54e126cab --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountRegionsInner.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountUsageImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..2494cee63f7f8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabaseAccountUsageImpl extends WrapperImpl implements DatabaseAccountUsage { + private final CosmosDBManager manager; + + DatabaseAccountUsageImpl(UsageInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + + + @Override + public Long currentValue() { + return this.inner().currentValue(); + } + + @Override + public Long 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsImpl.java new file mode 100644 index 0000000000000..60050924fce02 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.resources.collection.implementation.GroupableResourcesCoreImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccounts; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountGetResults; +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.cosmosdb.v2019_12_12.DatabaseAccountListKeysResult; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountListConnectionStringsResult; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountListReadOnlyKeysResult; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.FailoverPolicy; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.KeyKind; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountUsage; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountMetricDefinition; + +class DatabaseAccountsImpl extends GroupableResourcesCoreImpl implements DatabaseAccounts { + protected DatabaseAccountsImpl(CosmosDBManager 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 DatabaseAccountGetResults call(DatabaseAccountGetResultsInner 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 DatabaseAccountGetResults call(DatabaseAccountGetResultsInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public DatabaseAccountGetResultsImpl 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 DatabaseAccountGetResultsImpl wrapModel(DatabaseAccountGetResultsInner inner) { + return new DatabaseAccountGetResultsImpl(inner.name(), inner, manager()); + } + + @Override + protected DatabaseAccountGetResultsImpl wrapModel(String name) { + return new DatabaseAccountGetResultsImpl(name, new DatabaseAccountGetResultsInner(), 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 Observable checkNameExistsAsync(String accountName) { + DatabaseAccountsInner client = this.inner(); + return client.checkNameExistsAsync(accountName) + ;} + + @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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsInner.java new file mode 100644 index 0000000000000..d75eeecbe52a9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabaseAccountsInner.java @@ -0,0 +1,2356 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.DatabaseAccountCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountRegenerateKeyParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabaseAccountUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ErrorResponseException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.FailoverPolicies; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.FailoverPolicy; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.KeyKind; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.DatabaseAccounts update" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> update(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountUpdateParameters 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.cosmosdb.v2019_12_12.DatabaseAccounts beginUpdate" }) + @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}") + Observable> beginUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Query("api-version") String apiVersion, @Body DatabaseAccountUpdateParameters 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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 DatabaseAccountGetResultsInner object if successful. + */ + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner object + */ + public Observable getByResourceGroupAsync(String resourceGroupName, String accountName) { + return getByResourceGroupWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1, DatabaseAccountGetResultsInner>() { + @Override + public DatabaseAccountGetResultsInner 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 DatabaseAccountGetResultsInner 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."); + } + final String apiVersion = "2019-12-12"; + return service.getByResourceGroup(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getByResourceGroupDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getByResourceGroupDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Updates 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 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 DatabaseAccountGetResultsInner object if successful. + */ + public DatabaseAccountGetResultsInner update(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().last().body(); + } + + /** + * Updates 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 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 updateAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); + } + + /** + * Updates 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 parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return updateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountGetResultsInner>() { + @Override + public DatabaseAccountGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters 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 (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); + } + Validator.validate(updateParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.update(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, updateParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Updates 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 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 DatabaseAccountGetResultsInner object if successful. + */ + public DatabaseAccountGetResultsInner beginUpdate(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).toBlocking().single().body(); + } + + /** + * Updates 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 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 beginUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters), serviceCallback); + } + + /** + * Updates 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 parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountGetResultsInner object + */ + public Observable beginUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters updateParameters) { + return beginUpdateWithServiceResponseAsync(resourceGroupName, accountName, updateParameters).map(new Func1, DatabaseAccountGetResultsInner>() { + @Override + public DatabaseAccountGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Updates 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 parameters to provide for the current database account. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the DatabaseAccountGetResultsInner object + */ + public Observable> beginUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, DatabaseAccountUpdateParameters 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 (updateParameters == null) { + throw new IllegalArgumentException("Parameter updateParameters is required and cannot be null."); + } + Validator.validate(updateParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdate(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, updateParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateDelegate(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. The "Update" method is preferred when performing updates on an 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 DatabaseAccountGetResultsInner object if successful. + */ + public DatabaseAccountGetResultsInner createOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().last().body(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an 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. The "Update" method is preferred when performing updates on an 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, DatabaseAccountGetResultsInner>() { + @Override + public DatabaseAccountGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an 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 (createUpdateParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null."); + } + Validator.validate(createUpdateParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, 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. The "Update" method is preferred when performing updates on an 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 DatabaseAccountGetResultsInner object if successful. + */ + public DatabaseAccountGetResultsInner beginCreateOrUpdate(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).toBlocking().single().body(); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an 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. The "Update" method is preferred when performing updates on an 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 DatabaseAccountGetResultsInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, DatabaseAccountCreateUpdateParameters createUpdateParameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, createUpdateParameters).map(new Func1, DatabaseAccountGetResultsInner>() { + @Override + public DatabaseAccountGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Creates or updates an Azure Cosmos DB database account. The "Update" method is preferred when performing updates on an 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 DatabaseAccountGetResultsInner 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 (createUpdateParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateParameters is required and cannot be null."); + } + Validator.validate(createUpdateParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, 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 (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } + Validator.validate(failoverPolicies); + final String apiVersion = "2019-12-12"; + FailoverPolicies failoverParameters = new FailoverPolicies(); + failoverParameters.withFailoverPolicies(failoverPolicies); + Observable> observable = service.failoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, 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 (failoverPolicies == null) { + throw new IllegalArgumentException("Parameter failoverPolicies is required and cannot be null."); + } + Validator.validate(failoverPolicies); + final String apiVersion = "2019-12-12"; + FailoverPolicies failoverParameters = new FailoverPolicies(); + failoverParameters.withFailoverPolicies(failoverPolicies); + return service.beginFailoverPriorityChange(this.client.subscriptionId(), resourceGroupName, accountName, 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<DatabaseAccountGetResultsInner> 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<DatabaseAccountGetResultsInner> object + */ + public Observable>> listWithServiceResponseAsync() { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.list(this.client.subscriptionId(), 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<DatabaseAccountGetResultsInner> 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<DatabaseAccountGetResultsInner> 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."); + } + final String apiVersion = "2019-12-12"; + return service.listByResourceGroup(resourceGroupName, this.client.subscriptionId(), 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."); + } + final String apiVersion = "2019-12-12"; + return service.listKeys(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listConnectionStrings(this.client.subscriptionId(), resourceGroupName, accountName, 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 (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + Observable> observable = service.offlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, 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 (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + RegionForOnlineOffline regionParameterForOffline = new RegionForOnlineOffline(); + regionParameterForOffline.withRegion(region); + return service.beginOfflineRegion(this.client.subscriptionId(), resourceGroupName, accountName, 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 (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + Observable> observable = service.onlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, 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 (region == null) { + throw new IllegalArgumentException("Parameter region is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + RegionForOnlineOffline regionParameterForOnline = new RegionForOnlineOffline(); + regionParameterForOnline.withRegion(region); + return service.beginOnlineRegion(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.getReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listReadOnlyKeys(this.client.subscriptionId(), resourceGroupName, accountName, 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 (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + Observable> observable = service.regenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, 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 (keyKind == null) { + throw new IllegalArgumentException("Parameter keyKind is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + DatabaseAccountRegenerateKeyParameters keyToRegenerate = new DatabaseAccountRegenerateKeyParameters(); + keyToRegenerate.withKeyKind(keyKind); + return service.beginRegenerateKey(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.checkNameExists(accountName, 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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, 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 definitions 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 definitions 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 definitions 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 definitions 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."); + } + final String apiVersion = "2019-12-12"; + return service.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesImpl.java new file mode 100644 index 0000000000000..b683f3128a7d7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Databases; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountMetric; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountUsage; + +class DatabasesImpl extends WrapperImpl implements Databases { + private final CosmosDBManager manager; + + DatabasesImpl(CosmosDBManager manager) { + super(manager.inner().databases()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesInner.java new file mode 100644 index 0000000000000..25fff6af9bcb9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasesInner.java @@ -0,0 +1,458 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, 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."); + } + final String apiVersion = "2019-12-12"; + final String filter = null; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, 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."); + } + final String apiVersion = "2019-12-12"; + return service.listUsages(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, 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 definitions 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 definitions 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 definitions 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 definitions 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."); + } + final String apiVersion = "2019-12-12"; + return service.listMetricDefinitions(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricDefinitionImpl.java new file mode 100644 index 0000000000000..889f3c0cc3139 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountMetricDefinition; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricAvailability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrimaryAggregationType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabasisDatabaseAccountMetricDefinitionImpl extends WrapperImpl implements DatabasisDatabaseAccountMetricDefinition { + private final CosmosDBManager manager; + + DatabasisDatabaseAccountMetricDefinitionImpl(MetricDefinitionInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountMetricImpl.java new file mode 100644 index 0000000000000..88e43744db684 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.MetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabasisDatabaseAccountMetricImpl extends WrapperImpl implements DatabasisDatabaseAccountMetric { + private final CosmosDBManager manager; + + DatabasisDatabaseAccountMetricImpl(MetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountUsageImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/DatabasisDatabaseAccountUsageImpl.java new file mode 100644 index 0000000000000..85bfc7aca94d7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.DatabasisDatabaseAccountUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class DatabasisDatabaseAccountUsageImpl extends WrapperImpl implements DatabasisDatabaseAccountUsage { + private final CosmosDBManager manager; + + DatabasisDatabaseAccountUsageImpl(UsageInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + + + @Override + public Long currentValue() { + return this.inner().currentValue(); + } + + @Override + public Long 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..ad4e6b99bb7e8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseResource; +import rx.functions.Func1; + +class GremlinDatabaseGetResultsImpl extends CreatableUpdatableImpl implements GremlinDatabaseGetResults, GremlinDatabaseGetResults.Definition, GremlinDatabaseGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private GremlinDatabaseCreateUpdateParameters createOrUpdateParameter; + + GremlinDatabaseGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new GremlinDatabaseGetResultsInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new GremlinDatabaseCreateUpdateParameters(); + } + + GremlinDatabaseGetResultsImpl(GremlinDatabaseGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "gremlinDatabases"); + // + this.createOrUpdateParameter = new GremlinDatabaseCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.createUpdateGremlinDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public GremlinDatabaseGetResultsInner call(GremlinDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.createUpdateGremlinDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public GremlinDatabaseGetResultsInner call(GremlinDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.getGremlinDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new GremlinDatabaseCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public GremlinDatabaseGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GremlinDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public GremlinDatabaseGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public GremlinDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public GremlinDatabaseGetResultsImpl withResource(GremlinDatabaseResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public GremlinDatabaseGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..43fe295424923 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinDatabaseGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB Gremlin database. + */ +@JsonFlatten +public class GremlinDatabaseGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private GremlinDatabaseGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public GremlinDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the GremlinDatabaseGetResultsInner object itself. + */ + public GremlinDatabaseGetResultsInner withResource(GremlinDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsImpl.java new file mode 100644 index 0000000000000..2c525802b7563 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphResource; +import rx.functions.Func1; + +class GremlinGraphGetResultsImpl extends CreatableUpdatableImpl implements GremlinGraphGetResults, GremlinGraphGetResults.Definition, GremlinGraphGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String graphName; + private GremlinGraphCreateUpdateParameters createOrUpdateParameter; + + GremlinGraphGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new GremlinGraphGetResultsInner()); + this.manager = manager; + // Set resource name + this.graphName = name; + // + this.createOrUpdateParameter = new GremlinGraphCreateUpdateParameters(); + } + + GremlinGraphGetResultsImpl(GremlinGraphGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.graphName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "gremlinDatabases"); + this.graphName = IdParsingUtils.getValueFromIdByName(inner.id(), "graphs"); + // + this.createOrUpdateParameter = new GremlinGraphCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.createUpdateGremlinGraphAsync(this.resourceGroupName, this.accountName, this.databaseName, this.graphName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public GremlinGraphGetResultsInner call(GremlinGraphGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.createUpdateGremlinGraphAsync(this.resourceGroupName, this.accountName, this.databaseName, this.graphName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public GremlinGraphGetResultsInner call(GremlinGraphGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + GremlinResourcesInner client = this.manager().inner().gremlinResources(); + return client.getGremlinGraphAsync(this.resourceGroupName, this.accountName, this.databaseName, this.graphName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new GremlinGraphCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public GremlinGraphGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public GremlinGraphGetResultsImpl withExistingGremlinDatabasis(String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + @Override + public GremlinGraphGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public GremlinGraphGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public GremlinGraphGetResultsImpl withResource(GremlinGraphResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public GremlinGraphGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsInner.java new file mode 100644 index 0000000000000..7a249205c3117 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinGraphGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB Gremlin graph. + */ +@JsonFlatten +public class GremlinGraphGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private GremlinGraphGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public GremlinGraphGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the GremlinGraphGetResultsInner object itself. + */ + public GremlinGraphGetResultsInner withResource(GremlinGraphGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesImpl.java new file mode 100644 index 0000000000000..00ef4570daf99 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesImpl.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinResources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseGetResults; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphGetResults; + +class GremlinResourcesImpl extends WrapperImpl implements GremlinResources { + private final CosmosDBManager manager; + + GremlinResourcesImpl(CosmosDBManager manager) { + super(manager.inner().gremlinResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public GremlinDatabaseGetResultsImpl defineGremlinDatabasis(String name) { + return wrapGremlinDatabasisModel(name); + } + + @Override + public GremlinGraphGetResultsImpl defineGraph(String name) { + return wrapGraphModel(name); + } + + private GremlinDatabaseGetResultsImpl wrapGremlinDatabasisModel(String name) { + return new GremlinDatabaseGetResultsImpl(name, this.manager()); + } + + private GremlinGraphGetResultsImpl wrapGraphModel(String name) { + return new GremlinGraphGetResultsImpl(name, this.manager()); + } + + private GremlinDatabaseGetResultsImpl wrapGremlinDatabaseGetResultsModel(GremlinDatabaseGetResultsInner inner) { + return new GremlinDatabaseGetResultsImpl(inner, manager()); + } + + private GremlinGraphGetResultsImpl wrapGremlinGraphGetResultsModel(GremlinGraphGetResultsInner inner) { + return new GremlinGraphGetResultsImpl(inner, manager()); + } + + private Observable getGremlinDatabaseGetResultsInnerUsingGremlinResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "gremlinDatabases"); + GremlinResourcesInner client = this.inner(); + return client.getGremlinDatabaseAsync(resourceGroupName, accountName, databaseName); + } + + private Observable getGremlinGraphGetResultsInnerUsingGremlinResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "gremlinDatabases"); + String graphName = IdParsingUtils.getValueFromIdByName(id, "graphs"); + GremlinResourcesInner client = this.inner(); + return client.getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName); + } + + @Override + public Observable getGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.getGremlinDatabaseAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(GremlinDatabaseGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((GremlinDatabaseGetResults)wrapGremlinDatabaseGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listGremlinDatabasesAsync(String resourceGroupName, String accountName) { + GremlinResourcesInner client = this.inner(); + return client.listGremlinDatabasesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public GremlinDatabaseGetResults call(GremlinDatabaseGetResultsInner inner) { + return wrapGremlinDatabaseGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.deleteGremlinDatabaseAsync(resourceGroupName, accountName, databaseName).toCompletable(); + } + + @Override + public Observable getGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.getGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + GremlinResourcesInner client = this.inner(); + return client.updateGremlinDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinResourcesInner client = this.inner(); + return client.getGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + GremlinResourcesInner client = this.inner(); + return client.updateGremlinGraphThroughputAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinResourcesInner client = this.inner(); + return client.getGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName) + .flatMap(new Func1>() { + @Override + public Observable call(GremlinGraphGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((GremlinGraphGetResults)wrapGremlinGraphGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName) { + GremlinResourcesInner client = this.inner(); + return client.listGremlinGraphsAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public GremlinGraphGetResults call(GremlinGraphGetResultsInner inner) { + return wrapGremlinGraphGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + GremlinResourcesInner client = this.inner(); + return client.deleteGremlinGraphAsync(resourceGroupName, accountName, databaseName, graphName).toCompletable(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesInner.java new file mode 100644 index 0000000000000..a14440ad5bd8f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/GremlinResourcesInner.java @@ -0,0 +1,1797 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinGraphCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in GremlinResources. + */ +public class GremlinResourcesInner { + /** The Retrofit service to perform REST calls. */ + private GremlinResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of GremlinResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public GremlinResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(GremlinResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for GremlinResources to be + * used by Retrofit to perform actually REST calls. + */ + interface GremlinResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.GremlinResources listGremlinDatabases" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases") + Observable> listGremlinDatabases(@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.cosmosdb.v2019_12_12.GremlinResources getGremlinDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + Observable> getGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.GremlinResources createUpdateGremlinDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + Observable> createUpdateGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, @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.cosmosdb.v2019_12_12.GremlinResources beginCreateUpdateGremlinDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}") + Observable> beginCreateUpdateGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, @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.cosmosdb.v2019_12_12.GremlinResources deleteGremlinDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> deleteGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.GremlinResources beginDeleteGremlinDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDeleteGremlinDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.GremlinResources getGremlinDatabaseThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + Observable> getGremlinDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.GremlinResources updateGremlinDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + Observable> updateGremlinDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.GremlinResources beginUpdateGremlinDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/throughputSettings/default") + Observable> beginUpdateGremlinDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.GremlinResources listGremlinGraphs" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs") + Observable> listGremlinGraphs(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.GremlinResources getGremlinGraph" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + Observable> getGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @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.cosmosdb.v2019_12_12.GremlinResources createUpdateGremlinGraph" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + Observable> createUpdateGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Body GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, @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.cosmosdb.v2019_12_12.GremlinResources beginCreateUpdateGremlinGraph" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}") + Observable> beginCreateUpdateGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Body GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, @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.cosmosdb.v2019_12_12.GremlinResources deleteGremlinGraph" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", method = "DELETE", hasBody = true) + Observable> deleteGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @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.cosmosdb.v2019_12_12.GremlinResources beginDeleteGremlinGraph" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}", method = "DELETE", hasBody = true) + Observable> beginDeleteGremlinGraph(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @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.cosmosdb.v2019_12_12.GremlinResources getGremlinGraphThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") + Observable> getGremlinGraphThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @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.cosmosdb.v2019_12_12.GremlinResources updateGremlinGraphThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") + Observable> updateGremlinGraphThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.GremlinResources beginUpdateGremlinGraphThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/gremlinDatabases/{databaseName}/graphs/{graphName}/throughputSettings/default") + Observable> beginUpdateGremlinGraphThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("graphName") String graphName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the Gremlin databases under 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 List<GremlinDatabaseGetResultsInner> object if successful. + */ + public List listGremlinDatabases(String resourceGroupName, String accountName) { + return listGremlinDatabasesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the Gremlin databases under 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> listGremlinDatabasesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listGremlinDatabasesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the Gremlin databases under 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 List<GremlinDatabaseGetResultsInner> object + */ + public Observable> listGremlinDatabasesAsync(String resourceGroupName, String accountName) { + return listGremlinDatabasesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Gremlin databases under 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 List<GremlinDatabaseGetResultsInner> object + */ + public Observable>> listGremlinDatabasesWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-12-12"; + return service.listGremlinDatabases(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listGremlinDatabasesDelegate(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> listGremlinDatabasesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 GremlinDatabaseGetResultsInner object if successful. + */ + public GremlinDatabaseGetResultsInner getGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinDatabaseGetResultsInner object + */ + public Observable getGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, GremlinDatabaseGetResultsInner>() { + @Override + public GremlinDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Gremlin databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinDatabaseGetResultsInner object + */ + public Observable> getGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinDatabaseDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @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 GremlinDatabaseGetResultsInner object if successful. + */ + public GremlinDatabaseGetResultsInner createUpdateGremlinDatabase(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return createUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @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 createUpdateGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return createUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).map(new Func1, GremlinDatabaseGetResultsInner>() { + @Override + public GremlinDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateGremlinDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinDatabaseParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateGremlinDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @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 GremlinDatabaseGetResultsInner object if successful. + */ + public GremlinDatabaseGetResultsInner beginCreateUpdateGremlinDatabase(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @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 beginCreateUpdateGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinDatabaseGetResultsInner object + */ + public Observable beginCreateUpdateGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + return beginCreateUpdateGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateGremlinDatabaseParameters).map(new Func1, GremlinDatabaseGetResultsInner>() { + @Override + public GremlinDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateGremlinDatabaseParameters The parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinDatabaseGetResultsInner object + */ + public Observable> beginCreateUpdateGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, GremlinDatabaseCreateUpdateParameters createUpdateGremlinDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateGremlinDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinDatabaseParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateGremlinDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateGremlinDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateGremlinDatabaseDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return deleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteGremlinDatabase(String resourceGroupName, String accountName, String databaseName) { + beginDeleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteGremlinDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteGremlinDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteGremlinDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteGremlinDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteGremlinDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteGremlinDatabaseDelegate(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); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getGremlinDatabaseThroughput(String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + return getGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the Gremlin database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getGremlinDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getGremlinDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinDatabaseThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateGremlinDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @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 updateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateGremlinDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateGremlinDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateGremlinDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @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 beginUpdateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateGremlinDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateGremlinDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateGremlinDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateGremlinDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateGremlinDatabaseThroughputDelegate(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); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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<GremlinGraphGetResultsInner> object if successful. + */ + public List listGremlinGraphs(String resourceGroupName, String accountName, String databaseName) { + return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GremlinGraphGetResultsInner> object + */ + public Observable> listGremlinGraphsAsync(String resourceGroupName, String accountName, String databaseName) { + return listGremlinGraphsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<GremlinGraphGetResultsInner> object + */ + public Observable>> listGremlinGraphsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listGremlinGraphs(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listGremlinGraphsDelegate(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> listGremlinGraphsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 GremlinGraphGetResultsInner object if successful. + */ + public GremlinGraphGetResultsInner getGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable getGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, GremlinGraphGetResultsInner>() { + @Override + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Gremlin graph under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable> getGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinGraphDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @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 GremlinGraphGetResultsInner object if successful. + */ + public GremlinGraphGetResultsInner createUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @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 createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return createUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + @Override + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (createUpdateGremlinGraphParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinGraphParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @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 GremlinGraphGetResultsInner object if successful. + */ + public GremlinGraphGetResultsInner beginCreateUpdateGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @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 beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable beginCreateUpdateGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + return beginCreateUpdateGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, createUpdateGremlinGraphParameters).map(new Func1, GremlinGraphGetResultsInner>() { + @Override + public GremlinGraphGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param createUpdateGremlinGraphParameters The parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the GremlinGraphGetResultsInner object + */ + public Observable> beginCreateUpdateGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, GremlinGraphCreateUpdateParameters createUpdateGremlinGraphParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (createUpdateGremlinGraphParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateGremlinGraphParameters is required and cannot be null."); + } + Validator.validate(createUpdateGremlinGraphParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, createUpdateGremlinGraphParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateGremlinGraphDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 deleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return deleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 beginDeleteGremlinGraph(String resourceGroupName, String accountName, String databaseName, String graphName) { + beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteGremlinGraphAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return beginDeleteGremlinGraphWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteGremlinGraphWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteGremlinGraph(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteGremlinGraphDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteGremlinGraphDelegate(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); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).toBlocking().single().body(); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph 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 getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName), serviceCallback); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + return getGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Gremlin graph throughput under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getGremlinGraphThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getGremlinGraphThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @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 updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateGremlinGraphThroughput(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @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 beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateGremlinGraphThroughputAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateGremlinGraphThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, graphName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Gremlin graph. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param graphName Cosmos DB graph name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current Gremlin graph. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateGremlinGraphThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String graphName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (graphName == null) { + throw new IllegalArgumentException("Parameter graphName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateGremlinGraphThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, graphName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateGremlinGraphThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateGremlinGraphThroughputDelegate(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); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/IdParsingUtils.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/IdParsingUtils.java new file mode 100644 index 0000000000000..4105ae7621a07 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; +import java.util.Arrays; +import java.util.Iterator; + +class IdParsingUtils { + public static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + public static String getValueFromIdByPosition(String id, int pos) { + if (id == null) { + return null; + } + Iterable iterable = Arrays.asList(id.split("/")); + Iterator itr = iterable.iterator(); + int index = 0; + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && part.trim() != "") { + if (index == pos) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + index++; + } + return null; + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricDefinitionInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricDefinitionInner.java new file mode 100644 index 0000000000000..c9406483d9875 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricAvailability; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrimaryAggregationType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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', 'Minimum', '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', 'Minimum', '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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MetricInner.java new file mode 100644 index 0000000000000..e46e94d4faeef --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsImpl.java new file mode 100644 index 0000000000000..abce5bc98d8fd --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionResource; +import rx.functions.Func1; + +class MongoDBCollectionGetResultsImpl extends CreatableUpdatableImpl implements MongoDBCollectionGetResults, MongoDBCollectionGetResults.Definition, MongoDBCollectionGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String collectionName; + private MongoDBCollectionCreateUpdateParameters createOrUpdateParameter; + + MongoDBCollectionGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new MongoDBCollectionGetResultsInner()); + this.manager = manager; + // Set resource name + this.collectionName = name; + // + this.createOrUpdateParameter = new MongoDBCollectionCreateUpdateParameters(); + } + + MongoDBCollectionGetResultsImpl(MongoDBCollectionGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.collectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "mongodbDatabases"); + this.collectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "collections"); + // + this.createOrUpdateParameter = new MongoDBCollectionCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.createUpdateMongoDBCollectionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.collectionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public MongoDBCollectionGetResultsInner call(MongoDBCollectionGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.createUpdateMongoDBCollectionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.collectionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public MongoDBCollectionGetResultsInner call(MongoDBCollectionGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.getMongoDBCollectionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.collectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new MongoDBCollectionCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public MongoDBCollectionGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public MongoDBCollectionGetResultsImpl withExistingMongodbDatabasis(String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + @Override + public MongoDBCollectionGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public MongoDBCollectionGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public MongoDBCollectionGetResultsImpl withResource(MongoDBCollectionResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public MongoDBCollectionGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsInner.java new file mode 100644 index 0000000000000..46454622244f3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBCollectionGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB MongoDB collection. + */ +@JsonFlatten +public class MongoDBCollectionGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private MongoDBCollectionGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public MongoDBCollectionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the MongoDBCollectionGetResultsInner object itself. + */ + public MongoDBCollectionGetResultsInner withResource(MongoDBCollectionGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..9390ddfd35b22 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseResource; +import rx.functions.Func1; + +class MongoDBDatabaseGetResultsImpl extends CreatableUpdatableImpl implements MongoDBDatabaseGetResults, MongoDBDatabaseGetResults.Definition, MongoDBDatabaseGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private MongoDBDatabaseCreateUpdateParameters createOrUpdateParameter; + + MongoDBDatabaseGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new MongoDBDatabaseGetResultsInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new MongoDBDatabaseCreateUpdateParameters(); + } + + MongoDBDatabaseGetResultsImpl(MongoDBDatabaseGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "mongodbDatabases"); + // + this.createOrUpdateParameter = new MongoDBDatabaseCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.createUpdateMongoDBDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public MongoDBDatabaseGetResultsInner call(MongoDBDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.createUpdateMongoDBDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public MongoDBDatabaseGetResultsInner call(MongoDBDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + MongoDBResourcesInner client = this.manager().inner().mongoDBResources(); + return client.getMongoDBDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new MongoDBDatabaseCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public MongoDBDatabaseGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public MongoDBDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public MongoDBDatabaseGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public MongoDBDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public MongoDBDatabaseGetResultsImpl withResource(MongoDBDatabaseResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public MongoDBDatabaseGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..133ead96def9a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBDatabaseGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB MongoDB database. + */ +@JsonFlatten +public class MongoDBDatabaseGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private MongoDBDatabaseGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public MongoDBDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the MongoDBDatabaseGetResultsInner object itself. + */ + public MongoDBDatabaseGetResultsInner withResource(MongoDBDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesImpl.java new file mode 100644 index 0000000000000..cdccce474ceb9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesImpl.java @@ -0,0 +1,206 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBResources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseGetResults; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionGetResults; + +class MongoDBResourcesImpl extends WrapperImpl implements MongoDBResources { + private final CosmosDBManager manager; + + MongoDBResourcesImpl(CosmosDBManager manager) { + super(manager.inner().mongoDBResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public MongoDBDatabaseGetResultsImpl defineMongodbDatabasis(String name) { + return wrapMongodbDatabasisModel(name); + } + + @Override + public MongoDBCollectionGetResultsImpl defineCollection(String name) { + return wrapCollectionModel(name); + } + + private MongoDBDatabaseGetResultsImpl wrapMongodbDatabasisModel(String name) { + return new MongoDBDatabaseGetResultsImpl(name, this.manager()); + } + + private MongoDBCollectionGetResultsImpl wrapCollectionModel(String name) { + return new MongoDBCollectionGetResultsImpl(name, this.manager()); + } + + private MongoDBDatabaseGetResultsImpl wrapMongoDBDatabaseGetResultsModel(MongoDBDatabaseGetResultsInner inner) { + return new MongoDBDatabaseGetResultsImpl(inner, manager()); + } + + private MongoDBCollectionGetResultsImpl wrapMongoDBCollectionGetResultsModel(MongoDBCollectionGetResultsInner inner) { + return new MongoDBCollectionGetResultsImpl(inner, manager()); + } + + private Observable getMongoDBDatabaseGetResultsInnerUsingMongoDBResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "mongodbDatabases"); + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName); + } + + private Observable getMongoDBCollectionGetResultsInnerUsingMongoDBResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "mongodbDatabases"); + String collectionName = IdParsingUtils.getValueFromIdByName(id, "collections"); + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName); + } + + @Override + public Observable getMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(MongoDBDatabaseGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((MongoDBDatabaseGetResults)wrapMongoDBDatabaseGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listMongoDBDatabasesAsync(String resourceGroupName, String accountName) { + MongoDBResourcesInner client = this.inner(); + return client.listMongoDBDatabasesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public MongoDBDatabaseGetResults call(MongoDBDatabaseGetResultsInner inner) { + return wrapMongoDBDatabaseGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.deleteMongoDBDatabaseAsync(resourceGroupName, accountName, databaseName).toCompletable(); + } + + @Override + public Observable getMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + MongoDBResourcesInner client = this.inner(); + return client.updateMongoDBDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + MongoDBResourcesInner client = this.inner(); + return client.updateMongoDBCollectionThroughputAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBResourcesInner client = this.inner(); + return client.getMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName) + .flatMap(new Func1>() { + @Override + public Observable call(MongoDBCollectionGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((MongoDBCollectionGetResults)wrapMongoDBCollectionGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName) { + MongoDBResourcesInner client = this.inner(); + return client.listMongoDBCollectionsAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public MongoDBCollectionGetResults call(MongoDBCollectionGetResultsInner inner) { + return wrapMongoDBCollectionGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + MongoDBResourcesInner client = this.inner(); + return client.deleteMongoDBCollectionAsync(resourceGroupName, accountName, databaseName, collectionName).toCompletable(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesInner.java new file mode 100644 index 0000000000000..9cb112a6471de --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/MongoDBResourcesInner.java @@ -0,0 +1,1797 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBCollectionCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in MongoDBResources. + */ +public class MongoDBResourcesInner { + /** The Retrofit service to perform REST calls. */ + private MongoDBResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of MongoDBResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public MongoDBResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(MongoDBResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for MongoDBResources to be + * used by Retrofit to perform actually REST calls. + */ + interface MongoDBResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.MongoDBResources listMongoDBDatabases" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases") + Observable> listMongoDBDatabases(@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.cosmosdb.v2019_12_12.MongoDBResources getMongoDBDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + Observable> getMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.MongoDBResources createUpdateMongoDBDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + Observable> createUpdateMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, @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.cosmosdb.v2019_12_12.MongoDBResources beginCreateUpdateMongoDBDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}") + Observable> beginCreateUpdateMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, @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.cosmosdb.v2019_12_12.MongoDBResources deleteMongoDBDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> deleteMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.MongoDBResources beginDeleteMongoDBDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDeleteMongoDBDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.MongoDBResources getMongoDBDatabaseThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + Observable> getMongoDBDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.MongoDBResources updateMongoDBDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + Observable> updateMongoDBDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.MongoDBResources beginUpdateMongoDBDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default") + Observable> beginUpdateMongoDBDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.MongoDBResources listMongoDBCollections" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections") + Observable> listMongoDBCollections(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.MongoDBResources getMongoDBCollection" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + Observable> getMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @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.cosmosdb.v2019_12_12.MongoDBResources createUpdateMongoDBCollection" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + Observable> createUpdateMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Body MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, @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.cosmosdb.v2019_12_12.MongoDBResources beginCreateUpdateMongoDBCollection" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}") + Observable> beginCreateUpdateMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Body MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, @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.cosmosdb.v2019_12_12.MongoDBResources deleteMongoDBCollection" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", method = "DELETE", hasBody = true) + Observable> deleteMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @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.cosmosdb.v2019_12_12.MongoDBResources beginDeleteMongoDBCollection" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}", method = "DELETE", hasBody = true) + Observable> beginDeleteMongoDBCollection(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @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.cosmosdb.v2019_12_12.MongoDBResources getMongoDBCollectionThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") + Observable> getMongoDBCollectionThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @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.cosmosdb.v2019_12_12.MongoDBResources updateMongoDBCollectionThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") + Observable> updateMongoDBCollectionThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.MongoDBResources beginUpdateMongoDBCollectionThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default") + Observable> beginUpdateMongoDBCollectionThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("collectionName") String collectionName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the MongoDB databases under 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 List<MongoDBDatabaseGetResultsInner> object if successful. + */ + public List listMongoDBDatabases(String resourceGroupName, String accountName) { + return listMongoDBDatabasesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the MongoDB databases under 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> listMongoDBDatabasesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMongoDBDatabasesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the MongoDB databases under 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 List<MongoDBDatabaseGetResultsInner> object + */ + public Observable> listMongoDBDatabasesAsync(String resourceGroupName, String accountName) { + return listMongoDBDatabasesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the MongoDB databases under 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 List<MongoDBDatabaseGetResultsInner> object + */ + public Observable>> listMongoDBDatabasesWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-12-12"; + return service.listMongoDBDatabases(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMongoDBDatabasesDelegate(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> listMongoDBDatabasesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 MongoDBDatabaseGetResultsInner object if successful. + */ + public MongoDBDatabaseGetResultsInner getMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBDatabaseGetResultsInner object + */ + public Observable getMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, MongoDBDatabaseGetResultsInner>() { + @Override + public MongoDBDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the MongoDB databases under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBDatabaseGetResultsInner object + */ + public Observable> getMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBDatabaseDelegate(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); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @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 MongoDBDatabaseGetResultsInner object if successful. + */ + public MongoDBDatabaseGetResultsInner createUpdateMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return createUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).toBlocking().last().body(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @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 createUpdateMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters), serviceCallback); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return createUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).map(new Func1, MongoDBDatabaseGetResultsInner>() { + @Override + public MongoDBDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateMongoDBDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBDatabaseParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateMongoDBDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @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 MongoDBDatabaseGetResultsInner object if successful. + */ + public MongoDBDatabaseGetResultsInner beginCreateUpdateMongoDBDatabase(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).toBlocking().single().body(); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @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 beginCreateUpdateMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters), serviceCallback); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBDatabaseGetResultsInner object + */ + public Observable beginCreateUpdateMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + return beginCreateUpdateMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateMongoDBDatabaseParameters).map(new Func1, MongoDBDatabaseGetResultsInner>() { + @Override + public MongoDBDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or updates Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateMongoDBDatabaseParameters The parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBDatabaseGetResultsInner object + */ + public Observable> beginCreateUpdateMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, MongoDBDatabaseCreateUpdateParameters createUpdateMongoDBDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateMongoDBDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBDatabaseParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateMongoDBDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateMongoDBDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateMongoDBDatabaseDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return deleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteMongoDBDatabase(String resourceGroupName, String accountName, String databaseName) { + beginDeleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteMongoDBDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteMongoDBDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteMongoDBDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteMongoDBDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteMongoDBDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteMongoDBDatabaseDelegate(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); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getMongoDBDatabaseThroughput(String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + return getMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getMongoDBDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getMongoDBDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBDatabaseThroughputDelegate(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); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateMongoDBDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @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 updateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateMongoDBDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateMongoDBDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateMongoDBDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @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 beginUpdateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateMongoDBDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of the an Azure Cosmos DB MongoDB database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateMongoDBDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateMongoDBDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateMongoDBDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateMongoDBDatabaseThroughputDelegate(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); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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<MongoDBCollectionGetResultsInner> object if successful. + */ + public List listMongoDBCollections(String resourceGroupName, String accountName, String databaseName) { + return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MongoDBCollectionGetResultsInner> object + */ + public Observable> listMongoDBCollectionsAsync(String resourceGroupName, String accountName, String databaseName) { + return listMongoDBCollectionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<MongoDBCollectionGetResultsInner> object + */ + public Observable>> listMongoDBCollectionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMongoDBCollections(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listMongoDBCollectionsDelegate(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> listMongoDBCollectionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 MongoDBCollectionGetResultsInner object if successful. + */ + public MongoDBCollectionGetResultsInner getMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable getMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, MongoDBCollectionGetResultsInner>() { + @Override + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the MongoDB collection under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable> getMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBCollectionDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @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 MongoDBCollectionGetResultsInner object if successful. + */ + public MongoDBCollectionGetResultsInner createUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @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 createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return createUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + @Override + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (createUpdateMongoDBCollectionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBCollectionParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @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 MongoDBCollectionGetResultsInner object if successful. + */ + public MongoDBCollectionGetResultsInner beginCreateUpdateMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @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 beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable beginCreateUpdateMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + return beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, createUpdateMongoDBCollectionParameters).map(new Func1, MongoDBCollectionGetResultsInner>() { + @Override + public MongoDBCollectionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param createUpdateMongoDBCollectionParameters The parameters to provide for the current MongoDB Collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the MongoDBCollectionGetResultsInner object + */ + public Observable> beginCreateUpdateMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, MongoDBCollectionCreateUpdateParameters createUpdateMongoDBCollectionParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (createUpdateMongoDBCollectionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateMongoDBCollectionParameters is required and cannot be null."); + } + Validator.validate(createUpdateMongoDBCollectionParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, createUpdateMongoDBCollectionParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateMongoDBCollectionDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 deleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return deleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 beginDeleteMongoDBCollection(String resourceGroupName, String accountName, String databaseName, String collectionName) { + beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteMongoDBCollectionAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return beginDeleteMongoDBCollectionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB MongoDB Collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteMongoDBCollectionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteMongoDBCollection(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteMongoDBCollectionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteMongoDBCollectionDelegate(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); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection 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 getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName), serviceCallback); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + return getMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the MongoDB collection under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getMongoDBCollectionThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getMongoDBCollectionThroughputDelegate(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); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @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 updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateMongoDBCollectionThroughput(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @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 beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters), serviceCallback); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateMongoDBCollectionThroughputAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, collectionName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update the RUs per second of an Azure Cosmos DB MongoDB collection. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param collectionName Cosmos DB collection name. + * @param updateThroughputParameters The RUs per second of the parameters to provide for the current MongoDB collection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateMongoDBCollectionThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String collectionName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (collectionName == null) { + throw new IllegalArgumentException("Parameter collectionName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateMongoDBCollectionThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, collectionName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateMongoDBCollectionThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateMongoDBCollectionThroughputDelegate(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); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationImpl.java new file mode 100644 index 0000000000000..e2341af09e355 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Operation; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.OperationDisplay; + +class OperationImpl extends WrapperImpl implements Operation { + private final CosmosDBManager manager; + OperationImpl(OperationInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public OperationDisplay display() { + return this.inner().display(); + } + + @Override + public String name() { + return this.inner().name(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationInner.java new file mode 100644 index 0000000000000..efcd05876fc76 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..70e86c7051cdb --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Operations; +import rx.functions.Func1; +import rx.Observable; +import com.microsoft.azure.Page; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Operation; + +class OperationsImpl extends WrapperImpl implements Operations { + private final CosmosDBManager manager; + + OperationsImpl(CosmosDBManager manager) { + super(manager.inner().operations()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable listAsync() { + OperationsInner client = this.inner(); + return client.listAsync() + .flatMapIterable(new Func1, Iterable>() { + @Override + public Iterable call(Page page) { + return page.items(); + } + }) + .map(new Func1() { + @Override + public Operation call(OperationInner inner) { + return new OperationImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsInner.java new file mode 100644 index 0000000000000..9b2f06ef80d5a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/OperationsInner.java @@ -0,0 +1,281 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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.cosmosdb.v2019_12_12.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() { + final String apiVersion = "2019-12-12"; + return service.list(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 { + 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl.java new file mode 100644 index 0000000000000..31d7b24097a0e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl implements Page { + /** + * The link to the next page. + */ + @JsonProperty("") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl1.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PageImpl1.java new file mode 100644 index 0000000000000..a6d51ad13327d --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.azure.Page; +import java.util.List; + +/** + * An instance of this class defines a page of Azure resources and a link to + * get the next page of resources, if any. + * + * @param type of Azure resource + */ +public class PageImpl1 implements Page { + /** + * The link to the next page. + */ + @JsonProperty("nextLink") + private String nextPageLink; + + /** + * The list of items. + */ + @JsonProperty("value") + private List items; + + /** + * Gets the link to the next page. + * + * @return the link to the next page. + */ + @Override + public String nextPageLink() { + return this.nextPageLink; + } + + /** + * Gets the list of items. + * + * @return the list of items in {@link List}. + */ + @Override + public List items() { + return items; + } + + /** + * Sets the link to the next page. + * + * @param nextPageLink the link to the next page. + * @return this Page object itself. + */ + public PageImpl1 setNextPageLink(String nextPageLink) { + this.nextPageLink = nextPageLink; + return this; + } + + /** + * Sets the list of items. + * + * @param items the list of items in {@link List}. + * @return this Page object itself. + */ + public PageImpl1 setItems(List items) { + this.items = items; + return this; + } +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsImpl.java new file mode 100644 index 0000000000000..dbf0db3fb6bc9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionKeyRangeIdRegions; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionMetric; + +class PartitionKeyRangeIdRegionsImpl extends WrapperImpl implements PartitionKeyRangeIdRegions { + private final CosmosDBManager manager; + + PartitionKeyRangeIdRegionsImpl(CosmosDBManager manager) { + super(manager.inner().partitionKeyRangeIdRegions()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsInner.java new file mode 100644 index 0000000000000..674969d0e03d4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdRegionsInner.java @@ -0,0 +1,185 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, region, databaseRid, collectionRid, partitionKeyRangeId, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsImpl.java new file mode 100644 index 0000000000000..7c643cd1a153e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionKeyRangeIds; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionMetric; + +class PartitionKeyRangeIdsImpl extends WrapperImpl implements PartitionKeyRangeIds { + private final CosmosDBManager manager; + + PartitionKeyRangeIdsImpl(CosmosDBManager manager) { + super(manager.inner().partitionKeyRangeIds()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsInner.java new file mode 100644 index 0000000000000..0a262eb99f74c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionKeyRangeIdsInner.java @@ -0,0 +1,178 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricImpl.java new file mode 100644 index 0000000000000..4529511132cc6 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class PartitionMetricImpl extends WrapperImpl implements PartitionMetric { + private final CosmosDBManager manager; + PartitionMetricImpl(PartitionMetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionMetricInner.java new file mode 100644 index 0000000000000..283915babe766 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The metric values for a single partition. + */ +public class PartitionMetricInner extends MetricInner { + /** + * The partition 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 partition 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageImpl.java new file mode 100644 index 0000000000000..28a8a071701c9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PartitionUsage; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class PartitionUsageImpl extends WrapperImpl implements PartitionUsage { + private final CosmosDBManager manager; + PartitionUsageImpl(PartitionUsageInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Long currentValue() { + return this.inner().currentValue(); + } + + @Override + public Long 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PartitionUsageInner.java new file mode 100644 index 0000000000000..6854b4cae52ce --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The partition level usage data for a usage request. + */ +public class PartitionUsageInner extends UsageInner { + /** + * The partition 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 partition 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricImpl.java new file mode 100644 index 0000000000000..e9edac5696dd1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetric; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import org.joda.time.DateTime; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetricValue; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; + +class PercentileMetricImpl extends WrapperImpl implements PercentileMetric { + private final CosmosDBManager manager; + PercentileMetricImpl(PercentileMetricInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileMetricInner.java new file mode 100644 index 0000000000000..ebe85146783b2 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import org.joda.time.DateTime; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.MetricName; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsImpl.java new file mode 100644 index 0000000000000..a8d2a9db252c1 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileSourceTargets; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetric; + +class PercentileSourceTargetsImpl extends WrapperImpl implements PercentileSourceTargets { + private final CosmosDBManager manager; + + PercentileSourceTargetsImpl(CosmosDBManager manager) { + super(manager.inner().percentileSourceTargets()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsInner.java new file mode 100644 index 0000000000000..b59236f58f39a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileSourceTargetsInner.java @@ -0,0 +1,171 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, sourceRegion, targetRegion, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsImpl.java new file mode 100644 index 0000000000000..8c8fb949e6c64 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileTargets; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetric; + +class PercentileTargetsImpl extends WrapperImpl implements PercentileTargets { + private final CosmosDBManager manager; + + PercentileTargetsImpl(CosmosDBManager manager) { + super(manager.inner().percentileTargets()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsInner.java new file mode 100644 index 0000000000000..0e9a56cd1f92f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentileTargetsInner.java @@ -0,0 +1,164 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, targetRegion, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesImpl.java new file mode 100644 index 0000000000000..1bb4a72bd1636 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.Percentiles; +import rx.functions.Func1; +import rx.Observable; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PercentileMetric; + +class PercentilesImpl extends WrapperImpl implements Percentiles { + private final CosmosDBManager manager; + + PercentilesImpl(CosmosDBManager manager) { + super(manager.inner().percentiles()); + this.manager = manager; + } + + public CosmosDBManager 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesInner.java new file mode 100644 index 0000000000000..8d72795248049 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PercentilesInner.java @@ -0,0 +1,157 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 CosmosDBManagementClientImpl 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, CosmosDBManagementClientImpl 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.cosmosdb.v2019_12_12.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 (filter == null) { + throw new IllegalArgumentException("Parameter filter is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listMetrics(this.client.subscriptionId(), resourceGroupName, accountName, 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/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..6fa632dd785af --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnection; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointProperty; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkServiceConnectionStateProperty; + +class PrivateEndpointConnectionImpl extends CreatableUpdatableImpl implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String privateEndpointConnectionName; + + PrivateEndpointConnectionImpl(String name, CosmosDBManager manager) { + super(name, new PrivateEndpointConnectionInner()); + this.manager = manager; + // Set resource name + this.privateEndpointConnectionName = name; + // + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.privateEndpointConnectionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.privateEndpointConnectionName = IdParsingUtils.getValueFromIdByName(inner.id(), "privateEndpointConnections"); + // + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.privateEndpointConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.createOrUpdateAsync(this.resourceGroupName, this.accountName, this.privateEndpointConnectionName, this.inner()) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + PrivateEndpointConnectionsInner client = this.manager().inner().privateEndpointConnections(); + return client.getAsync(this.resourceGroupName, this.accountName, this.privateEndpointConnectionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public PrivateEndpointProperty privateEndpoint() { + return this.inner().privateEndpoint(); + } + + @Override + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.inner().privateLinkServiceConnectionState(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public PrivateEndpointConnectionImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.inner().withPrivateEndpoint(privateEndpoint); + return this; + } + + @Override + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.inner().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..45e04a7811ba7 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionInner.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointProperty; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * A private endpoint connection. + */ +@JsonFlatten +public class PrivateEndpointConnectionInner extends ProxyResource { + /** + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /** + * Connection State of the Private Endpoint Connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /** + * Get private endpoint which the connection belongs to. + * + * @return the privateEndpoint value + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get connection State of the Private Endpoint Connection. + * + * @return the privateLinkServiceConnectionState value + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set connection State of the Private Endpoint Connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..82b104207689e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,85 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + * + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnections; +import rx.Completable; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnection; + +class PrivateEndpointConnectionsImpl extends WrapperImpl implements PrivateEndpointConnections { + private final CosmosDBManager manager; + + PrivateEndpointConnectionsImpl(CosmosDBManager manager) { + super(manager.inner().privateEndpointConnections()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public PrivateEndpointConnectionImpl define(String name) { + return wrapModel(name); + } + + private PrivateEndpointConnectionImpl wrapModel(PrivateEndpointConnectionInner inner) { + return new PrivateEndpointConnectionImpl(inner, manager()); + } + + private PrivateEndpointConnectionImpl wrapModel(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } + + @Override + public Observable listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.listByDatabaseAccountAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PrivateEndpointConnection call(PrivateEndpointConnectionInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, privateEndpointConnectionName) + .flatMap(new Func1>() { + @Override + public Observable call(PrivateEndpointConnectionInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PrivateEndpointConnection)wrapModel(inner)); + } + } + }); + } + + @Override + public Completable deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + PrivateEndpointConnectionsInner client = this.inner(); + return client.deleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).toCompletable(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsInner.java new file mode 100644 index 0000000000000..f81617df19ea5 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateEndpointConnectionsInner.java @@ -0,0 +1,612 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ErrorResponseException; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in PrivateEndpointConnections. + */ +public class PrivateEndpointConnectionsInner { + /** The Retrofit service to perform REST calls. */ + private PrivateEndpointConnectionsService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PrivateEndpointConnectionsInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(PrivateEndpointConnectionsService.class); + this.client = client; + } + + /** + * The interface defining all the services for PrivateEndpointConnections to be + * used by Retrofit to perform actually REST calls. + */ + interface PrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnections listByDatabaseAccount" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections") + Observable> listByDatabaseAccount(@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.cosmosdb.v2019_12_12.PrivateEndpointConnections get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @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.cosmosdb.v2019_12_12.PrivateEndpointConnections createOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> createOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Query("api-version") String apiVersion, @Body PrivateEndpointConnectionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnections beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}") + Observable> beginCreateOrUpdate(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Query("api-version") String apiVersion, @Body PrivateEndpointConnectionInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateEndpointConnections delete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", method = "DELETE", hasBody = true) + Observable> delete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @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.cosmosdb.v2019_12_12.PrivateEndpointConnections beginDelete" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", method = "DELETE", hasBody = true) + Observable> beginDelete(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("privateEndpointConnectionName") String privateEndpointConnectionName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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<PrivateEndpointConnectionInner> object if successful. + */ + public List listByDatabaseAccount(String resourceGroupName, String accountName) { + return listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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> listByDatabaseAccountAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PrivateEndpointConnectionInner> object + */ + public Observable> listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + return listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * List all private endpoint connections on a Cosmos DB account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<PrivateEndpointConnectionInner> object + */ + public Observable>> listByDatabaseAccountWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-08-01-preview"; + return service.listByDatabaseAccount(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseAccountDelegate(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> listByDatabaseAccountDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner get(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).toBlocking().single().body(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + 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 (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + final String apiVersion = "2019-08-01-preview"; + return service.get(this.client.subscriptionId(), resourceGroupName, accountName, privateEndpointConnectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).toBlocking().last().body(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @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, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters), serviceCallback); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createOrUpdateAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return createOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01-preview"; + Observable> observable = service.createOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, privateEndpointConnectionName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateEndpointConnectionInner object if successful. + */ + public PrivateEndpointConnectionInner beginCreateOrUpdate(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).toBlocking().single().body(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @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, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters), serviceCallback); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName, parameters).map(new Func1, PrivateEndpointConnectionInner>() { + @Override + public PrivateEndpointConnectionInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters the PrivateEndpointConnectionInner value + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateEndpointConnectionInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + final String apiVersion = "2019-08-01-preview"; + return service.beginCreateOrUpdate(this.client.subscriptionId(), resourceGroupName, accountName, privateEndpointConnectionName, apiVersion, parameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .register(202, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + */ + public void delete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + deleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).toBlocking().last().body(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return deleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteWithServiceResponseAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + 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 (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + final String apiVersion = "2019-08-01-preview"; + Observable> observable = service.delete(this.client.subscriptionId(), resourceGroupName, accountName, privateEndpointConnectionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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 beginDelete(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).toBlocking().single().body(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @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, String privateEndpointConnectionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName), serviceCallback); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + return beginDeleteWithServiceResponseAsync(resourceGroupName, accountName, privateEndpointConnectionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param accountName Cosmos DB database account name. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteWithServiceResponseAsync(String resourceGroupName, String accountName, String privateEndpointConnectionName) { + 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 (privateEndpointConnectionName == null) { + throw new IllegalArgumentException("Parameter privateEndpointConnectionName is required and cannot be null."); + } + final String apiVersion = "2019-08-01-preview"; + return service.beginDelete(this.client.subscriptionId(), resourceGroupName, accountName, privateEndpointConnectionName, 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 ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(202, new TypeToken() { }.getType()) + .register(204, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..fd526da517102 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkResource; +import com.microsoft.azure.arm.model.implementation.IndexableRefreshableWrapperImpl; +import rx.Observable; +import java.util.List; + +class PrivateLinkResourceImpl extends IndexableRefreshableWrapperImpl implements PrivateLinkResource { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String groupName; + + PrivateLinkResourceImpl(PrivateLinkResourceInner inner, CosmosDBManager manager) { + super(null, inner); + this.manager = manager; + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.groupName = IdParsingUtils.getValueFromIdByName(inner.id(), "privateLinkResources"); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + protected Observable getInnerAsync() { + PrivateLinkResourcesInner client = this.manager().inner().privateLinkResources(); + return client.getAsync(this.resourceGroupName, this.accountName, this.groupName); + } + + + + @Override + public String groupId() { + return this.inner().groupId(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public List requiredMembers() { + return this.inner().requiredMembers(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..fabd8ebc3045e --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourceInner.java @@ -0,0 +1,51 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMProxyResource; + +/** + * A private link resource. + */ +@JsonFlatten +public class PrivateLinkResourceInner extends ARMProxyResource { + /** + * The private link resource group id. + */ + @JsonProperty(value = "properties.groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /** + * The private link resource required member names. + */ + @JsonProperty(value = "properties.requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * Get the private link resource group id. + * + * @return the groupId value + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the private link resource required member names. + * + * @return the requiredMembers value + */ + public List requiredMembers() { + return this.requiredMembers; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..d18caf7fb6c66 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkResources; +import rx.Observable; +import rx.functions.Func1; +import java.util.List; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkResource; + +class PrivateLinkResourcesImpl extends WrapperImpl implements PrivateLinkResources { + private final CosmosDBManager manager; + + PrivateLinkResourcesImpl(CosmosDBManager manager) { + super(manager.inner().privateLinkResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + private PrivateLinkResourceImpl wrapModel(PrivateLinkResourceInner inner) { + return new PrivateLinkResourceImpl(inner, manager()); + } + + @Override + public Observable listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + PrivateLinkResourcesInner client = this.inner(); + return client.listByDatabaseAccountAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public PrivateLinkResource call(PrivateLinkResourceInner inner) { + return wrapModel(inner); + } + }); + } + + @Override + public Observable getAsync(String resourceGroupName, String accountName, String groupName) { + PrivateLinkResourcesInner client = this.inner(); + return client.getAsync(resourceGroupName, accountName, groupName) + .flatMap(new Func1>() { + @Override + public Observable call(PrivateLinkResourceInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((PrivateLinkResource)wrapModel(inner)); + } + } + }); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesInner.java new file mode 100644 index 0000000000000..3173659890580 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/PrivateLinkResourcesInner.java @@ -0,0 +1,245 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.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 PrivateLinkResources. + */ +public class PrivateLinkResourcesInner { + /** The Retrofit service to perform REST calls. */ + private PrivateLinkResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public PrivateLinkResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(PrivateLinkResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for PrivateLinkResources to be + * used by Retrofit to perform actually REST calls. + */ + interface PrivateLinkResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.PrivateLinkResources listByDatabaseAccount" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources") + Observable> listByDatabaseAccount(@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.cosmosdb.v2019_12_12.PrivateLinkResources get" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/privateLinkResources/{groupName}") + Observable> get(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("groupName") String groupName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB 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<PrivateLinkResourceInner> object if successful. + */ + public List listByDatabaseAccount(String resourceGroupName, String accountName) { + return listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB 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> listByDatabaseAccountAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB 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<PrivateLinkResourceInner> object + */ + public Observable> listByDatabaseAccountAsync(String resourceGroupName, String accountName) { + return listByDatabaseAccountWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB 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<PrivateLinkResourceInner> object + */ + public Observable>> listByDatabaseAccountWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-08-01-preview"; + return service.listByDatabaseAccount(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listByDatabaseAccountDelegate(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> listByDatabaseAccountDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the PrivateLinkResourceInner object if successful. + */ + public PrivateLinkResourceInner get(String resourceGroupName, String accountName, String groupName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, groupName).toBlocking().single().body(); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture getAsync(String resourceGroupName, String accountName, String groupName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getWithServiceResponseAsync(resourceGroupName, accountName, groupName), serviceCallback); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateLinkResourceInner object + */ + public Observable getAsync(String resourceGroupName, String accountName, String groupName) { + return getWithServiceResponseAsync(resourceGroupName, accountName, groupName).map(new Func1, PrivateLinkResourceInner>() { + @Override + public PrivateLinkResourceInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the private link resources that need to be created for a Cosmos DB account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the PrivateLinkResourceInner object + */ + public Observable> getWithServiceResponseAsync(String resourceGroupName, String accountName, String groupName) { + 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 (groupName == null) { + throw new IllegalArgumentException("Parameter groupName is required and cannot be null."); + } + final String apiVersion = "2019-08-01-preview"; + return service.get(this.client.subscriptionId(), resourceGroupName, accountName, groupName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsImpl.java new file mode 100644 index 0000000000000..5f20d096b480f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsImpl.java @@ -0,0 +1,162 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerResource; +import rx.functions.Func1; + +class SqlContainerGetResultsImpl extends CreatableUpdatableImpl implements SqlContainerGetResults, SqlContainerGetResults.Definition, SqlContainerGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String containerName; + private SqlContainerCreateUpdateParameters createOrUpdateParameter; + + SqlContainerGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new SqlContainerGetResultsInner()); + this.manager = manager; + // Set resource name + this.containerName = name; + // + this.createOrUpdateParameter = new SqlContainerCreateUpdateParameters(); + } + + SqlContainerGetResultsImpl(SqlContainerGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.containerName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "sqlDatabases"); + this.containerName = IdParsingUtils.getValueFromIdByName(inner.id(), "containers"); + // + this.createOrUpdateParameter = new SqlContainerCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlContainerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlContainerGetResultsInner call(SqlContainerGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlContainerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlContainerGetResultsInner call(SqlContainerGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.getSqlContainerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SqlContainerCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlContainerGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SqlContainerGetResultsImpl withExistingSqlDatabasis(String resourceGroupName, String accountName, String databaseName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + return this; + } + + @Override + public SqlContainerGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SqlContainerGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public SqlContainerGetResultsImpl withResource(SqlContainerResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public SqlContainerGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsInner.java new file mode 100644 index 0000000000000..f502bdc057288 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlContainerGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB container. + */ +@JsonFlatten +public class SqlContainerGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlContainerGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public SqlContainerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the SqlContainerGetResultsInner object itself. + */ + public SqlContainerGetResultsInner withResource(SqlContainerGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsImpl.java new file mode 100644 index 0000000000000..fef84afbe149f --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsImpl.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseResource; +import rx.functions.Func1; + +class SqlDatabaseGetResultsImpl extends CreatableUpdatableImpl implements SqlDatabaseGetResults, SqlDatabaseGetResults.Definition, SqlDatabaseGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private SqlDatabaseCreateUpdateParameters createOrUpdateParameter; + + SqlDatabaseGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new SqlDatabaseGetResultsInner()); + this.manager = manager; + // Set resource name + this.databaseName = name; + // + this.createOrUpdateParameter = new SqlDatabaseCreateUpdateParameters(); + } + + SqlDatabaseGetResultsImpl(SqlDatabaseGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.databaseName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "sqlDatabases"); + // + this.createOrUpdateParameter = new SqlDatabaseCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlDatabaseGetResultsInner call(SqlDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlDatabaseGetResultsInner call(SqlDatabaseGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.getSqlDatabaseAsync(this.resourceGroupName, this.accountName, this.databaseName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SqlDatabaseCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlDatabaseGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SqlDatabaseGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public SqlDatabaseGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SqlDatabaseGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public SqlDatabaseGetResultsImpl withResource(SqlDatabaseResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public SqlDatabaseGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsInner.java new file mode 100644 index 0000000000000..a655bc08023b6 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlDatabaseGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB SQL database. + */ +@JsonFlatten +public class SqlDatabaseGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlDatabaseGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public SqlDatabaseGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the SqlDatabaseGetResultsInner object itself. + */ + public SqlDatabaseGetResultsInner withResource(SqlDatabaseGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesImpl.java new file mode 100644 index 0000000000000..a569b3067085c --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesImpl.java @@ -0,0 +1,398 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlResources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseGetResults; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerGetResults; + +class SqlResourcesImpl extends WrapperImpl implements SqlResources { + private final CosmosDBManager manager; + + SqlResourcesImpl(CosmosDBManager manager) { + super(manager.inner().sqlResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public SqlDatabaseGetResultsImpl defineSqlDatabasis(String name) { + return wrapSqlDatabasisModel(name); + } + + @Override + public SqlContainerGetResultsImpl defineContainer(String name) { + return wrapContainerModel(name); + } + + @Override + public SqlStoredProcedureGetResultsImpl defineStoredProcedure(String name) { + return wrapStoredProcedureModel(name); + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl defineUserDefinedFunction(String name) { + return wrapUserDefinedFunctionModel(name); + } + + @Override + public SqlTriggerGetResultsImpl defineTrigger(String name) { + return wrapTriggerModel(name); + } + + private SqlDatabaseGetResultsImpl wrapSqlDatabasisModel(String name) { + return new SqlDatabaseGetResultsImpl(name, this.manager()); + } + + private SqlContainerGetResultsImpl wrapContainerModel(String name) { + return new SqlContainerGetResultsImpl(name, this.manager()); + } + + private SqlStoredProcedureGetResultsImpl wrapStoredProcedureModel(String name) { + return new SqlStoredProcedureGetResultsImpl(name, this.manager()); + } + + private SqlUserDefinedFunctionGetResultsImpl wrapUserDefinedFunctionModel(String name) { + return new SqlUserDefinedFunctionGetResultsImpl(name, this.manager()); + } + + private SqlTriggerGetResultsImpl wrapTriggerModel(String name) { + return new SqlTriggerGetResultsImpl(name, this.manager()); + } + + private SqlDatabaseGetResultsImpl wrapSqlDatabaseGetResultsModel(SqlDatabaseGetResultsInner inner) { + return new SqlDatabaseGetResultsImpl(inner, manager()); + } + + private SqlContainerGetResultsImpl wrapSqlContainerGetResultsModel(SqlContainerGetResultsInner inner) { + return new SqlContainerGetResultsImpl(inner, manager()); + } + + private SqlStoredProcedureGetResultsImpl wrapSqlStoredProcedureGetResultsModel(SqlStoredProcedureGetResultsInner inner) { + return new SqlStoredProcedureGetResultsImpl(inner, manager()); + } + + private SqlUserDefinedFunctionGetResultsImpl wrapSqlUserDefinedFunctionGetResultsModel(SqlUserDefinedFunctionGetResultsInner inner) { + return new SqlUserDefinedFunctionGetResultsImpl(inner, manager()); + } + + private SqlTriggerGetResultsImpl wrapSqlTriggerGetResultsModel(SqlTriggerGetResultsInner inner) { + return new SqlTriggerGetResultsImpl(inner, manager()); + } + + private Observable getSqlDatabaseGetResultsInnerUsingSqlResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "sqlDatabases"); + SqlResourcesInner client = this.inner(); + return client.getSqlDatabaseAsync(resourceGroupName, accountName, databaseName); + } + + private Observable getSqlContainerGetResultsInnerUsingSqlResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "sqlDatabases"); + String containerName = IdParsingUtils.getValueFromIdByName(id, "containers"); + SqlResourcesInner client = this.inner(); + return client.getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName); + } + + private Observable getSqlStoredProcedureGetResultsInnerUsingSqlResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "sqlDatabases"); + String containerName = IdParsingUtils.getValueFromIdByName(id, "containers"); + String storedProcedureName = IdParsingUtils.getValueFromIdByName(id, "storedProcedures"); + SqlResourcesInner client = this.inner(); + return client.getSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName); + } + + private Observable getSqlUserDefinedFunctionGetResultsInnerUsingSqlResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "sqlDatabases"); + String containerName = IdParsingUtils.getValueFromIdByName(id, "containers"); + String userDefinedFunctionName = IdParsingUtils.getValueFromIdByName(id, "userDefinedFunctions"); + SqlResourcesInner client = this.inner(); + return client.getSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName); + } + + private Observable getSqlTriggerGetResultsInnerUsingSqlResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String databaseName = IdParsingUtils.getValueFromIdByName(id, "sqlDatabases"); + String containerName = IdParsingUtils.getValueFromIdByName(id, "containers"); + String triggerName = IdParsingUtils.getValueFromIdByName(id, "triggers"); + SqlResourcesInner client = this.inner(); + return client.getSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName); + } + + @Override + public Observable getSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.getSqlDatabaseAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1>() { + @Override + public Observable call(SqlDatabaseGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlDatabaseGetResults)wrapSqlDatabaseGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listSqlDatabasesAsync(String resourceGroupName, String accountName) { + SqlResourcesInner client = this.inner(); + return client.listSqlDatabasesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SqlDatabaseGetResults call(SqlDatabaseGetResultsInner inner) { + return wrapSqlDatabaseGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.deleteSqlDatabaseAsync(resourceGroupName, accountName, databaseName).toCompletable(); + } + + @Override + public Observable getSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.getSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + SqlResourcesInner client = this.inner(); + return client.updateSqlDatabaseThroughputAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.getSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + SqlResourcesInner client = this.inner(); + return client.updateSqlContainerThroughputAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.getSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(new Func1>() { + @Override + public Observable call(SqlContainerGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlContainerGetResults)wrapSqlContainerGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName) { + SqlResourcesInner client = this.inner(); + return client.listSqlContainersAsync(resourceGroupName, accountName, databaseName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SqlContainerGetResults call(SqlContainerGetResultsInner inner) { + return wrapSqlContainerGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.deleteSqlContainerAsync(resourceGroupName, accountName, databaseName, containerName).toCompletable(); + } + + @Override + public Observable getSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + SqlResourcesInner client = this.inner(); + return client.getSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName) + .flatMap(new Func1>() { + @Override + public Observable call(SqlStoredProcedureGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlStoredProcedureGetResults)wrapSqlStoredProcedureGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listSqlStoredProceduresAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.listSqlStoredProceduresAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SqlStoredProcedureGetResults call(SqlStoredProcedureGetResultsInner inner) { + return wrapSqlStoredProcedureGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + SqlResourcesInner client = this.inner(); + return client.deleteSqlStoredProcedureAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).toCompletable(); + } + + @Override + public Observable getSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + SqlResourcesInner client = this.inner(); + return client.getSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName) + .flatMap(new Func1>() { + @Override + public Observable call(SqlUserDefinedFunctionGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlUserDefinedFunctionGetResults)wrapSqlUserDefinedFunctionGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listSqlUserDefinedFunctionsAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.listSqlUserDefinedFunctionsAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SqlUserDefinedFunctionGetResults call(SqlUserDefinedFunctionGetResultsInner inner) { + return wrapSqlUserDefinedFunctionGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + SqlResourcesInner client = this.inner(); + return client.deleteSqlUserDefinedFunctionAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).toCompletable(); + } + + @Override + public Observable getSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + SqlResourcesInner client = this.inner(); + return client.getSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName) + .flatMap(new Func1>() { + @Override + public Observable call(SqlTriggerGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((SqlTriggerGetResults)wrapSqlTriggerGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listSqlTriggersAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + SqlResourcesInner client = this.inner(); + return client.listSqlTriggersAsync(resourceGroupName, accountName, databaseName, containerName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public SqlTriggerGetResults call(SqlTriggerGetResultsInner inner) { + return wrapSqlTriggerGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + SqlResourcesInner client = this.inner(); + return client.deleteSqlTriggerAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).toCompletable(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesInner.java new file mode 100644 index 0000000000000..1b053e7a16294 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlResourcesInner.java @@ -0,0 +1,3702 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlContainerCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlDatabaseCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in SqlResources. + */ +public class SqlResourcesInner { + /** The Retrofit service to perform REST calls. */ + private SqlResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of SqlResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public SqlResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(SqlResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for SqlResources to be + * used by Retrofit to perform actually REST calls. + */ + interface SqlResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlResources listSqlDatabases" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases") + Observable> listSqlDatabases(@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.cosmosdb.v2019_12_12.SqlResources getSqlDatabase" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + Observable> getSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.SqlResources createUpdateSqlDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + Observable> createUpdateSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, @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.cosmosdb.v2019_12_12.SqlResources beginCreateUpdateSqlDatabase" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}") + Observable> beginCreateUpdateSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, @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.cosmosdb.v2019_12_12.SqlResources deleteSqlDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> deleteSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.SqlResources beginDeleteSqlDatabase" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}", method = "DELETE", hasBody = true) + Observable> beginDeleteSqlDatabase(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.SqlResources getSqlDatabaseThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + Observable> getSqlDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.SqlResources updateSqlDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + Observable> updateSqlDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.SqlResources beginUpdateSqlDatabaseThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default") + Observable> beginUpdateSqlDatabaseThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.SqlResources listSqlContainers" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers") + Observable> listSqlContainers(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @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.cosmosdb.v2019_12_12.SqlResources getSqlContainer" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + Observable> getSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources createUpdateSqlContainer" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + Observable> createUpdateSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, @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.cosmosdb.v2019_12_12.SqlResources beginCreateUpdateSqlContainer" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}") + Observable> beginCreateUpdateSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, @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.cosmosdb.v2019_12_12.SqlResources deleteSqlContainer" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", method = "DELETE", hasBody = true) + Observable> deleteSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources beginDeleteSqlContainer" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}", method = "DELETE", hasBody = true) + Observable> beginDeleteSqlContainer(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources getSqlContainerThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") + Observable> getSqlContainerThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources updateSqlContainerThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") + Observable> updateSqlContainerThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.SqlResources beginUpdateSqlContainerThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default") + Observable> beginUpdateSqlContainerThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.SqlResources listSqlStoredProcedures" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures") + Observable> listSqlStoredProcedures(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources getSqlStoredProcedure" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") + Observable> getSqlStoredProcedure(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("storedProcedureName") String storedProcedureName, @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.cosmosdb.v2019_12_12.SqlResources createUpdateSqlStoredProcedure" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") + Observable> createUpdateSqlStoredProcedure(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("storedProcedureName") String storedProcedureName, @Query("api-version") String apiVersion, @Body SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, @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.cosmosdb.v2019_12_12.SqlResources beginCreateUpdateSqlStoredProcedure" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}") + Observable> beginCreateUpdateSqlStoredProcedure(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("storedProcedureName") String storedProcedureName, @Query("api-version") String apiVersion, @Body SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, @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.cosmosdb.v2019_12_12.SqlResources deleteSqlStoredProcedure" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", method = "DELETE", hasBody = true) + Observable> deleteSqlStoredProcedure(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("storedProcedureName") String storedProcedureName, @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.cosmosdb.v2019_12_12.SqlResources beginDeleteSqlStoredProcedure" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}", method = "DELETE", hasBody = true) + Observable> beginDeleteSqlStoredProcedure(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("storedProcedureName") String storedProcedureName, @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.cosmosdb.v2019_12_12.SqlResources listSqlUserDefinedFunctions" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions") + Observable> listSqlUserDefinedFunctions(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources getSqlUserDefinedFunction" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") + Observable> getSqlUserDefinedFunction(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("userDefinedFunctionName") String userDefinedFunctionName, @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.cosmosdb.v2019_12_12.SqlResources createUpdateSqlUserDefinedFunction" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") + Observable> createUpdateSqlUserDefinedFunction(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("userDefinedFunctionName") String userDefinedFunctionName, @Query("api-version") String apiVersion, @Body SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, @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.cosmosdb.v2019_12_12.SqlResources beginCreateUpdateSqlUserDefinedFunction" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}") + Observable> beginCreateUpdateSqlUserDefinedFunction(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("userDefinedFunctionName") String userDefinedFunctionName, @Query("api-version") String apiVersion, @Body SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, @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.cosmosdb.v2019_12_12.SqlResources deleteSqlUserDefinedFunction" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", method = "DELETE", hasBody = true) + Observable> deleteSqlUserDefinedFunction(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("userDefinedFunctionName") String userDefinedFunctionName, @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.cosmosdb.v2019_12_12.SqlResources beginDeleteSqlUserDefinedFunction" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}", method = "DELETE", hasBody = true) + Observable> beginDeleteSqlUserDefinedFunction(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("userDefinedFunctionName") String userDefinedFunctionName, @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.cosmosdb.v2019_12_12.SqlResources listSqlTriggers" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers") + Observable> listSqlTriggers(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @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.cosmosdb.v2019_12_12.SqlResources getSqlTrigger" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") + Observable> getSqlTrigger(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("triggerName") String triggerName, @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.cosmosdb.v2019_12_12.SqlResources createUpdateSqlTrigger" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") + Observable> createUpdateSqlTrigger(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Body SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, @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.cosmosdb.v2019_12_12.SqlResources beginCreateUpdateSqlTrigger" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}") + Observable> beginCreateUpdateSqlTrigger(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Body SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, @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.cosmosdb.v2019_12_12.SqlResources deleteSqlTrigger" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", method = "DELETE", hasBody = true) + Observable> deleteSqlTrigger(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("triggerName") String triggerName, @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.cosmosdb.v2019_12_12.SqlResources beginDeleteSqlTrigger" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}", method = "DELETE", hasBody = true) + Observable> beginDeleteSqlTrigger(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("databaseName") String databaseName, @Path("containerName") String containerName, @Path("triggerName") String triggerName, @Query("api-version") String apiVersion, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the SQL databases under 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 List<SqlDatabaseGetResultsInner> object if successful. + */ + public List listSqlDatabases(String resourceGroupName, String accountName) { + return listSqlDatabasesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the SQL databases under 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> listSqlDatabasesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlDatabasesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the SQL databases under 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 List<SqlDatabaseGetResultsInner> object + */ + public Observable> listSqlDatabasesAsync(String resourceGroupName, String accountName) { + return listSqlDatabasesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the SQL databases under 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 List<SqlDatabaseGetResultsInner> object + */ + public Observable>> listSqlDatabasesWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-12-12"; + return service.listSqlDatabases(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlDatabasesDelegate(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> listSqlDatabasesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 SqlDatabaseGetResultsInner object if successful. + */ + public SqlDatabaseGetResultsInner getSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlDatabaseGetResultsInner object + */ + public Observable getSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, SqlDatabaseGetResultsInner>() { + @Override + public SqlDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlDatabaseGetResultsInner object + */ + public Observable> getSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlDatabaseDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @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 SqlDatabaseGetResultsInner object if successful. + */ + public SqlDatabaseGetResultsInner createUpdateSqlDatabase(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return createUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @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 createUpdateSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return createUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).map(new Func1, SqlDatabaseGetResultsInner>() { + @Override + public SqlDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateSqlDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlDatabaseParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateSqlDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @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 SqlDatabaseGetResultsInner object if successful. + */ + public SqlDatabaseGetResultsInner beginCreateUpdateSqlDatabase(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @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 beginCreateUpdateSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlDatabaseGetResultsInner object + */ + public Observable beginCreateUpdateSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + return beginCreateUpdateSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName, createUpdateSqlDatabaseParameters).map(new Func1, SqlDatabaseGetResultsInner>() { + @Override + public SqlDatabaseGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param createUpdateSqlDatabaseParameters The parameters to provide for the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlDatabaseGetResultsInner object + */ + public Observable> beginCreateUpdateSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, SqlDatabaseCreateUpdateParameters createUpdateSqlDatabaseParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (createUpdateSqlDatabaseParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlDatabaseParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlDatabaseParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, createUpdateSqlDatabaseParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlDatabaseDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + deleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return deleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteSqlDatabase(String resourceGroupName, String accountName, String databaseName) { + beginDeleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 beginDeleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlDatabaseAsync(String resourceGroupName, String accountName, String databaseName) { + return beginDeleteSqlDatabaseWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlDatabaseWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteSqlDatabase(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlDatabaseDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlDatabaseDelegate(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); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getSqlDatabaseThroughput(String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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 getSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName) { + return getSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the SQL database under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getSqlDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlDatabaseThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateSqlDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @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 updateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateSqlDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateSqlDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateSqlDatabaseThroughput(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @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 beginUpdateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateSqlDatabaseThroughputAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlDatabaseThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL database. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL database. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateSqlDatabaseThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateSqlDatabaseThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateSqlDatabaseThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateSqlDatabaseThroughputDelegate(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); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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<SqlContainerGetResultsInner> object if successful. + */ + public List listSqlContainers(String resourceGroupName, String accountName, String databaseName) { + return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).toBlocking().single().body(); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database 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> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName), serviceCallback); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlContainerGetResultsInner> object + */ + public Observable> listSqlContainersAsync(String resourceGroupName, String accountName, String databaseName) { + return listSqlContainersWithServiceResponseAsync(resourceGroupName, accountName, databaseName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlContainerGetResultsInner> object + */ + public Observable>> listSqlContainersWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listSqlContainers(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlContainersDelegate(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> listSqlContainersDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 SqlContainerGetResultsInner object if successful. + */ + public SqlContainerGetResultsInner getSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable getSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, SqlContainerGetResultsInner>() { + @Override + public SqlContainerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable> getSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlContainerDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @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 SqlContainerGetResultsInner object if successful. + */ + public SqlContainerGetResultsInner createUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @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 createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return createUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + @Override + public SqlContainerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (createUpdateSqlContainerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlContainerParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @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 SqlContainerGetResultsInner object if successful. + */ + public SqlContainerGetResultsInner beginCreateUpdateSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @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 beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable beginCreateUpdateSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + return beginCreateUpdateSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, createUpdateSqlContainerParameters).map(new Func1, SqlContainerGetResultsInner>() { + @Override + public SqlContainerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param createUpdateSqlContainerParameters The parameters to provide for the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlContainerGetResultsInner object + */ + public Observable> beginCreateUpdateSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, SqlContainerCreateUpdateParameters createUpdateSqlContainerParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (createUpdateSqlContainerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlContainerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlContainerParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, createUpdateSqlContainerParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlContainerDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 deleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return deleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 beginDeleteSqlContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlContainerAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return beginDeleteSqlContainerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlContainerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteSqlContainer(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlContainerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlContainerDelegate(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); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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 getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return getSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the SQL container under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlContainerThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlContainerThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @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 updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateSqlContainerThroughput(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @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 beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateSqlContainerThroughputAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateSqlContainerThroughputWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB SQL container. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current SQL container. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateSqlContainerThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateSqlContainerThroughput(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateSqlContainerThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateSqlContainerThroughputDelegate(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); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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<SqlStoredProcedureGetResultsInner> object if successful. + */ + public List listSqlStoredProcedures(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlStoredProceduresWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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> listSqlStoredProceduresAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlStoredProceduresWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlStoredProcedureGetResultsInner> object + */ + public Observable> listSqlStoredProceduresAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlStoredProceduresWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlStoredProcedureGetResultsInner> object + */ + public Observable>> listSqlStoredProceduresWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listSqlStoredProcedures(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlStoredProceduresDelegate(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> listSqlStoredProceduresDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 SqlStoredProcedureGetResultsInner object if successful. + */ + public SqlStoredProcedureGetResultsInner getSqlStoredProcedure(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + return getSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).toBlocking().single().body(); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 getSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName), serviceCallback); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlStoredProcedureGetResultsInner object + */ + public Observable getSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + return getSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).map(new Func1, SqlStoredProcedureGetResultsInner>() { + @Override + public SqlStoredProcedureGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the SQL storedProcedure under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlStoredProcedureGetResultsInner object + */ + public Observable> getSqlStoredProcedureWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (storedProcedureName == null) { + throw new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlStoredProcedure(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, storedProcedureName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlStoredProcedureDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlStoredProcedureDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @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 SqlStoredProcedureGetResultsInner object if successful. + */ + public SqlStoredProcedureGetResultsInner createUpdateSqlStoredProcedure(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return createUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @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 createUpdateSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return createUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).map(new Func1, SqlStoredProcedureGetResultsInner>() { + @Override + public SqlStoredProcedureGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlStoredProcedureWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (storedProcedureName == null) { + throw new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null."); + } + if (createUpdateSqlStoredProcedureParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlStoredProcedureParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateSqlStoredProcedure(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, storedProcedureName, apiVersion, createUpdateSqlStoredProcedureParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @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 SqlStoredProcedureGetResultsInner object if successful. + */ + public SqlStoredProcedureGetResultsInner beginCreateUpdateSqlStoredProcedure(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @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 beginCreateUpdateSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlStoredProcedureGetResultsInner object + */ + public Observable beginCreateUpdateSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + return beginCreateUpdateSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName, createUpdateSqlStoredProcedureParameters).map(new Func1, SqlStoredProcedureGetResultsInner>() { + @Override + public SqlStoredProcedureGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @param createUpdateSqlStoredProcedureParameters The parameters to provide for the current SQL storedProcedure. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlStoredProcedureGetResultsInner object + */ + public Observable> beginCreateUpdateSqlStoredProcedureWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, SqlStoredProcedureCreateUpdateParameters createUpdateSqlStoredProcedureParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (storedProcedureName == null) { + throw new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null."); + } + if (createUpdateSqlStoredProcedureParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlStoredProcedureParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlStoredProcedureParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateSqlStoredProcedure(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, storedProcedureName, apiVersion, createUpdateSqlStoredProcedureParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlStoredProcedureDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlStoredProcedureDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 deleteSqlStoredProcedure(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + deleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 deleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + return deleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlStoredProcedureWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (storedProcedureName == null) { + throw new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteSqlStoredProcedure(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, storedProcedureName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 beginDeleteSqlStoredProcedure(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + beginDeleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure 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 beginDeleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlStoredProcedureAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + return beginDeleteSqlStoredProcedureWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, storedProcedureName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL storedProcedure. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param storedProcedureName Cosmos DB storedProcedure name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlStoredProcedureWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String storedProcedureName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (storedProcedureName == null) { + throw new IllegalArgumentException("Parameter storedProcedureName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteSqlStoredProcedure(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, storedProcedureName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlStoredProcedureDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlStoredProcedureDelegate(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 the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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<SqlUserDefinedFunctionGetResultsInner> object if successful. + */ + public List listSqlUserDefinedFunctions(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlUserDefinedFunctionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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> listSqlUserDefinedFunctionsAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlUserDefinedFunctionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlUserDefinedFunctionGetResultsInner> object + */ + public Observable> listSqlUserDefinedFunctionsAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlUserDefinedFunctionsWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlUserDefinedFunctionGetResultsInner> object + */ + public Observable>> listSqlUserDefinedFunctionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listSqlUserDefinedFunctions(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlUserDefinedFunctionsDelegate(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> listSqlUserDefinedFunctionsDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 SqlUserDefinedFunctionGetResultsInner object if successful. + */ + public SqlUserDefinedFunctionGetResultsInner getSqlUserDefinedFunction(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + return getSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).toBlocking().single().body(); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 getSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName), serviceCallback); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlUserDefinedFunctionGetResultsInner object + */ + public Observable getSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + return getSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).map(new Func1, SqlUserDefinedFunctionGetResultsInner>() { + @Override + public SqlUserDefinedFunctionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlUserDefinedFunctionGetResultsInner object + */ + public Observable> getSqlUserDefinedFunctionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (userDefinedFunctionName == null) { + throw new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlUserDefinedFunction(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlUserDefinedFunctionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlUserDefinedFunctionDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @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 SqlUserDefinedFunctionGetResultsInner object if successful. + */ + public SqlUserDefinedFunctionGetResultsInner createUpdateSqlUserDefinedFunction(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return createUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @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 createUpdateSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return createUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).map(new Func1, SqlUserDefinedFunctionGetResultsInner>() { + @Override + public SqlUserDefinedFunctionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlUserDefinedFunctionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (userDefinedFunctionName == null) { + throw new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null."); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlUserDefinedFunctionParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateSqlUserDefinedFunction(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, apiVersion, createUpdateSqlUserDefinedFunctionParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @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 SqlUserDefinedFunctionGetResultsInner object if successful. + */ + public SqlUserDefinedFunctionGetResultsInner beginCreateUpdateSqlUserDefinedFunction(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @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 beginCreateUpdateSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlUserDefinedFunctionGetResultsInner object + */ + public Observable beginCreateUpdateSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + return beginCreateUpdateSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, createUpdateSqlUserDefinedFunctionParameters).map(new Func1, SqlUserDefinedFunctionGetResultsInner>() { + @Override + public SqlUserDefinedFunctionGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @param createUpdateSqlUserDefinedFunctionParameters The parameters to provide for the current SQL userDefinedFunction. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlUserDefinedFunctionGetResultsInner object + */ + public Observable> beginCreateUpdateSqlUserDefinedFunctionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, SqlUserDefinedFunctionCreateUpdateParameters createUpdateSqlUserDefinedFunctionParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (userDefinedFunctionName == null) { + throw new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null."); + } + if (createUpdateSqlUserDefinedFunctionParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlUserDefinedFunctionParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlUserDefinedFunctionParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateSqlUserDefinedFunction(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, apiVersion, createUpdateSqlUserDefinedFunctionParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlUserDefinedFunctionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlUserDefinedFunctionDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 deleteSqlUserDefinedFunction(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + deleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 deleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + return deleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlUserDefinedFunctionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (userDefinedFunctionName == null) { + throw new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteSqlUserDefinedFunction(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 beginDeleteSqlUserDefinedFunction(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + beginDeleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction 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 beginDeleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlUserDefinedFunctionAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + return beginDeleteSqlUserDefinedFunctionWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL userDefinedFunction. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param userDefinedFunctionName Cosmos DB userDefinedFunction name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlUserDefinedFunctionWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String userDefinedFunctionName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (userDefinedFunctionName == null) { + throw new IllegalArgumentException("Parameter userDefinedFunctionName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteSqlUserDefinedFunction(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, userDefinedFunctionName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlUserDefinedFunctionDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlUserDefinedFunctionDelegate(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 the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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<SqlTriggerGetResultsInner> object if successful. + */ + public List listSqlTriggers(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlTriggersWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).toBlocking().single().body(); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container 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> listSqlTriggersAsync(String resourceGroupName, String accountName, String databaseName, String containerName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listSqlTriggersWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName), serviceCallback); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlTriggerGetResultsInner> object + */ + public Observable> listSqlTriggersAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + return listSqlTriggersWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the List<SqlTriggerGetResultsInner> object + */ + public Observable>> listSqlTriggersWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.listSqlTriggers(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listSqlTriggersDelegate(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> listSqlTriggersDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 SqlTriggerGetResultsInner object if successful. + */ + public SqlTriggerGetResultsInner getSqlTrigger(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).toBlocking().single().body(); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 getSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName), serviceCallback); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlTriggerGetResultsInner object + */ + public Observable getSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return getSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).map(new Func1, SqlTriggerGetResultsInner>() { + @Override + public SqlTriggerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the SQL trigger under an existing Azure Cosmos DB database account. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlTriggerGetResultsInner object + */ + public Observable> getSqlTriggerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getSqlTrigger(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, triggerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getSqlTriggerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getSqlTriggerDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @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 SqlTriggerGetResultsInner object if successful. + */ + public SqlTriggerGetResultsInner createUpdateSqlTrigger(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return createUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @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 createUpdateSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return createUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).map(new Func1, SqlTriggerGetResultsInner>() { + @Override + public SqlTriggerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateSqlTriggerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (createUpdateSqlTriggerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlTriggerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlTriggerParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateSqlTrigger(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, triggerName, apiVersion, createUpdateSqlTriggerParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @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 SqlTriggerGetResultsInner object if successful. + */ + public SqlTriggerGetResultsInner beginCreateUpdateSqlTrigger(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @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 beginCreateUpdateSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlTriggerGetResultsInner object + */ + public Observable beginCreateUpdateSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + return beginCreateUpdateSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName, createUpdateSqlTriggerParameters).map(new Func1, SqlTriggerGetResultsInner>() { + @Override + public SqlTriggerGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @param createUpdateSqlTriggerParameters The parameters to provide for the current SQL trigger. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the SqlTriggerGetResultsInner object + */ + public Observable> beginCreateUpdateSqlTriggerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, SqlTriggerCreateUpdateParameters createUpdateSqlTriggerParameters) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + if (createUpdateSqlTriggerParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateSqlTriggerParameters is required and cannot be null."); + } + Validator.validate(createUpdateSqlTriggerParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateSqlTrigger(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, triggerName, apiVersion, createUpdateSqlTriggerParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateSqlTriggerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateSqlTriggerDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 deleteSqlTrigger(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + deleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 deleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return deleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteSqlTriggerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteSqlTrigger(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, triggerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 beginDeleteSqlTrigger(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + beginDeleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger 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 beginDeleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteSqlTriggerAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + return beginDeleteSqlTriggerWithServiceResponseAsync(resourceGroupName, accountName, databaseName, containerName, triggerName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB SQL trigger. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param databaseName Cosmos DB database name. + * @param containerName Cosmos DB container name. + * @param triggerName Cosmos DB trigger name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteSqlTriggerWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseName, String containerName, String triggerName) { + 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 (databaseName == null) { + throw new IllegalArgumentException("Parameter databaseName is required and cannot be null."); + } + if (containerName == null) { + throw new IllegalArgumentException("Parameter containerName is required and cannot be null."); + } + if (triggerName == null) { + throw new IllegalArgumentException("Parameter triggerName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteSqlTrigger(this.client.subscriptionId(), resourceGroupName, accountName, databaseName, containerName, triggerName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteSqlTriggerDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteSqlTriggerDelegate(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); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsImpl.java new file mode 100644 index 0000000000000..b4ed7a2a674c8 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsImpl.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureResource; +import rx.functions.Func1; + +class SqlStoredProcedureGetResultsImpl extends CreatableUpdatableImpl implements SqlStoredProcedureGetResults, SqlStoredProcedureGetResults.Definition, SqlStoredProcedureGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String containerName; + private String storedProcedureName; + private SqlStoredProcedureCreateUpdateParameters createOrUpdateParameter; + + SqlStoredProcedureGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new SqlStoredProcedureGetResultsInner()); + this.manager = manager; + // Set resource name + this.storedProcedureName = name; + // + this.createOrUpdateParameter = new SqlStoredProcedureCreateUpdateParameters(); + } + + SqlStoredProcedureGetResultsImpl(SqlStoredProcedureGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.storedProcedureName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "sqlDatabases"); + this.containerName = IdParsingUtils.getValueFromIdByName(inner.id(), "containers"); + this.storedProcedureName = IdParsingUtils.getValueFromIdByName(inner.id(), "storedProcedures"); + // + this.createOrUpdateParameter = new SqlStoredProcedureCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlStoredProcedureAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.storedProcedureName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlStoredProcedureGetResultsInner call(SqlStoredProcedureGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlStoredProcedureAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.storedProcedureName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlStoredProcedureGetResultsInner call(SqlStoredProcedureGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.getSqlStoredProcedureAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.storedProcedureName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SqlStoredProcedureCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlStoredProcedureGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SqlStoredProcedureGetResultsImpl withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + @Override + public SqlStoredProcedureGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SqlStoredProcedureGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public SqlStoredProcedureGetResultsImpl withResource(SqlStoredProcedureResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public SqlStoredProcedureGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsInner.java new file mode 100644 index 0000000000000..055929457ce5a --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlStoredProcedureGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlStoredProcedureGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB storedProcedure. + */ +@JsonFlatten +public class SqlStoredProcedureGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlStoredProcedureGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public SqlStoredProcedureGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the SqlStoredProcedureGetResultsInner object itself. + */ + public SqlStoredProcedureGetResultsInner withResource(SqlStoredProcedureGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsImpl.java new file mode 100644 index 0000000000000..1240f6edc49c0 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsImpl.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerResource; +import rx.functions.Func1; + +class SqlTriggerGetResultsImpl extends CreatableUpdatableImpl implements SqlTriggerGetResults, SqlTriggerGetResults.Definition, SqlTriggerGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String containerName; + private String triggerName; + private SqlTriggerCreateUpdateParameters createOrUpdateParameter; + + SqlTriggerGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new SqlTriggerGetResultsInner()); + this.manager = manager; + // Set resource name + this.triggerName = name; + // + this.createOrUpdateParameter = new SqlTriggerCreateUpdateParameters(); + } + + SqlTriggerGetResultsImpl(SqlTriggerGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.triggerName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "sqlDatabases"); + this.containerName = IdParsingUtils.getValueFromIdByName(inner.id(), "containers"); + this.triggerName = IdParsingUtils.getValueFromIdByName(inner.id(), "triggers"); + // + this.createOrUpdateParameter = new SqlTriggerCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlTriggerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.triggerName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlTriggerGetResultsInner call(SqlTriggerGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlTriggerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.triggerName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlTriggerGetResultsInner call(SqlTriggerGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.getSqlTriggerAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.triggerName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SqlTriggerCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlTriggerGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SqlTriggerGetResultsImpl withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + @Override + public SqlTriggerGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SqlTriggerGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public SqlTriggerGetResultsImpl withResource(SqlTriggerResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public SqlTriggerGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsInner.java new file mode 100644 index 0000000000000..c42b49a545cc4 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlTriggerGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlTriggerGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB trigger. + */ +@JsonFlatten +public class SqlTriggerGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlTriggerGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public SqlTriggerGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the SqlTriggerGetResultsInner object itself. + */ + public SqlTriggerGetResultsInner withResource(SqlTriggerGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsImpl.java new file mode 100644 index 0000000000000..5b6fe60348fd5 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsImpl.java @@ -0,0 +1,165 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionResource; +import rx.functions.Func1; + +class SqlUserDefinedFunctionGetResultsImpl extends CreatableUpdatableImpl implements SqlUserDefinedFunctionGetResults, SqlUserDefinedFunctionGetResults.Definition, SqlUserDefinedFunctionGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String databaseName; + private String containerName; + private String userDefinedFunctionName; + private SqlUserDefinedFunctionCreateUpdateParameters createOrUpdateParameter; + + SqlUserDefinedFunctionGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new SqlUserDefinedFunctionGetResultsInner()); + this.manager = manager; + // Set resource name + this.userDefinedFunctionName = name; + // + this.createOrUpdateParameter = new SqlUserDefinedFunctionCreateUpdateParameters(); + } + + SqlUserDefinedFunctionGetResultsImpl(SqlUserDefinedFunctionGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.userDefinedFunctionName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.databaseName = IdParsingUtils.getValueFromIdByName(inner.id(), "sqlDatabases"); + this.containerName = IdParsingUtils.getValueFromIdByName(inner.id(), "containers"); + this.userDefinedFunctionName = IdParsingUtils.getValueFromIdByName(inner.id(), "userDefinedFunctions"); + // + this.createOrUpdateParameter = new SqlUserDefinedFunctionCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlUserDefinedFunctionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.userDefinedFunctionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlUserDefinedFunctionGetResultsInner call(SqlUserDefinedFunctionGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.createUpdateSqlUserDefinedFunctionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.userDefinedFunctionName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public SqlUserDefinedFunctionGetResultsInner call(SqlUserDefinedFunctionGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + SqlResourcesInner client = this.manager().inner().sqlResources(); + return client.getSqlUserDefinedFunctionAsync(this.resourceGroupName, this.accountName, this.databaseName, this.containerName, this.userDefinedFunctionName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new SqlUserDefinedFunctionCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl withExistingContainer(String resourceGroupName, String accountName, String databaseName, String containerName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + this.databaseName = databaseName; + this.containerName = containerName; + return this; + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl withResource(SqlUserDefinedFunctionResource resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public SqlUserDefinedFunctionGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsInner.java new file mode 100644 index 0000000000000..0e31dee32ea41 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/SqlUserDefinedFunctionGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.SqlUserDefinedFunctionGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB userDefinedFunction. + */ +@JsonFlatten +public class SqlUserDefinedFunctionGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private SqlUserDefinedFunctionGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public SqlUserDefinedFunctionGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the SqlUserDefinedFunctionGetResultsInner object itself. + */ + public SqlUserDefinedFunctionGetResultsInner withResource(SqlUserDefinedFunctionGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsImpl.java new file mode 100644 index 0000000000000..404b907faaddb --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsImpl.java @@ -0,0 +1,158 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableGetResults; +import com.microsoft.azure.arm.model.implementation.CreatableUpdatableImpl; +import rx.Observable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableGetPropertiesResource; +import java.util.Map; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.CreateUpdateOptions; +import rx.functions.Func1; + +class TableGetResultsImpl extends CreatableUpdatableImpl implements TableGetResults, TableGetResults.Definition, TableGetResults.Update { + private final CosmosDBManager manager; + private String resourceGroupName; + private String accountName; + private String tableName; + private TableCreateUpdateParameters createOrUpdateParameter; + + TableGetResultsImpl(String name, CosmosDBManager manager) { + super(name, new TableGetResultsInner()); + this.manager = manager; + // Set resource name + this.tableName = name; + // + this.createOrUpdateParameter = new TableCreateUpdateParameters(); + } + + TableGetResultsImpl(TableGetResultsInner inner, CosmosDBManager manager) { + super(inner.name(), inner); + this.manager = manager; + // Set resource name + this.tableName = inner.name(); + // set resource ancestor and positional variables + this.resourceGroupName = IdParsingUtils.getValueFromIdByName(inner.id(), "resourceGroups"); + this.accountName = IdParsingUtils.getValueFromIdByName(inner.id(), "databaseAccounts"); + this.tableName = IdParsingUtils.getValueFromIdByName(inner.id(), "tables"); + // + this.createOrUpdateParameter = new TableCreateUpdateParameters(); + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public Observable createResourceAsync() { + TableResourcesInner client = this.manager().inner().tableResources(); + return client.createUpdateTableAsync(this.resourceGroupName, this.accountName, this.tableName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public TableGetResultsInner call(TableGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + public Observable updateResourceAsync() { + TableResourcesInner client = this.manager().inner().tableResources(); + return client.createUpdateTableAsync(this.resourceGroupName, this.accountName, this.tableName, this.createOrUpdateParameter) + .map(new Func1() { + @Override + public TableGetResultsInner call(TableGetResultsInner resource) { + resetCreateUpdateParameters(); + return resource; + } + }) + .map(innerToFluentMap(this)); + } + + @Override + protected Observable getInnerAsync() { + TableResourcesInner client = this.manager().inner().tableResources(); + return client.getTableAsync(this.resourceGroupName, this.accountName, this.tableName); + } + + @Override + public boolean isInCreateMode() { + return this.inner().id() == null; + } + + private void resetCreateUpdateParameters() { + this.createOrUpdateParameter = new TableCreateUpdateParameters(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public TableGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public TableGetResultsImpl withExistingDatabaseAccount(String resourceGroupName, String accountName) { + this.resourceGroupName = resourceGroupName; + this.accountName = accountName; + return this; + } + + @Override + public TableGetResultsImpl withLocation(String location) { + this.createOrUpdateParameter.withLocation(location); + return this; + } + + @Override + public TableGetResultsImpl withOptions(CreateUpdateOptions options) { + this.createOrUpdateParameter.withOptions(options); + return this; + } + + @Override + public TableGetResultsImpl withResource(TableResourceInner resource) { + this.createOrUpdateParameter.withResource(resource); + return this; + } + + @Override + public TableGetResultsImpl withTags(Map tags) { + this.createOrUpdateParameter.withTags(tags); + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsInner.java new file mode 100644 index 0000000000000..a4b512b312786 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB Table. + */ +@JsonFlatten +public class TableGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private TableGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public TableGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the TableGetResultsInner object itself. + */ + public TableGetResultsInner withResource(TableGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourceInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourceInner.java new file mode 100644 index 0000000000000..71d821e7545fe --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourceInner.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.cosmosdb.v2019_12_12.implementation; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Cosmos DB table resource object. + */ +public class TableResourceInner { + /** + * Name of the Cosmos DB table. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get name of the Cosmos DB table. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set name of the Cosmos DB table. + * + * @param id the id value to set + * @return the TableResourceInner object itself. + */ + public TableResourceInner withId(String id) { + this.id = id; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesImpl.java new file mode 100644 index 0000000000000..d5d841a358e40 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesImpl.java @@ -0,0 +1,119 @@ +/** + * Copyright (c) Microsoft Corporation. All rights 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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableResources; +import rx.Observable; +import rx.functions.Func1; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableGetResults; +import java.util.List; +import rx.Completable; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; + +class TableResourcesImpl extends WrapperImpl implements TableResources { + private final CosmosDBManager manager; + + TableResourcesImpl(CosmosDBManager manager) { + super(manager.inner().tableResources()); + this.manager = manager; + } + + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public TableGetResultsImpl defineTable(String name) { + return wrapTableModel(name); + } + + private TableGetResultsImpl wrapTableModel(String name) { + return new TableGetResultsImpl(name, this.manager()); + } + + private TableGetResultsImpl wrapTableGetResultsModel(TableGetResultsInner inner) { + return new TableGetResultsImpl(inner, manager()); + } + + private Observable getTableGetResultsInnerUsingTableResourcesInnerAsync(String id) { + String resourceGroupName = IdParsingUtils.getValueFromIdByName(id, "resourceGroups"); + String accountName = IdParsingUtils.getValueFromIdByName(id, "databaseAccounts"); + String tableName = IdParsingUtils.getValueFromIdByName(id, "tables"); + TableResourcesInner client = this.inner(); + return client.getTableAsync(resourceGroupName, accountName, tableName); + } + + @Override + public Observable getTableAsync(String resourceGroupName, String accountName, String tableName) { + TableResourcesInner client = this.inner(); + return client.getTableAsync(resourceGroupName, accountName, tableName) + .flatMap(new Func1>() { + @Override + public Observable call(TableGetResultsInner inner) { + if (inner == null) { + return Observable.empty(); + } else { + return Observable.just((TableGetResults)wrapTableGetResultsModel(inner)); + } + } + }); + } + + @Override + public Observable listTablesAsync(String resourceGroupName, String accountName) { + TableResourcesInner client = this.inner(); + return client.listTablesAsync(resourceGroupName, accountName) + .flatMap(new Func1, Observable>() { + @Override + public Observable call(List innerList) { + return Observable.from(innerList); + } + }) + .map(new Func1() { + @Override + public TableGetResults call(TableGetResultsInner inner) { + return wrapTableGetResultsModel(inner); + } + }); + } + + @Override + public Completable deleteTableAsync(String resourceGroupName, String accountName, String tableName) { + TableResourcesInner client = this.inner(); + return client.deleteTableAsync(resourceGroupName, accountName, tableName).toCompletable(); + } + + @Override + public Observable getTableThroughputAsync(String resourceGroupName, String accountName, String tableName) { + TableResourcesInner client = this.inner(); + return client.getTableThroughputAsync(resourceGroupName, accountName, tableName) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + + @Override + public Observable updateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + TableResourcesInner client = this.inner(); + return client.updateTableThroughputAsync(resourceGroupName, accountName, tableName, updateThroughputParameters) + .map(new Func1() { + @Override + public ThroughputSettingsGetResults call(ThroughputSettingsGetResultsInner inner) { + return new ThroughputSettingsGetResultsImpl(inner, manager()); + } + }); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesInner.java new file mode 100644 index 0000000000000..bc14a54a43ec9 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/TableResourcesInner.java @@ -0,0 +1,898 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import retrofit2.Retrofit; +import com.google.common.reflect.TypeToken; +import com.microsoft.azure.CloudException; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.TableCreateUpdateParameters; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsUpdateParameters; +import com.microsoft.rest.ServiceCallback; +import com.microsoft.rest.ServiceFuture; +import com.microsoft.rest.ServiceResponse; +import com.microsoft.rest.Validator; +import java.io.IOException; +import java.util.List; +import okhttp3.ResponseBody; +import retrofit2.http.Body; +import retrofit2.http.GET; +import retrofit2.http.Header; +import retrofit2.http.Headers; +import retrofit2.http.HTTP; +import retrofit2.http.Path; +import retrofit2.http.PUT; +import retrofit2.http.Query; +import retrofit2.Response; +import rx.functions.Func1; +import rx.Observable; + +/** + * An instance of this class provides access to all the operations defined + * in TableResources. + */ +public class TableResourcesInner { + /** The Retrofit service to perform REST calls. */ + private TableResourcesService service; + /** The service client containing this operation class. */ + private CosmosDBManagementClientImpl client; + + /** + * Initializes an instance of TableResourcesInner. + * + * @param retrofit the Retrofit instance built from a Retrofit Builder. + * @param client the instance of the service client containing this operation class. + */ + public TableResourcesInner(Retrofit retrofit, CosmosDBManagementClientImpl client) { + this.service = retrofit.create(TableResourcesService.class); + this.client = client; + } + + /** + * The interface defining all the services for TableResources to be + * used by Retrofit to perform actually REST calls. + */ + interface TableResourcesService { + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.cosmosdb.v2019_12_12.TableResources listTables" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables") + Observable> listTables(@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.cosmosdb.v2019_12_12.TableResources getTable" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") + Observable> getTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.TableResources createUpdateTable" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") + Observable> createUpdateTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body TableCreateUpdateParameters createUpdateTableParameters, @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.cosmosdb.v2019_12_12.TableResources beginCreateUpdateTable" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}") + Observable> beginCreateUpdateTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body TableCreateUpdateParameters createUpdateTableParameters, @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.cosmosdb.v2019_12_12.TableResources deleteTable" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", method = "DELETE", hasBody = true) + Observable> deleteTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.TableResources beginDeleteTable" }) + @HTTP(path = "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}", method = "DELETE", hasBody = true) + Observable> beginDeleteTable(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.TableResources getTableThroughput" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + Observable> getTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @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.cosmosdb.v2019_12_12.TableResources updateTableThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + Observable> updateTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @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.cosmosdb.v2019_12_12.TableResources beginUpdateTableThroughput" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/tables/{tableName}/throughputSettings/default") + Observable> beginUpdateTableThroughput(@Path("subscriptionId") String subscriptionId, @Path("resourceGroupName") String resourceGroupName, @Path("accountName") String accountName, @Path("tableName") String tableName, @Query("api-version") String apiVersion, @Body ThroughputSettingsUpdateParameters updateThroughputParameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + + } + + /** + * Lists the Tables under 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 List<TableGetResultsInner> object if successful. + */ + public List listTables(String resourceGroupName, String accountName) { + return listTablesWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); + } + + /** + * Lists the Tables under 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> listTablesAsync(String resourceGroupName, String accountName, final ServiceCallback> serviceCallback) { + return ServiceFuture.fromResponse(listTablesWithServiceResponseAsync(resourceGroupName, accountName), serviceCallback); + } + + /** + * Lists the Tables under 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 List<TableGetResultsInner> object + */ + public Observable> listTablesAsync(String resourceGroupName, String accountName) { + return listTablesWithServiceResponseAsync(resourceGroupName, accountName).map(new Func1>, List>() { + @Override + public List call(ServiceResponse> response) { + return response.body(); + } + }); + } + + /** + * Lists the Tables under 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 List<TableGetResultsInner> object + */ + public Observable>> listTablesWithServiceResponseAsync(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."); + } + final String apiVersion = "2019-12-12"; + return service.listTables(this.client.subscriptionId(), resourceGroupName, accountName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>>() { + @Override + public Observable>> call(Response response) { + try { + ServiceResponse> result = listTablesDelegate(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> listTablesDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory()., CloudException>newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken>() { }.getType()) + .registerError(CloudException.class) + .build(response); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 TableGetResultsInner object if successful. + */ + public TableGetResultsInner getTable(String resourceGroupName, String accountName, String tableName) { + return getTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().single().body(); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 getTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableGetResultsInner object + */ + public Observable getTableAsync(String resourceGroupName, String accountName, String tableName) { + return getTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, TableGetResultsInner>() { + @Override + public TableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the Tables under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableGetResultsInner object + */ + public Observable> getTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getTableDelegate(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); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @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 TableGetResultsInner object if successful. + */ + public TableGetResultsInner createUpdateTable(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + return createUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).toBlocking().last().body(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture createUpdateTableAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable createUpdateTableAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + return createUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).map(new Func1, TableGetResultsInner>() { + @Override + public TableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> createUpdateTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + 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 (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateTableParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.createUpdateTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, createUpdateTableParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @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 TableGetResultsInner object if successful. + */ + public TableGetResultsInner beginCreateUpdateTable(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).toBlocking().single().body(); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateUpdateTableAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters), serviceCallback); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableGetResultsInner object + */ + public Observable beginCreateUpdateTableAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + return beginCreateUpdateTableWithServiceResponseAsync(resourceGroupName, accountName, tableName, createUpdateTableParameters).map(new Func1, TableGetResultsInner>() { + @Override + public TableGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param createUpdateTableParameters The parameters to provide for the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the TableGetResultsInner object + */ + public Observable> beginCreateUpdateTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName, TableCreateUpdateParameters createUpdateTableParameters) { + 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 (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (createUpdateTableParameters == null) { + throw new IllegalArgumentException("Parameter createUpdateTableParameters is required and cannot be null."); + } + Validator.validate(createUpdateTableParameters); + final String apiVersion = "2019-12-12"; + return service.beginCreateUpdateTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, createUpdateTableParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginCreateUpdateTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginCreateUpdateTableDelegate(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); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 deleteTable(String resourceGroupName, String accountName, String tableName) { + deleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().last().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 deleteTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(deleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable deleteTableAsync(String resourceGroupName, String accountName, String tableName) { + return deleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> deleteTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + Observable> observable = service.deleteTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPostOrDeleteResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 beginDeleteTable(String resourceGroupName, String accountName, String tableName) { + beginDeleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().single().body(); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 beginDeleteTableAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginDeleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable beginDeleteTableAsync(String resourceGroupName, String accountName, String tableName) { + return beginDeleteTableWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, Void>() { + @Override + public Void call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Deletes an existing Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceResponse} object if successful. + */ + public Observable> beginDeleteTableWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.beginDeleteTable(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginDeleteTableDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginDeleteTableDelegate(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); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner getTableThroughput(String resourceGroupName, String accountName, String tableName) { + return getTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName).toBlocking().single().body(); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table 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 getTableThroughputAsync(String resourceGroupName, String accountName, String tableName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName), serviceCallback); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable getTableThroughputAsync(String resourceGroupName, String accountName, String tableName) { + return getTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets the RUs per second of the Table under an existing Azure Cosmos DB database account with the provided name. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> getTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName) { + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (accountName == null) { + throw new IllegalArgumentException("Parameter accountName is required and cannot be null."); + } + if (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + final String apiVersion = "2019-12-12"; + return service.getTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getTableThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getTableThroughputDelegate(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); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner updateTableThroughput(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters).toBlocking().last().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture updateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(updateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable updateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return updateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + public Observable> updateTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + Observable> observable = service.updateTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @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 ThroughputSettingsGetResultsInner object if successful. + */ + public ThroughputSettingsGetResultsInner beginUpdateTableThroughput(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters).toBlocking().single().body(); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginUpdateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginUpdateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters), serviceCallback); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable beginUpdateTableThroughputAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + return beginUpdateTableThroughputWithServiceResponseAsync(resourceGroupName, accountName, tableName, updateThroughputParameters).map(new Func1, ThroughputSettingsGetResultsInner>() { + @Override + public ThroughputSettingsGetResultsInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Update RUs per second of an Azure Cosmos DB Table. + * + * @param resourceGroupName Name of an Azure resource group. + * @param accountName Cosmos DB database account name. + * @param tableName Cosmos DB table name. + * @param updateThroughputParameters The parameters to provide for the RUs per second of the current Table. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the ThroughputSettingsGetResultsInner object + */ + public Observable> beginUpdateTableThroughputWithServiceResponseAsync(String resourceGroupName, String accountName, String tableName, ThroughputSettingsUpdateParameters updateThroughputParameters) { + 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 (tableName == null) { + throw new IllegalArgumentException("Parameter tableName is required and cannot be null."); + } + if (updateThroughputParameters == null) { + throw new IllegalArgumentException("Parameter updateThroughputParameters is required and cannot be null."); + } + Validator.validate(updateThroughputParameters); + final String apiVersion = "2019-12-12"; + return service.beginUpdateTableThroughput(this.client.subscriptionId(), resourceGroupName, accountName, tableName, apiVersion, updateThroughputParameters, this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = beginUpdateTableThroughputDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse beginUpdateTableThroughputDelegate(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); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsImpl.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsImpl.java new file mode 100644 index 0000000000000..7976799bebb25 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsImpl.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetResults; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetPropertiesResource; +import java.util.Map; + +class ThroughputSettingsGetResultsImpl extends WrapperImpl implements ThroughputSettingsGetResults { + private final CosmosDBManager manager; + ThroughputSettingsGetResultsImpl(ThroughputSettingsGetResultsInner inner, CosmosDBManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public CosmosDBManager manager() { + return this.manager; + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public String location() { + return this.inner().location(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public ThroughputSettingsGetPropertiesResource resource() { + return this.inner().resource(); + } + + @Override + public Map tags() { + return this.inner().getTags(); + } + + @Override + public String type() { + return this.inner().type(); + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsInner.java new file mode 100644 index 0000000000000..62ece383608ab --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/ThroughputSettingsGetResultsInner.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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ThroughputSettingsGetPropertiesResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.ARMResourceProperties; + +/** + * An Azure Cosmos DB resource throughput. + */ +@JsonFlatten +public class ThroughputSettingsGetResultsInner extends ARMResourceProperties { + /** + * The resource property. + */ + @JsonProperty(value = "properties.resource") + private ThroughputSettingsGetPropertiesResource resource; + + /** + * Get the resource value. + * + * @return the resource value + */ + public ThroughputSettingsGetPropertiesResource resource() { + return this.resource; + } + + /** + * Set the resource value. + * + * @param resource the resource value to set + * @return the ThroughputSettingsGetResultsInner object itself. + */ + public ThroughputSettingsGetResultsInner withResource(ThroughputSettingsGetPropertiesResource resource) { + this.resource = resource; + return this; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/UsageInner.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/UsageInner.java new file mode 100644 index 0000000000000..a4d157c499525 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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.cosmosdb.v2019_12_12.implementation; + +import com.microsoft.azure.management.cosmosdb.v2019_12_12.UnitType; +import com.microsoft.azure.management.cosmosdb.v2019_12_12.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 Long limit; + + /** + * Current value for this metric. + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Long 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 Long limit() { + return this.limit; + } + + /** + * Get current value for this metric. + * + * @return the currentValue value + */ + public Long currentValue() { + return this.currentValue; + } + +} diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/package-info.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/implementation/package-info.java new file mode 100644 index 0000000000000..75cbf538671d3 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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 CosmosDBManagementClient. + * Azure Cosmos DB Database Service Resource Provider REST API. + */ +package com.microsoft.azure.management.cosmosdb.v2019_12_12.implementation; diff --git a/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/package-info.java b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/package-info.java new file mode 100644 index 0000000000000..6c22d6eae0c66 --- /dev/null +++ b/sdk/cosmos/mgmt-v2019_12_12/src/main/java/com/microsoft/azure/management/cosmosdb/v2019_12_12/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 CosmosDBManagementClient. + * Azure Cosmos DB Database Service Resource Provider REST API. + */ +package com.microsoft.azure.management.cosmosdb.v2019_12_12;