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,162 @@
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 PartitionKeyRangeIdRegion
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PartitionKeyRangeIdRegion 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 partition
26
+ # key range id 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 partition_key_range_id [String] Partition Key Range Id for which to
35
+ # get data.
36
+ # @param filter [String] An OData filter expression that describes a subset of
37
+ # metrics to return. The parameters that can be filtered are name.value (name
38
+ # of the metric, can have an or of multiple names), startTime, endTime, and
39
+ # timeGrain. The supported operator is eq.
40
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
41
+ # will be added to the HTTP request.
42
+ #
43
+ # @return [PartitionMetricListResult] operation results.
44
+ #
45
+ def list_metrics(resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers:nil)
46
+ response = list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers:custom_headers).value!
47
+ response.body unless response.nil?
48
+ end
49
+
50
+ #
51
+ # Retrieves the metrics determined by the given filter for the given partition
52
+ # key range id and region.
53
+ #
54
+ # @param resource_group_name [String] Name of an Azure resource group.
55
+ # @param account_name [String] Cosmos DB database account name.
56
+ # @param region [String] Cosmos DB region, with spaces between words and each
57
+ # word capitalized.
58
+ # @param database_rid [String] Cosmos DB database rid.
59
+ # @param collection_rid [String] Cosmos DB collection rid.
60
+ # @param partition_key_range_id [String] Partition Key Range Id for which to
61
+ # get data.
62
+ # @param filter [String] An OData filter expression that describes a subset of
63
+ # metrics to return. The parameters that can be filtered are name.value (name
64
+ # of the metric, can have an or of multiple names), startTime, endTime, and
65
+ # timeGrain. The supported operator is eq.
66
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
67
+ # will be added to the HTTP request.
68
+ #
69
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
70
+ #
71
+ def list_metrics_with_http_info(resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers:nil)
72
+ list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers:custom_headers).value!
73
+ end
74
+
75
+ #
76
+ # Retrieves the metrics determined by the given filter for the given partition
77
+ # key range id and region.
78
+ #
79
+ # @param resource_group_name [String] Name of an Azure resource group.
80
+ # @param account_name [String] Cosmos DB database account name.
81
+ # @param region [String] Cosmos DB region, with spaces between words and each
82
+ # word capitalized.
83
+ # @param database_rid [String] Cosmos DB database rid.
84
+ # @param collection_rid [String] Cosmos DB collection rid.
85
+ # @param partition_key_range_id [String] Partition Key Range Id for which to
86
+ # get data.
87
+ # @param filter [String] An OData filter expression that describes a subset of
88
+ # metrics to return. The parameters that can be filtered are name.value (name
89
+ # of the metric, can have an or of multiple names), startTime, endTime, and
90
+ # timeGrain. The supported operator is eq.
91
+ # @param [Hash{String => String}] A hash of custom headers that will be added
92
+ # to the HTTP request.
93
+ #
94
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
95
+ #
96
+ def list_metrics_async(resource_group_name, account_name, region, database_rid, collection_rid, partition_key_range_id, filter, custom_headers:nil)
97
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
98
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
99
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
100
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
101
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
102
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
103
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
104
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
105
+ fail ArgumentError, 'region is nil' if region.nil?
106
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
107
+ fail ArgumentError, 'collection_rid is nil' if collection_rid.nil?
108
+ fail ArgumentError, 'partition_key_range_id is nil' if partition_key_range_id.nil?
109
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
110
+ fail ArgumentError, 'filter is nil' if filter.nil?
111
+
112
+
113
+ request_headers = {}
114
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
115
+
116
+ # Set Headers
117
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
118
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
119
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/region/{region}/databases/{databaseRid}/collections/{collectionRid}/partitionKeyRangeId/{partitionKeyRangeId}/metrics'
120
+
121
+ request_url = @base_url || @client.base_url
122
+
123
+ options = {
124
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
125
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'region' => region,'databaseRid' => database_rid,'collectionRid' => collection_rid,'partitionKeyRangeId' => partition_key_range_id},
126
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
127
+ headers: request_headers.merge(custom_headers || {}),
128
+ base_url: request_url
129
+ }
130
+ promise = @client.make_request_async(:get, path_template, options)
131
+
132
+ promise = promise.then do |result|
133
+ http_response = result.response
134
+ status_code = http_response.status
135
+ response_content = http_response.body
136
+ unless status_code == 200
137
+ error_model = JSON.load(response_content)
138
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
139
+ end
140
+
141
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
142
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
143
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
144
+ # Deserialize Response
145
+ if status_code == 200
146
+ begin
147
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
148
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PartitionMetricListResult.mapper()
149
+ result.body = @client.deserialize(result_mapper, parsed_response)
150
+ rescue Exception => e
151
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
152
+ end
153
+ end
154
+
155
+ result
156
+ end
157
+
158
+ promise.execute
159
+ end
160
+
161
+ end
162
+ end
@@ -0,0 +1,140 @@
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 Percentile
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Percentile 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. This url is only for PBS and Replication Latency data
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 filter [String] An OData filter expression that describes a subset of
31
+ # metrics to return. The parameters that can be filtered are name.value (name
32
+ # of the metric, can have an or of multiple names), startTime, endTime, and
33
+ # timeGrain. The supported operator is eq.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [PercentileMetricListResult] operation results.
38
+ #
39
+ def list_metrics(resource_group_name, account_name, filter, custom_headers:nil)
40
+ response = list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Retrieves the metrics determined by the given filter for the given database
46
+ # account. This url is only for PBS and Replication Latency data
47
+ #
48
+ # @param resource_group_name [String] Name of an Azure resource group.
49
+ # @param account_name [String] Cosmos DB database account name.
50
+ # @param filter [String] An OData filter expression that describes a subset of
51
+ # metrics to return. The parameters that can be filtered are name.value (name
52
+ # of the metric, can have an or of multiple names), startTime, endTime, and
53
+ # timeGrain. The supported operator is eq.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def list_metrics_with_http_info(resource_group_name, account_name, filter, custom_headers:nil)
60
+ list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Retrieves the metrics determined by the given filter for the given database
65
+ # account. This url is only for PBS and Replication Latency data
66
+ #
67
+ # @param resource_group_name [String] Name of an Azure resource group.
68
+ # @param account_name [String] Cosmos DB database account name.
69
+ # @param filter [String] An OData filter expression that describes a subset of
70
+ # metrics to return. The parameters that can be filtered are name.value (name
71
+ # of the metric, can have an or of multiple names), startTime, endTime, and
72
+ # timeGrain. The supported operator is eq.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def list_metrics_async(resource_group_name, account_name, filter, custom_headers:nil)
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
82
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
83
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
84
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
85
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
86
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
87
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
88
+ fail ArgumentError, 'filter is nil' if filter.nil?
89
+
90
+
91
+ request_headers = {}
92
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
93
+
94
+ # Set Headers
95
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
96
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
97
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics'
98
+
99
+ request_url = @base_url || @client.base_url
100
+
101
+ options = {
102
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
103
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
104
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
105
+ headers: request_headers.merge(custom_headers || {}),
106
+ base_url: request_url
107
+ }
108
+ promise = @client.make_request_async(:get, path_template, options)
109
+
110
+ promise = promise.then do |result|
111
+ http_response = result.response
112
+ status_code = http_response.status
113
+ response_content = http_response.body
114
+ unless status_code == 200
115
+ error_model = JSON.load(response_content)
116
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
117
+ end
118
+
119
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
120
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
121
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
122
+ # Deserialize Response
123
+ if status_code == 200
124
+ begin
125
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
126
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PercentileMetricListResult.mapper()
127
+ result.body = @client.deserialize(result_mapper, parsed_response)
128
+ rescue Exception => e
129
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
130
+ end
131
+ end
132
+
133
+ result
134
+ end
135
+
136
+ promise.execute
137
+ end
138
+
139
+ end
140
+ end
@@ -0,0 +1,157 @@
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 PercentileSourceTarget
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PercentileSourceTarget 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 account,
26
+ # source and target region. This url is only for PBS and Replication Latency
27
+ # data
28
+ #
29
+ # @param resource_group_name [String] Name of an Azure resource group.
30
+ # @param account_name [String] Cosmos DB database account name.
31
+ # @param source_region [String] Source region from which data is written.
32
+ # Cosmos DB region, with spaces between words and each word capitalized.
33
+ # @param target_region [String] Target region to which data is written. Cosmos
34
+ # DB region, with spaces between words and each word capitalized.
35
+ # @param filter [String] An OData filter expression that describes a subset of
36
+ # metrics to return. The parameters that can be filtered are name.value (name
37
+ # of the metric, can have an or of multiple names), startTime, endTime, and
38
+ # timeGrain. The supported operator is eq.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [PercentileMetricListResult] operation results.
43
+ #
44
+ def list_metrics(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
45
+ response = list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:custom_headers).value!
46
+ response.body unless response.nil?
47
+ end
48
+
49
+ #
50
+ # Retrieves the metrics determined by the given filter for the given account,
51
+ # source and target region. This url is only for PBS and Replication Latency
52
+ # data
53
+ #
54
+ # @param resource_group_name [String] Name of an Azure resource group.
55
+ # @param account_name [String] Cosmos DB database account name.
56
+ # @param source_region [String] Source region from which data is written.
57
+ # Cosmos DB region, with spaces between words and each word capitalized.
58
+ # @param target_region [String] Target region to which data is written. Cosmos
59
+ # DB region, with spaces between words and each word capitalized.
60
+ # @param filter [String] An OData filter expression that describes a subset of
61
+ # metrics to return. The parameters that can be filtered are name.value (name
62
+ # of the metric, can have an or of multiple names), startTime, endTime, and
63
+ # timeGrain. The supported operator is eq.
64
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
65
+ # will be added to the HTTP request.
66
+ #
67
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
68
+ #
69
+ def list_metrics_with_http_info(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
70
+ list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:custom_headers).value!
71
+ end
72
+
73
+ #
74
+ # Retrieves the metrics determined by the given filter for the given account,
75
+ # source and target region. This url is only for PBS and Replication Latency
76
+ # data
77
+ #
78
+ # @param resource_group_name [String] Name of an Azure resource group.
79
+ # @param account_name [String] Cosmos DB database account name.
80
+ # @param source_region [String] Source region from which data is written.
81
+ # Cosmos DB region, with spaces between words and each word capitalized.
82
+ # @param target_region [String] Target region to which data is written. Cosmos
83
+ # DB region, with spaces between words and each word capitalized.
84
+ # @param filter [String] An OData filter expression that describes a subset of
85
+ # metrics to return. The parameters that can be filtered are name.value (name
86
+ # of the metric, can have an or of multiple names), startTime, endTime, and
87
+ # timeGrain. The supported operator is eq.
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
94
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
95
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
96
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
97
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
98
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
99
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
100
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
101
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
102
+ fail ArgumentError, 'source_region is nil' if source_region.nil?
103
+ fail ArgumentError, 'target_region is nil' if target_region.nil?
104
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
105
+ fail ArgumentError, 'filter is nil' if filter.nil?
106
+
107
+
108
+ request_headers = {}
109
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
110
+
111
+ # Set Headers
112
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
113
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
114
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics'
115
+
116
+ request_url = @base_url || @client.base_url
117
+
118
+ options = {
119
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
120
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'sourceRegion' => source_region,'targetRegion' => target_region},
121
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
122
+ headers: request_headers.merge(custom_headers || {}),
123
+ base_url: request_url
124
+ }
125
+ promise = @client.make_request_async(:get, path_template, options)
126
+
127
+ promise = promise.then do |result|
128
+ http_response = result.response
129
+ status_code = http_response.status
130
+ response_content = http_response.body
131
+ unless status_code == 200
132
+ error_model = JSON.load(response_content)
133
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
134
+ end
135
+
136
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
137
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
138
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
139
+ # Deserialize Response
140
+ if status_code == 200
141
+ begin
142
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
143
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::PercentileMetricListResult.mapper()
144
+ result.body = @client.deserialize(result_mapper, parsed_response)
145
+ rescue Exception => e
146
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
147
+ end
148
+ end
149
+
150
+ result
151
+ end
152
+
153
+ promise.execute
154
+ end
155
+
156
+ end
157
+ end