azure_mgmt_cosmosdb 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +20 -20
  3. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb.rb +0 -0
  4. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection.rb +0 -0
  5. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition.rb +0 -0
  6. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +0 -0
  7. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_region.rb +0 -0
  8. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/cosmos_db.rb +1 -1
  9. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database.rb +0 -0
  10. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_account_region.rb +0 -0
  11. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_accounts.rb +0 -0
  12. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/capability.rb +0 -0
  13. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace.rb +0 -0
  14. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +0 -0
  15. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +0 -0
  16. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +0 -0
  17. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +0 -0
  18. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +0 -0
  19. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table.rb +0 -0
  20. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +0 -0
  21. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +0 -0
  22. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +0 -0
  23. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +0 -0
  24. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/column.rb +0 -0
  25. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +0 -0
  26. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +0 -0
  27. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +0 -0
  28. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +0 -0
  29. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +0 -0
  30. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/data_type.rb +0 -0
  31. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account.rb +0 -0
  32. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +0 -0
  33. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +0 -0
  34. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +0 -0
  35. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +0 -0
  36. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +0 -0
  37. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +0 -0
  38. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +0 -0
  39. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_patch_parameters.rb +0 -0
  40. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +0 -0
  41. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +0 -0
  42. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +0 -0
  43. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/error_response.rb +0 -0
  44. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +0 -0
  45. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +0 -0
  46. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +0 -0
  47. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +0 -0
  48. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database.rb +0 -0
  49. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +0 -0
  50. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +0 -0
  51. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +0 -0
  52. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph.rb +0 -0
  53. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +0 -0
  54. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +0 -0
  55. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +0 -0
  56. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/included_path.rb +0 -0
  57. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/index_kind.rb +0 -0
  58. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexes.rb +0 -0
  59. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +0 -0
  60. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +0 -0
  61. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/key_kind.rb +0 -0
  62. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/location.rb +0 -0
  63. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric.rb +0 -0
  64. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +0 -0
  65. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +0 -0
  66. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +0 -0
  67. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +0 -0
  68. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_name.rb +0 -0
  69. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_value.rb +0 -0
  70. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection.rb +0 -0
  71. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +0 -0
  72. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +0 -0
  73. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +0 -0
  74. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase.rb +0 -0
  75. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +0 -0
  76. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +0 -0
  77. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +0 -0
  78. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +0 -0
  79. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +0 -0
  80. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +0 -0
  81. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation.rb +0 -0
  82. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_display.rb +0 -0
  83. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +0 -0
  84. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +0 -0
  85. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +0 -0
  86. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +0 -0
  87. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +0 -0
  88. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +0 -0
  89. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +0 -0
  90. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +0 -0
  91. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +0 -0
  92. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +0 -0
  93. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +0 -0
  94. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/resource.rb +0 -0
  95. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container.rb +0 -0
  96. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +0 -0
  97. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +0 -0
  98. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +0 -0
  99. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database.rb +0 -0
  100. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +0 -0
  101. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +0 -0
  102. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +0 -0
  103. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table.rb +0 -0
  104. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +0 -0
  105. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +0 -0
  106. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_resource.rb +0 -0
  107. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput.rb +0 -0
  108. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_resource.rb +0 -0
  109. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_update_parameters.rb +0 -0
  110. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key.rb +0 -0
  111. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +0 -0
  112. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unit_type.rb +0 -0
  113. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usage.rb +0 -0
  114. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usages_result.rb +0 -0
  115. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +0 -0
  116. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/module_definition.rb +0 -0
  117. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/operations.rb +0 -0
  118. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +0 -0
  119. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +0 -0
  120. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile.rb +0 -0
  121. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +0 -0
  122. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_target.rb +0 -0
  123. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb.rb +41 -0
  124. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/cosmos_db.rb +142 -0
  125. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  126. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/azure_entity_resource.rb +75 -0
  127. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  128. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection.rb +88 -0
  129. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection_list_result.rb +56 -0
  130. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_property.rb +46 -0
  131. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource.rb +95 -0
  132. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource_list_result.rb +55 -0
  133. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_service_connection_state_property.rb +71 -0
  134. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/proxy_resource.rb +63 -0
  135. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/resource.rb +83 -0
  136. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/tracked_resource.rb +92 -0
  137. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  138. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_endpoint_connections.rb +560 -0
  139. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_link_resources.rb +235 -0
  140. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb.rb +164 -0
  141. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cassandra_resources.rb +1628 -0
  142. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection.rb +374 -0
  143. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition.rb +269 -0
  144. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +156 -0
  145. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_region.rb +156 -0
  146. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cosmos_db.rb +200 -0
  147. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database.rb +362 -0
  148. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_account_region.rb +148 -0
  149. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb +2184 -0
  150. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/gremlin_resources.rb +1623 -0
  151. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  152. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armresource_properties.rb +102 -0
  153. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/capability.rb +48 -0
  154. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +120 -0
  155. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_get_results.rb +135 -0
  156. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +58 -0
  157. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +46 -0
  158. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +46 -0
  159. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +95 -0
  160. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +120 -0
  161. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_get_results.rb +158 -0
  162. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +58 -0
  163. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +69 -0
  164. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +58 -0
  165. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/column.rb +57 -0
  166. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +16 -0
  167. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +73 -0
  168. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +15 -0
  169. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +86 -0
  170. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +85 -0
  171. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/data_type.rb +20 -0
  172. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +59 -0
  173. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +279 -0
  174. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_get_results.rb +371 -0
  175. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +17 -0
  176. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +57 -0
  177. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +77 -0
  178. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +59 -0
  179. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +15 -0
  180. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +47 -0
  181. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_update_parameters.rb +230 -0
  182. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +58 -0
  183. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +19 -0
  184. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  185. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +48 -0
  186. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +74 -0
  187. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +55 -0
  188. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +79 -0
  189. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +120 -0
  190. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_get_results.rb +135 -0
  191. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +58 -0
  192. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +46 -0
  193. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +120 -0
  194. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_get_results.rb +200 -0
  195. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +58 -0
  196. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +111 -0
  197. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/included_path.rb +67 -0
  198. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/index_kind.rb +17 -0
  199. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexes.rb +73 -0
  200. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +17 -0
  201. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +99 -0
  202. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/key_kind.rb +18 -0
  203. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/location.rb +114 -0
  204. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric.rb +120 -0
  205. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +60 -0
  206. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +109 -0
  207. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +57 -0
  208. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +56 -0
  209. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_name.rb +59 -0
  210. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_value.rb +107 -0
  211. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +120 -0
  212. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_get_results.rb +175 -0
  213. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +58 -0
  214. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +86 -0
  215. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +120 -0
  216. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_get_results.rb +135 -0
  217. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +58 -0
  218. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +46 -0
  219. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +60 -0
  220. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +55 -0
  221. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +57 -0
  222. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation.rb +58 -0
  223. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_display.rb +80 -0
  224. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +101 -0
  225. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +16 -0
  226. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +124 -0
  227. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +57 -0
  228. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +105 -0
  229. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +57 -0
  230. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +120 -0
  231. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +57 -0
  232. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +173 -0
  233. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +20 -0
  234. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +47 -0
  235. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +119 -0
  236. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_get_results.rb +200 -0
  237. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +58 -0
  238. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +111 -0
  239. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +120 -0
  240. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_get_results.rb +159 -0
  241. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +58 -0
  242. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +46 -0
  243. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_create_update_parameters.rb +120 -0
  244. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_get_results.rb +146 -0
  245. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_list_result.rb +58 -0
  246. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_resource.rb +57 -0
  247. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_create_update_parameters.rb +119 -0
  248. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_get_results.rb +171 -0
  249. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_list_result.rb +58 -0
  250. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_resource.rb +82 -0
  251. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_create_update_parameters.rb +121 -0
  252. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_get_results.rb +146 -0
  253. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_list_result.rb +58 -0
  254. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_resource.rb +57 -0
  255. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +119 -0
  256. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_get_results.rb +135 -0
  257. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +57 -0
  258. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_resource.rb +46 -0
  259. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_get_results.rb +121 -0
  260. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_resource.rb +70 -0
  261. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_update_parameters.rb +99 -0
  262. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_operation.rb +19 -0
  263. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_type.rb +16 -0
  264. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key.rb +56 -0
  265. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +58 -0
  266. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unit_type.rb +21 -0
  267. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usage.rb +97 -0
  268. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usages_result.rb +57 -0
  269. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +59 -0
  270. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  271. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/mongo_dbresources.rb +1634 -0
  272. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/operations.rb +219 -0
  273. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +156 -0
  274. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +163 -0
  275. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile.rb +141 -0
  276. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +158 -0
  277. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_target.rb +148 -0
  278. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/sql_resources.rb +3289 -0
  279. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/table_resources.rb +804 -0
  280. data/lib/azure_mgmt_cosmosdb.rb +8 -6
  281. data/lib/module_definition.rb +7 -7
  282. data/lib/profiles/latest/cosmosdb_latest_profile_client.rb +40 -40
  283. data/lib/profiles/latest/cosmosdb_module_definition.rb +8 -8
  284. data/lib/profiles/latest/modules/cosmosdb_profile_module.rb +571 -501
  285. data/lib/version.rb +1 -1
  286. metadata +160 -3
@@ -0,0 +1,2184 @@
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::V2019_08_01
7
+ #
8
+ # Azure Cosmos DB Database Service Resource Provider REST API
9
+ #
10
+ class DatabaseAccounts
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the DatabaseAccounts 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 properties of an existing Azure Cosmos DB database account.
26
+ #
27
+ # @param resource_group_name [String] Name of an Azure resource group.
28
+ # @param account_name [String] Cosmos DB database account name.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [DatabaseAccountGetResults] operation results.
33
+ #
34
+ def get(resource_group_name, account_name, custom_headers:nil)
35
+ response = get_async(resource_group_name, account_name, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Retrieves the properties of an existing Azure Cosmos DB database account.
41
+ #
42
+ # @param resource_group_name [String] Name of an Azure resource group.
43
+ # @param account_name [String] Cosmos DB database account name.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def get_with_http_info(resource_group_name, account_name, custom_headers:nil)
50
+ get_async(resource_group_name, account_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Retrieves the properties of an existing Azure Cosmos DB database account.
55
+ #
56
+ # @param resource_group_name [String] Name of an Azure resource group.
57
+ # @param account_name [String] Cosmos DB database account name.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def get_async(resource_group_name, account_name, custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
66
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
67
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
68
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
69
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
70
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
71
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
72
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
106
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Updates the properties of an existing Azure Cosmos DB database account.
126
+ #
127
+ # @param resource_group_name [String] Name of an Azure resource group.
128
+ # @param account_name [String] Cosmos DB database account name.
129
+ # @param update_parameters [DatabaseAccountUpdateParameters] The parameters to
130
+ # provide for the current database account.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [DatabaseAccountGetResults] operation results.
135
+ #
136
+ def update(resource_group_name, account_name, update_parameters, custom_headers:nil)
137
+ response = update_async(resource_group_name, account_name, update_parameters, custom_headers:custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # @param resource_group_name [String] Name of an Azure resource group.
143
+ # @param account_name [String] Cosmos DB database account name.
144
+ # @param update_parameters [DatabaseAccountUpdateParameters] The parameters to
145
+ # provide for the current database account.
146
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
147
+ # will be added to the HTTP request.
148
+ #
149
+ # @return [Concurrent::Promise] promise which provides async access to http
150
+ # response.
151
+ #
152
+ def update_async(resource_group_name, account_name, update_parameters, custom_headers:nil)
153
+ # Send request
154
+ promise = begin_update_async(resource_group_name, account_name, update_parameters, custom_headers:custom_headers)
155
+
156
+ promise = promise.then do |response|
157
+ # Defining deserialization method.
158
+ deserialize_method = lambda do |parsed_response|
159
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
160
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
161
+ end
162
+
163
+ # Waiting for response.
164
+ @client.get_long_running_operation_result(response, deserialize_method)
165
+ end
166
+
167
+ promise
168
+ end
169
+
170
+ #
171
+ # Creates or updates an Azure Cosmos DB database account. The "Update" method
172
+ # is preferred when performing updates on an account.
173
+ #
174
+ # @param resource_group_name [String] Name of an Azure resource group.
175
+ # @param account_name [String] Cosmos DB database account name.
176
+ # @param create_update_parameters [DatabaseAccountCreateUpdateParameters] The
177
+ # parameters to provide for the current database account.
178
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
179
+ # will be added to the HTTP request.
180
+ #
181
+ # @return [DatabaseAccountGetResults] operation results.
182
+ #
183
+ def create_or_update(resource_group_name, account_name, create_update_parameters, custom_headers:nil)
184
+ response = create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:custom_headers).value!
185
+ response.body unless response.nil?
186
+ end
187
+
188
+ #
189
+ # @param resource_group_name [String] Name of an Azure resource group.
190
+ # @param account_name [String] Cosmos DB database account name.
191
+ # @param create_update_parameters [DatabaseAccountCreateUpdateParameters] The
192
+ # parameters to provide for the current database account.
193
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
194
+ # will be added to the HTTP request.
195
+ #
196
+ # @return [Concurrent::Promise] promise which provides async access to http
197
+ # response.
198
+ #
199
+ def create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:nil)
200
+ # Send request
201
+ promise = begin_create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:custom_headers)
202
+
203
+ promise = promise.then do |response|
204
+ # Defining deserialization method.
205
+ deserialize_method = lambda do |parsed_response|
206
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
207
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
208
+ end
209
+
210
+ # Waiting for response.
211
+ @client.get_long_running_operation_result(response, deserialize_method)
212
+ end
213
+
214
+ promise
215
+ end
216
+
217
+ #
218
+ # Deletes an existing Azure Cosmos DB database account.
219
+ #
220
+ # @param resource_group_name [String] Name of an Azure resource group.
221
+ # @param account_name [String] Cosmos DB database account name.
222
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
223
+ # will be added to the HTTP request.
224
+ #
225
+ def delete(resource_group_name, account_name, custom_headers:nil)
226
+ response = delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
227
+ nil
228
+ end
229
+
230
+ #
231
+ # @param resource_group_name [String] Name of an Azure resource group.
232
+ # @param account_name [String] Cosmos DB database account name.
233
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
234
+ # will be added to the HTTP request.
235
+ #
236
+ # @return [Concurrent::Promise] promise which provides async access to http
237
+ # response.
238
+ #
239
+ def delete_async(resource_group_name, account_name, custom_headers:nil)
240
+ # Send request
241
+ promise = begin_delete_async(resource_group_name, account_name, custom_headers:custom_headers)
242
+
243
+ promise = promise.then do |response|
244
+ # Defining deserialization method.
245
+ deserialize_method = lambda do |parsed_response|
246
+ end
247
+
248
+ # Waiting for response.
249
+ @client.get_long_running_operation_result(response, deserialize_method)
250
+ end
251
+
252
+ promise
253
+ end
254
+
255
+ #
256
+ # Changes the failover priority for the Azure Cosmos DB database account. A
257
+ # failover priority of 0 indicates a write region. The maximum value for a
258
+ # failover priority = (total number of regions - 1). Failover priority values
259
+ # must be unique for each of the regions in which the database account exists.
260
+ #
261
+ # @param resource_group_name [String] Name of an Azure resource group.
262
+ # @param account_name [String] Cosmos DB database account name.
263
+ # @param failover_parameters [FailoverPolicies] The new failover policies for
264
+ # the database account.
265
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
266
+ # will be added to the HTTP request.
267
+ #
268
+ def failover_priority_change(resource_group_name, account_name, failover_parameters, custom_headers:nil)
269
+ response = failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:custom_headers).value!
270
+ nil
271
+ end
272
+
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 failover_parameters [FailoverPolicies] The new failover policies for
277
+ # the database account.
278
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
279
+ # will be added to the HTTP request.
280
+ #
281
+ # @return [Concurrent::Promise] promise which provides async access to http
282
+ # response.
283
+ #
284
+ def failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:nil)
285
+ # Send request
286
+ promise = begin_failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:custom_headers)
287
+
288
+ promise = promise.then do |response|
289
+ # Defining deserialization method.
290
+ deserialize_method = lambda do |parsed_response|
291
+ end
292
+
293
+ # Waiting for response.
294
+ @client.get_long_running_operation_result(response, deserialize_method)
295
+ end
296
+
297
+ promise
298
+ end
299
+
300
+ #
301
+ # Lists all the Azure Cosmos DB database accounts available under the
302
+ # subscription.
303
+ #
304
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
305
+ # will be added to the HTTP request.
306
+ #
307
+ # @return [DatabaseAccountsListResult] operation results.
308
+ #
309
+ def list(custom_headers:nil)
310
+ response = list_async(custom_headers:custom_headers).value!
311
+ response.body unless response.nil?
312
+ end
313
+
314
+ #
315
+ # Lists all the Azure Cosmos DB database accounts available under the
316
+ # subscription.
317
+ #
318
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
319
+ # will be added to the HTTP request.
320
+ #
321
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
322
+ #
323
+ def list_with_http_info(custom_headers:nil)
324
+ list_async(custom_headers:custom_headers).value!
325
+ end
326
+
327
+ #
328
+ # Lists all the Azure Cosmos DB database accounts available under the
329
+ # subscription.
330
+ #
331
+ # @param [Hash{String => String}] A hash of custom headers that will be added
332
+ # to the HTTP request.
333
+ #
334
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
335
+ #
336
+ def list_async(custom_headers:nil)
337
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
338
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
339
+
340
+
341
+ request_headers = {}
342
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
343
+
344
+ # Set Headers
345
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
346
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
347
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/databaseAccounts'
348
+
349
+ request_url = @base_url || @client.base_url
350
+
351
+ options = {
352
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
353
+ path_params: {'subscriptionId' => @client.subscription_id},
354
+ query_params: {'api-version' => @client.api_version},
355
+ headers: request_headers.merge(custom_headers || {}),
356
+ base_url: request_url
357
+ }
358
+ promise = @client.make_request_async(:get, path_template, options)
359
+
360
+ promise = promise.then do |result|
361
+ http_response = result.response
362
+ status_code = http_response.status
363
+ response_content = http_response.body
364
+ unless status_code == 200
365
+ error_model = JSON.load(response_content)
366
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
367
+ end
368
+
369
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
370
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
371
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
372
+ # Deserialize Response
373
+ if status_code == 200
374
+ begin
375
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
376
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountsListResult.mapper()
377
+ result.body = @client.deserialize(result_mapper, parsed_response)
378
+ rescue Exception => e
379
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
380
+ end
381
+ end
382
+
383
+ result
384
+ end
385
+
386
+ promise.execute
387
+ end
388
+
389
+ #
390
+ # Lists all the Azure Cosmos DB database accounts available under the given
391
+ # resource group.
392
+ #
393
+ # @param resource_group_name [String] Name of an Azure resource group.
394
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
395
+ # will be added to the HTTP request.
396
+ #
397
+ # @return [DatabaseAccountsListResult] operation results.
398
+ #
399
+ def list_by_resource_group(resource_group_name, custom_headers:nil)
400
+ response = list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
401
+ response.body unless response.nil?
402
+ end
403
+
404
+ #
405
+ # Lists all the Azure Cosmos DB database accounts available under the given
406
+ # resource group.
407
+ #
408
+ # @param resource_group_name [String] Name of an Azure resource group.
409
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
410
+ # will be added to the HTTP request.
411
+ #
412
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
413
+ #
414
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers:nil)
415
+ list_by_resource_group_async(resource_group_name, custom_headers:custom_headers).value!
416
+ end
417
+
418
+ #
419
+ # Lists all the Azure Cosmos DB database accounts available under the given
420
+ # resource group.
421
+ #
422
+ # @param resource_group_name [String] Name of an Azure resource group.
423
+ # @param [Hash{String => String}] A hash of custom headers that will be added
424
+ # to the HTTP request.
425
+ #
426
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
427
+ #
428
+ def list_by_resource_group_async(resource_group_name, custom_headers:nil)
429
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
430
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
431
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
432
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
433
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
434
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
435
+
436
+
437
+ request_headers = {}
438
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
439
+
440
+ # Set Headers
441
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
442
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
443
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts'
444
+
445
+ request_url = @base_url || @client.base_url
446
+
447
+ options = {
448
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
449
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
450
+ query_params: {'api-version' => @client.api_version},
451
+ headers: request_headers.merge(custom_headers || {}),
452
+ base_url: request_url
453
+ }
454
+ promise = @client.make_request_async(:get, path_template, options)
455
+
456
+ promise = promise.then do |result|
457
+ http_response = result.response
458
+ status_code = http_response.status
459
+ response_content = http_response.body
460
+ unless status_code == 200
461
+ error_model = JSON.load(response_content)
462
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
463
+ end
464
+
465
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
466
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
467
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
468
+ # Deserialize Response
469
+ if status_code == 200
470
+ begin
471
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
472
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountsListResult.mapper()
473
+ result.body = @client.deserialize(result_mapper, parsed_response)
474
+ rescue Exception => e
475
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
476
+ end
477
+ end
478
+
479
+ result
480
+ end
481
+
482
+ promise.execute
483
+ end
484
+
485
+ #
486
+ # Lists the access keys for the specified Azure Cosmos DB database account.
487
+ #
488
+ # @param resource_group_name [String] Name of an Azure resource group.
489
+ # @param account_name [String] Cosmos DB database account name.
490
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
491
+ # will be added to the HTTP request.
492
+ #
493
+ # @return [DatabaseAccountListKeysResult] operation results.
494
+ #
495
+ def list_keys(resource_group_name, account_name, custom_headers:nil)
496
+ response = list_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
497
+ response.body unless response.nil?
498
+ end
499
+
500
+ #
501
+ # Lists the access keys for the specified Azure Cosmos DB database account.
502
+ #
503
+ # @param resource_group_name [String] Name of an Azure resource group.
504
+ # @param account_name [String] Cosmos DB database account name.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
509
+ #
510
+ def list_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
511
+ list_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
512
+ end
513
+
514
+ #
515
+ # Lists the access keys for the specified Azure Cosmos DB database account.
516
+ #
517
+ # @param resource_group_name [String] Name of an Azure resource group.
518
+ # @param account_name [String] Cosmos DB database account name.
519
+ # @param [Hash{String => String}] A hash of custom headers that will be added
520
+ # to the HTTP request.
521
+ #
522
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
523
+ #
524
+ def list_keys_async(resource_group_name, account_name, custom_headers:nil)
525
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
526
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
527
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
528
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
529
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
530
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
531
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
532
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
533
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
534
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
535
+
536
+
537
+ request_headers = {}
538
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
539
+
540
+ # Set Headers
541
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
542
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
543
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listKeys'
544
+
545
+ request_url = @base_url || @client.base_url
546
+
547
+ options = {
548
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
549
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
550
+ query_params: {'api-version' => @client.api_version},
551
+ headers: request_headers.merge(custom_headers || {}),
552
+ base_url: request_url
553
+ }
554
+ promise = @client.make_request_async(:post, path_template, options)
555
+
556
+ promise = promise.then do |result|
557
+ http_response = result.response
558
+ status_code = http_response.status
559
+ response_content = http_response.body
560
+ unless status_code == 200
561
+ error_model = JSON.load(response_content)
562
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
563
+ end
564
+
565
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
566
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
567
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
568
+ # Deserialize Response
569
+ if status_code == 200
570
+ begin
571
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
572
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListKeysResult.mapper()
573
+ result.body = @client.deserialize(result_mapper, parsed_response)
574
+ rescue Exception => e
575
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
576
+ end
577
+ end
578
+
579
+ result
580
+ end
581
+
582
+ promise.execute
583
+ end
584
+
585
+ #
586
+ # Lists the connection strings for the specified Azure Cosmos DB database
587
+ # account.
588
+ #
589
+ # @param resource_group_name [String] Name of an Azure resource group.
590
+ # @param account_name [String] Cosmos DB database account name.
591
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
592
+ # will be added to the HTTP request.
593
+ #
594
+ # @return [DatabaseAccountListConnectionStringsResult] operation results.
595
+ #
596
+ def list_connection_strings(resource_group_name, account_name, custom_headers:nil)
597
+ response = list_connection_strings_async(resource_group_name, account_name, custom_headers:custom_headers).value!
598
+ response.body unless response.nil?
599
+ end
600
+
601
+ #
602
+ # Lists the connection strings for the specified Azure Cosmos DB database
603
+ # account.
604
+ #
605
+ # @param resource_group_name [String] Name of an Azure resource group.
606
+ # @param account_name [String] Cosmos DB database account name.
607
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
608
+ # will be added to the HTTP request.
609
+ #
610
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
611
+ #
612
+ def list_connection_strings_with_http_info(resource_group_name, account_name, custom_headers:nil)
613
+ list_connection_strings_async(resource_group_name, account_name, custom_headers:custom_headers).value!
614
+ end
615
+
616
+ #
617
+ # Lists the connection strings for the specified Azure Cosmos DB database
618
+ # account.
619
+ #
620
+ # @param resource_group_name [String] Name of an Azure resource group.
621
+ # @param account_name [String] Cosmos DB database account name.
622
+ # @param [Hash{String => String}] A hash of custom headers that will be added
623
+ # to the HTTP request.
624
+ #
625
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
626
+ #
627
+ def list_connection_strings_async(resource_group_name, account_name, custom_headers:nil)
628
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
629
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
630
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
631
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
632
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
633
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
634
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
635
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
636
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
637
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
638
+
639
+
640
+ request_headers = {}
641
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
642
+
643
+ # Set Headers
644
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
645
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
646
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings'
647
+
648
+ request_url = @base_url || @client.base_url
649
+
650
+ options = {
651
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
652
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
653
+ query_params: {'api-version' => @client.api_version},
654
+ headers: request_headers.merge(custom_headers || {}),
655
+ base_url: request_url
656
+ }
657
+ promise = @client.make_request_async(:post, path_template, options)
658
+
659
+ promise = promise.then do |result|
660
+ http_response = result.response
661
+ status_code = http_response.status
662
+ response_content = http_response.body
663
+ unless status_code == 200
664
+ error_model = JSON.load(response_content)
665
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
666
+ end
667
+
668
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
669
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
670
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
671
+ # Deserialize Response
672
+ if status_code == 200
673
+ begin
674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
675
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListConnectionStringsResult.mapper()
676
+ result.body = @client.deserialize(result_mapper, parsed_response)
677
+ rescue Exception => e
678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
679
+ end
680
+ end
681
+
682
+ result
683
+ end
684
+
685
+ promise.execute
686
+ end
687
+
688
+ #
689
+ # Offline the specified region for the specified Azure Cosmos DB database
690
+ # account.
691
+ #
692
+ # @param resource_group_name [String] Name of an Azure resource group.
693
+ # @param account_name [String] Cosmos DB database account name.
694
+ # @param region_parameter_for_offline [RegionForOnlineOffline] Cosmos DB region
695
+ # to offline for the database account.
696
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
697
+ # will be added to the HTTP request.
698
+ #
699
+ def offline_region(resource_group_name, account_name, region_parameter_for_offline, custom_headers:nil)
700
+ response = offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:custom_headers).value!
701
+ nil
702
+ end
703
+
704
+ #
705
+ # @param resource_group_name [String] Name of an Azure resource group.
706
+ # @param account_name [String] Cosmos DB database account name.
707
+ # @param region_parameter_for_offline [RegionForOnlineOffline] Cosmos DB region
708
+ # to offline for the database account.
709
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
710
+ # will be added to the HTTP request.
711
+ #
712
+ # @return [Concurrent::Promise] promise which provides async access to http
713
+ # response.
714
+ #
715
+ def offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:nil)
716
+ # Send request
717
+ promise = begin_offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:custom_headers)
718
+
719
+ promise = promise.then do |response|
720
+ # Defining deserialization method.
721
+ deserialize_method = lambda do |parsed_response|
722
+ end
723
+
724
+ # Waiting for response.
725
+ @client.get_long_running_operation_result(response, deserialize_method)
726
+ end
727
+
728
+ promise
729
+ end
730
+
731
+ #
732
+ # Online the specified region for the specified Azure Cosmos DB database
733
+ # account.
734
+ #
735
+ # @param resource_group_name [String] Name of an Azure resource group.
736
+ # @param account_name [String] Cosmos DB database account name.
737
+ # @param region_parameter_for_online [RegionForOnlineOffline] Cosmos DB region
738
+ # to online for the database account.
739
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
740
+ # will be added to the HTTP request.
741
+ #
742
+ def online_region(resource_group_name, account_name, region_parameter_for_online, custom_headers:nil)
743
+ response = online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:custom_headers).value!
744
+ nil
745
+ end
746
+
747
+ #
748
+ # @param resource_group_name [String] Name of an Azure resource group.
749
+ # @param account_name [String] Cosmos DB database account name.
750
+ # @param region_parameter_for_online [RegionForOnlineOffline] Cosmos DB region
751
+ # to online for the database account.
752
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
753
+ # will be added to the HTTP request.
754
+ #
755
+ # @return [Concurrent::Promise] promise which provides async access to http
756
+ # response.
757
+ #
758
+ def online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:nil)
759
+ # Send request
760
+ promise = begin_online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:custom_headers)
761
+
762
+ promise = promise.then do |response|
763
+ # Defining deserialization method.
764
+ deserialize_method = lambda do |parsed_response|
765
+ end
766
+
767
+ # Waiting for response.
768
+ @client.get_long_running_operation_result(response, deserialize_method)
769
+ end
770
+
771
+ promise
772
+ end
773
+
774
+ #
775
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
776
+ # account.
777
+ #
778
+ # @param resource_group_name [String] Name of an Azure resource group.
779
+ # @param account_name [String] Cosmos DB database account name.
780
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
781
+ # will be added to the HTTP request.
782
+ #
783
+ # @return [DatabaseAccountListReadOnlyKeysResult] operation results.
784
+ #
785
+ def get_read_only_keys(resource_group_name, account_name, custom_headers:nil)
786
+ response = get_read_only_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
787
+ response.body unless response.nil?
788
+ end
789
+
790
+ #
791
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
792
+ # account.
793
+ #
794
+ # @param resource_group_name [String] Name of an Azure resource group.
795
+ # @param account_name [String] Cosmos DB database account name.
796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
797
+ # will be added to the HTTP request.
798
+ #
799
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
800
+ #
801
+ def get_read_only_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
802
+ get_read_only_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
803
+ end
804
+
805
+ #
806
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
807
+ # account.
808
+ #
809
+ # @param resource_group_name [String] Name of an Azure resource group.
810
+ # @param account_name [String] Cosmos DB database account name.
811
+ # @param [Hash{String => String}] A hash of custom headers that will be added
812
+ # to the HTTP request.
813
+ #
814
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
815
+ #
816
+ def get_read_only_keys_async(resource_group_name, account_name, custom_headers:nil)
817
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
818
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
819
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
820
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
821
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
822
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
823
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
824
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
825
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
826
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
827
+
828
+
829
+ request_headers = {}
830
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
831
+
832
+ # Set Headers
833
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
834
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
835
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'
836
+
837
+ request_url = @base_url || @client.base_url
838
+
839
+ options = {
840
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
841
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
842
+ query_params: {'api-version' => @client.api_version},
843
+ headers: request_headers.merge(custom_headers || {}),
844
+ base_url: request_url
845
+ }
846
+ promise = @client.make_request_async(:get, path_template, options)
847
+
848
+ promise = promise.then do |result|
849
+ http_response = result.response
850
+ status_code = http_response.status
851
+ response_content = http_response.body
852
+ unless status_code == 200
853
+ error_model = JSON.load(response_content)
854
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
855
+ end
856
+
857
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
858
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
859
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
860
+ # Deserialize Response
861
+ if status_code == 200
862
+ begin
863
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
864
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListReadOnlyKeysResult.mapper()
865
+ result.body = @client.deserialize(result_mapper, parsed_response)
866
+ rescue Exception => e
867
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
868
+ end
869
+ end
870
+
871
+ result
872
+ end
873
+
874
+ promise.execute
875
+ end
876
+
877
+ #
878
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
879
+ # account.
880
+ #
881
+ # @param resource_group_name [String] Name of an Azure resource group.
882
+ # @param account_name [String] Cosmos DB database account name.
883
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
884
+ # will be added to the HTTP request.
885
+ #
886
+ # @return [DatabaseAccountListReadOnlyKeysResult] operation results.
887
+ #
888
+ def list_read_only_keys(resource_group_name, account_name, custom_headers:nil)
889
+ response = list_read_only_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
890
+ response.body unless response.nil?
891
+ end
892
+
893
+ #
894
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
895
+ # account.
896
+ #
897
+ # @param resource_group_name [String] Name of an Azure resource group.
898
+ # @param account_name [String] Cosmos DB database account name.
899
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
900
+ # will be added to the HTTP request.
901
+ #
902
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
903
+ #
904
+ def list_read_only_keys_with_http_info(resource_group_name, account_name, custom_headers:nil)
905
+ list_read_only_keys_async(resource_group_name, account_name, custom_headers:custom_headers).value!
906
+ end
907
+
908
+ #
909
+ # Lists the read-only access keys for the specified Azure Cosmos DB database
910
+ # account.
911
+ #
912
+ # @param resource_group_name [String] Name of an Azure resource group.
913
+ # @param account_name [String] Cosmos DB database account name.
914
+ # @param [Hash{String => String}] A hash of custom headers that will be added
915
+ # to the HTTP request.
916
+ #
917
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
918
+ #
919
+ def list_read_only_keys_async(resource_group_name, account_name, custom_headers:nil)
920
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
921
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
922
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
923
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
924
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
925
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
926
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
927
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
928
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
929
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
930
+
931
+
932
+ request_headers = {}
933
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
934
+
935
+ # Set Headers
936
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
937
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
938
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/readonlykeys'
939
+
940
+ request_url = @base_url || @client.base_url
941
+
942
+ options = {
943
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
944
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
945
+ query_params: {'api-version' => @client.api_version},
946
+ headers: request_headers.merge(custom_headers || {}),
947
+ base_url: request_url
948
+ }
949
+ promise = @client.make_request_async(:post, path_template, options)
950
+
951
+ promise = promise.then do |result|
952
+ http_response = result.response
953
+ status_code = http_response.status
954
+ response_content = http_response.body
955
+ unless status_code == 200
956
+ error_model = JSON.load(response_content)
957
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
958
+ end
959
+
960
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
961
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
962
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
963
+ # Deserialize Response
964
+ if status_code == 200
965
+ begin
966
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
967
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountListReadOnlyKeysResult.mapper()
968
+ result.body = @client.deserialize(result_mapper, parsed_response)
969
+ rescue Exception => e
970
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
971
+ end
972
+ end
973
+
974
+ result
975
+ end
976
+
977
+ promise.execute
978
+ end
979
+
980
+ #
981
+ # Regenerates an access key for the specified Azure Cosmos DB database account.
982
+ #
983
+ # @param resource_group_name [String] Name of an Azure resource group.
984
+ # @param account_name [String] Cosmos DB database account name.
985
+ # @param key_to_regenerate [DatabaseAccountRegenerateKeyParameters] The name of
986
+ # the key to regenerate.
987
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
988
+ # will be added to the HTTP request.
989
+ #
990
+ def regenerate_key(resource_group_name, account_name, key_to_regenerate, custom_headers:nil)
991
+ response = regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:custom_headers).value!
992
+ nil
993
+ end
994
+
995
+ #
996
+ # @param resource_group_name [String] Name of an Azure resource group.
997
+ # @param account_name [String] Cosmos DB database account name.
998
+ # @param key_to_regenerate [DatabaseAccountRegenerateKeyParameters] The name of
999
+ # the key to regenerate.
1000
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1001
+ # will be added to the HTTP request.
1002
+ #
1003
+ # @return [Concurrent::Promise] promise which provides async access to http
1004
+ # response.
1005
+ #
1006
+ def regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:nil)
1007
+ # Send request
1008
+ promise = begin_regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:custom_headers)
1009
+
1010
+ promise = promise.then do |response|
1011
+ # Defining deserialization method.
1012
+ deserialize_method = lambda do |parsed_response|
1013
+ end
1014
+
1015
+ # Waiting for response.
1016
+ @client.get_long_running_operation_result(response, deserialize_method)
1017
+ end
1018
+
1019
+ promise
1020
+ end
1021
+
1022
+ #
1023
+ # Checks that the Azure Cosmos DB account name already exists. A valid account
1024
+ # name may contain only lowercase letters, numbers, and the '-' character, and
1025
+ # must be between 3 and 50 characters.
1026
+ #
1027
+ # @param account_name [String] Cosmos DB database account name.
1028
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1029
+ # will be added to the HTTP request.
1030
+ #
1031
+ # @return [Boolean] operation results.
1032
+ #
1033
+ def check_name_exists(account_name, custom_headers:nil)
1034
+ response = check_name_exists_async(account_name, custom_headers:custom_headers).value!
1035
+ response.body unless response.nil?
1036
+ end
1037
+
1038
+ #
1039
+ # Checks that the Azure Cosmos DB account name already exists. A valid account
1040
+ # name may contain only lowercase letters, numbers, and the '-' character, and
1041
+ # must be between 3 and 50 characters.
1042
+ #
1043
+ # @param account_name [String] Cosmos DB database account name.
1044
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1045
+ # will be added to the HTTP request.
1046
+ #
1047
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1048
+ #
1049
+ def check_name_exists_with_http_info(account_name, custom_headers:nil)
1050
+ check_name_exists_async(account_name, custom_headers:custom_headers).value!
1051
+ end
1052
+
1053
+ #
1054
+ # Checks that the Azure Cosmos DB account name already exists. A valid account
1055
+ # name may contain only lowercase letters, numbers, and the '-' character, and
1056
+ # must be between 3 and 50 characters.
1057
+ #
1058
+ # @param account_name [String] Cosmos DB database account name.
1059
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1060
+ # to the HTTP request.
1061
+ #
1062
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1063
+ #
1064
+ def check_name_exists_async(account_name, custom_headers:nil)
1065
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1066
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1067
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1068
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1069
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1070
+
1071
+
1072
+ request_headers = {}
1073
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1074
+
1075
+ # Set Headers
1076
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1077
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1078
+ path_template = 'providers/Microsoft.DocumentDB/databaseAccountNames/{accountName}'
1079
+
1080
+ request_url = @base_url || @client.base_url
1081
+
1082
+ options = {
1083
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1084
+ path_params: {'accountName' => account_name},
1085
+ query_params: {'api-version' => @client.api_version},
1086
+ headers: request_headers.merge(custom_headers || {}),
1087
+ base_url: request_url
1088
+ }
1089
+ promise = @client.make_request_async(:head, path_template, options)
1090
+
1091
+ promise = promise.then do |result|
1092
+ http_response = result.response
1093
+ status_code = http_response.status
1094
+ response_content = http_response.body
1095
+ unless status_code == 200 || status_code == 404
1096
+ error_model = JSON.load(response_content)
1097
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1098
+ end
1099
+
1100
+ result.body = (status_code == 200)
1101
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1102
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1103
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1104
+
1105
+ result
1106
+ end
1107
+
1108
+ promise.execute
1109
+ end
1110
+
1111
+ #
1112
+ # Retrieves the metrics determined by the given filter for the given database
1113
+ # account.
1114
+ #
1115
+ # @param resource_group_name [String] Name of an Azure resource group.
1116
+ # @param account_name [String] Cosmos DB database account name.
1117
+ # @param filter [String] An OData filter expression that describes a subset of
1118
+ # metrics to return. The parameters that can be filtered are name.value (name
1119
+ # of the metric, can have an or of multiple names), startTime, endTime, and
1120
+ # timeGrain. The supported operator is eq.
1121
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1122
+ # will be added to the HTTP request.
1123
+ #
1124
+ # @return [MetricListResult] operation results.
1125
+ #
1126
+ def list_metrics(resource_group_name, account_name, filter, custom_headers:nil)
1127
+ response = list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
1128
+ response.body unless response.nil?
1129
+ end
1130
+
1131
+ #
1132
+ # Retrieves the metrics determined by the given filter for the given database
1133
+ # account.
1134
+ #
1135
+ # @param resource_group_name [String] Name of an Azure resource group.
1136
+ # @param account_name [String] Cosmos DB database account name.
1137
+ # @param filter [String] An OData filter expression that describes a subset of
1138
+ # metrics to return. The parameters that can be filtered are name.value (name
1139
+ # of the metric, can have an or of multiple names), startTime, endTime, and
1140
+ # timeGrain. The supported operator is eq.
1141
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1142
+ # will be added to the HTTP request.
1143
+ #
1144
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1145
+ #
1146
+ def list_metrics_with_http_info(resource_group_name, account_name, filter, custom_headers:nil)
1147
+ list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
1148
+ end
1149
+
1150
+ #
1151
+ # Retrieves the metrics determined by the given filter for the given database
1152
+ # account.
1153
+ #
1154
+ # @param resource_group_name [String] Name of an Azure resource group.
1155
+ # @param account_name [String] Cosmos DB database account name.
1156
+ # @param filter [String] An OData filter expression that describes a subset of
1157
+ # metrics to return. The parameters that can be filtered are name.value (name
1158
+ # of the metric, can have an or of multiple names), startTime, endTime, and
1159
+ # timeGrain. The supported operator is eq.
1160
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1161
+ # to the HTTP request.
1162
+ #
1163
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1164
+ #
1165
+ def list_metrics_async(resource_group_name, account_name, filter, custom_headers:nil)
1166
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1167
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1168
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1169
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1170
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1171
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1172
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1173
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1174
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1175
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1176
+ fail ArgumentError, 'filter is nil' if filter.nil?
1177
+
1178
+
1179
+ request_headers = {}
1180
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1181
+
1182
+ # Set Headers
1183
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1184
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1185
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metrics'
1186
+
1187
+ request_url = @base_url || @client.base_url
1188
+
1189
+ options = {
1190
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1191
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1192
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
1193
+ headers: request_headers.merge(custom_headers || {}),
1194
+ base_url: request_url
1195
+ }
1196
+ promise = @client.make_request_async(:get, path_template, options)
1197
+
1198
+ promise = promise.then do |result|
1199
+ http_response = result.response
1200
+ status_code = http_response.status
1201
+ response_content = http_response.body
1202
+ unless status_code == 200
1203
+ error_model = JSON.load(response_content)
1204
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1205
+ end
1206
+
1207
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1208
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1209
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1210
+ # Deserialize Response
1211
+ if status_code == 200
1212
+ begin
1213
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1214
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MetricListResult.mapper()
1215
+ result.body = @client.deserialize(result_mapper, parsed_response)
1216
+ rescue Exception => e
1217
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1218
+ end
1219
+ end
1220
+
1221
+ result
1222
+ end
1223
+
1224
+ promise.execute
1225
+ end
1226
+
1227
+ #
1228
+ # Retrieves the usages (most recent data) for the given database account.
1229
+ #
1230
+ # @param resource_group_name [String] Name of an Azure resource group.
1231
+ # @param account_name [String] Cosmos DB database account name.
1232
+ # @param filter [String] An OData filter expression that describes a subset of
1233
+ # usages to return. The supported parameter is name.value (name of the metric,
1234
+ # can have an or of multiple names).
1235
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1236
+ # will be added to the HTTP request.
1237
+ #
1238
+ # @return [UsagesResult] operation results.
1239
+ #
1240
+ def list_usages(resource_group_name, account_name, filter:nil, custom_headers:nil)
1241
+ response = list_usages_async(resource_group_name, account_name, filter:filter, custom_headers:custom_headers).value!
1242
+ response.body unless response.nil?
1243
+ end
1244
+
1245
+ #
1246
+ # Retrieves the usages (most recent data) for the given database account.
1247
+ #
1248
+ # @param resource_group_name [String] Name of an Azure resource group.
1249
+ # @param account_name [String] Cosmos DB database account name.
1250
+ # @param filter [String] An OData filter expression that describes a subset of
1251
+ # usages to return. The supported parameter is name.value (name of the metric,
1252
+ # can have an or of multiple names).
1253
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1254
+ # will be added to the HTTP request.
1255
+ #
1256
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1257
+ #
1258
+ def list_usages_with_http_info(resource_group_name, account_name, filter:nil, custom_headers:nil)
1259
+ list_usages_async(resource_group_name, account_name, filter:filter, custom_headers:custom_headers).value!
1260
+ end
1261
+
1262
+ #
1263
+ # Retrieves the usages (most recent data) for the given database account.
1264
+ #
1265
+ # @param resource_group_name [String] Name of an Azure resource group.
1266
+ # @param account_name [String] Cosmos DB database account name.
1267
+ # @param filter [String] An OData filter expression that describes a subset of
1268
+ # usages to return. The supported parameter is name.value (name of the metric,
1269
+ # can have an or of multiple names).
1270
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1271
+ # to the HTTP request.
1272
+ #
1273
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1274
+ #
1275
+ def list_usages_async(resource_group_name, account_name, filter:nil, custom_headers:nil)
1276
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1277
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1278
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1279
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1280
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1281
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1282
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1283
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1284
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1285
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1286
+
1287
+
1288
+ request_headers = {}
1289
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1290
+
1291
+ # Set Headers
1292
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1293
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1294
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/usages'
1295
+
1296
+ request_url = @base_url || @client.base_url
1297
+
1298
+ options = {
1299
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1300
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1301
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
1302
+ headers: request_headers.merge(custom_headers || {}),
1303
+ base_url: request_url
1304
+ }
1305
+ promise = @client.make_request_async(:get, path_template, options)
1306
+
1307
+ promise = promise.then do |result|
1308
+ http_response = result.response
1309
+ status_code = http_response.status
1310
+ response_content = http_response.body
1311
+ unless status_code == 200
1312
+ error_model = JSON.load(response_content)
1313
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1314
+ end
1315
+
1316
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1317
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1318
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1319
+ # Deserialize Response
1320
+ if status_code == 200
1321
+ begin
1322
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1323
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::UsagesResult.mapper()
1324
+ result.body = @client.deserialize(result_mapper, parsed_response)
1325
+ rescue Exception => e
1326
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1327
+ end
1328
+ end
1329
+
1330
+ result
1331
+ end
1332
+
1333
+ promise.execute
1334
+ end
1335
+
1336
+ #
1337
+ # Retrieves metric definitions for the given database account.
1338
+ #
1339
+ # @param resource_group_name [String] Name of an Azure resource group.
1340
+ # @param account_name [String] Cosmos DB database account name.
1341
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1342
+ # will be added to the HTTP request.
1343
+ #
1344
+ # @return [MetricDefinitionsListResult] operation results.
1345
+ #
1346
+ def list_metric_definitions(resource_group_name, account_name, custom_headers:nil)
1347
+ response = list_metric_definitions_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1348
+ response.body unless response.nil?
1349
+ end
1350
+
1351
+ #
1352
+ # Retrieves metric definitions for the given database account.
1353
+ #
1354
+ # @param resource_group_name [String] Name of an Azure resource group.
1355
+ # @param account_name [String] Cosmos DB database account name.
1356
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1357
+ # will be added to the HTTP request.
1358
+ #
1359
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1360
+ #
1361
+ def list_metric_definitions_with_http_info(resource_group_name, account_name, custom_headers:nil)
1362
+ list_metric_definitions_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1363
+ end
1364
+
1365
+ #
1366
+ # Retrieves metric definitions for the given database account.
1367
+ #
1368
+ # @param resource_group_name [String] Name of an Azure resource group.
1369
+ # @param account_name [String] Cosmos DB database account name.
1370
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1371
+ # to the HTTP request.
1372
+ #
1373
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1374
+ #
1375
+ def list_metric_definitions_async(resource_group_name, account_name, custom_headers:nil)
1376
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1377
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1378
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1379
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1380
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1381
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1382
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1383
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1384
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1385
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1386
+
1387
+
1388
+ request_headers = {}
1389
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1390
+
1391
+ # Set Headers
1392
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1393
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1394
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/metricDefinitions'
1395
+
1396
+ request_url = @base_url || @client.base_url
1397
+
1398
+ options = {
1399
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1400
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1401
+ query_params: {'api-version' => @client.api_version},
1402
+ headers: request_headers.merge(custom_headers || {}),
1403
+ base_url: request_url
1404
+ }
1405
+ promise = @client.make_request_async(:get, path_template, options)
1406
+
1407
+ promise = promise.then do |result|
1408
+ http_response = result.response
1409
+ status_code = http_response.status
1410
+ response_content = http_response.body
1411
+ unless status_code == 200
1412
+ error_model = JSON.load(response_content)
1413
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1414
+ end
1415
+
1416
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1417
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1418
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1419
+ # Deserialize Response
1420
+ if status_code == 200
1421
+ begin
1422
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1423
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MetricDefinitionsListResult.mapper()
1424
+ result.body = @client.deserialize(result_mapper, parsed_response)
1425
+ rescue Exception => e
1426
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1427
+ end
1428
+ end
1429
+
1430
+ result
1431
+ end
1432
+
1433
+ promise.execute
1434
+ end
1435
+
1436
+ #
1437
+ # Updates the properties of an existing Azure Cosmos DB database account.
1438
+ #
1439
+ # @param resource_group_name [String] Name of an Azure resource group.
1440
+ # @param account_name [String] Cosmos DB database account name.
1441
+ # @param update_parameters [DatabaseAccountUpdateParameters] The parameters to
1442
+ # provide for the current database account.
1443
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1444
+ # will be added to the HTTP request.
1445
+ #
1446
+ # @return [DatabaseAccountGetResults] operation results.
1447
+ #
1448
+ def begin_update(resource_group_name, account_name, update_parameters, custom_headers:nil)
1449
+ response = begin_update_async(resource_group_name, account_name, update_parameters, custom_headers:custom_headers).value!
1450
+ response.body unless response.nil?
1451
+ end
1452
+
1453
+ #
1454
+ # Updates the properties of an existing Azure Cosmos DB database account.
1455
+ #
1456
+ # @param resource_group_name [String] Name of an Azure resource group.
1457
+ # @param account_name [String] Cosmos DB database account name.
1458
+ # @param update_parameters [DatabaseAccountUpdateParameters] The parameters to
1459
+ # provide for the current database account.
1460
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1461
+ # will be added to the HTTP request.
1462
+ #
1463
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1464
+ #
1465
+ def begin_update_with_http_info(resource_group_name, account_name, update_parameters, custom_headers:nil)
1466
+ begin_update_async(resource_group_name, account_name, update_parameters, custom_headers:custom_headers).value!
1467
+ end
1468
+
1469
+ #
1470
+ # Updates the properties of an existing Azure Cosmos DB database account.
1471
+ #
1472
+ # @param resource_group_name [String] Name of an Azure resource group.
1473
+ # @param account_name [String] Cosmos DB database account name.
1474
+ # @param update_parameters [DatabaseAccountUpdateParameters] The parameters to
1475
+ # provide for the current database account.
1476
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1477
+ # to the HTTP request.
1478
+ #
1479
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1480
+ #
1481
+ def begin_update_async(resource_group_name, account_name, update_parameters, custom_headers:nil)
1482
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1483
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1484
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1485
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1486
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1487
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1488
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1489
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1490
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1491
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1492
+ fail ArgumentError, 'update_parameters is nil' if update_parameters.nil?
1493
+
1494
+
1495
+ request_headers = {}
1496
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1497
+
1498
+ # Set Headers
1499
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1500
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1501
+
1502
+ # Serialize Request
1503
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountUpdateParameters.mapper()
1504
+ request_content = @client.serialize(request_mapper, update_parameters)
1505
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1506
+
1507
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'
1508
+
1509
+ request_url = @base_url || @client.base_url
1510
+
1511
+ options = {
1512
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1513
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1514
+ query_params: {'api-version' => @client.api_version},
1515
+ body: request_content,
1516
+ headers: request_headers.merge(custom_headers || {}),
1517
+ base_url: request_url
1518
+ }
1519
+ promise = @client.make_request_async(:patch, path_template, options)
1520
+
1521
+ promise = promise.then do |result|
1522
+ http_response = result.response
1523
+ status_code = http_response.status
1524
+ response_content = http_response.body
1525
+ unless status_code == 200
1526
+ error_model = JSON.load(response_content)
1527
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1528
+ end
1529
+
1530
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1531
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1532
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1533
+ # Deserialize Response
1534
+ if status_code == 200
1535
+ begin
1536
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1537
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
1538
+ result.body = @client.deserialize(result_mapper, parsed_response)
1539
+ rescue Exception => e
1540
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1541
+ end
1542
+ end
1543
+
1544
+ result
1545
+ end
1546
+
1547
+ promise.execute
1548
+ end
1549
+
1550
+ #
1551
+ # Creates or updates an Azure Cosmos DB database account. The "Update" method
1552
+ # is preferred when performing updates on an account.
1553
+ #
1554
+ # @param resource_group_name [String] Name of an Azure resource group.
1555
+ # @param account_name [String] Cosmos DB database account name.
1556
+ # @param create_update_parameters [DatabaseAccountCreateUpdateParameters] The
1557
+ # parameters to provide for the current database account.
1558
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1559
+ # will be added to the HTTP request.
1560
+ #
1561
+ # @return [DatabaseAccountGetResults] operation results.
1562
+ #
1563
+ def begin_create_or_update(resource_group_name, account_name, create_update_parameters, custom_headers:nil)
1564
+ response = begin_create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:custom_headers).value!
1565
+ response.body unless response.nil?
1566
+ end
1567
+
1568
+ #
1569
+ # Creates or updates an Azure Cosmos DB database account. The "Update" method
1570
+ # is preferred when performing updates on an account.
1571
+ #
1572
+ # @param resource_group_name [String] Name of an Azure resource group.
1573
+ # @param account_name [String] Cosmos DB database account name.
1574
+ # @param create_update_parameters [DatabaseAccountCreateUpdateParameters] The
1575
+ # parameters to provide for the current database account.
1576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1577
+ # will be added to the HTTP request.
1578
+ #
1579
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1580
+ #
1581
+ def begin_create_or_update_with_http_info(resource_group_name, account_name, create_update_parameters, custom_headers:nil)
1582
+ begin_create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:custom_headers).value!
1583
+ end
1584
+
1585
+ #
1586
+ # Creates or updates an Azure Cosmos DB database account. The "Update" method
1587
+ # is preferred when performing updates on an account.
1588
+ #
1589
+ # @param resource_group_name [String] Name of an Azure resource group.
1590
+ # @param account_name [String] Cosmos DB database account name.
1591
+ # @param create_update_parameters [DatabaseAccountCreateUpdateParameters] The
1592
+ # parameters to provide for the current database account.
1593
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1594
+ # to the HTTP request.
1595
+ #
1596
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1597
+ #
1598
+ def begin_create_or_update_async(resource_group_name, account_name, create_update_parameters, custom_headers:nil)
1599
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1600
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1601
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1602
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1603
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1604
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1605
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1606
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1607
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1608
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1609
+ fail ArgumentError, 'create_update_parameters is nil' if create_update_parameters.nil?
1610
+
1611
+
1612
+ request_headers = {}
1613
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1614
+
1615
+ # Set Headers
1616
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1617
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1618
+
1619
+ # Serialize Request
1620
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountCreateUpdateParameters.mapper()
1621
+ request_content = @client.serialize(request_mapper, create_update_parameters)
1622
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1623
+
1624
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'
1625
+
1626
+ request_url = @base_url || @client.base_url
1627
+
1628
+ options = {
1629
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1630
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1631
+ query_params: {'api-version' => @client.api_version},
1632
+ body: request_content,
1633
+ headers: request_headers.merge(custom_headers || {}),
1634
+ base_url: request_url
1635
+ }
1636
+ promise = @client.make_request_async(:put, path_template, options)
1637
+
1638
+ promise = promise.then do |result|
1639
+ http_response = result.response
1640
+ status_code = http_response.status
1641
+ response_content = http_response.body
1642
+ unless status_code == 200
1643
+ error_model = JSON.load(response_content)
1644
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1645
+ end
1646
+
1647
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1648
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1649
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1650
+ # Deserialize Response
1651
+ if status_code == 200
1652
+ begin
1653
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1654
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountGetResults.mapper()
1655
+ result.body = @client.deserialize(result_mapper, parsed_response)
1656
+ rescue Exception => e
1657
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1658
+ end
1659
+ end
1660
+
1661
+ result
1662
+ end
1663
+
1664
+ promise.execute
1665
+ end
1666
+
1667
+ #
1668
+ # Deletes an existing Azure Cosmos DB database account.
1669
+ #
1670
+ # @param resource_group_name [String] Name of an Azure resource group.
1671
+ # @param account_name [String] Cosmos DB database account name.
1672
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1673
+ # will be added to the HTTP request.
1674
+ #
1675
+ #
1676
+ def begin_delete(resource_group_name, account_name, custom_headers:nil)
1677
+ response = begin_delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1678
+ nil
1679
+ end
1680
+
1681
+ #
1682
+ # Deletes an existing Azure Cosmos DB database account.
1683
+ #
1684
+ # @param resource_group_name [String] Name of an Azure resource group.
1685
+ # @param account_name [String] Cosmos DB database account name.
1686
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1687
+ # will be added to the HTTP request.
1688
+ #
1689
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1690
+ #
1691
+ def begin_delete_with_http_info(resource_group_name, account_name, custom_headers:nil)
1692
+ begin_delete_async(resource_group_name, account_name, custom_headers:custom_headers).value!
1693
+ end
1694
+
1695
+ #
1696
+ # Deletes an existing Azure Cosmos DB database account.
1697
+ #
1698
+ # @param resource_group_name [String] Name of an Azure resource group.
1699
+ # @param account_name [String] Cosmos DB database account name.
1700
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1701
+ # to the HTTP request.
1702
+ #
1703
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1704
+ #
1705
+ def begin_delete_async(resource_group_name, account_name, custom_headers:nil)
1706
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1707
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1708
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1709
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1710
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1711
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1712
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1713
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1714
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1715
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1716
+
1717
+
1718
+ request_headers = {}
1719
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1720
+
1721
+ # Set Headers
1722
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1723
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1724
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}'
1725
+
1726
+ request_url = @base_url || @client.base_url
1727
+
1728
+ options = {
1729
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1730
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1731
+ query_params: {'api-version' => @client.api_version},
1732
+ headers: request_headers.merge(custom_headers || {}),
1733
+ base_url: request_url
1734
+ }
1735
+ promise = @client.make_request_async(:delete, path_template, options)
1736
+
1737
+ promise = promise.then do |result|
1738
+ http_response = result.response
1739
+ status_code = http_response.status
1740
+ response_content = http_response.body
1741
+ unless status_code == 202 || status_code == 204
1742
+ error_model = JSON.load(response_content)
1743
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1744
+ end
1745
+
1746
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1747
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1748
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1749
+
1750
+ result
1751
+ end
1752
+
1753
+ promise.execute
1754
+ end
1755
+
1756
+ #
1757
+ # Changes the failover priority for the Azure Cosmos DB database account. A
1758
+ # failover priority of 0 indicates a write region. The maximum value for a
1759
+ # failover priority = (total number of regions - 1). Failover priority values
1760
+ # must be unique for each of the regions in which the database account exists.
1761
+ #
1762
+ # @param resource_group_name [String] Name of an Azure resource group.
1763
+ # @param account_name [String] Cosmos DB database account name.
1764
+ # @param failover_parameters [FailoverPolicies] The new failover policies for
1765
+ # the database account.
1766
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1767
+ # will be added to the HTTP request.
1768
+ #
1769
+ #
1770
+ def begin_failover_priority_change(resource_group_name, account_name, failover_parameters, custom_headers:nil)
1771
+ response = begin_failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:custom_headers).value!
1772
+ nil
1773
+ end
1774
+
1775
+ #
1776
+ # Changes the failover priority for the Azure Cosmos DB database account. A
1777
+ # failover priority of 0 indicates a write region. The maximum value for a
1778
+ # failover priority = (total number of regions - 1). Failover priority values
1779
+ # must be unique for each of the regions in which the database account exists.
1780
+ #
1781
+ # @param resource_group_name [String] Name of an Azure resource group.
1782
+ # @param account_name [String] Cosmos DB database account name.
1783
+ # @param failover_parameters [FailoverPolicies] The new failover policies for
1784
+ # the database account.
1785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1786
+ # will be added to the HTTP request.
1787
+ #
1788
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1789
+ #
1790
+ def begin_failover_priority_change_with_http_info(resource_group_name, account_name, failover_parameters, custom_headers:nil)
1791
+ begin_failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:custom_headers).value!
1792
+ end
1793
+
1794
+ #
1795
+ # Changes the failover priority for the Azure Cosmos DB database account. A
1796
+ # failover priority of 0 indicates a write region. The maximum value for a
1797
+ # failover priority = (total number of regions - 1). Failover priority values
1798
+ # must be unique for each of the regions in which the database account exists.
1799
+ #
1800
+ # @param resource_group_name [String] Name of an Azure resource group.
1801
+ # @param account_name [String] Cosmos DB database account name.
1802
+ # @param failover_parameters [FailoverPolicies] The new failover policies for
1803
+ # the database account.
1804
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1805
+ # to the HTTP request.
1806
+ #
1807
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1808
+ #
1809
+ def begin_failover_priority_change_async(resource_group_name, account_name, failover_parameters, custom_headers:nil)
1810
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1811
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1812
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1813
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1814
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1815
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1816
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1817
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1818
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1819
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1820
+ fail ArgumentError, 'failover_parameters is nil' if failover_parameters.nil?
1821
+
1822
+
1823
+ request_headers = {}
1824
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1825
+
1826
+ # Set Headers
1827
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1828
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1829
+
1830
+ # Serialize Request
1831
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::FailoverPolicies.mapper()
1832
+ request_content = @client.serialize(request_mapper, failover_parameters)
1833
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1834
+
1835
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/failoverPriorityChange'
1836
+
1837
+ request_url = @base_url || @client.base_url
1838
+
1839
+ options = {
1840
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1841
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1842
+ query_params: {'api-version' => @client.api_version},
1843
+ body: request_content,
1844
+ headers: request_headers.merge(custom_headers || {}),
1845
+ base_url: request_url
1846
+ }
1847
+ promise = @client.make_request_async(:post, path_template, options)
1848
+
1849
+ promise = promise.then do |result|
1850
+ http_response = result.response
1851
+ status_code = http_response.status
1852
+ response_content = http_response.body
1853
+ unless status_code == 202 || status_code == 204
1854
+ error_model = JSON.load(response_content)
1855
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1856
+ end
1857
+
1858
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1859
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1860
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1861
+
1862
+ result
1863
+ end
1864
+
1865
+ promise.execute
1866
+ end
1867
+
1868
+ #
1869
+ # Offline the specified region for the specified Azure Cosmos DB database
1870
+ # account.
1871
+ #
1872
+ # @param resource_group_name [String] Name of an Azure resource group.
1873
+ # @param account_name [String] Cosmos DB database account name.
1874
+ # @param region_parameter_for_offline [RegionForOnlineOffline] Cosmos DB region
1875
+ # to offline for the database account.
1876
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1877
+ # will be added to the HTTP request.
1878
+ #
1879
+ #
1880
+ def begin_offline_region(resource_group_name, account_name, region_parameter_for_offline, custom_headers:nil)
1881
+ response = begin_offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:custom_headers).value!
1882
+ nil
1883
+ end
1884
+
1885
+ #
1886
+ # Offline the specified region for the specified Azure Cosmos DB database
1887
+ # account.
1888
+ #
1889
+ # @param resource_group_name [String] Name of an Azure resource group.
1890
+ # @param account_name [String] Cosmos DB database account name.
1891
+ # @param region_parameter_for_offline [RegionForOnlineOffline] Cosmos DB region
1892
+ # to offline for the database account.
1893
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1894
+ # will be added to the HTTP request.
1895
+ #
1896
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1897
+ #
1898
+ def begin_offline_region_with_http_info(resource_group_name, account_name, region_parameter_for_offline, custom_headers:nil)
1899
+ begin_offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:custom_headers).value!
1900
+ end
1901
+
1902
+ #
1903
+ # Offline the specified region for the specified Azure Cosmos DB database
1904
+ # account.
1905
+ #
1906
+ # @param resource_group_name [String] Name of an Azure resource group.
1907
+ # @param account_name [String] Cosmos DB database account name.
1908
+ # @param region_parameter_for_offline [RegionForOnlineOffline] Cosmos DB region
1909
+ # to offline for the database account.
1910
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1911
+ # to the HTTP request.
1912
+ #
1913
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1914
+ #
1915
+ def begin_offline_region_async(resource_group_name, account_name, region_parameter_for_offline, custom_headers:nil)
1916
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1917
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1918
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1919
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1920
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1921
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1922
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1923
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1924
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
1925
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1926
+ fail ArgumentError, 'region_parameter_for_offline is nil' if region_parameter_for_offline.nil?
1927
+
1928
+
1929
+ request_headers = {}
1930
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1931
+
1932
+ # Set Headers
1933
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1934
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1935
+
1936
+ # Serialize Request
1937
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::RegionForOnlineOffline.mapper()
1938
+ request_content = @client.serialize(request_mapper, region_parameter_for_offline)
1939
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1940
+
1941
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/offlineRegion'
1942
+
1943
+ request_url = @base_url || @client.base_url
1944
+
1945
+ options = {
1946
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1947
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
1948
+ query_params: {'api-version' => @client.api_version},
1949
+ body: request_content,
1950
+ headers: request_headers.merge(custom_headers || {}),
1951
+ base_url: request_url
1952
+ }
1953
+ promise = @client.make_request_async(:post, path_template, options)
1954
+
1955
+ promise = promise.then do |result|
1956
+ http_response = result.response
1957
+ status_code = http_response.status
1958
+ response_content = http_response.body
1959
+ unless status_code == 200 || status_code == 202
1960
+ error_model = JSON.load(response_content)
1961
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
1962
+ end
1963
+
1964
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1965
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1966
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1967
+
1968
+ result
1969
+ end
1970
+
1971
+ promise.execute
1972
+ end
1973
+
1974
+ #
1975
+ # Online the specified region for the specified Azure Cosmos DB database
1976
+ # account.
1977
+ #
1978
+ # @param resource_group_name [String] Name of an Azure resource group.
1979
+ # @param account_name [String] Cosmos DB database account name.
1980
+ # @param region_parameter_for_online [RegionForOnlineOffline] Cosmos DB region
1981
+ # to online for the database account.
1982
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1983
+ # will be added to the HTTP request.
1984
+ #
1985
+ #
1986
+ def begin_online_region(resource_group_name, account_name, region_parameter_for_online, custom_headers:nil)
1987
+ response = begin_online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:custom_headers).value!
1988
+ nil
1989
+ end
1990
+
1991
+ #
1992
+ # Online the specified region for the specified Azure Cosmos DB database
1993
+ # account.
1994
+ #
1995
+ # @param resource_group_name [String] Name of an Azure resource group.
1996
+ # @param account_name [String] Cosmos DB database account name.
1997
+ # @param region_parameter_for_online [RegionForOnlineOffline] Cosmos DB region
1998
+ # to online for the database account.
1999
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2000
+ # will be added to the HTTP request.
2001
+ #
2002
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2003
+ #
2004
+ def begin_online_region_with_http_info(resource_group_name, account_name, region_parameter_for_online, custom_headers:nil)
2005
+ begin_online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:custom_headers).value!
2006
+ end
2007
+
2008
+ #
2009
+ # Online the specified region for the specified Azure Cosmos DB database
2010
+ # account.
2011
+ #
2012
+ # @param resource_group_name [String] Name of an Azure resource group.
2013
+ # @param account_name [String] Cosmos DB database account name.
2014
+ # @param region_parameter_for_online [RegionForOnlineOffline] Cosmos DB region
2015
+ # to online for the database account.
2016
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2017
+ # to the HTTP request.
2018
+ #
2019
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2020
+ #
2021
+ def begin_online_region_async(resource_group_name, account_name, region_parameter_for_online, custom_headers:nil)
2022
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2023
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2024
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2025
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2026
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2027
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2028
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2029
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2030
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2031
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2032
+ fail ArgumentError, 'region_parameter_for_online is nil' if region_parameter_for_online.nil?
2033
+
2034
+
2035
+ request_headers = {}
2036
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2037
+
2038
+ # Set Headers
2039
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2040
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2041
+
2042
+ # Serialize Request
2043
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::RegionForOnlineOffline.mapper()
2044
+ request_content = @client.serialize(request_mapper, region_parameter_for_online)
2045
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2046
+
2047
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/onlineRegion'
2048
+
2049
+ request_url = @base_url || @client.base_url
2050
+
2051
+ options = {
2052
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2053
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
2054
+ query_params: {'api-version' => @client.api_version},
2055
+ body: request_content,
2056
+ headers: request_headers.merge(custom_headers || {}),
2057
+ base_url: request_url
2058
+ }
2059
+ promise = @client.make_request_async(:post, path_template, options)
2060
+
2061
+ promise = promise.then do |result|
2062
+ http_response = result.response
2063
+ status_code = http_response.status
2064
+ response_content = http_response.body
2065
+ unless status_code == 200 || status_code == 202
2066
+ error_model = JSON.load(response_content)
2067
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
2068
+ end
2069
+
2070
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2071
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2072
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2073
+
2074
+ result
2075
+ end
2076
+
2077
+ promise.execute
2078
+ end
2079
+
2080
+ #
2081
+ # Regenerates an access key for the specified Azure Cosmos DB database account.
2082
+ #
2083
+ # @param resource_group_name [String] Name of an Azure resource group.
2084
+ # @param account_name [String] Cosmos DB database account name.
2085
+ # @param key_to_regenerate [DatabaseAccountRegenerateKeyParameters] The name of
2086
+ # the key to regenerate.
2087
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2088
+ # will be added to the HTTP request.
2089
+ #
2090
+ #
2091
+ def begin_regenerate_key(resource_group_name, account_name, key_to_regenerate, custom_headers:nil)
2092
+ response = begin_regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:custom_headers).value!
2093
+ nil
2094
+ end
2095
+
2096
+ #
2097
+ # Regenerates an access key for the specified Azure Cosmos DB database account.
2098
+ #
2099
+ # @param resource_group_name [String] Name of an Azure resource group.
2100
+ # @param account_name [String] Cosmos DB database account name.
2101
+ # @param key_to_regenerate [DatabaseAccountRegenerateKeyParameters] The name of
2102
+ # the key to regenerate.
2103
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2104
+ # will be added to the HTTP request.
2105
+ #
2106
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2107
+ #
2108
+ def begin_regenerate_key_with_http_info(resource_group_name, account_name, key_to_regenerate, custom_headers:nil)
2109
+ begin_regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:custom_headers).value!
2110
+ end
2111
+
2112
+ #
2113
+ # Regenerates an access key for the specified Azure Cosmos DB database account.
2114
+ #
2115
+ # @param resource_group_name [String] Name of an Azure resource group.
2116
+ # @param account_name [String] Cosmos DB database account name.
2117
+ # @param key_to_regenerate [DatabaseAccountRegenerateKeyParameters] The name of
2118
+ # the key to regenerate.
2119
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2120
+ # to the HTTP request.
2121
+ #
2122
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2123
+ #
2124
+ def begin_regenerate_key_async(resource_group_name, account_name, key_to_regenerate, custom_headers:nil)
2125
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2126
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2127
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2128
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2129
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2130
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2131
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2132
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2133
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
2134
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2135
+ fail ArgumentError, 'key_to_regenerate is nil' if key_to_regenerate.nil?
2136
+
2137
+
2138
+ request_headers = {}
2139
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2140
+
2141
+ # Set Headers
2142
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2143
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2144
+
2145
+ # Serialize Request
2146
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::DatabaseAccountRegenerateKeyParameters.mapper()
2147
+ request_content = @client.serialize(request_mapper, key_to_regenerate)
2148
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2149
+
2150
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/regenerateKey'
2151
+
2152
+ request_url = @base_url || @client.base_url
2153
+
2154
+ options = {
2155
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2156
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
2157
+ query_params: {'api-version' => @client.api_version},
2158
+ body: request_content,
2159
+ headers: request_headers.merge(custom_headers || {}),
2160
+ base_url: request_url
2161
+ }
2162
+ promise = @client.make_request_async(:post, path_template, options)
2163
+
2164
+ promise = promise.then do |result|
2165
+ http_response = result.response
2166
+ status_code = http_response.status
2167
+ response_content = http_response.body
2168
+ unless status_code == 200 || status_code == 202
2169
+ error_model = JSON.load(response_content)
2170
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2171
+ end
2172
+
2173
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2174
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2175
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2176
+
2177
+ result
2178
+ end
2179
+
2180
+ promise.execute
2181
+ end
2182
+
2183
+ end
2184
+ end