azure_mgmt_cosmosdb 0.17.0 → 0.21.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (201) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb.rb +50 -46
  3. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection.rb +3 -0
  4. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition.rb +2 -0
  5. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +1 -0
  6. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_region.rb +1 -0
  7. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/cosmos_db.rb +1 -1
  8. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database.rb +3 -0
  9. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_account_region.rb +1 -0
  10. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_accounts.rb +3264 -715
  11. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +15 -0
  12. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account.rb +24 -0
  13. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +24 -0
  14. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +9 -15
  15. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/location.rb +12 -0
  16. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput.rb +97 -0
  17. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_resource.rb +46 -0
  18. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_update_parameters.rb +48 -0
  19. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +1 -0
  20. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +1 -0
  21. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile.rb +1 -0
  22. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +1 -0
  23. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_target.rb +1 -0
  24. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb.rb +41 -0
  25. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +142 -0
  26. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  27. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/azure_entity_resource.rb +75 -0
  28. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  29. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection.rb +88 -0
  30. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection_list_result.rb +56 -0
  31. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_property.rb +46 -0
  32. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource.rb +95 -0
  33. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource_list_result.rb +55 -0
  34. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_service_connection_state_property.rb +71 -0
  35. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/proxy_resource.rb +63 -0
  36. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/resource.rb +83 -0
  37. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/tracked_resource.rb +92 -0
  38. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  39. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_endpoint_connections.rb +560 -0
  40. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_link_resources.rb +235 -0
  41. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb.rb +181 -0
  42. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cassandra_resources.rb +1628 -0
  43. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection.rb +374 -0
  44. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition.rb +269 -0
  45. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +156 -0
  46. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_region.rb +156 -0
  47. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cosmos_dbmanagement_client.rb +200 -0
  48. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database.rb +362 -0
  49. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_account_region.rb +148 -0
  50. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb +2184 -0
  51. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/gremlin_resources.rb +1623 -0
  52. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  53. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armresource_properties.rb +102 -0
  54. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/capability.rb +48 -0
  55. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +120 -0
  56. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_get_properties_resource.rb +85 -0
  57. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_get_results.rb +98 -0
  58. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +58 -0
  59. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +46 -0
  60. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +46 -0
  61. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +95 -0
  62. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +120 -0
  63. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_get_properties_resource.rb +108 -0
  64. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_get_results.rb +98 -0
  65. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +58 -0
  66. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +69 -0
  67. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +58 -0
  68. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/column.rb +57 -0
  69. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/composite_path.rb +60 -0
  70. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/composite_path_sort_order.rb +16 -0
  71. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +16 -0
  72. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +73 -0
  73. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +15 -0
  74. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +86 -0
  75. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +85 -0
  76. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/data_type.rb +20 -0
  77. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +59 -0
  78. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +279 -0
  79. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_get_results.rb +371 -0
  80. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +17 -0
  81. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +57 -0
  82. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +77 -0
  83. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +59 -0
  84. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +15 -0
  85. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +47 -0
  86. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_update_parameters.rb +230 -0
  87. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +58 -0
  88. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +19 -0
  89. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  90. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +48 -0
  91. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +74 -0
  92. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +55 -0
  93. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +79 -0
  94. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +120 -0
  95. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_get_properties_resource.rb +85 -0
  96. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_get_results.rb +98 -0
  97. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +58 -0
  98. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +46 -0
  99. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +120 -0
  100. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_get_properties_resource.rb +150 -0
  101. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_get_results.rb +98 -0
  102. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +58 -0
  103. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +111 -0
  104. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/included_path.rb +67 -0
  105. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/index_kind.rb +17 -0
  106. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexes.rb +73 -0
  107. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +17 -0
  108. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +147 -0
  109. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/key_kind.rb +18 -0
  110. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/location.rb +114 -0
  111. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric.rb +120 -0
  112. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +60 -0
  113. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +109 -0
  114. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +57 -0
  115. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +56 -0
  116. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_name.rb +59 -0
  117. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_value.rb +107 -0
  118. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +120 -0
  119. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_get_properties_resource.rb +125 -0
  120. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_get_results.rb +98 -0
  121. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +58 -0
  122. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +86 -0
  123. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +120 -0
  124. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_get_properties_resource.rb +85 -0
  125. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_get_results.rb +98 -0
  126. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +58 -0
  127. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +46 -0
  128. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +60 -0
  129. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +55 -0
  130. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +57 -0
  131. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation.rb +58 -0
  132. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_display.rb +80 -0
  133. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +101 -0
  134. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +16 -0
  135. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +124 -0
  136. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +57 -0
  137. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +105 -0
  138. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +57 -0
  139. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +120 -0
  140. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +57 -0
  141. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +173 -0
  142. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +20 -0
  143. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +47 -0
  144. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/spatial_spec.rb +67 -0
  145. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/spatial_type.rb +18 -0
  146. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +119 -0
  147. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_get_properties_resource.rb +150 -0
  148. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_get_results.rb +98 -0
  149. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +58 -0
  150. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +111 -0
  151. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +120 -0
  152. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_get_properties_resource.rb +109 -0
  153. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_get_results.rb +98 -0
  154. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +58 -0
  155. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +46 -0
  156. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_create_update_parameters.rb +120 -0
  157. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_get_properties_resource.rb +96 -0
  158. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_get_results.rb +98 -0
  159. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_list_result.rb +58 -0
  160. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_resource.rb +57 -0
  161. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_create_update_parameters.rb +119 -0
  162. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_get_properties_resource.rb +121 -0
  163. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_get_results.rb +98 -0
  164. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_list_result.rb +58 -0
  165. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_resource.rb +82 -0
  166. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_create_update_parameters.rb +121 -0
  167. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_get_properties_resource.rb +97 -0
  168. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_get_results.rb +98 -0
  169. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_list_result.rb +58 -0
  170. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_resource.rb +57 -0
  171. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +119 -0
  172. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_get_properties_resource.rb +85 -0
  173. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_get_results.rb +98 -0
  174. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +57 -0
  175. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_resource.rb +46 -0
  176. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_get_properties_resource.rb +109 -0
  177. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_get_results.rb +98 -0
  178. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_resource.rb +70 -0
  179. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_update_parameters.rb +99 -0
  180. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_operation.rb +19 -0
  181. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_type.rb +16 -0
  182. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key.rb +56 -0
  183. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +58 -0
  184. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unit_type.rb +21 -0
  185. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usage.rb +97 -0
  186. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usages_result.rb +57 -0
  187. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +59 -0
  188. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  189. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/mongo_dbresources.rb +1634 -0
  190. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/operations.rb +219 -0
  191. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +156 -0
  192. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +163 -0
  193. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile.rb +141 -0
  194. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +158 -0
  195. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_target.rb +148 -0
  196. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/sql_resources.rb +3289 -0
  197. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/table_resources.rb +804 -0
  198. data/lib/azure_mgmt_cosmosdb.rb +2 -0
  199. data/lib/profiles/latest/modules/cosmosdb_profile_module.rb +502 -296
  200. data/lib/version.rb +1 -1
  201. metadata +183 -5
@@ -0,0 +1,58 @@
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
+ module Models
8
+ #
9
+ # The unique key policy configuration for specifying uniqueness constraints
10
+ # on documents in the collection in the Azure Cosmos DB service.
11
+ #
12
+ class UniqueKeyPolicy
13
+
14
+ include MsRestAzure
15
+
16
+ # @return [Array<UniqueKey>] List of unique keys on that enforces
17
+ # uniqueness constraint on documents in the collection in the Azure
18
+ # Cosmos DB service.
19
+ attr_accessor :unique_keys
20
+
21
+
22
+ #
23
+ # Mapper for UniqueKeyPolicy class as Ruby Hash.
24
+ # This will be used for serialization/deserialization.
25
+ #
26
+ def self.mapper()
27
+ {
28
+ client_side_validation: true,
29
+ required: false,
30
+ serialized_name: 'UniqueKeyPolicy',
31
+ type: {
32
+ name: 'Composite',
33
+ class_name: 'UniqueKeyPolicy',
34
+ model_properties: {
35
+ unique_keys: {
36
+ client_side_validation: true,
37
+ required: false,
38
+ serialized_name: 'uniqueKeys',
39
+ type: {
40
+ name: 'Sequence',
41
+ element: {
42
+ client_side_validation: true,
43
+ required: false,
44
+ serialized_name: 'UniqueKeyElementType',
45
+ type: {
46
+ name: 'Composite',
47
+ class_name: 'UniqueKey'
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,21 @@
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
+ module Models
8
+ #
9
+ # Defines values for UnitType
10
+ #
11
+ module UnitType
12
+ Count = "Count"
13
+ Bytes = "Bytes"
14
+ Seconds = "Seconds"
15
+ Percent = "Percent"
16
+ CountPerSecond = "CountPerSecond"
17
+ BytesPerSecond = "BytesPerSecond"
18
+ Milliseconds = "Milliseconds"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,97 @@
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
+ module Models
8
+ #
9
+ # The usage data for a usage request.
10
+ #
11
+ class Usage
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [UnitType] The unit of the metric. Possible values include:
16
+ # 'Count', 'Bytes', 'Seconds', 'Percent', 'CountPerSecond',
17
+ # 'BytesPerSecond', 'Milliseconds'
18
+ attr_accessor :unit
19
+
20
+ # @return [MetricName] The name information for the metric.
21
+ attr_accessor :name
22
+
23
+ # @return [String] The quota period used to summarize the usage values.
24
+ attr_accessor :quota_period
25
+
26
+ # @return [Integer] Maximum value for this metric
27
+ attr_accessor :limit
28
+
29
+ # @return [Integer] Current value for this metric
30
+ attr_accessor :current_value
31
+
32
+
33
+ #
34
+ # Mapper for Usage class as Ruby Hash.
35
+ # This will be used for serialization/deserialization.
36
+ #
37
+ def self.mapper()
38
+ {
39
+ client_side_validation: true,
40
+ required: false,
41
+ serialized_name: 'Usage',
42
+ type: {
43
+ name: 'Composite',
44
+ class_name: 'Usage',
45
+ model_properties: {
46
+ unit: {
47
+ client_side_validation: true,
48
+ required: false,
49
+ serialized_name: 'unit',
50
+ type: {
51
+ name: 'String'
52
+ }
53
+ },
54
+ name: {
55
+ client_side_validation: true,
56
+ required: false,
57
+ read_only: true,
58
+ serialized_name: 'name',
59
+ type: {
60
+ name: 'Composite',
61
+ class_name: 'MetricName'
62
+ }
63
+ },
64
+ quota_period: {
65
+ client_side_validation: true,
66
+ required: false,
67
+ read_only: true,
68
+ serialized_name: 'quotaPeriod',
69
+ type: {
70
+ name: 'String'
71
+ }
72
+ },
73
+ limit: {
74
+ client_side_validation: true,
75
+ required: false,
76
+ read_only: true,
77
+ serialized_name: 'limit',
78
+ type: {
79
+ name: 'Number'
80
+ }
81
+ },
82
+ current_value: {
83
+ client_side_validation: true,
84
+ required: false,
85
+ read_only: true,
86
+ serialized_name: 'currentValue',
87
+ type: {
88
+ name: 'Number'
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,57 @@
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
+ module Models
8
+ #
9
+ # The response to a list usage request.
10
+ #
11
+ class UsagesResult
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [Array<Usage>] The list of usages for the database. A usage is
16
+ # a point in time metric
17
+ attr_accessor :value
18
+
19
+
20
+ #
21
+ # Mapper for UsagesResult class as Ruby Hash.
22
+ # This will be used for serialization/deserialization.
23
+ #
24
+ def self.mapper()
25
+ {
26
+ client_side_validation: true,
27
+ required: false,
28
+ serialized_name: 'UsagesResult',
29
+ type: {
30
+ name: 'Composite',
31
+ class_name: 'UsagesResult',
32
+ model_properties: {
33
+ value: {
34
+ client_side_validation: true,
35
+ required: false,
36
+ read_only: true,
37
+ serialized_name: 'value',
38
+ type: {
39
+ name: 'Sequence',
40
+ element: {
41
+ client_side_validation: true,
42
+ required: false,
43
+ serialized_name: 'UsageElementType',
44
+ type: {
45
+ name: 'Composite',
46
+ class_name: 'Usage'
47
+ }
48
+ }
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,59 @@
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
+ module Models
8
+ #
9
+ # Virtual Network ACL Rule object
10
+ #
11
+ class VirtualNetworkRule
12
+
13
+ include MsRestAzure
14
+
15
+ # @return [String] Resource ID of a subnet, for example:
16
+ # /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName}.
17
+ attr_accessor :id
18
+
19
+ # @return [Boolean] Create firewall rule before the virtual network has
20
+ # vnet service endpoint enabled.
21
+ attr_accessor :ignore_missing_vnet_service_endpoint
22
+
23
+
24
+ #
25
+ # Mapper for VirtualNetworkRule class as Ruby Hash.
26
+ # This will be used for serialization/deserialization.
27
+ #
28
+ def self.mapper()
29
+ {
30
+ client_side_validation: true,
31
+ required: false,
32
+ serialized_name: 'VirtualNetworkRule',
33
+ type: {
34
+ name: 'Composite',
35
+ class_name: 'VirtualNetworkRule',
36
+ model_properties: {
37
+ id: {
38
+ client_side_validation: true,
39
+ required: false,
40
+ serialized_name: 'id',
41
+ type: {
42
+ name: 'String'
43
+ }
44
+ },
45
+ ignore_missing_vnet_service_endpoint: {
46
+ client_side_validation: true,
47
+ required: false,
48
+ serialized_name: 'ignoreMissingVNetServiceEndpoint',
49
+ type: {
50
+ name: 'Boolean'
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,9 @@
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 end
7
+ module Azure::Cosmosdb end
8
+ module Azure::Cosmosdb::Mgmt end
9
+ module Azure::Cosmosdb::Mgmt::V2019_08_01 end
@@ -0,0 +1,1634 @@
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 MongoDBResources
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the MongoDBResources class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDBManagementClient] reference to the CosmosDBManagementClient
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists the MongoDB databases under an existing Azure Cosmos DB database
26
+ # account.
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [MongoDBDatabaseListResult] operation results.
34
+ #
35
+ def list_mongo_dbdatabases(resource_group_name, account_name, custom_headers:nil)
36
+ response = list_mongo_dbdatabases_async(resource_group_name, account_name, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # Lists the MongoDB databases under an existing Azure Cosmos DB database
42
+ # account.
43
+ #
44
+ # @param resource_group_name [String] Name of an Azure resource group.
45
+ # @param account_name [String] Cosmos DB database account name.
46
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
47
+ # will be added to the HTTP request.
48
+ #
49
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
50
+ #
51
+ def list_mongo_dbdatabases_with_http_info(resource_group_name, account_name, custom_headers:nil)
52
+ list_mongo_dbdatabases_async(resource_group_name, account_name, custom_headers:custom_headers).value!
53
+ end
54
+
55
+ #
56
+ # Lists the MongoDB databases under an existing Azure Cosmos DB database
57
+ # account.
58
+ #
59
+ # @param resource_group_name [String] Name of an Azure resource group.
60
+ # @param account_name [String] Cosmos DB database account name.
61
+ # @param [Hash{String => String}] A hash of custom headers that will be added
62
+ # to the HTTP request.
63
+ #
64
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
65
+ #
66
+ def list_mongo_dbdatabases_async(resource_group_name, account_name, custom_headers:nil)
67
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
68
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
69
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
70
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
71
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
72
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
73
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
74
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
75
+ 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?
76
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
77
+
78
+
79
+ request_headers = {}
80
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
81
+
82
+ # Set Headers
83
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
84
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
85
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases'
86
+
87
+ request_url = @base_url || @client.base_url
88
+
89
+ options = {
90
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
91
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
92
+ query_params: {'api-version' => @client.api_version},
93
+ headers: request_headers.merge(custom_headers || {}),
94
+ base_url: request_url
95
+ }
96
+ promise = @client.make_request_async(:get, path_template, options)
97
+
98
+ promise = promise.then do |result|
99
+ http_response = result.response
100
+ status_code = http_response.status
101
+ response_content = http_response.body
102
+ unless status_code == 200
103
+ error_model = JSON.load(response_content)
104
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
105
+ end
106
+
107
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
108
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
109
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
110
+ # Deserialize Response
111
+ if status_code == 200
112
+ begin
113
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
114
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBDatabaseListResult.mapper()
115
+ result.body = @client.deserialize(result_mapper, parsed_response)
116
+ rescue Exception => e
117
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
118
+ end
119
+ end
120
+
121
+ result
122
+ end
123
+
124
+ promise.execute
125
+ end
126
+
127
+ #
128
+ # Gets the MongoDB databases under an existing Azure Cosmos DB database account
129
+ # with the provided name.
130
+ #
131
+ # @param resource_group_name [String] Name of an Azure resource group.
132
+ # @param account_name [String] Cosmos DB database account name.
133
+ # @param database_name [String] Cosmos DB database name.
134
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
135
+ # will be added to the HTTP request.
136
+ #
137
+ # @return [MongoDBDatabaseGetResults] operation results.
138
+ #
139
+ def get_mongo_dbdatabase(resource_group_name, account_name, database_name, custom_headers:nil)
140
+ response = get_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
141
+ response.body unless response.nil?
142
+ end
143
+
144
+ #
145
+ # Gets the MongoDB databases under an existing Azure Cosmos DB database account
146
+ # with the provided name.
147
+ #
148
+ # @param resource_group_name [String] Name of an Azure resource group.
149
+ # @param account_name [String] Cosmos DB database account name.
150
+ # @param database_name [String] Cosmos DB database name.
151
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
152
+ # will be added to the HTTP request.
153
+ #
154
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
155
+ #
156
+ def get_mongo_dbdatabase_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
157
+ get_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
158
+ end
159
+
160
+ #
161
+ # Gets the MongoDB databases under an existing Azure Cosmos DB database account
162
+ # with the provided name.
163
+ #
164
+ # @param resource_group_name [String] Name of an Azure resource group.
165
+ # @param account_name [String] Cosmos DB database account name.
166
+ # @param database_name [String] Cosmos DB database name.
167
+ # @param [Hash{String => String}] A hash of custom headers that will be added
168
+ # to the HTTP request.
169
+ #
170
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
171
+ #
172
+ def get_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:nil)
173
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
174
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
175
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
176
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
177
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
178
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
179
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
180
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
181
+ 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?
182
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
183
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
184
+
185
+
186
+ request_headers = {}
187
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
188
+
189
+ # Set Headers
190
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
191
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
192
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'
193
+
194
+ request_url = @base_url || @client.base_url
195
+
196
+ options = {
197
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
198
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
199
+ query_params: {'api-version' => @client.api_version},
200
+ headers: request_headers.merge(custom_headers || {}),
201
+ base_url: request_url
202
+ }
203
+ promise = @client.make_request_async(:get, path_template, options)
204
+
205
+ promise = promise.then do |result|
206
+ http_response = result.response
207
+ status_code = http_response.status
208
+ response_content = http_response.body
209
+ unless status_code == 200
210
+ error_model = JSON.load(response_content)
211
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
212
+ end
213
+
214
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
215
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
216
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
217
+ # Deserialize Response
218
+ if status_code == 200
219
+ begin
220
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
221
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBDatabaseGetResults.mapper()
222
+ result.body = @client.deserialize(result_mapper, parsed_response)
223
+ rescue Exception => e
224
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
225
+ end
226
+ end
227
+
228
+ result
229
+ end
230
+
231
+ promise.execute
232
+ end
233
+
234
+ #
235
+ # Create or updates Azure Cosmos DB MongoDB database
236
+ #
237
+ # @param resource_group_name [String] Name of an Azure resource group.
238
+ # @param account_name [String] Cosmos DB database account name.
239
+ # @param database_name [String] Cosmos DB database name.
240
+ # @param create_update_mongo_dbdatabase_parameters
241
+ # [MongoDBDatabaseCreateUpdateParameters] The parameters to provide for the
242
+ # current MongoDB database.
243
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
244
+ # will be added to the HTTP request.
245
+ #
246
+ # @return [MongoDBDatabaseGetResults] operation results.
247
+ #
248
+ def create_update_mongo_dbdatabase(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:nil)
249
+ response = create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:custom_headers).value!
250
+ response.body unless response.nil?
251
+ end
252
+
253
+ #
254
+ # @param resource_group_name [String] Name of an Azure resource group.
255
+ # @param account_name [String] Cosmos DB database account name.
256
+ # @param database_name [String] Cosmos DB database name.
257
+ # @param create_update_mongo_dbdatabase_parameters
258
+ # [MongoDBDatabaseCreateUpdateParameters] The parameters to provide for the
259
+ # current MongoDB database.
260
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
261
+ # will be added to the HTTP request.
262
+ #
263
+ # @return [Concurrent::Promise] promise which provides async access to http
264
+ # response.
265
+ #
266
+ def create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:nil)
267
+ # Send request
268
+ promise = begin_create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:custom_headers)
269
+
270
+ promise = promise.then do |response|
271
+ # Defining deserialization method.
272
+ deserialize_method = lambda do |parsed_response|
273
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBDatabaseGetResults.mapper()
274
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
275
+ end
276
+
277
+ # Waiting for response.
278
+ @client.get_long_running_operation_result(response, deserialize_method)
279
+ end
280
+
281
+ promise
282
+ end
283
+
284
+ #
285
+ # Deletes an existing Azure Cosmos DB MongoDB database.
286
+ #
287
+ # @param resource_group_name [String] Name of an Azure resource group.
288
+ # @param account_name [String] Cosmos DB database account name.
289
+ # @param database_name [String] Cosmos DB database name.
290
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
291
+ # will be added to the HTTP request.
292
+ #
293
+ def delete_mongo_dbdatabase(resource_group_name, account_name, database_name, custom_headers:nil)
294
+ response = delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
295
+ nil
296
+ end
297
+
298
+ #
299
+ # @param resource_group_name [String] Name of an Azure resource group.
300
+ # @param account_name [String] Cosmos DB database account name.
301
+ # @param database_name [String] Cosmos DB database name.
302
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
303
+ # will be added to the HTTP request.
304
+ #
305
+ # @return [Concurrent::Promise] promise which provides async access to http
306
+ # response.
307
+ #
308
+ def delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:nil)
309
+ # Send request
310
+ promise = begin_delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
311
+
312
+ promise = promise.then do |response|
313
+ # Defining deserialization method.
314
+ deserialize_method = lambda do |parsed_response|
315
+ end
316
+
317
+ # Waiting for response.
318
+ @client.get_long_running_operation_result(response, deserialize_method)
319
+ end
320
+
321
+ promise
322
+ end
323
+
324
+ #
325
+ # Gets the RUs per second of the MongoDB database under an existing Azure
326
+ # Cosmos DB database account with the provided name.
327
+ #
328
+ # @param resource_group_name [String] Name of an Azure resource group.
329
+ # @param account_name [String] Cosmos DB database account name.
330
+ # @param database_name [String] Cosmos DB database name.
331
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
332
+ # will be added to the HTTP request.
333
+ #
334
+ # @return [ThroughputSettingsGetResults] operation results.
335
+ #
336
+ def get_mongo_dbdatabase_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
337
+ response = get_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
338
+ response.body unless response.nil?
339
+ end
340
+
341
+ #
342
+ # Gets the RUs per second of the MongoDB database under an existing Azure
343
+ # Cosmos DB database account with the provided name.
344
+ #
345
+ # @param resource_group_name [String] Name of an Azure resource group.
346
+ # @param account_name [String] Cosmos DB database account name.
347
+ # @param database_name [String] Cosmos DB database name.
348
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
349
+ # will be added to the HTTP request.
350
+ #
351
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
352
+ #
353
+ def get_mongo_dbdatabase_throughput_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
354
+ get_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
355
+ end
356
+
357
+ #
358
+ # Gets the RUs per second of the MongoDB database under an existing Azure
359
+ # Cosmos DB database account with the provided name.
360
+ #
361
+ # @param resource_group_name [String] Name of an Azure resource group.
362
+ # @param account_name [String] Cosmos DB database account name.
363
+ # @param database_name [String] Cosmos DB database name.
364
+ # @param [Hash{String => String}] A hash of custom headers that will be added
365
+ # to the HTTP request.
366
+ #
367
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
368
+ #
369
+ def get_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
370
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
371
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
372
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
373
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
374
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
375
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
376
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
377
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
378
+ 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?
379
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
380
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
381
+
382
+
383
+ request_headers = {}
384
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
385
+
386
+ # Set Headers
387
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
388
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
389
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'
390
+
391
+ request_url = @base_url || @client.base_url
392
+
393
+ options = {
394
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
395
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
396
+ query_params: {'api-version' => @client.api_version},
397
+ headers: request_headers.merge(custom_headers || {}),
398
+ base_url: request_url
399
+ }
400
+ promise = @client.make_request_async(:get, path_template, options)
401
+
402
+ promise = promise.then do |result|
403
+ http_response = result.response
404
+ status_code = http_response.status
405
+ response_content = http_response.body
406
+ unless status_code == 200
407
+ error_model = JSON.load(response_content)
408
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
409
+ end
410
+
411
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
412
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
413
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
414
+ # Deserialize Response
415
+ if status_code == 200
416
+ begin
417
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
418
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
419
+ result.body = @client.deserialize(result_mapper, parsed_response)
420
+ rescue Exception => e
421
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
422
+ end
423
+ end
424
+
425
+ result
426
+ end
427
+
428
+ promise.execute
429
+ end
430
+
431
+ #
432
+ # Update RUs per second of the an Azure Cosmos DB MongoDB database
433
+ #
434
+ # @param resource_group_name [String] Name of an Azure resource group.
435
+ # @param account_name [String] Cosmos DB database account name.
436
+ # @param database_name [String] Cosmos DB database name.
437
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
438
+ # RUs per second of the parameters to provide for the current MongoDB database.
439
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
440
+ # will be added to the HTTP request.
441
+ #
442
+ # @return [ThroughputSettingsGetResults] operation results.
443
+ #
444
+ def update_mongo_dbdatabase_throughput(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
445
+ response = update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
446
+ response.body unless response.nil?
447
+ end
448
+
449
+ #
450
+ # @param resource_group_name [String] Name of an Azure resource group.
451
+ # @param account_name [String] Cosmos DB database account name.
452
+ # @param database_name [String] Cosmos DB database name.
453
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
454
+ # RUs per second of the parameters to provide for the current MongoDB database.
455
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
456
+ # will be added to the HTTP request.
457
+ #
458
+ # @return [Concurrent::Promise] promise which provides async access to http
459
+ # response.
460
+ #
461
+ def update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
462
+ # Send request
463
+ promise = begin_update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers)
464
+
465
+ promise = promise.then do |response|
466
+ # Defining deserialization method.
467
+ deserialize_method = lambda do |parsed_response|
468
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
469
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
470
+ end
471
+
472
+ # Waiting for response.
473
+ @client.get_long_running_operation_result(response, deserialize_method)
474
+ end
475
+
476
+ promise
477
+ end
478
+
479
+ #
480
+ # Lists the MongoDB collection under an existing Azure Cosmos DB database
481
+ # account.
482
+ #
483
+ # @param resource_group_name [String] Name of an Azure resource group.
484
+ # @param account_name [String] Cosmos DB database account name.
485
+ # @param database_name [String] Cosmos DB database name.
486
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
487
+ # will be added to the HTTP request.
488
+ #
489
+ # @return [MongoDBCollectionListResult] operation results.
490
+ #
491
+ def list_mongo_dbcollections(resource_group_name, account_name, database_name, custom_headers:nil)
492
+ response = list_mongo_dbcollections_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
493
+ response.body unless response.nil?
494
+ end
495
+
496
+ #
497
+ # Lists the MongoDB collection under an existing Azure Cosmos DB database
498
+ # account.
499
+ #
500
+ # @param resource_group_name [String] Name of an Azure resource group.
501
+ # @param account_name [String] Cosmos DB database account name.
502
+ # @param database_name [String] Cosmos DB database name.
503
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
504
+ # will be added to the HTTP request.
505
+ #
506
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
507
+ #
508
+ def list_mongo_dbcollections_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
509
+ list_mongo_dbcollections_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
510
+ end
511
+
512
+ #
513
+ # Lists the MongoDB collection under an existing Azure Cosmos DB database
514
+ # account.
515
+ #
516
+ # @param resource_group_name [String] Name of an Azure resource group.
517
+ # @param account_name [String] Cosmos DB database account name.
518
+ # @param database_name [String] Cosmos DB database 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_mongo_dbcollections_async(resource_group_name, account_name, database_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, 'database_name is nil' if database_name.nil?
535
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
536
+
537
+
538
+ request_headers = {}
539
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
540
+
541
+ # Set Headers
542
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
543
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
544
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections'
545
+
546
+ request_url = @base_url || @client.base_url
547
+
548
+ options = {
549
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
550
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
551
+ query_params: {'api-version' => @client.api_version},
552
+ headers: request_headers.merge(custom_headers || {}),
553
+ base_url: request_url
554
+ }
555
+ promise = @client.make_request_async(:get, path_template, options)
556
+
557
+ promise = promise.then do |result|
558
+ http_response = result.response
559
+ status_code = http_response.status
560
+ response_content = http_response.body
561
+ unless status_code == 200
562
+ error_model = JSON.load(response_content)
563
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
564
+ end
565
+
566
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
567
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
568
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
569
+ # Deserialize Response
570
+ if status_code == 200
571
+ begin
572
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
573
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBCollectionListResult.mapper()
574
+ result.body = @client.deserialize(result_mapper, parsed_response)
575
+ rescue Exception => e
576
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
577
+ end
578
+ end
579
+
580
+ result
581
+ end
582
+
583
+ promise.execute
584
+ end
585
+
586
+ #
587
+ # Gets the MongoDB collection under an existing Azure Cosmos DB database
588
+ # account.
589
+ #
590
+ # @param resource_group_name [String] Name of an Azure resource group.
591
+ # @param account_name [String] Cosmos DB database account name.
592
+ # @param database_name [String] Cosmos DB database name.
593
+ # @param collection_name [String] Cosmos DB collection name.
594
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
595
+ # will be added to the HTTP request.
596
+ #
597
+ # @return [MongoDBCollectionGetResults] operation results.
598
+ #
599
+ def get_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
600
+ response = get_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
601
+ response.body unless response.nil?
602
+ end
603
+
604
+ #
605
+ # Gets the MongoDB collection under an existing Azure Cosmos DB database
606
+ # account.
607
+ #
608
+ # @param resource_group_name [String] Name of an Azure resource group.
609
+ # @param account_name [String] Cosmos DB database account name.
610
+ # @param database_name [String] Cosmos DB database name.
611
+ # @param collection_name [String] Cosmos DB collection name.
612
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
613
+ # will be added to the HTTP request.
614
+ #
615
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
616
+ #
617
+ def get_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
618
+ get_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
619
+ end
620
+
621
+ #
622
+ # Gets the MongoDB collection under an existing Azure Cosmos DB database
623
+ # account.
624
+ #
625
+ # @param resource_group_name [String] Name of an Azure resource group.
626
+ # @param account_name [String] Cosmos DB database account name.
627
+ # @param database_name [String] Cosmos DB database name.
628
+ # @param collection_name [String] Cosmos DB collection name.
629
+ # @param [Hash{String => String}] A hash of custom headers that will be added
630
+ # to the HTTP request.
631
+ #
632
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
633
+ #
634
+ def get_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
635
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
636
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
637
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
638
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
639
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
640
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
641
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
642
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
643
+ 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?
644
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
645
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
646
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
647
+
648
+
649
+ request_headers = {}
650
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
651
+
652
+ # Set Headers
653
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
654
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
655
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
656
+
657
+ request_url = @base_url || @client.base_url
658
+
659
+ options = {
660
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
661
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
662
+ query_params: {'api-version' => @client.api_version},
663
+ headers: request_headers.merge(custom_headers || {}),
664
+ base_url: request_url
665
+ }
666
+ promise = @client.make_request_async(:get, path_template, options)
667
+
668
+ promise = promise.then do |result|
669
+ http_response = result.response
670
+ status_code = http_response.status
671
+ response_content = http_response.body
672
+ unless status_code == 200
673
+ error_model = JSON.load(response_content)
674
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
675
+ end
676
+
677
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
678
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
679
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
680
+ # Deserialize Response
681
+ if status_code == 200
682
+ begin
683
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
684
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBCollectionGetResults.mapper()
685
+ result.body = @client.deserialize(result_mapper, parsed_response)
686
+ rescue Exception => e
687
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
688
+ end
689
+ end
690
+
691
+ result
692
+ end
693
+
694
+ promise.execute
695
+ end
696
+
697
+ #
698
+ # Create or update an Azure Cosmos DB MongoDB Collection
699
+ #
700
+ # @param resource_group_name [String] Name of an Azure resource group.
701
+ # @param account_name [String] Cosmos DB database account name.
702
+ # @param database_name [String] Cosmos DB database name.
703
+ # @param collection_name [String] Cosmos DB collection name.
704
+ # @param create_update_mongo_dbcollection_parameters
705
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
706
+ # current MongoDB Collection.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ # @return [MongoDBCollectionGetResults] operation results.
711
+ #
712
+ def create_update_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
713
+ response = create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
714
+ response.body unless response.nil?
715
+ end
716
+
717
+ #
718
+ # @param resource_group_name [String] Name of an Azure resource group.
719
+ # @param account_name [String] Cosmos DB database account name.
720
+ # @param database_name [String] Cosmos DB database name.
721
+ # @param collection_name [String] Cosmos DB collection name.
722
+ # @param create_update_mongo_dbcollection_parameters
723
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
724
+ # current MongoDB Collection.
725
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
726
+ # will be added to the HTTP request.
727
+ #
728
+ # @return [Concurrent::Promise] promise which provides async access to http
729
+ # response.
730
+ #
731
+ def create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
732
+ # Send request
733
+ promise = begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers)
734
+
735
+ promise = promise.then do |response|
736
+ # Defining deserialization method.
737
+ deserialize_method = lambda do |parsed_response|
738
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBCollectionGetResults.mapper()
739
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
740
+ end
741
+
742
+ # Waiting for response.
743
+ @client.get_long_running_operation_result(response, deserialize_method)
744
+ end
745
+
746
+ promise
747
+ end
748
+
749
+ #
750
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
751
+ #
752
+ # @param resource_group_name [String] Name of an Azure resource group.
753
+ # @param account_name [String] Cosmos DB database account name.
754
+ # @param database_name [String] Cosmos DB database name.
755
+ # @param collection_name [String] Cosmos DB collection name.
756
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
757
+ # will be added to the HTTP request.
758
+ #
759
+ def delete_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
760
+ response = delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
761
+ nil
762
+ end
763
+
764
+ #
765
+ # @param resource_group_name [String] Name of an Azure resource group.
766
+ # @param account_name [String] Cosmos DB database account name.
767
+ # @param database_name [String] Cosmos DB database name.
768
+ # @param collection_name [String] Cosmos DB collection name.
769
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
770
+ # will be added to the HTTP request.
771
+ #
772
+ # @return [Concurrent::Promise] promise which provides async access to http
773
+ # response.
774
+ #
775
+ def delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
776
+ # Send request
777
+ promise = begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers)
778
+
779
+ promise = promise.then do |response|
780
+ # Defining deserialization method.
781
+ deserialize_method = lambda do |parsed_response|
782
+ end
783
+
784
+ # Waiting for response.
785
+ @client.get_long_running_operation_result(response, deserialize_method)
786
+ end
787
+
788
+ promise
789
+ end
790
+
791
+ #
792
+ # Gets the RUs per second of the MongoDB collection under an existing Azure
793
+ # Cosmos DB database account with the provided name.
794
+ #
795
+ # @param resource_group_name [String] Name of an Azure resource group.
796
+ # @param account_name [String] Cosmos DB database account name.
797
+ # @param database_name [String] Cosmos DB database name.
798
+ # @param collection_name [String] Cosmos DB collection name.
799
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
800
+ # will be added to the HTTP request.
801
+ #
802
+ # @return [ThroughputSettingsGetResults] operation results.
803
+ #
804
+ def get_mongo_dbcollection_throughput(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
805
+ response = get_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
806
+ response.body unless response.nil?
807
+ end
808
+
809
+ #
810
+ # Gets the RUs per second of the MongoDB collection under an existing Azure
811
+ # Cosmos DB database account with the provided name.
812
+ #
813
+ # @param resource_group_name [String] Name of an Azure resource group.
814
+ # @param account_name [String] Cosmos DB database account name.
815
+ # @param database_name [String] Cosmos DB database name.
816
+ # @param collection_name [String] Cosmos DB collection name.
817
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
818
+ # will be added to the HTTP request.
819
+ #
820
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
821
+ #
822
+ def get_mongo_dbcollection_throughput_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
823
+ get_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
824
+ end
825
+
826
+ #
827
+ # Gets the RUs per second of the MongoDB collection under an existing Azure
828
+ # Cosmos DB database account with the provided name.
829
+ #
830
+ # @param resource_group_name [String] Name of an Azure resource group.
831
+ # @param account_name [String] Cosmos DB database account name.
832
+ # @param database_name [String] Cosmos DB database name.
833
+ # @param collection_name [String] Cosmos DB collection name.
834
+ # @param [Hash{String => String}] A hash of custom headers that will be added
835
+ # to the HTTP request.
836
+ #
837
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
838
+ #
839
+ def get_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
840
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
841
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
842
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
843
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
844
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
845
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
846
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
847
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
848
+ 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?
849
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
850
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
851
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
852
+
853
+
854
+ request_headers = {}
855
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
856
+
857
+ # Set Headers
858
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
859
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
860
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'
861
+
862
+ request_url = @base_url || @client.base_url
863
+
864
+ options = {
865
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
866
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
867
+ query_params: {'api-version' => @client.api_version},
868
+ headers: request_headers.merge(custom_headers || {}),
869
+ base_url: request_url
870
+ }
871
+ promise = @client.make_request_async(:get, path_template, options)
872
+
873
+ promise = promise.then do |result|
874
+ http_response = result.response
875
+ status_code = http_response.status
876
+ response_content = http_response.body
877
+ unless status_code == 200
878
+ error_model = JSON.load(response_content)
879
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
880
+ end
881
+
882
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
883
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
884
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
885
+ # Deserialize Response
886
+ if status_code == 200
887
+ begin
888
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
889
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
890
+ result.body = @client.deserialize(result_mapper, parsed_response)
891
+ rescue Exception => e
892
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
893
+ end
894
+ end
895
+
896
+ result
897
+ end
898
+
899
+ promise.execute
900
+ end
901
+
902
+ #
903
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
904
+ #
905
+ # @param resource_group_name [String] Name of an Azure resource group.
906
+ # @param account_name [String] Cosmos DB database account name.
907
+ # @param database_name [String] Cosmos DB database name.
908
+ # @param collection_name [String] Cosmos DB collection name.
909
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
910
+ # RUs per second of the parameters to provide for the current MongoDB
911
+ # collection.
912
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
913
+ # will be added to the HTTP request.
914
+ #
915
+ # @return [ThroughputSettingsGetResults] operation results.
916
+ #
917
+ def update_mongo_dbcollection_throughput(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
918
+ response = update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers).value!
919
+ response.body unless response.nil?
920
+ end
921
+
922
+ #
923
+ # @param resource_group_name [String] Name of an Azure resource group.
924
+ # @param account_name [String] Cosmos DB database account name.
925
+ # @param database_name [String] Cosmos DB database name.
926
+ # @param collection_name [String] Cosmos DB collection name.
927
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
928
+ # RUs per second of the parameters to provide for the current MongoDB
929
+ # collection.
930
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
931
+ # will be added to the HTTP request.
932
+ #
933
+ # @return [Concurrent::Promise] promise which provides async access to http
934
+ # response.
935
+ #
936
+ def update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
937
+ # Send request
938
+ promise = begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers)
939
+
940
+ promise = promise.then do |response|
941
+ # Defining deserialization method.
942
+ deserialize_method = lambda do |parsed_response|
943
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
944
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
945
+ end
946
+
947
+ # Waiting for response.
948
+ @client.get_long_running_operation_result(response, deserialize_method)
949
+ end
950
+
951
+ promise
952
+ end
953
+
954
+ #
955
+ # Create or updates Azure Cosmos DB MongoDB database
956
+ #
957
+ # @param resource_group_name [String] Name of an Azure resource group.
958
+ # @param account_name [String] Cosmos DB database account name.
959
+ # @param database_name [String] Cosmos DB database name.
960
+ # @param create_update_mongo_dbdatabase_parameters
961
+ # [MongoDBDatabaseCreateUpdateParameters] The parameters to provide for the
962
+ # current MongoDB database.
963
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
964
+ # will be added to the HTTP request.
965
+ #
966
+ # @return [MongoDBDatabaseGetResults] operation results.
967
+ #
968
+ def begin_create_update_mongo_dbdatabase(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:nil)
969
+ response = begin_create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:custom_headers).value!
970
+ response.body unless response.nil?
971
+ end
972
+
973
+ #
974
+ # Create or updates Azure Cosmos DB MongoDB database
975
+ #
976
+ # @param resource_group_name [String] Name of an Azure resource group.
977
+ # @param account_name [String] Cosmos DB database account name.
978
+ # @param database_name [String] Cosmos DB database name.
979
+ # @param create_update_mongo_dbdatabase_parameters
980
+ # [MongoDBDatabaseCreateUpdateParameters] The parameters to provide for the
981
+ # current MongoDB database.
982
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
983
+ # will be added to the HTTP request.
984
+ #
985
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
986
+ #
987
+ def begin_create_update_mongo_dbdatabase_with_http_info(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:nil)
988
+ begin_create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:custom_headers).value!
989
+ end
990
+
991
+ #
992
+ # Create or updates Azure Cosmos DB MongoDB database
993
+ #
994
+ # @param resource_group_name [String] Name of an Azure resource group.
995
+ # @param account_name [String] Cosmos DB database account name.
996
+ # @param database_name [String] Cosmos DB database name.
997
+ # @param create_update_mongo_dbdatabase_parameters
998
+ # [MongoDBDatabaseCreateUpdateParameters] The parameters to provide for the
999
+ # current MongoDB database.
1000
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1001
+ # to the HTTP request.
1002
+ #
1003
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1004
+ #
1005
+ def begin_create_update_mongo_dbdatabase_async(resource_group_name, account_name, database_name, create_update_mongo_dbdatabase_parameters, custom_headers:nil)
1006
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1007
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1008
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1009
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1010
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1011
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1012
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1013
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1014
+ 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?
1015
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1016
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1017
+ fail ArgumentError, 'create_update_mongo_dbdatabase_parameters is nil' if create_update_mongo_dbdatabase_parameters.nil?
1018
+
1019
+
1020
+ request_headers = {}
1021
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1022
+
1023
+ # Set Headers
1024
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1025
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1026
+
1027
+ # Serialize Request
1028
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBDatabaseCreateUpdateParameters.mapper()
1029
+ request_content = @client.serialize(request_mapper, create_update_mongo_dbdatabase_parameters)
1030
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1031
+
1032
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'
1033
+
1034
+ request_url = @base_url || @client.base_url
1035
+
1036
+ options = {
1037
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1038
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1039
+ query_params: {'api-version' => @client.api_version},
1040
+ body: request_content,
1041
+ headers: request_headers.merge(custom_headers || {}),
1042
+ base_url: request_url
1043
+ }
1044
+ promise = @client.make_request_async(:put, path_template, options)
1045
+
1046
+ promise = promise.then do |result|
1047
+ http_response = result.response
1048
+ status_code = http_response.status
1049
+ response_content = http_response.body
1050
+ unless status_code == 202 || status_code == 200
1051
+ error_model = JSON.load(response_content)
1052
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1053
+ end
1054
+
1055
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1056
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1057
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1058
+ # Deserialize Response
1059
+ if status_code == 200
1060
+ begin
1061
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1062
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBDatabaseGetResults.mapper()
1063
+ result.body = @client.deserialize(result_mapper, parsed_response)
1064
+ rescue Exception => e
1065
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1066
+ end
1067
+ end
1068
+
1069
+ result
1070
+ end
1071
+
1072
+ promise.execute
1073
+ end
1074
+
1075
+ #
1076
+ # Deletes an existing Azure Cosmos DB MongoDB database.
1077
+ #
1078
+ # @param resource_group_name [String] Name of an Azure resource group.
1079
+ # @param account_name [String] Cosmos DB database account name.
1080
+ # @param database_name [String] Cosmos DB database name.
1081
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1082
+ # will be added to the HTTP request.
1083
+ #
1084
+ #
1085
+ def begin_delete_mongo_dbdatabase(resource_group_name, account_name, database_name, custom_headers:nil)
1086
+ response = begin_delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1087
+ nil
1088
+ end
1089
+
1090
+ #
1091
+ # Deletes an existing Azure Cosmos DB MongoDB database.
1092
+ #
1093
+ # @param resource_group_name [String] Name of an Azure resource group.
1094
+ # @param account_name [String] Cosmos DB database account name.
1095
+ # @param database_name [String] Cosmos DB database name.
1096
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1097
+ # will be added to the HTTP request.
1098
+ #
1099
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1100
+ #
1101
+ def begin_delete_mongo_dbdatabase_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
1102
+ begin_delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
1103
+ end
1104
+
1105
+ #
1106
+ # Deletes an existing Azure Cosmos DB MongoDB database.
1107
+ #
1108
+ # @param resource_group_name [String] Name of an Azure resource group.
1109
+ # @param account_name [String] Cosmos DB database account name.
1110
+ # @param database_name [String] Cosmos DB database name.
1111
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1112
+ # to the HTTP request.
1113
+ #
1114
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1115
+ #
1116
+ def begin_delete_mongo_dbdatabase_async(resource_group_name, account_name, database_name, custom_headers:nil)
1117
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1118
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1119
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1120
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1121
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1122
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1123
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1124
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1125
+ 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?
1126
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1127
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1128
+
1129
+
1130
+ request_headers = {}
1131
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1132
+
1133
+ # Set Headers
1134
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1135
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1136
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}'
1137
+
1138
+ request_url = @base_url || @client.base_url
1139
+
1140
+ options = {
1141
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1142
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1143
+ query_params: {'api-version' => @client.api_version},
1144
+ headers: request_headers.merge(custom_headers || {}),
1145
+ base_url: request_url
1146
+ }
1147
+ promise = @client.make_request_async(:delete, path_template, options)
1148
+
1149
+ promise = promise.then do |result|
1150
+ http_response = result.response
1151
+ status_code = http_response.status
1152
+ response_content = http_response.body
1153
+ unless status_code == 202 || status_code == 204
1154
+ error_model = JSON.load(response_content)
1155
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1156
+ end
1157
+
1158
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1159
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1160
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1161
+
1162
+ result
1163
+ end
1164
+
1165
+ promise.execute
1166
+ end
1167
+
1168
+ #
1169
+ # Update RUs per second of the an Azure Cosmos DB MongoDB database
1170
+ #
1171
+ # @param resource_group_name [String] Name of an Azure resource group.
1172
+ # @param account_name [String] Cosmos DB database account name.
1173
+ # @param database_name [String] Cosmos DB database name.
1174
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1175
+ # RUs per second of the parameters to provide for the current MongoDB database.
1176
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1177
+ # will be added to the HTTP request.
1178
+ #
1179
+ # @return [ThroughputSettingsGetResults] operation results.
1180
+ #
1181
+ def begin_update_mongo_dbdatabase_throughput(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
1182
+ response = begin_update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
1183
+ response.body unless response.nil?
1184
+ end
1185
+
1186
+ #
1187
+ # Update RUs per second of the an Azure Cosmos DB MongoDB database
1188
+ #
1189
+ # @param resource_group_name [String] Name of an Azure resource group.
1190
+ # @param account_name [String] Cosmos DB database account name.
1191
+ # @param database_name [String] Cosmos DB database name.
1192
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1193
+ # RUs per second of the parameters to provide for the current MongoDB database.
1194
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1195
+ # will be added to the HTTP request.
1196
+ #
1197
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1198
+ #
1199
+ def begin_update_mongo_dbdatabase_throughput_with_http_info(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
1200
+ begin_update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
1201
+ end
1202
+
1203
+ #
1204
+ # Update RUs per second of the an Azure Cosmos DB MongoDB database
1205
+ #
1206
+ # @param resource_group_name [String] Name of an Azure resource group.
1207
+ # @param account_name [String] Cosmos DB database account name.
1208
+ # @param database_name [String] Cosmos DB database name.
1209
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1210
+ # RUs per second of the parameters to provide for the current MongoDB database.
1211
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1212
+ # to the HTTP request.
1213
+ #
1214
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1215
+ #
1216
+ def begin_update_mongo_dbdatabase_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
1217
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1218
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1219
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1220
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1221
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1222
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1223
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1224
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1225
+ 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?
1226
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1227
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1228
+ fail ArgumentError, 'update_throughput_parameters is nil' if update_throughput_parameters.nil?
1229
+
1230
+
1231
+ request_headers = {}
1232
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1233
+
1234
+ # Set Headers
1235
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1236
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1237
+
1238
+ # Serialize Request
1239
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsUpdateParameters.mapper()
1240
+ request_content = @client.serialize(request_mapper, update_throughput_parameters)
1241
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1242
+
1243
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/throughputSettings/default'
1244
+
1245
+ request_url = @base_url || @client.base_url
1246
+
1247
+ options = {
1248
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1249
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
1250
+ query_params: {'api-version' => @client.api_version},
1251
+ body: request_content,
1252
+ headers: request_headers.merge(custom_headers || {}),
1253
+ base_url: request_url
1254
+ }
1255
+ promise = @client.make_request_async(:put, path_template, options)
1256
+
1257
+ promise = promise.then do |result|
1258
+ http_response = result.response
1259
+ status_code = http_response.status
1260
+ response_content = http_response.body
1261
+ unless status_code == 202 || status_code == 200
1262
+ error_model = JSON.load(response_content)
1263
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1264
+ end
1265
+
1266
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1267
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1268
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1269
+ # Deserialize Response
1270
+ if status_code == 200
1271
+ begin
1272
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1273
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
1274
+ result.body = @client.deserialize(result_mapper, parsed_response)
1275
+ rescue Exception => e
1276
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1277
+ end
1278
+ end
1279
+
1280
+ result
1281
+ end
1282
+
1283
+ promise.execute
1284
+ end
1285
+
1286
+ #
1287
+ # Create or update an Azure Cosmos DB MongoDB Collection
1288
+ #
1289
+ # @param resource_group_name [String] Name of an Azure resource group.
1290
+ # @param account_name [String] Cosmos DB database account name.
1291
+ # @param database_name [String] Cosmos DB database name.
1292
+ # @param collection_name [String] Cosmos DB collection name.
1293
+ # @param create_update_mongo_dbcollection_parameters
1294
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1295
+ # current MongoDB Collection.
1296
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1297
+ # will be added to the HTTP request.
1298
+ #
1299
+ # @return [MongoDBCollectionGetResults] operation results.
1300
+ #
1301
+ def begin_create_update_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1302
+ response = begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1303
+ response.body unless response.nil?
1304
+ end
1305
+
1306
+ #
1307
+ # Create or update an Azure Cosmos DB MongoDB Collection
1308
+ #
1309
+ # @param resource_group_name [String] Name of an Azure resource group.
1310
+ # @param account_name [String] Cosmos DB database account name.
1311
+ # @param database_name [String] Cosmos DB database name.
1312
+ # @param collection_name [String] Cosmos DB collection name.
1313
+ # @param create_update_mongo_dbcollection_parameters
1314
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1315
+ # current MongoDB Collection.
1316
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1317
+ # will be added to the HTTP request.
1318
+ #
1319
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1320
+ #
1321
+ def begin_create_update_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1322
+ begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:custom_headers).value!
1323
+ end
1324
+
1325
+ #
1326
+ # Create or update an Azure Cosmos DB MongoDB Collection
1327
+ #
1328
+ # @param resource_group_name [String] Name of an Azure resource group.
1329
+ # @param account_name [String] Cosmos DB database account name.
1330
+ # @param database_name [String] Cosmos DB database name.
1331
+ # @param collection_name [String] Cosmos DB collection name.
1332
+ # @param create_update_mongo_dbcollection_parameters
1333
+ # [MongoDBCollectionCreateUpdateParameters] The parameters to provide for the
1334
+ # current MongoDB Collection.
1335
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1336
+ # to the HTTP request.
1337
+ #
1338
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1339
+ #
1340
+ def begin_create_update_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, create_update_mongo_dbcollection_parameters, custom_headers:nil)
1341
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1342
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1343
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1344
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1345
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1346
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1347
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1348
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1349
+ 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?
1350
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1351
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1352
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1353
+ fail ArgumentError, 'create_update_mongo_dbcollection_parameters is nil' if create_update_mongo_dbcollection_parameters.nil?
1354
+
1355
+
1356
+ request_headers = {}
1357
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1358
+
1359
+ # Set Headers
1360
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1361
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1362
+
1363
+ # Serialize Request
1364
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBCollectionCreateUpdateParameters.mapper()
1365
+ request_content = @client.serialize(request_mapper, create_update_mongo_dbcollection_parameters)
1366
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1367
+
1368
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1369
+
1370
+ request_url = @base_url || @client.base_url
1371
+
1372
+ options = {
1373
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1374
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1375
+ query_params: {'api-version' => @client.api_version},
1376
+ body: request_content,
1377
+ headers: request_headers.merge(custom_headers || {}),
1378
+ base_url: request_url
1379
+ }
1380
+ promise = @client.make_request_async(:put, path_template, options)
1381
+
1382
+ promise = promise.then do |result|
1383
+ http_response = result.response
1384
+ status_code = http_response.status
1385
+ response_content = http_response.body
1386
+ unless status_code == 202 || status_code == 200
1387
+ error_model = JSON.load(response_content)
1388
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1389
+ end
1390
+
1391
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1392
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1393
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1394
+ # Deserialize Response
1395
+ if status_code == 200
1396
+ begin
1397
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1398
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::MongoDBCollectionGetResults.mapper()
1399
+ result.body = @client.deserialize(result_mapper, parsed_response)
1400
+ rescue Exception => e
1401
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1402
+ end
1403
+ end
1404
+
1405
+ result
1406
+ end
1407
+
1408
+ promise.execute
1409
+ end
1410
+
1411
+ #
1412
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1413
+ #
1414
+ # @param resource_group_name [String] Name of an Azure resource group.
1415
+ # @param account_name [String] Cosmos DB database account name.
1416
+ # @param database_name [String] Cosmos DB database name.
1417
+ # @param collection_name [String] Cosmos DB collection name.
1418
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1419
+ # will be added to the HTTP request.
1420
+ #
1421
+ #
1422
+ def begin_delete_mongo_dbcollection(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1423
+ response = begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1424
+ nil
1425
+ end
1426
+
1427
+ #
1428
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1429
+ #
1430
+ # @param resource_group_name [String] Name of an Azure resource group.
1431
+ # @param account_name [String] Cosmos DB database account name.
1432
+ # @param database_name [String] Cosmos DB database name.
1433
+ # @param collection_name [String] Cosmos DB collection name.
1434
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1435
+ # will be added to the HTTP request.
1436
+ #
1437
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1438
+ #
1439
+ def begin_delete_mongo_dbcollection_with_http_info(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1440
+ begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:custom_headers).value!
1441
+ end
1442
+
1443
+ #
1444
+ # Deletes an existing Azure Cosmos DB MongoDB Collection.
1445
+ #
1446
+ # @param resource_group_name [String] Name of an Azure resource group.
1447
+ # @param account_name [String] Cosmos DB database account name.
1448
+ # @param database_name [String] Cosmos DB database name.
1449
+ # @param collection_name [String] Cosmos DB collection name.
1450
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1451
+ # to the HTTP request.
1452
+ #
1453
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1454
+ #
1455
+ def begin_delete_mongo_dbcollection_async(resource_group_name, account_name, database_name, collection_name, custom_headers:nil)
1456
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1457
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1458
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1459
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1460
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1461
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1462
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1463
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1464
+ 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?
1465
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1466
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1467
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1468
+
1469
+
1470
+ request_headers = {}
1471
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1472
+
1473
+ # Set Headers
1474
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1475
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1476
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}'
1477
+
1478
+ request_url = @base_url || @client.base_url
1479
+
1480
+ options = {
1481
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1482
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1483
+ query_params: {'api-version' => @client.api_version},
1484
+ headers: request_headers.merge(custom_headers || {}),
1485
+ base_url: request_url
1486
+ }
1487
+ promise = @client.make_request_async(:delete, path_template, options)
1488
+
1489
+ promise = promise.then do |result|
1490
+ http_response = result.response
1491
+ status_code = http_response.status
1492
+ response_content = http_response.body
1493
+ unless status_code == 202 || status_code == 204
1494
+ error_model = JSON.load(response_content)
1495
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1496
+ end
1497
+
1498
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1499
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1500
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1501
+
1502
+ result
1503
+ end
1504
+
1505
+ promise.execute
1506
+ end
1507
+
1508
+ #
1509
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1510
+ #
1511
+ # @param resource_group_name [String] Name of an Azure resource group.
1512
+ # @param account_name [String] Cosmos DB database account name.
1513
+ # @param database_name [String] Cosmos DB database name.
1514
+ # @param collection_name [String] Cosmos DB collection name.
1515
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1516
+ # RUs per second of the parameters to provide for the current MongoDB
1517
+ # collection.
1518
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1519
+ # will be added to the HTTP request.
1520
+ #
1521
+ # @return [ThroughputSettingsGetResults] operation results.
1522
+ #
1523
+ def begin_update_mongo_dbcollection_throughput(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
1524
+ response = begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers).value!
1525
+ response.body unless response.nil?
1526
+ end
1527
+
1528
+ #
1529
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1530
+ #
1531
+ # @param resource_group_name [String] Name of an Azure resource group.
1532
+ # @param account_name [String] Cosmos DB database account name.
1533
+ # @param database_name [String] Cosmos DB database name.
1534
+ # @param collection_name [String] Cosmos DB collection name.
1535
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1536
+ # RUs per second of the parameters to provide for the current MongoDB
1537
+ # collection.
1538
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1539
+ # will be added to the HTTP request.
1540
+ #
1541
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1542
+ #
1543
+ def begin_update_mongo_dbcollection_throughput_with_http_info(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
1544
+ begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:custom_headers).value!
1545
+ end
1546
+
1547
+ #
1548
+ # Update the RUs per second of an Azure Cosmos DB MongoDB collection
1549
+ #
1550
+ # @param resource_group_name [String] Name of an Azure resource group.
1551
+ # @param account_name [String] Cosmos DB database account name.
1552
+ # @param database_name [String] Cosmos DB database name.
1553
+ # @param collection_name [String] Cosmos DB collection name.
1554
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
1555
+ # RUs per second of the parameters to provide for the current MongoDB
1556
+ # collection.
1557
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1558
+ # to the HTTP request.
1559
+ #
1560
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1561
+ #
1562
+ def begin_update_mongo_dbcollection_throughput_async(resource_group_name, account_name, database_name, collection_name, update_throughput_parameters, custom_headers:nil)
1563
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1564
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1565
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1566
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1567
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1568
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1569
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1570
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1571
+ 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?
1572
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1573
+ fail ArgumentError, 'collection_name is nil' if collection_name.nil?
1574
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1575
+ fail ArgumentError, 'update_throughput_parameters is nil' if update_throughput_parameters.nil?
1576
+
1577
+
1578
+ request_headers = {}
1579
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1580
+
1581
+ # Set Headers
1582
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1583
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1584
+
1585
+ # Serialize Request
1586
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsUpdateParameters.mapper()
1587
+ request_content = @client.serialize(request_mapper, update_throughput_parameters)
1588
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1589
+
1590
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/throughputSettings/default'
1591
+
1592
+ request_url = @base_url || @client.base_url
1593
+
1594
+ options = {
1595
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1596
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'collectionName' => collection_name},
1597
+ query_params: {'api-version' => @client.api_version},
1598
+ body: request_content,
1599
+ headers: request_headers.merge(custom_headers || {}),
1600
+ base_url: request_url
1601
+ }
1602
+ promise = @client.make_request_async(:put, path_template, options)
1603
+
1604
+ promise = promise.then do |result|
1605
+ http_response = result.response
1606
+ status_code = http_response.status
1607
+ response_content = http_response.body
1608
+ unless status_code == 202 || status_code == 200
1609
+ error_model = JSON.load(response_content)
1610
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1611
+ end
1612
+
1613
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1614
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1615
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1616
+ # Deserialize Response
1617
+ if status_code == 200
1618
+ begin
1619
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1620
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
1621
+ result.body = @client.deserialize(result_mapper, parsed_response)
1622
+ rescue Exception => e
1623
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1624
+ end
1625
+ end
1626
+
1627
+ result
1628
+ end
1629
+
1630
+ promise.execute
1631
+ end
1632
+
1633
+ end
1634
+ end