azure_mgmt_cosmosdb 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb.rb +140 -0
  4. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection.rb +371 -0
  5. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition.rb +267 -0
  6. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +155 -0
  7. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_region.rb +155 -0
  8. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/cosmos_db.rb +180 -0
  9. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database.rb +359 -0
  10. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_account_region.rb +147 -0
  11. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_accounts.rb +6805 -0
  12. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/capability.rb +48 -0
  13. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace.rb +97 -0
  14. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +69 -0
  15. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +58 -0
  16. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +46 -0
  17. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +46 -0
  18. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +95 -0
  19. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table.rb +120 -0
  20. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +69 -0
  21. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +58 -0
  22. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +69 -0
  23. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +58 -0
  24. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/column.rb +57 -0
  25. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +16 -0
  26. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +73 -0
  27. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +86 -0
  28. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +70 -0
  29. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/data_type.rb +20 -0
  30. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account.rb +313 -0
  31. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +59 -0
  32. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +243 -0
  33. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +17 -0
  34. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +57 -0
  35. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +83 -0
  36. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +59 -0
  37. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +15 -0
  38. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_patch_parameters.rb +75 -0
  39. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +47 -0
  40. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +58 -0
  41. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +19 -0
  42. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  43. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +48 -0
  44. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +71 -0
  45. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +55 -0
  46. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +79 -0
  47. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database.rb +132 -0
  48. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +69 -0
  49. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +58 -0
  50. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +46 -0
  51. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph.rb +197 -0
  52. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +69 -0
  53. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +57 -0
  54. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +111 -0
  55. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/included_path.rb +67 -0
  56. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/index_kind.rb +17 -0
  57. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexes.rb +73 -0
  58. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +17 -0
  59. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +99 -0
  60. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/key_kind.rb +18 -0
  61. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/location.rb +102 -0
  62. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric.rb +120 -0
  63. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +60 -0
  64. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +109 -0
  65. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +57 -0
  66. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +56 -0
  67. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_name.rb +59 -0
  68. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_value.rb +107 -0
  69. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection.rb +137 -0
  70. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +69 -0
  71. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +58 -0
  72. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +86 -0
  73. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase.rb +97 -0
  74. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +69 -0
  75. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +58 -0
  76. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +46 -0
  77. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +60 -0
  78. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +55 -0
  79. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +57 -0
  80. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation.rb +58 -0
  81. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_display.rb +80 -0
  82. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +101 -0
  83. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +16 -0
  84. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +124 -0
  85. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +57 -0
  86. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +105 -0
  87. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +57 -0
  88. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +120 -0
  89. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +57 -0
  90. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +173 -0
  91. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +20 -0
  92. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +47 -0
  93. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/resource.rb +112 -0
  94. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container.rb +197 -0
  95. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +68 -0
  96. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +57 -0
  97. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +111 -0
  98. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database.rb +156 -0
  99. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +69 -0
  100. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +58 -0
  101. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +46 -0
  102. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table.rb +97 -0
  103. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +68 -0
  104. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +57 -0
  105. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_resource.rb +46 -0
  106. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key.rb +56 -0
  107. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +58 -0
  108. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unit_type.rb +21 -0
  109. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usage.rb +97 -0
  110. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usages_result.rb +57 -0
  111. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +59 -0
  112. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  113. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/operations.rb +219 -0
  114. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +155 -0
  115. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +162 -0
  116. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile.rb +140 -0
  117. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +157 -0
  118. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_target.rb +147 -0
  119. data/lib/azure_mgmt_cosmosdb.rb +6 -0
  120. data/lib/module_definition.rb +7 -0
  121. data/lib/profiles/latest/cosmosdb_latest_profile_client.rb +40 -0
  122. data/lib/profiles/latest/cosmosdb_module_definition.rb +8 -0
  123. data/lib/profiles/latest/modules/cosmosdb_profile_module.rb +485 -0
  124. data/lib/version.rb +7 -0
  125. metadata +240 -0
@@ -0,0 +1,267 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Cosmosdb::Mgmt::V2015_04_08
7
+ #
8
+ # Azure Cosmos DB Database Service Resource Provider REST API
9
+ #
10
+ class CollectionPartition
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the CollectionPartition class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given
26
+ # collection, split by partition.
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param database_rid [String] Cosmos DB database rid.
31
+ # @param collection_rid [String] Cosmos DB collection rid.
32
+ # @param filter [String] An OData filter expression that describes a subset of
33
+ # metrics to return. The parameters that can be filtered are name.value (name
34
+ # of the metric, can have an or of multiple names), startTime, endTime, and
35
+ # timeGrain. The supported operator is eq.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [PartitionMetricListResult] operation results.
40
+ #
41
+ def list_metrics(resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers:nil)
42
+ response = list_metrics_async(resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Retrieves the metrics determined by the given filter for the given
48
+ # collection, split by partition.
49
+ #
50
+ # @param resource_group_name [String] Name of an Azure resource group.
51
+ # @param account_name [String] Cosmos DB database account name.
52
+ # @param database_rid [String] Cosmos DB database rid.
53
+ # @param collection_rid [String] Cosmos DB collection rid.
54
+ # @param filter [String] An OData filter expression that describes a subset of
55
+ # metrics to return. The parameters that can be filtered are name.value (name
56
+ # of the metric, can have an or of multiple names), startTime, endTime, and
57
+ # timeGrain. The supported operator is eq.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
+ #
63
+ def list_metrics_with_http_info(resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers:nil)
64
+ list_metrics_async(resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
65
+ end
66
+
67
+ #
68
+ # Retrieves the metrics determined by the given filter for the given
69
+ # collection, split by partition.
70
+ #
71
+ # @param resource_group_name [String] Name of an Azure resource group.
72
+ # @param account_name [String] Cosmos DB database account name.
73
+ # @param database_rid [String] Cosmos DB database rid.
74
+ # @param collection_rid [String] Cosmos DB collection rid.
75
+ # @param filter [String] An OData filter expression that describes a subset of
76
+ # metrics to return. The parameters that can be filtered are name.value (name
77
+ # of the metric, can have an or of multiple names), startTime, endTime, and
78
+ # timeGrain. The supported operator is eq.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def list_metrics_async(resource_group_name, account_name, database_rid, collection_rid, filter, custom_headers:nil)
85
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
86
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
87
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
88
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
89
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
90
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
91
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
92
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
93
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
94
+ fail ArgumentError, 'collection_rid is nil' if collection_rid.nil?
95
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
96
+ fail ArgumentError, 'filter is nil' if filter.nil?
97
+
98
+
99
+ request_headers = {}
100
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
101
+
102
+ # Set Headers
103
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
104
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
105
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'
106
+
107
+ request_url = @base_url || @client.base_url
108
+
109
+ options = {
110
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
111
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseRid' => database_rid,'collectionRid' => collection_rid},
112
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
113
+ headers: request_headers.merge(custom_headers || {}),
114
+ base_url: request_url
115
+ }
116
+ promise = @client.make_request_async(:get, path_template, options)
117
+
118
+ promise = promise.then do |result|
119
+ http_response = result.response
120
+ status_code = http_response.status
121
+ response_content = http_response.body
122
+ unless status_code == 200
123
+ error_model = JSON.load(response_content)
124
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
125
+ end
126
+
127
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
128
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
129
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
130
+ # Deserialize Response
131
+ if status_code == 200
132
+ begin
133
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
134
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PartitionMetricListResult.mapper()
135
+ result.body = @client.deserialize(result_mapper, parsed_response)
136
+ rescue Exception => e
137
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
138
+ end
139
+ end
140
+
141
+ result
142
+ end
143
+
144
+ promise.execute
145
+ end
146
+
147
+ #
148
+ # Retrieves the usages (most recent storage data) for the given collection,
149
+ # split by partition.
150
+ #
151
+ # @param resource_group_name [String] Name of an Azure resource group.
152
+ # @param account_name [String] Cosmos DB database account name.
153
+ # @param database_rid [String] Cosmos DB database rid.
154
+ # @param collection_rid [String] Cosmos DB collection rid.
155
+ # @param filter [String] An OData filter expression that describes a subset of
156
+ # usages to return. The supported parameter is name.value (name of the metric,
157
+ # can have an or of multiple names).
158
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
159
+ # will be added to the HTTP request.
160
+ #
161
+ # @return [PartitionUsagesResult] operation results.
162
+ #
163
+ def list_usages(resource_group_name, account_name, database_rid, collection_rid, filter:nil, custom_headers:nil)
164
+ response = list_usages_async(resource_group_name, account_name, database_rid, collection_rid, filter:filter, custom_headers:custom_headers).value!
165
+ response.body unless response.nil?
166
+ end
167
+
168
+ #
169
+ # Retrieves the usages (most recent storage data) for the given collection,
170
+ # split by partition.
171
+ #
172
+ # @param resource_group_name [String] Name of an Azure resource group.
173
+ # @param account_name [String] Cosmos DB database account name.
174
+ # @param database_rid [String] Cosmos DB database rid.
175
+ # @param collection_rid [String] Cosmos DB collection rid.
176
+ # @param filter [String] An OData filter expression that describes a subset of
177
+ # usages to return. The supported parameter is name.value (name of the metric,
178
+ # can have an or of multiple names).
179
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
180
+ # will be added to the HTTP request.
181
+ #
182
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
183
+ #
184
+ def list_usages_with_http_info(resource_group_name, account_name, database_rid, collection_rid, filter:nil, custom_headers:nil)
185
+ list_usages_async(resource_group_name, account_name, database_rid, collection_rid, filter:filter, custom_headers:custom_headers).value!
186
+ end
187
+
188
+ #
189
+ # Retrieves the usages (most recent storage data) for the given collection,
190
+ # split by partition.
191
+ #
192
+ # @param resource_group_name [String] Name of an Azure resource group.
193
+ # @param account_name [String] Cosmos DB database account name.
194
+ # @param database_rid [String] Cosmos DB database rid.
195
+ # @param collection_rid [String] Cosmos DB collection rid.
196
+ # @param filter [String] An OData filter expression that describes a subset of
197
+ # usages to return. The supported parameter is name.value (name of the metric,
198
+ # can have an or of multiple names).
199
+ # @param [Hash{String => String}] A hash of custom headers that will be added
200
+ # to the HTTP request.
201
+ #
202
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
203
+ #
204
+ def list_usages_async(resource_group_name, account_name, database_rid, collection_rid, filter:nil, custom_headers:nil)
205
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
206
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
207
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
208
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
209
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
210
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
211
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
212
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
213
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
214
+ fail ArgumentError, 'collection_rid is nil' if collection_rid.nil?
215
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
216
+
217
+
218
+ request_headers = {}
219
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
220
+
221
+ # Set Headers
222
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
223
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
224
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/collections/{collectionRid}/partitions/usages'
225
+
226
+ request_url = @base_url || @client.base_url
227
+
228
+ options = {
229
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
230
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseRid' => database_rid,'collectionRid' => collection_rid},
231
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
232
+ headers: request_headers.merge(custom_headers || {}),
233
+ base_url: request_url
234
+ }
235
+ promise = @client.make_request_async(:get, path_template, options)
236
+
237
+ promise = promise.then do |result|
238
+ http_response = result.response
239
+ status_code = http_response.status
240
+ response_content = http_response.body
241
+ unless status_code == 200
242
+ error_model = JSON.load(response_content)
243
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
244
+ end
245
+
246
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
247
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
248
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
249
+ # Deserialize Response
250
+ if status_code == 200
251
+ begin
252
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
253
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PartitionUsagesResult.mapper()
254
+ result.body = @client.deserialize(result_mapper, parsed_response)
255
+ rescue Exception => e
256
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
257
+ end
258
+ end
259
+
260
+ result
261
+ end
262
+
263
+ promise.execute
264
+ end
265
+
266
+ end
267
+ end
@@ -0,0 +1,155 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Cosmosdb::Mgmt::V2015_04_08
7
+ #
8
+ # Azure Cosmos DB Database Service Resource Provider REST API
9
+ #
10
+ class CollectionPartitionRegion
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the CollectionPartitionRegion class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given collection
26
+ # and region, split by partition.
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param region [String] Cosmos DB region, with spaces between words and each
31
+ # word capitalized.
32
+ # @param database_rid [String] Cosmos DB database rid.
33
+ # @param collection_rid [String] Cosmos DB collection rid.
34
+ # @param filter [String] An OData filter expression that describes a subset of
35
+ # metrics to return. The parameters that can be filtered are name.value (name
36
+ # of the metric, can have an or of multiple names), startTime, endTime, and
37
+ # timeGrain. The supported operator is eq.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [PartitionMetricListResult] operation results.
42
+ #
43
+ def list_metrics(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
44
+ response = list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Retrieves the metrics determined by the given filter for the given collection
50
+ # and region, split by partition.
51
+ #
52
+ # @param resource_group_name [String] Name of an Azure resource group.
53
+ # @param account_name [String] Cosmos DB database account name.
54
+ # @param region [String] Cosmos DB region, with spaces between words and each
55
+ # word capitalized.
56
+ # @param database_rid [String] Cosmos DB database rid.
57
+ # @param collection_rid [String] Cosmos DB collection rid.
58
+ # @param filter [String] An OData filter expression that describes a subset of
59
+ # metrics to return. The parameters that can be filtered are name.value (name
60
+ # of the metric, can have an or of multiple names), startTime, endTime, and
61
+ # timeGrain. The supported operator is eq.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def list_metrics_with_http_info(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
68
+ list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Retrieves the metrics determined by the given filter for the given collection
73
+ # and region, split by partition.
74
+ #
75
+ # @param resource_group_name [String] Name of an Azure resource group.
76
+ # @param account_name [String] Cosmos DB database account name.
77
+ # @param region [String] Cosmos DB region, with spaces between words and each
78
+ # word capitalized.
79
+ # @param database_rid [String] Cosmos DB database rid.
80
+ # @param collection_rid [String] Cosmos DB collection rid.
81
+ # @param filter [String] An OData filter expression that describes a subset of
82
+ # metrics to return. The parameters that can be filtered are name.value (name
83
+ # of the metric, can have an or of multiple names), startTime, endTime, and
84
+ # timeGrain. The supported operator is eq.
85
+ # @param [Hash{String => String}] A hash of custom headers that will be added
86
+ # to the HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
89
+ #
90
+ def list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
91
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
92
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
93
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
94
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
95
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
96
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
97
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
98
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
99
+ fail ArgumentError, 'region is nil' if region.nil?
100
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
101
+ fail ArgumentError, 'collection_rid is nil' if collection_rid.nil?
102
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
103
+ fail ArgumentError, 'filter is nil' if filter.nil?
104
+
105
+
106
+ request_headers = {}
107
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
108
+
109
+ # Set Headers
110
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
111
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
112
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitions/metrics'
113
+
114
+ request_url = @base_url || @client.base_url
115
+
116
+ options = {
117
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
118
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'region' => region,'databaseRid' => database_rid,'collectionRid' => collection_rid},
119
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
120
+ headers: request_headers.merge(custom_headers || {}),
121
+ base_url: request_url
122
+ }
123
+ promise = @client.make_request_async(:get, path_template, options)
124
+
125
+ promise = promise.then do |result|
126
+ http_response = result.response
127
+ status_code = http_response.status
128
+ response_content = http_response.body
129
+ unless status_code == 200
130
+ error_model = JSON.load(response_content)
131
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
132
+ end
133
+
134
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
135
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
136
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
137
+ # Deserialize Response
138
+ if status_code == 200
139
+ begin
140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
141
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PartitionMetricListResult.mapper()
142
+ result.body = @client.deserialize(result_mapper, parsed_response)
143
+ rescue Exception => e
144
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
145
+ end
146
+ end
147
+
148
+ result
149
+ end
150
+
151
+ promise.execute
152
+ end
153
+
154
+ end
155
+ end
@@ -0,0 +1,155 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::Cosmosdb::Mgmt::V2015_04_08
7
+ #
8
+ # Azure Cosmos DB Database Service Resource Provider REST API
9
+ #
10
+ class CollectionRegion
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the CollectionRegion class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given database
26
+ # account, collection and region.
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param region [String] Cosmos DB region, with spaces between words and each
31
+ # word capitalized.
32
+ # @param database_rid [String] Cosmos DB database rid.
33
+ # @param collection_rid [String] Cosmos DB collection rid.
34
+ # @param filter [String] An OData filter expression that describes a subset of
35
+ # metrics to return. The parameters that can be filtered are name.value (name
36
+ # of the metric, can have an or of multiple names), startTime, endTime, and
37
+ # timeGrain. The supported operator is eq.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ # @return [MetricListResult] operation results.
42
+ #
43
+ def list_metrics(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
44
+ response = list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
45
+ response.body unless response.nil?
46
+ end
47
+
48
+ #
49
+ # Retrieves the metrics determined by the given filter for the given database
50
+ # account, collection and region.
51
+ #
52
+ # @param resource_group_name [String] Name of an Azure resource group.
53
+ # @param account_name [String] Cosmos DB database account name.
54
+ # @param region [String] Cosmos DB region, with spaces between words and each
55
+ # word capitalized.
56
+ # @param database_rid [String] Cosmos DB database rid.
57
+ # @param collection_rid [String] Cosmos DB collection rid.
58
+ # @param filter [String] An OData filter expression that describes a subset of
59
+ # metrics to return. The parameters that can be filtered are name.value (name
60
+ # of the metric, can have an or of multiple names), startTime, endTime, and
61
+ # timeGrain. The supported operator is eq.
62
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
63
+ # will be added to the HTTP request.
64
+ #
65
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
66
+ #
67
+ def list_metrics_with_http_info(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
68
+ list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:custom_headers).value!
69
+ end
70
+
71
+ #
72
+ # Retrieves the metrics determined by the given filter for the given database
73
+ # account, collection and region.
74
+ #
75
+ # @param resource_group_name [String] Name of an Azure resource group.
76
+ # @param account_name [String] Cosmos DB database account name.
77
+ # @param region [String] Cosmos DB region, with spaces between words and each
78
+ # word capitalized.
79
+ # @param database_rid [String] Cosmos DB database rid.
80
+ # @param collection_rid [String] Cosmos DB collection rid.
81
+ # @param filter [String] An OData filter expression that describes a subset of
82
+ # metrics to return. The parameters that can be filtered are name.value (name
83
+ # of the metric, can have an or of multiple names), startTime, endTime, and
84
+ # timeGrain. The supported operator is eq.
85
+ # @param [Hash{String => String}] A hash of custom headers that will be added
86
+ # to the HTTP request.
87
+ #
88
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
89
+ #
90
+ def list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, filter, custom_headers:nil)
91
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
92
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
93
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
94
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
95
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
96
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
97
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
98
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
99
+ fail ArgumentError, 'region is nil' if region.nil?
100
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
101
+ fail ArgumentError, 'collection_rid is nil' if collection_rid.nil?
102
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
103
+ fail ArgumentError, 'filter is nil' if filter.nil?
104
+
105
+
106
+ request_headers = {}
107
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
108
+
109
+ # Set Headers
110
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
111
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
112
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/metrics'
113
+
114
+ request_url = @base_url || @client.base_url
115
+
116
+ options = {
117
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
118
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'region' => region,'databaseRid' => database_rid,'collectionRid' => collection_rid},
119
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
120
+ headers: request_headers.merge(custom_headers || {}),
121
+ base_url: request_url
122
+ }
123
+ promise = @client.make_request_async(:get, path_template, options)
124
+
125
+ promise = promise.then do |result|
126
+ http_response = result.response
127
+ status_code = http_response.status
128
+ response_content = http_response.body
129
+ unless status_code == 200
130
+ error_model = JSON.load(response_content)
131
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
132
+ end
133
+
134
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
135
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
136
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
137
+ # Deserialize Response
138
+ if status_code == 200
139
+ begin
140
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
141
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::MetricListResult.mapper()
142
+ result.body = @client.deserialize(result_mapper, parsed_response)
143
+ rescue Exception => e
144
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
145
+ end
146
+ end
147
+
148
+ result
149
+ end
150
+
151
+ promise.execute
152
+ end
153
+
154
+ end
155
+ end