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,180 @@
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
+ # A service client - single point of access to the REST API.
9
+ #
10
+ class CosmosDB < MsRestAzure::AzureServiceClient
11
+ include MsRestAzure
12
+ include MsRestAzure::Serialization
13
+
14
+ # @return [String] the base URI of the service.
15
+ attr_accessor :base_url
16
+
17
+ # @return Credentials needed for the client to connect to Azure.
18
+ attr_reader :credentials
19
+
20
+ # @return [String] Azure subscription ID.
21
+ attr_accessor :subscription_id
22
+
23
+ # @return [String] Version of the API to be used with the client request.
24
+ # The current version is 2015-04-08.
25
+ attr_reader :api_version
26
+
27
+ # @return [String] The preferred language for the response.
28
+ attr_accessor :accept_language
29
+
30
+ # @return [Integer] The retry timeout in seconds for Long Running
31
+ # Operations. Default value is 30.
32
+ attr_accessor :long_running_operation_retry_timeout
33
+
34
+ # @return [Boolean] Whether a unique x-ms-client-request-id should be
35
+ # generated. When set to true a unique x-ms-client-request-id value is
36
+ # generated and included in each request. Default is true.
37
+ attr_accessor :generate_client_request_id
38
+
39
+ # @return [DatabaseAccounts] database_accounts
40
+ attr_reader :database_accounts
41
+
42
+ # @return [Operations] operations
43
+ attr_reader :operations
44
+
45
+ # @return [Database] database
46
+ attr_reader :database
47
+
48
+ # @return [Collection] collection
49
+ attr_reader :collection
50
+
51
+ # @return [CollectionRegion] collection_region
52
+ attr_reader :collection_region
53
+
54
+ # @return [DatabaseAccountRegion] database_account_region
55
+ attr_reader :database_account_region
56
+
57
+ # @return [PercentileSourceTarget] percentile_source_target
58
+ attr_reader :percentile_source_target
59
+
60
+ # @return [PercentileTarget] percentile_target
61
+ attr_reader :percentile_target
62
+
63
+ # @return [Percentile] percentile
64
+ attr_reader :percentile
65
+
66
+ # @return [CollectionPartitionRegion] collection_partition_region
67
+ attr_reader :collection_partition_region
68
+
69
+ # @return [CollectionPartition] collection_partition
70
+ attr_reader :collection_partition
71
+
72
+ # @return [PartitionKeyRangeId] partition_key_range_id
73
+ attr_reader :partition_key_range_id
74
+
75
+ # @return [PartitionKeyRangeIdRegion] partition_key_range_id_region
76
+ attr_reader :partition_key_range_id_region
77
+
78
+ #
79
+ # Creates initializes a new instance of the CosmosDB class.
80
+ # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
81
+ # @param base_url [String] the base URI of the service.
82
+ # @param options [Array] filters to be applied to the HTTP requests.
83
+ #
84
+ def initialize(credentials = nil, base_url = nil, options = nil)
85
+ super(credentials, options)
86
+ @base_url = base_url || 'https://management.azure.com'
87
+
88
+ fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
89
+ @credentials = credentials
90
+
91
+ @database_accounts = DatabaseAccounts.new(self)
92
+ @operations = Operations.new(self)
93
+ @database = Database.new(self)
94
+ @collection = Collection.new(self)
95
+ @collection_region = CollectionRegion.new(self)
96
+ @database_account_region = DatabaseAccountRegion.new(self)
97
+ @percentile_source_target = PercentileSourceTarget.new(self)
98
+ @percentile_target = PercentileTarget.new(self)
99
+ @percentile = Percentile.new(self)
100
+ @collection_partition_region = CollectionPartitionRegion.new(self)
101
+ @collection_partition = CollectionPartition.new(self)
102
+ @partition_key_range_id = PartitionKeyRangeId.new(self)
103
+ @partition_key_range_id_region = PartitionKeyRangeIdRegion.new(self)
104
+ @api_version = '2015-04-08'
105
+ @accept_language = 'en-US'
106
+ @long_running_operation_retry_timeout = 30
107
+ @generate_client_request_id = true
108
+ add_telemetry
109
+ end
110
+
111
+ #
112
+ # Makes a request and returns the body of the response.
113
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
114
+ # @param path [String] the path, relative to {base_url}.
115
+ # @param options [Hash{String=>String}] specifying any request options like :body.
116
+ # @return [Hash{String=>String}] containing the body of the response.
117
+ # Example:
118
+ #
119
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
120
+ # path = "/path"
121
+ # options = {
122
+ # body: request_content,
123
+ # query_params: {'api-version' => '2016-02-01'}
124
+ # }
125
+ # result = @client.make_request(:put, path, options)
126
+ #
127
+ def make_request(method, path, options = {})
128
+ result = make_request_with_http_info(method, path, options)
129
+ result.body unless result.nil?
130
+ end
131
+
132
+ #
133
+ # Makes a request and returns the operation response.
134
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
135
+ # @param path [String] the path, relative to {base_url}.
136
+ # @param options [Hash{String=>String}] specifying any request options like :body.
137
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
138
+ #
139
+ def make_request_with_http_info(method, path, options = {})
140
+ result = make_request_async(method, path, options).value!
141
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
142
+ result
143
+ end
144
+
145
+ #
146
+ # Makes a request asynchronously.
147
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
148
+ # @param path [String] the path, relative to {base_url}.
149
+ # @param options [Hash{String=>String}] specifying any request options like :body.
150
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
151
+ #
152
+ def make_request_async(method, path, options = {})
153
+ fail ArgumentError, 'method is nil' if method.nil?
154
+ fail ArgumentError, 'path is nil' if path.nil?
155
+
156
+ request_url = options[:base_url] || @base_url
157
+ if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
158
+ @request_headers['Content-Type'] = options[:headers]['Content-Type']
159
+ end
160
+
161
+ request_headers = @request_headers
162
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
163
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
164
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
165
+
166
+ super(request_url, method, path, options)
167
+ end
168
+
169
+
170
+ private
171
+ #
172
+ # Adds telemetry information.
173
+ #
174
+ def add_telemetry
175
+ sdk_information = 'azure_mgmt_cosmosdb'
176
+ sdk_information = "#{sdk_information}/0.17.0"
177
+ add_user_agent_information(sdk_information)
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,359 @@
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 Database
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Database 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 and database.
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 filter [String] An OData filter expression that describes a subset of
32
+ # metrics to return. The parameters that can be filtered are name.value (name
33
+ # of the metric, can have an or of multiple names), startTime, endTime, and
34
+ # timeGrain. The supported operator is eq.
35
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
36
+ # will be added to the HTTP request.
37
+ #
38
+ # @return [MetricListResult] operation results.
39
+ #
40
+ def list_metrics(resource_group_name, account_name, database_rid, filter, custom_headers:nil)
41
+ response = list_metrics_async(resource_group_name, account_name, database_rid, filter, custom_headers:custom_headers).value!
42
+ response.body unless response.nil?
43
+ end
44
+
45
+ #
46
+ # Retrieves the metrics determined by the given filter for the given database
47
+ # account and database.
48
+ #
49
+ # @param resource_group_name [String] Name of an Azure resource group.
50
+ # @param account_name [String] Cosmos DB database account name.
51
+ # @param database_rid [String] Cosmos DB database rid.
52
+ # @param filter [String] An OData filter expression that describes a subset of
53
+ # metrics to return. The parameters that can be filtered are name.value (name
54
+ # of the metric, can have an or of multiple names), startTime, endTime, and
55
+ # timeGrain. The supported operator is eq.
56
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
57
+ # will be added to the HTTP request.
58
+ #
59
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
60
+ #
61
+ def list_metrics_with_http_info(resource_group_name, account_name, database_rid, filter, custom_headers:nil)
62
+ list_metrics_async(resource_group_name, account_name, database_rid, filter, custom_headers:custom_headers).value!
63
+ end
64
+
65
+ #
66
+ # Retrieves the metrics determined by the given filter for the given database
67
+ # account and database.
68
+ #
69
+ # @param resource_group_name [String] Name of an Azure resource group.
70
+ # @param account_name [String] Cosmos DB database account name.
71
+ # @param database_rid [String] Cosmos DB database rid.
72
+ # @param filter [String] An OData filter expression that describes a subset of
73
+ # metrics to return. The parameters that can be filtered are name.value (name
74
+ # of the metric, can have an or of multiple names), startTime, endTime, and
75
+ # timeGrain. The supported operator is eq.
76
+ # @param [Hash{String => String}] A hash of custom headers that will be added
77
+ # to the HTTP request.
78
+ #
79
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
80
+ #
81
+ def list_metrics_async(resource_group_name, account_name, database_rid, filter, custom_headers:nil)
82
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
83
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
84
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
85
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
86
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
87
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
88
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
89
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
90
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
91
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
92
+ fail ArgumentError, 'filter is nil' if filter.nil?
93
+
94
+
95
+ request_headers = {}
96
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
97
+
98
+ # Set Headers
99
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
100
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
101
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metrics'
102
+
103
+ request_url = @base_url || @client.base_url
104
+
105
+ options = {
106
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseRid' => database_rid},
108
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
109
+ headers: request_headers.merge(custom_headers || {}),
110
+ base_url: request_url
111
+ }
112
+ promise = @client.make_request_async(:get, path_template, options)
113
+
114
+ promise = promise.then do |result|
115
+ http_response = result.response
116
+ status_code = http_response.status
117
+ response_content = http_response.body
118
+ unless status_code == 200
119
+ error_model = JSON.load(response_content)
120
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
121
+ end
122
+
123
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
124
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
125
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
126
+ # Deserialize Response
127
+ if status_code == 200
128
+ begin
129
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
130
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::MetricListResult.mapper()
131
+ result.body = @client.deserialize(result_mapper, parsed_response)
132
+ rescue Exception => e
133
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
134
+ end
135
+ end
136
+
137
+ result
138
+ end
139
+
140
+ promise.execute
141
+ end
142
+
143
+ #
144
+ # Retrieves the usages (most recent data) for the given database.
145
+ #
146
+ # @param resource_group_name [String] Name of an Azure resource group.
147
+ # @param account_name [String] Cosmos DB database account name.
148
+ # @param database_rid [String] Cosmos DB database rid.
149
+ # @param filter [String] An OData filter expression that describes a subset of
150
+ # usages to return. The supported parameter is name.value (name of the metric,
151
+ # can have an or of multiple names).
152
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
153
+ # will be added to the HTTP request.
154
+ #
155
+ # @return [UsagesResult] operation results.
156
+ #
157
+ def list_usages(resource_group_name, account_name, database_rid, filter:nil, custom_headers:nil)
158
+ response = list_usages_async(resource_group_name, account_name, database_rid, filter:filter, custom_headers:custom_headers).value!
159
+ response.body unless response.nil?
160
+ end
161
+
162
+ #
163
+ # Retrieves the usages (most recent data) for the given database.
164
+ #
165
+ # @param resource_group_name [String] Name of an Azure resource group.
166
+ # @param account_name [String] Cosmos DB database account name.
167
+ # @param database_rid [String] Cosmos DB database rid.
168
+ # @param filter [String] An OData filter expression that describes a subset of
169
+ # usages to return. The supported parameter is name.value (name of the metric,
170
+ # can have an or of multiple names).
171
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
172
+ # will be added to the HTTP request.
173
+ #
174
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
175
+ #
176
+ def list_usages_with_http_info(resource_group_name, account_name, database_rid, filter:nil, custom_headers:nil)
177
+ list_usages_async(resource_group_name, account_name, database_rid, filter:filter, custom_headers:custom_headers).value!
178
+ end
179
+
180
+ #
181
+ # Retrieves the usages (most recent data) for the given database.
182
+ #
183
+ # @param resource_group_name [String] Name of an Azure resource group.
184
+ # @param account_name [String] Cosmos DB database account name.
185
+ # @param database_rid [String] Cosmos DB database rid.
186
+ # @param filter [String] An OData filter expression that describes a subset of
187
+ # usages to return. The supported parameter is name.value (name of the metric,
188
+ # can have an or of multiple names).
189
+ # @param [Hash{String => String}] A hash of custom headers that will be added
190
+ # to the HTTP request.
191
+ #
192
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
193
+ #
194
+ def list_usages_async(resource_group_name, account_name, database_rid, filter:nil, custom_headers:nil)
195
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
196
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
197
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
198
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
199
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
200
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
201
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
202
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
203
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
204
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
205
+
206
+
207
+ request_headers = {}
208
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
209
+
210
+ # Set Headers
211
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
212
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
213
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/usages'
214
+
215
+ request_url = @base_url || @client.base_url
216
+
217
+ options = {
218
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
219
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseRid' => database_rid},
220
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
221
+ headers: request_headers.merge(custom_headers || {}),
222
+ base_url: request_url
223
+ }
224
+ promise = @client.make_request_async(:get, path_template, options)
225
+
226
+ promise = promise.then do |result|
227
+ http_response = result.response
228
+ status_code = http_response.status
229
+ response_content = http_response.body
230
+ unless status_code == 200
231
+ error_model = JSON.load(response_content)
232
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
233
+ end
234
+
235
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
236
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
237
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
238
+ # Deserialize Response
239
+ if status_code == 200
240
+ begin
241
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
242
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::UsagesResult.mapper()
243
+ result.body = @client.deserialize(result_mapper, parsed_response)
244
+ rescue Exception => e
245
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
246
+ end
247
+ end
248
+
249
+ result
250
+ end
251
+
252
+ promise.execute
253
+ end
254
+
255
+ #
256
+ # Retrieves metric definitions for the given database.
257
+ #
258
+ # @param resource_group_name [String] Name of an Azure resource group.
259
+ # @param account_name [String] Cosmos DB database account name.
260
+ # @param database_rid [String] Cosmos DB database rid.
261
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
262
+ # will be added to the HTTP request.
263
+ #
264
+ # @return [MetricDefinitionsListResult] operation results.
265
+ #
266
+ def list_metric_definitions(resource_group_name, account_name, database_rid, custom_headers:nil)
267
+ response = list_metric_definitions_async(resource_group_name, account_name, database_rid, custom_headers:custom_headers).value!
268
+ response.body unless response.nil?
269
+ end
270
+
271
+ #
272
+ # Retrieves metric definitions for the given database.
273
+ #
274
+ # @param resource_group_name [String] Name of an Azure resource group.
275
+ # @param account_name [String] Cosmos DB database account name.
276
+ # @param database_rid [String] Cosmos DB database rid.
277
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
278
+ # will be added to the HTTP request.
279
+ #
280
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
281
+ #
282
+ def list_metric_definitions_with_http_info(resource_group_name, account_name, database_rid, custom_headers:nil)
283
+ list_metric_definitions_async(resource_group_name, account_name, database_rid, custom_headers:custom_headers).value!
284
+ end
285
+
286
+ #
287
+ # Retrieves metric definitions for the given database.
288
+ #
289
+ # @param resource_group_name [String] Name of an Azure resource group.
290
+ # @param account_name [String] Cosmos DB database account name.
291
+ # @param database_rid [String] Cosmos DB database rid.
292
+ # @param [Hash{String => String}] A hash of custom headers that will be added
293
+ # to the HTTP request.
294
+ #
295
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
296
+ #
297
+ def list_metric_definitions_async(resource_group_name, account_name, database_rid, custom_headers:nil)
298
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
299
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
300
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
301
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
302
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
303
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
304
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
305
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
306
+ fail ArgumentError, 'database_rid is nil' if database_rid.nil?
307
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
308
+
309
+
310
+ request_headers = {}
311
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
312
+
313
+ # Set Headers
314
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
315
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
316
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/databases/{databaseRid}/metricDefinitions'
317
+
318
+ request_url = @base_url || @client.base_url
319
+
320
+ options = {
321
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
322
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseRid' => database_rid},
323
+ query_params: {'api-version' => @client.api_version},
324
+ headers: request_headers.merge(custom_headers || {}),
325
+ base_url: request_url
326
+ }
327
+ promise = @client.make_request_async(:get, path_template, options)
328
+
329
+ promise = promise.then do |result|
330
+ http_response = result.response
331
+ status_code = http_response.status
332
+ response_content = http_response.body
333
+ unless status_code == 200
334
+ error_model = JSON.load(response_content)
335
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
336
+ end
337
+
338
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
339
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
340
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
341
+ # Deserialize Response
342
+ if status_code == 200
343
+ begin
344
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
345
+ result_mapper = Azure::Cosmosdb::Mgmt::V2015_04_08::Models::MetricDefinitionsListResult.mapper()
346
+ result.body = @client.deserialize(result_mapper, parsed_response)
347
+ rescue Exception => e
348
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
349
+ end
350
+ end
351
+
352
+ result
353
+ end
354
+
355
+ promise.execute
356
+ end
357
+
358
+ end
359
+ end