azure_mgmt_cosmosdb 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +5 -5
  2. data/LICENSE.txt +20 -20
  3. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb.rb +0 -0
  4. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection.rb +0 -0
  5. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition.rb +0 -0
  6. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +0 -0
  7. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/collection_region.rb +0 -0
  8. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/cosmos_db.rb +1 -1
  9. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database.rb +0 -0
  10. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_account_region.rb +0 -0
  11. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/database_accounts.rb +0 -0
  12. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/capability.rb +0 -0
  13. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace.rb +0 -0
  14. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +0 -0
  15. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +0 -0
  16. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +0 -0
  17. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +0 -0
  18. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +0 -0
  19. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table.rb +0 -0
  20. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +0 -0
  21. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +0 -0
  22. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +0 -0
  23. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +0 -0
  24. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/column.rb +0 -0
  25. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +0 -0
  26. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +0 -0
  27. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +0 -0
  28. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +0 -0
  29. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +0 -0
  30. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/data_type.rb +0 -0
  31. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account.rb +0 -0
  32. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +0 -0
  33. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +0 -0
  34. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +0 -0
  35. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +0 -0
  36. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +0 -0
  37. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +0 -0
  38. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +0 -0
  39. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_patch_parameters.rb +0 -0
  40. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +0 -0
  41. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +0 -0
  42. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +0 -0
  43. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/error_response.rb +0 -0
  44. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +0 -0
  45. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +0 -0
  46. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +0 -0
  47. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +0 -0
  48. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database.rb +0 -0
  49. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +0 -0
  50. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +0 -0
  51. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +0 -0
  52. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph.rb +0 -0
  53. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +0 -0
  54. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +0 -0
  55. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +0 -0
  56. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/included_path.rb +0 -0
  57. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/index_kind.rb +0 -0
  58. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexes.rb +0 -0
  59. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +0 -0
  60. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +0 -0
  61. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/key_kind.rb +0 -0
  62. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/location.rb +0 -0
  63. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric.rb +0 -0
  64. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +0 -0
  65. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +0 -0
  66. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +0 -0
  67. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +0 -0
  68. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_name.rb +0 -0
  69. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/metric_value.rb +0 -0
  70. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection.rb +0 -0
  71. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +0 -0
  72. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +0 -0
  73. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +0 -0
  74. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase.rb +0 -0
  75. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +0 -0
  76. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +0 -0
  77. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +0 -0
  78. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +0 -0
  79. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +0 -0
  80. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +0 -0
  81. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation.rb +0 -0
  82. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_display.rb +0 -0
  83. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +0 -0
  84. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +0 -0
  85. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +0 -0
  86. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +0 -0
  87. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +0 -0
  88. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +0 -0
  89. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +0 -0
  90. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +0 -0
  91. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +0 -0
  92. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +0 -0
  93. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +0 -0
  94. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/resource.rb +0 -0
  95. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container.rb +0 -0
  96. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +0 -0
  97. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +0 -0
  98. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +0 -0
  99. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database.rb +0 -0
  100. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +0 -0
  101. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +0 -0
  102. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +0 -0
  103. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table.rb +0 -0
  104. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +0 -0
  105. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +0 -0
  106. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/table_resource.rb +0 -0
  107. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput.rb +0 -0
  108. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_resource.rb +0 -0
  109. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/throughput_update_parameters.rb +0 -0
  110. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key.rb +0 -0
  111. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +0 -0
  112. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/unit_type.rb +0 -0
  113. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usage.rb +0 -0
  114. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/usages_result.rb +0 -0
  115. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +0 -0
  116. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/module_definition.rb +0 -0
  117. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/operations.rb +0 -0
  118. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +0 -0
  119. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +0 -0
  120. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile.rb +0 -0
  121. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +0 -0
  122. data/lib/2015-04-08/generated/azure_mgmt_cosmosdb/percentile_target.rb +0 -0
  123. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb.rb +41 -0
  124. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/cosmos_db.rb +142 -0
  125. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  126. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/azure_entity_resource.rb +75 -0
  127. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  128. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection.rb +88 -0
  129. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_connection_list_result.rb +56 -0
  130. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_endpoint_property.rb +46 -0
  131. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource.rb +95 -0
  132. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_resource_list_result.rb +55 -0
  133. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/private_link_service_connection_state_property.rb +71 -0
  134. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/proxy_resource.rb +63 -0
  135. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/resource.rb +83 -0
  136. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/models/tracked_resource.rb +92 -0
  137. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  138. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_endpoint_connections.rb +560 -0
  139. data/lib/2019-08-01-preview/generated/azure_mgmt_cosmosdb/private_link_resources.rb +235 -0
  140. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb.rb +164 -0
  141. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cassandra_resources.rb +1628 -0
  142. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection.rb +374 -0
  143. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition.rb +269 -0
  144. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_partition_region.rb +156 -0
  145. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/collection_region.rb +156 -0
  146. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/cosmos_db.rb +200 -0
  147. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database.rb +362 -0
  148. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_account_region.rb +148 -0
  149. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/database_accounts.rb +2184 -0
  150. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/gremlin_resources.rb +1623 -0
  151. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armproxy_resource.rb +73 -0
  152. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/armresource_properties.rb +102 -0
  153. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/capability.rb +48 -0
  154. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_create_update_parameters.rb +120 -0
  155. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_get_results.rb +135 -0
  156. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_list_result.rb +58 -0
  157. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_keyspace_resource.rb +46 -0
  158. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_partition_key.rb +46 -0
  159. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_schema.rb +95 -0
  160. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_create_update_parameters.rb +120 -0
  161. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_get_results.rb +158 -0
  162. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_list_result.rb +58 -0
  163. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cassandra_table_resource.rb +69 -0
  164. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/cluster_key.rb +58 -0
  165. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/column.rb +57 -0
  166. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_mode.rb +16 -0
  167. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/conflict_resolution_policy.rb +73 -0
  168. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/connector_offer.rb +15 -0
  169. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/consistency_policy.rb +86 -0
  170. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/container_partition_key.rb +85 -0
  171. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/data_type.rb +20 -0
  172. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_connection_string.rb +59 -0
  173. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_create_update_parameters.rb +279 -0
  174. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_get_results.rb +371 -0
  175. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_kind.rb +17 -0
  176. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_connection_strings_result.rb +57 -0
  177. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_keys_result.rb +77 -0
  178. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_list_read_only_keys_result.rb +59 -0
  179. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_offer_type.rb +15 -0
  180. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_regenerate_key_parameters.rb +47 -0
  181. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_account_update_parameters.rb +230 -0
  182. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/database_accounts_list_result.rb +58 -0
  183. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/default_consistency_level.rb +19 -0
  184. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/error_response.rb +57 -0
  185. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/excluded_path.rb +48 -0
  186. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/extended_resource_properties.rb +74 -0
  187. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policies.rb +55 -0
  188. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/failover_policy.rb +79 -0
  189. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_create_update_parameters.rb +120 -0
  190. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_get_results.rb +135 -0
  191. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_list_result.rb +58 -0
  192. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_database_resource.rb +46 -0
  193. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_create_update_parameters.rb +120 -0
  194. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_get_results.rb +200 -0
  195. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_list_result.rb +58 -0
  196. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/gremlin_graph_resource.rb +111 -0
  197. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/included_path.rb +67 -0
  198. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/index_kind.rb +17 -0
  199. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexes.rb +73 -0
  200. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_mode.rb +17 -0
  201. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/indexing_policy.rb +99 -0
  202. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/key_kind.rb +18 -0
  203. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/location.rb +114 -0
  204. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric.rb +120 -0
  205. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_availability.rb +60 -0
  206. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definition.rb +109 -0
  207. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_definitions_list_result.rb +57 -0
  208. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_list_result.rb +56 -0
  209. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_name.rb +59 -0
  210. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/metric_value.rb +107 -0
  211. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_create_update_parameters.rb +120 -0
  212. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_get_results.rb +175 -0
  213. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_list_result.rb +58 -0
  214. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbcollection_resource.rb +86 -0
  215. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_create_update_parameters.rb +120 -0
  216. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_get_results.rb +135 -0
  217. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_list_result.rb +58 -0
  218. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_dbdatabase_resource.rb +46 -0
  219. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index.rb +60 -0
  220. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_keys.rb +55 -0
  221. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/mongo_index_options.rb +57 -0
  222. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation.rb +58 -0
  223. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_display.rb +80 -0
  224. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/operation_list_result.rb +101 -0
  225. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_kind.rb +16 -0
  226. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric.rb +124 -0
  227. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_metric_list_result.rb +57 -0
  228. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usage.rb +105 -0
  229. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/partition_usages_result.rb +57 -0
  230. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric.rb +120 -0
  231. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_list_result.rb +57 -0
  232. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/percentile_metric_value.rb +173 -0
  233. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/primary_aggregation_type.rb +20 -0
  234. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/region_for_online_offline.rb +47 -0
  235. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_create_update_parameters.rb +119 -0
  236. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_get_results.rb +200 -0
  237. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_list_result.rb +58 -0
  238. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_container_resource.rb +111 -0
  239. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_create_update_parameters.rb +120 -0
  240. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_get_results.rb +159 -0
  241. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_list_result.rb +58 -0
  242. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_database_resource.rb +46 -0
  243. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_create_update_parameters.rb +120 -0
  244. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_get_results.rb +146 -0
  245. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_list_result.rb +58 -0
  246. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_stored_procedure_resource.rb +57 -0
  247. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_create_update_parameters.rb +119 -0
  248. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_get_results.rb +171 -0
  249. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_list_result.rb +58 -0
  250. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_trigger_resource.rb +82 -0
  251. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_create_update_parameters.rb +121 -0
  252. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_get_results.rb +146 -0
  253. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_list_result.rb +58 -0
  254. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/sql_user_defined_function_resource.rb +57 -0
  255. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_create_update_parameters.rb +119 -0
  256. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_get_results.rb +135 -0
  257. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_list_result.rb +57 -0
  258. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/table_resource.rb +46 -0
  259. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_get_results.rb +121 -0
  260. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_resource.rb +70 -0
  261. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/throughput_settings_update_parameters.rb +99 -0
  262. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_operation.rb +19 -0
  263. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/trigger_type.rb +16 -0
  264. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key.rb +56 -0
  265. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unique_key_policy.rb +58 -0
  266. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/unit_type.rb +21 -0
  267. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usage.rb +97 -0
  268. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/usages_result.rb +57 -0
  269. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/models/virtual_network_rule.rb +59 -0
  270. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/module_definition.rb +9 -0
  271. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/mongo_dbresources.rb +1634 -0
  272. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/operations.rb +219 -0
  273. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id.rb +156 -0
  274. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/partition_key_range_id_region.rb +163 -0
  275. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile.rb +141 -0
  276. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_source_target.rb +158 -0
  277. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/percentile_target.rb +148 -0
  278. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/sql_resources.rb +3289 -0
  279. data/lib/2019-08-01/generated/azure_mgmt_cosmosdb/table_resources.rb +804 -0
  280. data/lib/azure_mgmt_cosmosdb.rb +8 -6
  281. data/lib/module_definition.rb +7 -7
  282. data/lib/profiles/latest/cosmosdb_latest_profile_client.rb +40 -40
  283. data/lib/profiles/latest/cosmosdb_module_definition.rb +8 -8
  284. data/lib/profiles/latest/modules/cosmosdb_profile_module.rb +571 -501
  285. data/lib/version.rb +1 -1
  286. metadata +160 -3
@@ -0,0 +1,141 @@
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 Percentile
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the Percentile class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given database
26
+ # account. This url is only for PBS and Replication Latency data
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param filter [String] An OData filter expression that describes a subset of
31
+ # metrics to return. The parameters that can be filtered are name.value (name
32
+ # of the metric, can have an or of multiple names), startTime, endTime, and
33
+ # timeGrain. The supported operator is eq.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [PercentileMetricListResult] operation results.
38
+ #
39
+ def list_metrics(resource_group_name, account_name, filter, custom_headers:nil)
40
+ response = list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Retrieves the metrics determined by the given filter for the given database
46
+ # account. This url is only for PBS and Replication Latency data
47
+ #
48
+ # @param resource_group_name [String] Name of an Azure resource group.
49
+ # @param account_name [String] Cosmos DB database account name.
50
+ # @param filter [String] An OData filter expression that describes a subset of
51
+ # metrics to return. The parameters that can be filtered are name.value (name
52
+ # of the metric, can have an or of multiple names), startTime, endTime, and
53
+ # timeGrain. The supported operator is eq.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def list_metrics_with_http_info(resource_group_name, account_name, filter, custom_headers:nil)
60
+ list_metrics_async(resource_group_name, account_name, filter, custom_headers:custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Retrieves the metrics determined by the given filter for the given database
65
+ # account. This url is only for PBS and Replication Latency data
66
+ #
67
+ # @param resource_group_name [String] Name of an Azure resource group.
68
+ # @param account_name [String] Cosmos DB database account name.
69
+ # @param filter [String] An OData filter expression that describes a subset of
70
+ # metrics to return. The parameters that can be filtered are name.value (name
71
+ # of the metric, can have an or of multiple names), startTime, endTime, and
72
+ # timeGrain. The supported operator is eq.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def list_metrics_async(resource_group_name, account_name, filter, custom_headers:nil)
79
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
80
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
81
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
82
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
83
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
84
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
85
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
86
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
87
+ fail ArgumentError, "'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?
88
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
89
+ fail ArgumentError, 'filter is nil' if filter.nil?
90
+
91
+
92
+ request_headers = {}
93
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
94
+
95
+ # Set Headers
96
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
97
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
98
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/percentile/metrics'
99
+
100
+ request_url = @base_url || @client.base_url
101
+
102
+ options = {
103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
104
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
105
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
106
+ headers: request_headers.merge(custom_headers || {}),
107
+ base_url: request_url
108
+ }
109
+ promise = @client.make_request_async(:get, path_template, options)
110
+
111
+ promise = promise.then do |result|
112
+ http_response = result.response
113
+ status_code = http_response.status
114
+ response_content = http_response.body
115
+ unless status_code == 200
116
+ error_model = JSON.load(response_content)
117
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
118
+ end
119
+
120
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
121
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
122
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
123
+ # Deserialize Response
124
+ if status_code == 200
125
+ begin
126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
127
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::PercentileMetricListResult.mapper()
128
+ result.body = @client.deserialize(result_mapper, parsed_response)
129
+ rescue Exception => e
130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
131
+ end
132
+ end
133
+
134
+ result
135
+ end
136
+
137
+ promise.execute
138
+ end
139
+
140
+ end
141
+ end
@@ -0,0 +1,158 @@
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 PercentileSourceTarget
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PercentileSourceTarget class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given account,
26
+ # source and target region. This url is only for PBS and Replication Latency
27
+ # data
28
+ #
29
+ # @param resource_group_name [String] Name of an Azure resource group.
30
+ # @param account_name [String] Cosmos DB database account name.
31
+ # @param source_region [String] Source region from which data is written.
32
+ # Cosmos DB region, with spaces between words and each word capitalized.
33
+ # @param target_region [String] Target region to which data is written. Cosmos
34
+ # DB region, with spaces between words and each word capitalized.
35
+ # @param filter [String] An OData filter expression that describes a subset of
36
+ # metrics to return. The parameters that can be filtered are name.value (name
37
+ # of the metric, can have an or of multiple names), startTime, endTime, and
38
+ # timeGrain. The supported operator is eq.
39
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
40
+ # will be added to the HTTP request.
41
+ #
42
+ # @return [PercentileMetricListResult] operation results.
43
+ #
44
+ def list_metrics(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
45
+ response = list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:custom_headers).value!
46
+ response.body unless response.nil?
47
+ end
48
+
49
+ #
50
+ # Retrieves the metrics determined by the given filter for the given account,
51
+ # source and target region. This url is only for PBS and Replication Latency
52
+ # data
53
+ #
54
+ # @param resource_group_name [String] Name of an Azure resource group.
55
+ # @param account_name [String] Cosmos DB database account name.
56
+ # @param source_region [String] Source region from which data is written.
57
+ # Cosmos DB region, with spaces between words and each word capitalized.
58
+ # @param target_region [String] Target region to which data is written. Cosmos
59
+ # DB region, with spaces between words and each word capitalized.
60
+ # @param filter [String] An OData filter expression that describes a subset of
61
+ # metrics to return. The parameters that can be filtered are name.value (name
62
+ # of the metric, can have an or of multiple names), startTime, endTime, and
63
+ # timeGrain. The supported operator is eq.
64
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
65
+ # will be added to the HTTP request.
66
+ #
67
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
68
+ #
69
+ def list_metrics_with_http_info(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
70
+ list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:custom_headers).value!
71
+ end
72
+
73
+ #
74
+ # Retrieves the metrics determined by the given filter for the given account,
75
+ # source and target region. This url is only for PBS and Replication Latency
76
+ # data
77
+ #
78
+ # @param resource_group_name [String] Name of an Azure resource group.
79
+ # @param account_name [String] Cosmos DB database account name.
80
+ # @param source_region [String] Source region from which data is written.
81
+ # Cosmos DB region, with spaces between words and each word capitalized.
82
+ # @param target_region [String] Target region to which data is written. Cosmos
83
+ # DB region, with spaces between words and each word capitalized.
84
+ # @param filter [String] An OData filter expression that describes a subset of
85
+ # metrics to return. The parameters that can be filtered are name.value (name
86
+ # of the metric, can have an or of multiple names), startTime, endTime, and
87
+ # timeGrain. The supported operator is eq.
88
+ # @param [Hash{String => String}] A hash of custom headers that will be added
89
+ # to the HTTP request.
90
+ #
91
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
92
+ #
93
+ def list_metrics_async(resource_group_name, account_name, source_region, target_region, filter, custom_headers:nil)
94
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
95
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
96
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
97
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
98
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
99
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
100
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
101
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
102
+ fail ArgumentError, "'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?
103
+ fail ArgumentError, 'source_region is nil' if source_region.nil?
104
+ fail ArgumentError, 'target_region is nil' if target_region.nil?
105
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
106
+ fail ArgumentError, 'filter is nil' if filter.nil?
107
+
108
+
109
+ request_headers = {}
110
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
111
+
112
+ # Set Headers
113
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
114
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
115
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sourceRegion/{sourceRegion}/targetRegion/{targetRegion}/percentile/metrics'
116
+
117
+ request_url = @base_url || @client.base_url
118
+
119
+ options = {
120
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
121
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'sourceRegion' => source_region,'targetRegion' => target_region},
122
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
123
+ headers: request_headers.merge(custom_headers || {}),
124
+ base_url: request_url
125
+ }
126
+ promise = @client.make_request_async(:get, path_template, options)
127
+
128
+ promise = promise.then do |result|
129
+ http_response = result.response
130
+ status_code = http_response.status
131
+ response_content = http_response.body
132
+ unless status_code == 200
133
+ error_model = JSON.load(response_content)
134
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
135
+ end
136
+
137
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
138
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
139
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
140
+ # Deserialize Response
141
+ if status_code == 200
142
+ begin
143
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
144
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::PercentileMetricListResult.mapper()
145
+ result.body = @client.deserialize(result_mapper, parsed_response)
146
+ rescue Exception => e
147
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
148
+ end
149
+ end
150
+
151
+ result
152
+ end
153
+
154
+ promise.execute
155
+ end
156
+
157
+ end
158
+ end
@@ -0,0 +1,148 @@
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 PercentileTarget
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the PercentileTarget class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Retrieves the metrics determined by the given filter for the given account
26
+ # target region. This url is only for PBS and Replication Latency data
27
+ #
28
+ # @param resource_group_name [String] Name of an Azure resource group.
29
+ # @param account_name [String] Cosmos DB database account name.
30
+ # @param target_region [String] Target region to which data is written. Cosmos
31
+ # DB region, with spaces between words and each word capitalized.
32
+ # @param filter [String] An OData filter expression that describes a subset of
33
+ # metrics to return. The parameters that can be filtered are name.value (name
34
+ # of the metric, can have an or of multiple names), startTime, endTime, and
35
+ # timeGrain. The supported operator is eq.
36
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
37
+ # will be added to the HTTP request.
38
+ #
39
+ # @return [PercentileMetricListResult] operation results.
40
+ #
41
+ def list_metrics(resource_group_name, account_name, target_region, filter, custom_headers:nil)
42
+ response = list_metrics_async(resource_group_name, account_name, target_region, filter, custom_headers:custom_headers).value!
43
+ response.body unless response.nil?
44
+ end
45
+
46
+ #
47
+ # Retrieves the metrics determined by the given filter for the given account
48
+ # target region. This url is only for PBS and Replication Latency data
49
+ #
50
+ # @param resource_group_name [String] Name of an Azure resource group.
51
+ # @param account_name [String] Cosmos DB database account name.
52
+ # @param target_region [String] Target region to which data is written. Cosmos
53
+ # DB region, with spaces between words and each word capitalized.
54
+ # @param filter [String] An OData filter expression that describes a subset of
55
+ # metrics to return. The parameters that can be filtered are name.value (name
56
+ # of the metric, can have an or of multiple names), startTime, endTime, and
57
+ # timeGrain. The supported operator is eq.
58
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
59
+ # will be added to the HTTP request.
60
+ #
61
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
62
+ #
63
+ def list_metrics_with_http_info(resource_group_name, account_name, target_region, filter, custom_headers:nil)
64
+ list_metrics_async(resource_group_name, account_name, target_region, filter, custom_headers:custom_headers).value!
65
+ end
66
+
67
+ #
68
+ # Retrieves the metrics determined by the given filter for the given account
69
+ # target region. This url is only for PBS and Replication Latency data
70
+ #
71
+ # @param resource_group_name [String] Name of an Azure resource group.
72
+ # @param account_name [String] Cosmos DB database account name.
73
+ # @param target_region [String] Target region to which data is written. Cosmos
74
+ # DB region, with spaces between words and each word capitalized.
75
+ # @param filter [String] An OData filter expression that describes a subset of
76
+ # metrics to return. The parameters that can be filtered are name.value (name
77
+ # of the metric, can have an or of multiple names), startTime, endTime, and
78
+ # timeGrain. The supported operator is eq.
79
+ # @param [Hash{String => String}] A hash of custom headers that will be added
80
+ # to the HTTP request.
81
+ #
82
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
83
+ #
84
+ def list_metrics_async(resource_group_name, account_name, target_region, filter, custom_headers:nil)
85
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
86
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
87
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
88
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
89
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
90
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
91
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
92
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
93
+ fail ArgumentError, "'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?
94
+ fail ArgumentError, 'target_region is nil' if target_region.nil?
95
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
96
+ fail ArgumentError, 'filter is nil' if filter.nil?
97
+
98
+
99
+ request_headers = {}
100
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
101
+
102
+ # Set Headers
103
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
104
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
105
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/targetRegion/{targetRegion}/percentile/metrics'
106
+
107
+ request_url = @base_url || @client.base_url
108
+
109
+ options = {
110
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
111
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'targetRegion' => target_region},
112
+ query_params: {'api-version' => @client.api_version,'$filter' => filter},
113
+ headers: request_headers.merge(custom_headers || {}),
114
+ base_url: request_url
115
+ }
116
+ promise = @client.make_request_async(:get, path_template, options)
117
+
118
+ promise = promise.then do |result|
119
+ http_response = result.response
120
+ status_code = http_response.status
121
+ response_content = http_response.body
122
+ unless status_code == 200
123
+ error_model = JSON.load(response_content)
124
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
125
+ end
126
+
127
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
128
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
129
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
130
+ # Deserialize Response
131
+ if status_code == 200
132
+ begin
133
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
134
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::PercentileMetricListResult.mapper()
135
+ result.body = @client.deserialize(result_mapper, parsed_response)
136
+ rescue Exception => e
137
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
138
+ end
139
+ end
140
+
141
+ result
142
+ end
143
+
144
+ promise.execute
145
+ end
146
+
147
+ end
148
+ end
@@ -0,0 +1,3289 @@
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 SqlResources
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the SqlResources class.
15
+ # @param client service class for accessing basic functionality.
16
+ #
17
+ def initialize(client)
18
+ @client = client
19
+ end
20
+
21
+ # @return [CosmosDB] reference to the CosmosDB
22
+ attr_reader :client
23
+
24
+ #
25
+ # Lists the SQL databases under an existing Azure Cosmos DB database account.
26
+ #
27
+ # @param resource_group_name [String] Name of an Azure resource group.
28
+ # @param account_name [String] Cosmos DB database account name.
29
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
30
+ # will be added to the HTTP request.
31
+ #
32
+ # @return [SqlDatabaseListResult] operation results.
33
+ #
34
+ def list_sql_databases(resource_group_name, account_name, custom_headers:nil)
35
+ response = list_sql_databases_async(resource_group_name, account_name, custom_headers:custom_headers).value!
36
+ response.body unless response.nil?
37
+ end
38
+
39
+ #
40
+ # Lists the SQL databases under an existing Azure Cosmos DB database account.
41
+ #
42
+ # @param resource_group_name [String] Name of an Azure resource group.
43
+ # @param account_name [String] Cosmos DB database account name.
44
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
45
+ # will be added to the HTTP request.
46
+ #
47
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
48
+ #
49
+ def list_sql_databases_with_http_info(resource_group_name, account_name, custom_headers:nil)
50
+ list_sql_databases_async(resource_group_name, account_name, custom_headers:custom_headers).value!
51
+ end
52
+
53
+ #
54
+ # Lists the SQL databases under an existing Azure Cosmos DB database account.
55
+ #
56
+ # @param resource_group_name [String] Name of an Azure resource group.
57
+ # @param account_name [String] Cosmos DB database account name.
58
+ # @param [Hash{String => String}] A hash of custom headers that will be added
59
+ # to the HTTP request.
60
+ #
61
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
62
+ #
63
+ def list_sql_databases_async(resource_group_name, account_name, custom_headers:nil)
64
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
65
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
66
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
67
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
68
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
69
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
70
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
71
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
72
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-z0-9]+(-[a-z0-9]+)*'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-z0-9]+(-[a-z0-9]+)*$')).nil?
73
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
74
+
75
+
76
+ request_headers = {}
77
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
78
+
79
+ # Set Headers
80
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
81
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
82
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases'
83
+
84
+ request_url = @base_url || @client.base_url
85
+
86
+ options = {
87
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
88
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name},
89
+ query_params: {'api-version' => @client.api_version},
90
+ headers: request_headers.merge(custom_headers || {}),
91
+ base_url: request_url
92
+ }
93
+ promise = @client.make_request_async(:get, path_template, options)
94
+
95
+ promise = promise.then do |result|
96
+ http_response = result.response
97
+ status_code = http_response.status
98
+ response_content = http_response.body
99
+ unless status_code == 200
100
+ error_model = JSON.load(response_content)
101
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
102
+ end
103
+
104
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
105
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
106
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
107
+ # Deserialize Response
108
+ if status_code == 200
109
+ begin
110
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
111
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlDatabaseListResult.mapper()
112
+ result.body = @client.deserialize(result_mapper, parsed_response)
113
+ rescue Exception => e
114
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
115
+ end
116
+ end
117
+
118
+ result
119
+ end
120
+
121
+ promise.execute
122
+ end
123
+
124
+ #
125
+ # Gets the SQL database under an existing Azure Cosmos DB database account with
126
+ # the provided name.
127
+ #
128
+ # @param resource_group_name [String] Name of an Azure resource group.
129
+ # @param account_name [String] Cosmos DB database account name.
130
+ # @param database_name [String] Cosmos DB database name.
131
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
132
+ # will be added to the HTTP request.
133
+ #
134
+ # @return [SqlDatabaseGetResults] operation results.
135
+ #
136
+ def get_sql_database(resource_group_name, account_name, database_name, custom_headers:nil)
137
+ response = get_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
138
+ response.body unless response.nil?
139
+ end
140
+
141
+ #
142
+ # Gets the SQL database under an existing Azure Cosmos DB database account with
143
+ # the provided name.
144
+ #
145
+ # @param resource_group_name [String] Name of an Azure resource group.
146
+ # @param account_name [String] Cosmos DB database account name.
147
+ # @param database_name [String] Cosmos DB database name.
148
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
149
+ # will be added to the HTTP request.
150
+ #
151
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
152
+ #
153
+ def get_sql_database_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
154
+ get_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
155
+ end
156
+
157
+ #
158
+ # Gets the SQL database under an existing Azure Cosmos DB database account with
159
+ # the provided name.
160
+ #
161
+ # @param resource_group_name [String] Name of an Azure resource group.
162
+ # @param account_name [String] Cosmos DB database account name.
163
+ # @param database_name [String] Cosmos DB database name.
164
+ # @param [Hash{String => String}] A hash of custom headers that will be added
165
+ # to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
168
+ #
169
+ def get_sql_database_async(resource_group_name, account_name, database_name, custom_headers:nil)
170
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
171
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
172
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
173
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
174
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
175
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
176
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
177
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
178
+ 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?
179
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
180
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
181
+
182
+
183
+ request_headers = {}
184
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
185
+
186
+ # Set Headers
187
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
188
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
189
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'
190
+
191
+ request_url = @base_url || @client.base_url
192
+
193
+ options = {
194
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
195
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
196
+ query_params: {'api-version' => @client.api_version},
197
+ headers: request_headers.merge(custom_headers || {}),
198
+ base_url: request_url
199
+ }
200
+ promise = @client.make_request_async(:get, path_template, options)
201
+
202
+ promise = promise.then do |result|
203
+ http_response = result.response
204
+ status_code = http_response.status
205
+ response_content = http_response.body
206
+ unless status_code == 200
207
+ error_model = JSON.load(response_content)
208
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
209
+ end
210
+
211
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
212
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
213
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
214
+ # Deserialize Response
215
+ if status_code == 200
216
+ begin
217
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
218
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlDatabaseGetResults.mapper()
219
+ result.body = @client.deserialize(result_mapper, parsed_response)
220
+ rescue Exception => e
221
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
222
+ end
223
+ end
224
+
225
+ result
226
+ end
227
+
228
+ promise.execute
229
+ end
230
+
231
+ #
232
+ # Create or update an Azure Cosmos DB SQL database
233
+ #
234
+ # @param resource_group_name [String] Name of an Azure resource group.
235
+ # @param account_name [String] Cosmos DB database account name.
236
+ # @param database_name [String] Cosmos DB database name.
237
+ # @param create_update_sql_database_parameters
238
+ # [SqlDatabaseCreateUpdateParameters] The parameters to provide for the current
239
+ # SQL database.
240
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
241
+ # will be added to the HTTP request.
242
+ #
243
+ # @return [SqlDatabaseGetResults] operation results.
244
+ #
245
+ def create_update_sql_database(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:nil)
246
+ response = create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:custom_headers).value!
247
+ response.body unless response.nil?
248
+ end
249
+
250
+ #
251
+ # @param resource_group_name [String] Name of an Azure resource group.
252
+ # @param account_name [String] Cosmos DB database account name.
253
+ # @param database_name [String] Cosmos DB database name.
254
+ # @param create_update_sql_database_parameters
255
+ # [SqlDatabaseCreateUpdateParameters] The parameters to provide for the current
256
+ # SQL database.
257
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
258
+ # will be added to the HTTP request.
259
+ #
260
+ # @return [Concurrent::Promise] promise which provides async access to http
261
+ # response.
262
+ #
263
+ def create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:nil)
264
+ # Send request
265
+ promise = begin_create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:custom_headers)
266
+
267
+ promise = promise.then do |response|
268
+ # Defining deserialization method.
269
+ deserialize_method = lambda do |parsed_response|
270
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlDatabaseGetResults.mapper()
271
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
272
+ end
273
+
274
+ # Waiting for response.
275
+ @client.get_long_running_operation_result(response, deserialize_method)
276
+ end
277
+
278
+ promise
279
+ end
280
+
281
+ #
282
+ # Deletes an existing Azure Cosmos DB SQL database.
283
+ #
284
+ # @param resource_group_name [String] Name of an Azure resource group.
285
+ # @param account_name [String] Cosmos DB database account name.
286
+ # @param database_name [String] Cosmos DB database name.
287
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
288
+ # will be added to the HTTP request.
289
+ #
290
+ def delete_sql_database(resource_group_name, account_name, database_name, custom_headers:nil)
291
+ response = delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
292
+ nil
293
+ end
294
+
295
+ #
296
+ # @param resource_group_name [String] Name of an Azure resource group.
297
+ # @param account_name [String] Cosmos DB database account name.
298
+ # @param database_name [String] Cosmos DB database name.
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ # @return [Concurrent::Promise] promise which provides async access to http
303
+ # response.
304
+ #
305
+ def delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:nil)
306
+ # Send request
307
+ promise = begin_delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers)
308
+
309
+ promise = promise.then do |response|
310
+ # Defining deserialization method.
311
+ deserialize_method = lambda do |parsed_response|
312
+ end
313
+
314
+ # Waiting for response.
315
+ @client.get_long_running_operation_result(response, deserialize_method)
316
+ end
317
+
318
+ promise
319
+ end
320
+
321
+ #
322
+ # Gets the RUs per second of the SQL database under an existing Azure Cosmos DB
323
+ # database account with the provided name.
324
+ #
325
+ # @param resource_group_name [String] Name of an Azure resource group.
326
+ # @param account_name [String] Cosmos DB database account name.
327
+ # @param database_name [String] Cosmos DB database name.
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [ThroughputSettingsGetResults] operation results.
332
+ #
333
+ def get_sql_database_throughput(resource_group_name, account_name, database_name, custom_headers:nil)
334
+ response = get_sql_database_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
335
+ response.body unless response.nil?
336
+ end
337
+
338
+ #
339
+ # Gets the RUs per second of the SQL database under an existing Azure Cosmos DB
340
+ # database account with the provided name.
341
+ #
342
+ # @param resource_group_name [String] Name of an Azure resource group.
343
+ # @param account_name [String] Cosmos DB database account name.
344
+ # @param database_name [String] Cosmos DB database name.
345
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
346
+ # will be added to the HTTP request.
347
+ #
348
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
349
+ #
350
+ def get_sql_database_throughput_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
351
+ get_sql_database_throughput_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
352
+ end
353
+
354
+ #
355
+ # Gets the RUs per second of the SQL database under an existing Azure Cosmos DB
356
+ # database account with the provided name.
357
+ #
358
+ # @param resource_group_name [String] Name of an Azure resource group.
359
+ # @param account_name [String] Cosmos DB database account name.
360
+ # @param database_name [String] Cosmos DB database name.
361
+ # @param [Hash{String => String}] A hash of custom headers that will be added
362
+ # to the HTTP request.
363
+ #
364
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
365
+ #
366
+ def get_sql_database_throughput_async(resource_group_name, account_name, database_name, custom_headers:nil)
367
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
368
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
369
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
370
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
371
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
372
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
373
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
374
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
375
+ 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?
376
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
377
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
378
+
379
+
380
+ request_headers = {}
381
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
382
+
383
+ # Set Headers
384
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
385
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
386
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'
387
+
388
+ request_url = @base_url || @client.base_url
389
+
390
+ options = {
391
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
392
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
393
+ query_params: {'api-version' => @client.api_version},
394
+ headers: request_headers.merge(custom_headers || {}),
395
+ base_url: request_url
396
+ }
397
+ promise = @client.make_request_async(:get, path_template, options)
398
+
399
+ promise = promise.then do |result|
400
+ http_response = result.response
401
+ status_code = http_response.status
402
+ response_content = http_response.body
403
+ unless status_code == 200
404
+ error_model = JSON.load(response_content)
405
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
406
+ end
407
+
408
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
409
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
410
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
411
+ # Deserialize Response
412
+ if status_code == 200
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
416
+ result.body = @client.deserialize(result_mapper, parsed_response)
417
+ rescue Exception => e
418
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
419
+ end
420
+ end
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ #
429
+ # Update RUs per second of an Azure Cosmos DB SQL database
430
+ #
431
+ # @param resource_group_name [String] Name of an Azure resource group.
432
+ # @param account_name [String] Cosmos DB database account name.
433
+ # @param database_name [String] Cosmos DB database name.
434
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
435
+ # parameters to provide for the RUs per second of the current SQL database.
436
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
437
+ # will be added to the HTTP request.
438
+ #
439
+ # @return [ThroughputSettingsGetResults] operation results.
440
+ #
441
+ def update_sql_database_throughput(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
442
+ response = update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
443
+ response.body unless response.nil?
444
+ end
445
+
446
+ #
447
+ # @param resource_group_name [String] Name of an Azure resource group.
448
+ # @param account_name [String] Cosmos DB database account name.
449
+ # @param database_name [String] Cosmos DB database name.
450
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
451
+ # parameters to provide for the RUs per second of the current SQL database.
452
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
453
+ # will be added to the HTTP request.
454
+ #
455
+ # @return [Concurrent::Promise] promise which provides async access to http
456
+ # response.
457
+ #
458
+ def update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
459
+ # Send request
460
+ promise = begin_update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers)
461
+
462
+ promise = promise.then do |response|
463
+ # Defining deserialization method.
464
+ deserialize_method = lambda do |parsed_response|
465
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
466
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
467
+ end
468
+
469
+ # Waiting for response.
470
+ @client.get_long_running_operation_result(response, deserialize_method)
471
+ end
472
+
473
+ promise
474
+ end
475
+
476
+ #
477
+ # Lists the SQL container under an existing Azure Cosmos DB database account.
478
+ #
479
+ # @param resource_group_name [String] Name of an Azure resource group.
480
+ # @param account_name [String] Cosmos DB database account name.
481
+ # @param database_name [String] Cosmos DB database name.
482
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
483
+ # will be added to the HTTP request.
484
+ #
485
+ # @return [SqlContainerListResult] operation results.
486
+ #
487
+ def list_sql_containers(resource_group_name, account_name, database_name, custom_headers:nil)
488
+ response = list_sql_containers_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
489
+ response.body unless response.nil?
490
+ end
491
+
492
+ #
493
+ # Lists the SQL container under an existing Azure Cosmos DB database account.
494
+ #
495
+ # @param resource_group_name [String] Name of an Azure resource group.
496
+ # @param account_name [String] Cosmos DB database account name.
497
+ # @param database_name [String] Cosmos DB database name.
498
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
499
+ # will be added to the HTTP request.
500
+ #
501
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
502
+ #
503
+ def list_sql_containers_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
504
+ list_sql_containers_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
505
+ end
506
+
507
+ #
508
+ # Lists the SQL container under an existing Azure Cosmos DB database account.
509
+ #
510
+ # @param resource_group_name [String] Name of an Azure resource group.
511
+ # @param account_name [String] Cosmos DB database account name.
512
+ # @param database_name [String] Cosmos DB database name.
513
+ # @param [Hash{String => String}] A hash of custom headers that will be added
514
+ # to the HTTP request.
515
+ #
516
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
517
+ #
518
+ def list_sql_containers_async(resource_group_name, account_name, database_name, custom_headers:nil)
519
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
520
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
521
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
522
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
523
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
524
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
525
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
526
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
527
+ 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?
528
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
529
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
530
+
531
+
532
+ request_headers = {}
533
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
534
+
535
+ # Set Headers
536
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
537
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
538
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers'
539
+
540
+ request_url = @base_url || @client.base_url
541
+
542
+ options = {
543
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
544
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
545
+ query_params: {'api-version' => @client.api_version},
546
+ headers: request_headers.merge(custom_headers || {}),
547
+ base_url: request_url
548
+ }
549
+ promise = @client.make_request_async(:get, path_template, options)
550
+
551
+ promise = promise.then do |result|
552
+ http_response = result.response
553
+ status_code = http_response.status
554
+ response_content = http_response.body
555
+ unless status_code == 200
556
+ error_model = JSON.load(response_content)
557
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
558
+ end
559
+
560
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
561
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
562
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
563
+ # Deserialize Response
564
+ if status_code == 200
565
+ begin
566
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
567
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlContainerListResult.mapper()
568
+ result.body = @client.deserialize(result_mapper, parsed_response)
569
+ rescue Exception => e
570
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
571
+ end
572
+ end
573
+
574
+ result
575
+ end
576
+
577
+ promise.execute
578
+ end
579
+
580
+ #
581
+ # Gets the SQL container under an existing Azure Cosmos DB database account.
582
+ #
583
+ # @param resource_group_name [String] Name of an Azure resource group.
584
+ # @param account_name [String] Cosmos DB database account name.
585
+ # @param database_name [String] Cosmos DB database name.
586
+ # @param container_name [String] Cosmos DB container name.
587
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
588
+ # will be added to the HTTP request.
589
+ #
590
+ # @return [SqlContainerGetResults] operation results.
591
+ #
592
+ def get_sql_container(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
593
+ response = get_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
594
+ response.body unless response.nil?
595
+ end
596
+
597
+ #
598
+ # Gets the SQL container under an existing Azure Cosmos DB database account.
599
+ #
600
+ # @param resource_group_name [String] Name of an Azure resource group.
601
+ # @param account_name [String] Cosmos DB database account name.
602
+ # @param database_name [String] Cosmos DB database name.
603
+ # @param container_name [String] Cosmos DB container name.
604
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
605
+ # will be added to the HTTP request.
606
+ #
607
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
608
+ #
609
+ def get_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
610
+ get_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
611
+ end
612
+
613
+ #
614
+ # Gets the SQL container under an existing Azure Cosmos DB database account.
615
+ #
616
+ # @param resource_group_name [String] Name of an Azure resource group.
617
+ # @param account_name [String] Cosmos DB database account name.
618
+ # @param database_name [String] Cosmos DB database name.
619
+ # @param container_name [String] Cosmos DB container name.
620
+ # @param [Hash{String => String}] A hash of custom headers that will be added
621
+ # to the HTTP request.
622
+ #
623
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
624
+ #
625
+ def get_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
626
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
627
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
628
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
629
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
630
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
631
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
632
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
633
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
634
+ 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?
635
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
636
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
637
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
638
+
639
+
640
+ request_headers = {}
641
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
642
+
643
+ # Set Headers
644
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
645
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
646
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
647
+
648
+ request_url = @base_url || @client.base_url
649
+
650
+ options = {
651
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
652
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
653
+ query_params: {'api-version' => @client.api_version},
654
+ headers: request_headers.merge(custom_headers || {}),
655
+ base_url: request_url
656
+ }
657
+ promise = @client.make_request_async(:get, path_template, options)
658
+
659
+ promise = promise.then do |result|
660
+ http_response = result.response
661
+ status_code = http_response.status
662
+ response_content = http_response.body
663
+ unless status_code == 200
664
+ error_model = JSON.load(response_content)
665
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
666
+ end
667
+
668
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
669
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
670
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
671
+ # Deserialize Response
672
+ if status_code == 200
673
+ begin
674
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
675
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlContainerGetResults.mapper()
676
+ result.body = @client.deserialize(result_mapper, parsed_response)
677
+ rescue Exception => e
678
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
679
+ end
680
+ end
681
+
682
+ result
683
+ end
684
+
685
+ promise.execute
686
+ end
687
+
688
+ #
689
+ # Create or update an Azure Cosmos DB SQL container
690
+ #
691
+ # @param resource_group_name [String] Name of an Azure resource group.
692
+ # @param account_name [String] Cosmos DB database account name.
693
+ # @param database_name [String] Cosmos DB database name.
694
+ # @param container_name [String] Cosmos DB container name.
695
+ # @param create_update_sql_container_parameters
696
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
697
+ # current SQL container.
698
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
699
+ # will be added to the HTTP request.
700
+ #
701
+ # @return [SqlContainerGetResults] operation results.
702
+ #
703
+ def create_update_sql_container(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
704
+ response = create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
705
+ response.body unless response.nil?
706
+ end
707
+
708
+ #
709
+ # @param resource_group_name [String] Name of an Azure resource group.
710
+ # @param account_name [String] Cosmos DB database account name.
711
+ # @param database_name [String] Cosmos DB database name.
712
+ # @param container_name [String] Cosmos DB container name.
713
+ # @param create_update_sql_container_parameters
714
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
715
+ # current SQL container.
716
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
717
+ # will be added to the HTTP request.
718
+ #
719
+ # @return [Concurrent::Promise] promise which provides async access to http
720
+ # response.
721
+ #
722
+ def create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
723
+ # Send request
724
+ promise = begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers)
725
+
726
+ promise = promise.then do |response|
727
+ # Defining deserialization method.
728
+ deserialize_method = lambda do |parsed_response|
729
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlContainerGetResults.mapper()
730
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
731
+ end
732
+
733
+ # Waiting for response.
734
+ @client.get_long_running_operation_result(response, deserialize_method)
735
+ end
736
+
737
+ promise
738
+ end
739
+
740
+ #
741
+ # Deletes an existing Azure Cosmos DB SQL container.
742
+ #
743
+ # @param resource_group_name [String] Name of an Azure resource group.
744
+ # @param account_name [String] Cosmos DB database account name.
745
+ # @param database_name [String] Cosmos DB database name.
746
+ # @param container_name [String] Cosmos DB container name.
747
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
748
+ # will be added to the HTTP request.
749
+ #
750
+ def delete_sql_container(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
751
+ response = delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
752
+ nil
753
+ end
754
+
755
+ #
756
+ # @param resource_group_name [String] Name of an Azure resource group.
757
+ # @param account_name [String] Cosmos DB database account name.
758
+ # @param database_name [String] Cosmos DB database name.
759
+ # @param container_name [String] Cosmos DB container name.
760
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
761
+ # will be added to the HTTP request.
762
+ #
763
+ # @return [Concurrent::Promise] promise which provides async access to http
764
+ # response.
765
+ #
766
+ def delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
767
+ # Send request
768
+ promise = begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers)
769
+
770
+ promise = promise.then do |response|
771
+ # Defining deserialization method.
772
+ deserialize_method = lambda do |parsed_response|
773
+ end
774
+
775
+ # Waiting for response.
776
+ @client.get_long_running_operation_result(response, deserialize_method)
777
+ end
778
+
779
+ promise
780
+ end
781
+
782
+ #
783
+ # Gets the RUs per second of the SQL container under an existing Azure Cosmos
784
+ # DB database account.
785
+ #
786
+ # @param resource_group_name [String] Name of an Azure resource group.
787
+ # @param account_name [String] Cosmos DB database account name.
788
+ # @param database_name [String] Cosmos DB database name.
789
+ # @param container_name [String] Cosmos DB container name.
790
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
791
+ # will be added to the HTTP request.
792
+ #
793
+ # @return [ThroughputSettingsGetResults] operation results.
794
+ #
795
+ def get_sql_container_throughput(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
796
+ response = get_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
797
+ response.body unless response.nil?
798
+ end
799
+
800
+ #
801
+ # Gets the RUs per second of the SQL container under an existing Azure Cosmos
802
+ # DB database account.
803
+ #
804
+ # @param resource_group_name [String] Name of an Azure resource group.
805
+ # @param account_name [String] Cosmos DB database account name.
806
+ # @param database_name [String] Cosmos DB database name.
807
+ # @param container_name [String] Cosmos DB container name.
808
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
809
+ # will be added to the HTTP request.
810
+ #
811
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
812
+ #
813
+ def get_sql_container_throughput_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
814
+ get_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
815
+ end
816
+
817
+ #
818
+ # Gets the RUs per second of the SQL container under an existing Azure Cosmos
819
+ # DB database account.
820
+ #
821
+ # @param resource_group_name [String] Name of an Azure resource group.
822
+ # @param account_name [String] Cosmos DB database account name.
823
+ # @param database_name [String] Cosmos DB database name.
824
+ # @param container_name [String] Cosmos DB container name.
825
+ # @param [Hash{String => String}] A hash of custom headers that will be added
826
+ # to the HTTP request.
827
+ #
828
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
829
+ #
830
+ def get_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
831
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
832
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
833
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
834
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
835
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
836
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
837
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
838
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
839
+ 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?
840
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
841
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
842
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
843
+
844
+
845
+ request_headers = {}
846
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
847
+
848
+ # Set Headers
849
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
850
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
851
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'
852
+
853
+ request_url = @base_url || @client.base_url
854
+
855
+ options = {
856
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
857
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
858
+ query_params: {'api-version' => @client.api_version},
859
+ headers: request_headers.merge(custom_headers || {}),
860
+ base_url: request_url
861
+ }
862
+ promise = @client.make_request_async(:get, path_template, options)
863
+
864
+ promise = promise.then do |result|
865
+ http_response = result.response
866
+ status_code = http_response.status
867
+ response_content = http_response.body
868
+ unless status_code == 200
869
+ error_model = JSON.load(response_content)
870
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
871
+ end
872
+
873
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
874
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
875
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
876
+ # Deserialize Response
877
+ if status_code == 200
878
+ begin
879
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
880
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
881
+ result.body = @client.deserialize(result_mapper, parsed_response)
882
+ rescue Exception => e
883
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
884
+ end
885
+ end
886
+
887
+ result
888
+ end
889
+
890
+ promise.execute
891
+ end
892
+
893
+ #
894
+ # Update RUs per second of an Azure Cosmos DB SQL container
895
+ #
896
+ # @param resource_group_name [String] Name of an Azure resource group.
897
+ # @param account_name [String] Cosmos DB database account name.
898
+ # @param database_name [String] Cosmos DB database name.
899
+ # @param container_name [String] Cosmos DB container name.
900
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
901
+ # parameters to provide for the RUs per second of the current SQL container.
902
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
903
+ # will be added to the HTTP request.
904
+ #
905
+ # @return [ThroughputSettingsGetResults] operation results.
906
+ #
907
+ def update_sql_container_throughput(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
908
+ response = update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers).value!
909
+ response.body unless response.nil?
910
+ end
911
+
912
+ #
913
+ # @param resource_group_name [String] Name of an Azure resource group.
914
+ # @param account_name [String] Cosmos DB database account name.
915
+ # @param database_name [String] Cosmos DB database name.
916
+ # @param container_name [String] Cosmos DB container name.
917
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
918
+ # parameters to provide for the RUs per second of the current SQL container.
919
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
920
+ # will be added to the HTTP request.
921
+ #
922
+ # @return [Concurrent::Promise] promise which provides async access to http
923
+ # response.
924
+ #
925
+ def update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
926
+ # Send request
927
+ promise = begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers)
928
+
929
+ promise = promise.then do |response|
930
+ # Defining deserialization method.
931
+ deserialize_method = lambda do |parsed_response|
932
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
933
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
934
+ end
935
+
936
+ # Waiting for response.
937
+ @client.get_long_running_operation_result(response, deserialize_method)
938
+ end
939
+
940
+ promise
941
+ end
942
+
943
+ #
944
+ # Lists the SQL storedProcedure under an existing Azure Cosmos DB database
945
+ # account.
946
+ #
947
+ # @param resource_group_name [String] Name of an Azure resource group.
948
+ # @param account_name [String] Cosmos DB database account name.
949
+ # @param database_name [String] Cosmos DB database name.
950
+ # @param container_name [String] Cosmos DB container name.
951
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
952
+ # will be added to the HTTP request.
953
+ #
954
+ # @return [SqlStoredProcedureListResult] operation results.
955
+ #
956
+ def list_sql_stored_procedures(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
957
+ response = list_sql_stored_procedures_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
958
+ response.body unless response.nil?
959
+ end
960
+
961
+ #
962
+ # Lists the SQL storedProcedure under an existing Azure Cosmos DB database
963
+ # account.
964
+ #
965
+ # @param resource_group_name [String] Name of an Azure resource group.
966
+ # @param account_name [String] Cosmos DB database account name.
967
+ # @param database_name [String] Cosmos DB database name.
968
+ # @param container_name [String] Cosmos DB container name.
969
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
970
+ # will be added to the HTTP request.
971
+ #
972
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
973
+ #
974
+ def list_sql_stored_procedures_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
975
+ list_sql_stored_procedures_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
976
+ end
977
+
978
+ #
979
+ # Lists the SQL storedProcedure under an existing Azure Cosmos DB database
980
+ # account.
981
+ #
982
+ # @param resource_group_name [String] Name of an Azure resource group.
983
+ # @param account_name [String] Cosmos DB database account name.
984
+ # @param database_name [String] Cosmos DB database name.
985
+ # @param container_name [String] Cosmos DB container name.
986
+ # @param [Hash{String => String}] A hash of custom headers that will be added
987
+ # to the HTTP request.
988
+ #
989
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
990
+ #
991
+ def list_sql_stored_procedures_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
992
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
993
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
994
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
995
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
996
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
997
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
998
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
999
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1000
+ 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?
1001
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1002
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1003
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1004
+
1005
+
1006
+ request_headers = {}
1007
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1008
+
1009
+ # Set Headers
1010
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1011
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1012
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/'
1013
+
1014
+ request_url = @base_url || @client.base_url
1015
+
1016
+ options = {
1017
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1018
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
1019
+ query_params: {'api-version' => @client.api_version},
1020
+ headers: request_headers.merge(custom_headers || {}),
1021
+ base_url: request_url
1022
+ }
1023
+ promise = @client.make_request_async(:get, path_template, options)
1024
+
1025
+ promise = promise.then do |result|
1026
+ http_response = result.response
1027
+ status_code = http_response.status
1028
+ response_content = http_response.body
1029
+ unless status_code == 200
1030
+ error_model = JSON.load(response_content)
1031
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1032
+ end
1033
+
1034
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1035
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1036
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1037
+ # Deserialize Response
1038
+ if status_code == 200
1039
+ begin
1040
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1041
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlStoredProcedureListResult.mapper()
1042
+ result.body = @client.deserialize(result_mapper, parsed_response)
1043
+ rescue Exception => e
1044
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1045
+ end
1046
+ end
1047
+
1048
+ result
1049
+ end
1050
+
1051
+ promise.execute
1052
+ end
1053
+
1054
+ #
1055
+ # Gets the SQL storedProcedure under an existing Azure Cosmos DB database
1056
+ # account.
1057
+ #
1058
+ # @param resource_group_name [String] Name of an Azure resource group.
1059
+ # @param account_name [String] Cosmos DB database account name.
1060
+ # @param database_name [String] Cosmos DB database name.
1061
+ # @param container_name [String] Cosmos DB container name.
1062
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1063
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1064
+ # will be added to the HTTP request.
1065
+ #
1066
+ # @return [SqlStoredProcedureGetResults] operation results.
1067
+ #
1068
+ def get_sql_stored_procedure(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
1069
+ response = get_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers).value!
1070
+ response.body unless response.nil?
1071
+ end
1072
+
1073
+ #
1074
+ # Gets the SQL storedProcedure under an existing Azure Cosmos DB database
1075
+ # account.
1076
+ #
1077
+ # @param resource_group_name [String] Name of an Azure resource group.
1078
+ # @param account_name [String] Cosmos DB database account name.
1079
+ # @param database_name [String] Cosmos DB database name.
1080
+ # @param container_name [String] Cosmos DB container name.
1081
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1082
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1083
+ # will be added to the HTTP request.
1084
+ #
1085
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1086
+ #
1087
+ def get_sql_stored_procedure_with_http_info(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
1088
+ get_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers).value!
1089
+ end
1090
+
1091
+ #
1092
+ # Gets the SQL storedProcedure under an existing Azure Cosmos DB database
1093
+ # account.
1094
+ #
1095
+ # @param resource_group_name [String] Name of an Azure resource group.
1096
+ # @param account_name [String] Cosmos DB database account name.
1097
+ # @param database_name [String] Cosmos DB database name.
1098
+ # @param container_name [String] Cosmos DB container name.
1099
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1100
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1101
+ # to the HTTP request.
1102
+ #
1103
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1104
+ #
1105
+ def get_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
1106
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1107
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1108
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1109
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1110
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1111
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1112
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1113
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1114
+ 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?
1115
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1116
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1117
+ fail ArgumentError, 'stored_procedure_name is nil' if stored_procedure_name.nil?
1118
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1119
+
1120
+
1121
+ request_headers = {}
1122
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1123
+
1124
+ # Set Headers
1125
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1126
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1127
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'
1128
+
1129
+ request_url = @base_url || @client.base_url
1130
+
1131
+ options = {
1132
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1133
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'storedProcedureName' => stored_procedure_name},
1134
+ query_params: {'api-version' => @client.api_version},
1135
+ headers: request_headers.merge(custom_headers || {}),
1136
+ base_url: request_url
1137
+ }
1138
+ promise = @client.make_request_async(:get, path_template, options)
1139
+
1140
+ promise = promise.then do |result|
1141
+ http_response = result.response
1142
+ status_code = http_response.status
1143
+ response_content = http_response.body
1144
+ unless status_code == 200
1145
+ error_model = JSON.load(response_content)
1146
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1147
+ end
1148
+
1149
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1150
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1151
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1152
+ # Deserialize Response
1153
+ if status_code == 200
1154
+ begin
1155
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1156
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlStoredProcedureGetResults.mapper()
1157
+ result.body = @client.deserialize(result_mapper, parsed_response)
1158
+ rescue Exception => e
1159
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1160
+ end
1161
+ end
1162
+
1163
+ result
1164
+ end
1165
+
1166
+ promise.execute
1167
+ end
1168
+
1169
+ #
1170
+ # Create or update an Azure Cosmos DB SQL storedProcedure
1171
+ #
1172
+ # @param resource_group_name [String] Name of an Azure resource group.
1173
+ # @param account_name [String] Cosmos DB database account name.
1174
+ # @param database_name [String] Cosmos DB database name.
1175
+ # @param container_name [String] Cosmos DB container name.
1176
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1177
+ # @param create_update_sql_stored_procedure_parameters
1178
+ # [SqlStoredProcedureCreateUpdateParameters] The parameters to provide for the
1179
+ # current SQL storedProcedure.
1180
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1181
+ # will be added to the HTTP request.
1182
+ #
1183
+ # @return [SqlStoredProcedureGetResults] operation results.
1184
+ #
1185
+ def create_update_sql_stored_procedure(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:nil)
1186
+ response = create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:custom_headers).value!
1187
+ response.body unless response.nil?
1188
+ end
1189
+
1190
+ #
1191
+ # @param resource_group_name [String] Name of an Azure resource group.
1192
+ # @param account_name [String] Cosmos DB database account name.
1193
+ # @param database_name [String] Cosmos DB database name.
1194
+ # @param container_name [String] Cosmos DB container name.
1195
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1196
+ # @param create_update_sql_stored_procedure_parameters
1197
+ # [SqlStoredProcedureCreateUpdateParameters] The parameters to provide for the
1198
+ # current SQL storedProcedure.
1199
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1200
+ # will be added to the HTTP request.
1201
+ #
1202
+ # @return [Concurrent::Promise] promise which provides async access to http
1203
+ # response.
1204
+ #
1205
+ def create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:nil)
1206
+ # Send request
1207
+ promise = begin_create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:custom_headers)
1208
+
1209
+ promise = promise.then do |response|
1210
+ # Defining deserialization method.
1211
+ deserialize_method = lambda do |parsed_response|
1212
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlStoredProcedureGetResults.mapper()
1213
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1214
+ end
1215
+
1216
+ # Waiting for response.
1217
+ @client.get_long_running_operation_result(response, deserialize_method)
1218
+ end
1219
+
1220
+ promise
1221
+ end
1222
+
1223
+ #
1224
+ # Deletes an existing Azure Cosmos DB SQL storedProcedure.
1225
+ #
1226
+ # @param resource_group_name [String] Name of an Azure resource group.
1227
+ # @param account_name [String] Cosmos DB database account name.
1228
+ # @param database_name [String] Cosmos DB database name.
1229
+ # @param container_name [String] Cosmos DB container name.
1230
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1231
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1232
+ # will be added to the HTTP request.
1233
+ #
1234
+ def delete_sql_stored_procedure(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
1235
+ response = delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers).value!
1236
+ nil
1237
+ end
1238
+
1239
+ #
1240
+ # @param resource_group_name [String] Name of an Azure resource group.
1241
+ # @param account_name [String] Cosmos DB database account name.
1242
+ # @param database_name [String] Cosmos DB database name.
1243
+ # @param container_name [String] Cosmos DB container name.
1244
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
1245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1246
+ # will be added to the HTTP request.
1247
+ #
1248
+ # @return [Concurrent::Promise] promise which provides async access to http
1249
+ # response.
1250
+ #
1251
+ def delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
1252
+ # Send request
1253
+ promise = begin_delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers)
1254
+
1255
+ promise = promise.then do |response|
1256
+ # Defining deserialization method.
1257
+ deserialize_method = lambda do |parsed_response|
1258
+ end
1259
+
1260
+ # Waiting for response.
1261
+ @client.get_long_running_operation_result(response, deserialize_method)
1262
+ end
1263
+
1264
+ promise
1265
+ end
1266
+
1267
+ #
1268
+ # Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database
1269
+ # account.
1270
+ #
1271
+ # @param resource_group_name [String] Name of an Azure resource group.
1272
+ # @param account_name [String] Cosmos DB database account name.
1273
+ # @param database_name [String] Cosmos DB database name.
1274
+ # @param container_name [String] Cosmos DB container name.
1275
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1276
+ # will be added to the HTTP request.
1277
+ #
1278
+ # @return [SqlUserDefinedFunctionListResult] operation results.
1279
+ #
1280
+ def list_sql_user_defined_functions(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1281
+ response = list_sql_user_defined_functions_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1282
+ response.body unless response.nil?
1283
+ end
1284
+
1285
+ #
1286
+ # Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database
1287
+ # account.
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 container_name [String] Cosmos DB container name.
1293
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1294
+ # will be added to the HTTP request.
1295
+ #
1296
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1297
+ #
1298
+ def list_sql_user_defined_functions_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1299
+ list_sql_user_defined_functions_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1300
+ end
1301
+
1302
+ #
1303
+ # Lists the SQL userDefinedFunction under an existing Azure Cosmos DB database
1304
+ # account.
1305
+ #
1306
+ # @param resource_group_name [String] Name of an Azure resource group.
1307
+ # @param account_name [String] Cosmos DB database account name.
1308
+ # @param database_name [String] Cosmos DB database name.
1309
+ # @param container_name [String] Cosmos DB container name.
1310
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1311
+ # to the HTTP request.
1312
+ #
1313
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1314
+ #
1315
+ def list_sql_user_defined_functions_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1316
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1317
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1318
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1319
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1320
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1321
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1322
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1323
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1324
+ 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?
1325
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1326
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1327
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1328
+
1329
+
1330
+ request_headers = {}
1331
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1332
+
1333
+ # Set Headers
1334
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1335
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1336
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/'
1337
+
1338
+ request_url = @base_url || @client.base_url
1339
+
1340
+ options = {
1341
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1342
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
1343
+ query_params: {'api-version' => @client.api_version},
1344
+ headers: request_headers.merge(custom_headers || {}),
1345
+ base_url: request_url
1346
+ }
1347
+ promise = @client.make_request_async(:get, path_template, options)
1348
+
1349
+ promise = promise.then do |result|
1350
+ http_response = result.response
1351
+ status_code = http_response.status
1352
+ response_content = http_response.body
1353
+ unless status_code == 200
1354
+ error_model = JSON.load(response_content)
1355
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1356
+ end
1357
+
1358
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1359
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1360
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1361
+ # Deserialize Response
1362
+ if status_code == 200
1363
+ begin
1364
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1365
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlUserDefinedFunctionListResult.mapper()
1366
+ result.body = @client.deserialize(result_mapper, parsed_response)
1367
+ rescue Exception => e
1368
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1369
+ end
1370
+ end
1371
+
1372
+ result
1373
+ end
1374
+
1375
+ promise.execute
1376
+ end
1377
+
1378
+ #
1379
+ # Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database
1380
+ # account.
1381
+ #
1382
+ # @param resource_group_name [String] Name of an Azure resource group.
1383
+ # @param account_name [String] Cosmos DB database account name.
1384
+ # @param database_name [String] Cosmos DB database name.
1385
+ # @param container_name [String] Cosmos DB container name.
1386
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1387
+ # name.
1388
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1389
+ # will be added to the HTTP request.
1390
+ #
1391
+ # @return [SqlUserDefinedFunctionGetResults] operation results.
1392
+ #
1393
+ def get_sql_user_defined_function(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
1394
+ response = get_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers).value!
1395
+ response.body unless response.nil?
1396
+ end
1397
+
1398
+ #
1399
+ # Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database
1400
+ # account.
1401
+ #
1402
+ # @param resource_group_name [String] Name of an Azure resource group.
1403
+ # @param account_name [String] Cosmos DB database account name.
1404
+ # @param database_name [String] Cosmos DB database name.
1405
+ # @param container_name [String] Cosmos DB container name.
1406
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1407
+ # name.
1408
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1409
+ # will be added to the HTTP request.
1410
+ #
1411
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1412
+ #
1413
+ def get_sql_user_defined_function_with_http_info(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
1414
+ get_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers).value!
1415
+ end
1416
+
1417
+ #
1418
+ # Gets the SQL userDefinedFunction under an existing Azure Cosmos DB database
1419
+ # account.
1420
+ #
1421
+ # @param resource_group_name [String] Name of an Azure resource group.
1422
+ # @param account_name [String] Cosmos DB database account name.
1423
+ # @param database_name [String] Cosmos DB database name.
1424
+ # @param container_name [String] Cosmos DB container name.
1425
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1426
+ # name.
1427
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1428
+ # to the HTTP request.
1429
+ #
1430
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1431
+ #
1432
+ def get_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
1433
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1434
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1435
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1436
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1437
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1438
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1439
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1440
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1441
+ 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?
1442
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1443
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1444
+ fail ArgumentError, 'user_defined_function_name is nil' if user_defined_function_name.nil?
1445
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1446
+
1447
+
1448
+ request_headers = {}
1449
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1450
+
1451
+ # Set Headers
1452
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1453
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1454
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'
1455
+
1456
+ request_url = @base_url || @client.base_url
1457
+
1458
+ options = {
1459
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1460
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'userDefinedFunctionName' => user_defined_function_name},
1461
+ query_params: {'api-version' => @client.api_version},
1462
+ headers: request_headers.merge(custom_headers || {}),
1463
+ base_url: request_url
1464
+ }
1465
+ promise = @client.make_request_async(:get, path_template, options)
1466
+
1467
+ promise = promise.then do |result|
1468
+ http_response = result.response
1469
+ status_code = http_response.status
1470
+ response_content = http_response.body
1471
+ unless status_code == 200
1472
+ error_model = JSON.load(response_content)
1473
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1474
+ end
1475
+
1476
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1477
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1478
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1479
+ # Deserialize Response
1480
+ if status_code == 200
1481
+ begin
1482
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1483
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlUserDefinedFunctionGetResults.mapper()
1484
+ result.body = @client.deserialize(result_mapper, parsed_response)
1485
+ rescue Exception => e
1486
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1487
+ end
1488
+ end
1489
+
1490
+ result
1491
+ end
1492
+
1493
+ promise.execute
1494
+ end
1495
+
1496
+ #
1497
+ # Create or update an Azure Cosmos DB SQL userDefinedFunction
1498
+ #
1499
+ # @param resource_group_name [String] Name of an Azure resource group.
1500
+ # @param account_name [String] Cosmos DB database account name.
1501
+ # @param database_name [String] Cosmos DB database name.
1502
+ # @param container_name [String] Cosmos DB container name.
1503
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1504
+ # name.
1505
+ # @param create_update_sql_user_defined_function_parameters
1506
+ # [SqlUserDefinedFunctionCreateUpdateParameters] The parameters to provide for
1507
+ # the current SQL userDefinedFunction.
1508
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1509
+ # will be added to the HTTP request.
1510
+ #
1511
+ # @return [SqlUserDefinedFunctionGetResults] operation results.
1512
+ #
1513
+ def create_update_sql_user_defined_function(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:nil)
1514
+ response = create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:custom_headers).value!
1515
+ response.body unless response.nil?
1516
+ end
1517
+
1518
+ #
1519
+ # @param resource_group_name [String] Name of an Azure resource group.
1520
+ # @param account_name [String] Cosmos DB database account name.
1521
+ # @param database_name [String] Cosmos DB database name.
1522
+ # @param container_name [String] Cosmos DB container name.
1523
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1524
+ # name.
1525
+ # @param create_update_sql_user_defined_function_parameters
1526
+ # [SqlUserDefinedFunctionCreateUpdateParameters] The parameters to provide for
1527
+ # the current SQL userDefinedFunction.
1528
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1529
+ # will be added to the HTTP request.
1530
+ #
1531
+ # @return [Concurrent::Promise] promise which provides async access to http
1532
+ # response.
1533
+ #
1534
+ def create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:nil)
1535
+ # Send request
1536
+ promise = begin_create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:custom_headers)
1537
+
1538
+ promise = promise.then do |response|
1539
+ # Defining deserialization method.
1540
+ deserialize_method = lambda do |parsed_response|
1541
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlUserDefinedFunctionGetResults.mapper()
1542
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1543
+ end
1544
+
1545
+ # Waiting for response.
1546
+ @client.get_long_running_operation_result(response, deserialize_method)
1547
+ end
1548
+
1549
+ promise
1550
+ end
1551
+
1552
+ #
1553
+ # Deletes an existing Azure Cosmos DB SQL userDefinedFunction.
1554
+ #
1555
+ # @param resource_group_name [String] Name of an Azure resource group.
1556
+ # @param account_name [String] Cosmos DB database account name.
1557
+ # @param database_name [String] Cosmos DB database name.
1558
+ # @param container_name [String] Cosmos DB container name.
1559
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1560
+ # name.
1561
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1562
+ # will be added to the HTTP request.
1563
+ #
1564
+ def delete_sql_user_defined_function(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
1565
+ response = delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers).value!
1566
+ nil
1567
+ end
1568
+
1569
+ #
1570
+ # @param resource_group_name [String] Name of an Azure resource group.
1571
+ # @param account_name [String] Cosmos DB database account name.
1572
+ # @param database_name [String] Cosmos DB database name.
1573
+ # @param container_name [String] Cosmos DB container name.
1574
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
1575
+ # name.
1576
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1577
+ # will be added to the HTTP request.
1578
+ #
1579
+ # @return [Concurrent::Promise] promise which provides async access to http
1580
+ # response.
1581
+ #
1582
+ def delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
1583
+ # Send request
1584
+ promise = begin_delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers)
1585
+
1586
+ promise = promise.then do |response|
1587
+ # Defining deserialization method.
1588
+ deserialize_method = lambda do |parsed_response|
1589
+ end
1590
+
1591
+ # Waiting for response.
1592
+ @client.get_long_running_operation_result(response, deserialize_method)
1593
+ end
1594
+
1595
+ promise
1596
+ end
1597
+
1598
+ #
1599
+ # Lists the SQL trigger under an existing Azure Cosmos DB database account.
1600
+ #
1601
+ # @param resource_group_name [String] Name of an Azure resource group.
1602
+ # @param account_name [String] Cosmos DB database account name.
1603
+ # @param database_name [String] Cosmos DB database name.
1604
+ # @param container_name [String] Cosmos DB container name.
1605
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1606
+ # will be added to the HTTP request.
1607
+ #
1608
+ # @return [SqlTriggerListResult] operation results.
1609
+ #
1610
+ def list_sql_triggers(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1611
+ response = list_sql_triggers_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1612
+ response.body unless response.nil?
1613
+ end
1614
+
1615
+ #
1616
+ # Lists the SQL trigger under an existing Azure Cosmos DB database account.
1617
+ #
1618
+ # @param resource_group_name [String] Name of an Azure resource group.
1619
+ # @param account_name [String] Cosmos DB database account name.
1620
+ # @param database_name [String] Cosmos DB database name.
1621
+ # @param container_name [String] Cosmos DB container name.
1622
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1623
+ # will be added to the HTTP request.
1624
+ #
1625
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1626
+ #
1627
+ def list_sql_triggers_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1628
+ list_sql_triggers_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
1629
+ end
1630
+
1631
+ #
1632
+ # Lists the SQL trigger under an existing Azure Cosmos DB database account.
1633
+ #
1634
+ # @param resource_group_name [String] Name of an Azure resource group.
1635
+ # @param account_name [String] Cosmos DB database account name.
1636
+ # @param database_name [String] Cosmos DB database name.
1637
+ # @param container_name [String] Cosmos DB container name.
1638
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1639
+ # to the HTTP request.
1640
+ #
1641
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1642
+ #
1643
+ def list_sql_triggers_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
1644
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1645
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1646
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1647
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1648
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1649
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1650
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1651
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1652
+ 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?
1653
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1654
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1655
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1656
+
1657
+
1658
+ request_headers = {}
1659
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1660
+
1661
+ # Set Headers
1662
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1663
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1664
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/'
1665
+
1666
+ request_url = @base_url || @client.base_url
1667
+
1668
+ options = {
1669
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1670
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
1671
+ query_params: {'api-version' => @client.api_version},
1672
+ headers: request_headers.merge(custom_headers || {}),
1673
+ base_url: request_url
1674
+ }
1675
+ promise = @client.make_request_async(:get, path_template, options)
1676
+
1677
+ promise = promise.then do |result|
1678
+ http_response = result.response
1679
+ status_code = http_response.status
1680
+ response_content = http_response.body
1681
+ unless status_code == 200
1682
+ error_model = JSON.load(response_content)
1683
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1684
+ end
1685
+
1686
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1687
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1688
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1689
+ # Deserialize Response
1690
+ if status_code == 200
1691
+ begin
1692
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1693
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlTriggerListResult.mapper()
1694
+ result.body = @client.deserialize(result_mapper, parsed_response)
1695
+ rescue Exception => e
1696
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1697
+ end
1698
+ end
1699
+
1700
+ result
1701
+ end
1702
+
1703
+ promise.execute
1704
+ end
1705
+
1706
+ #
1707
+ # Gets the SQL trigger under an existing Azure Cosmos DB database account.
1708
+ #
1709
+ # @param resource_group_name [String] Name of an Azure resource group.
1710
+ # @param account_name [String] Cosmos DB database account name.
1711
+ # @param database_name [String] Cosmos DB database name.
1712
+ # @param container_name [String] Cosmos DB container name.
1713
+ # @param trigger_name [String] Cosmos DB trigger name.
1714
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1715
+ # will be added to the HTTP request.
1716
+ #
1717
+ # @return [SqlTriggerGetResults] operation results.
1718
+ #
1719
+ def get_sql_trigger(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
1720
+ response = get_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers).value!
1721
+ response.body unless response.nil?
1722
+ end
1723
+
1724
+ #
1725
+ # Gets the SQL trigger under an existing Azure Cosmos DB database account.
1726
+ #
1727
+ # @param resource_group_name [String] Name of an Azure resource group.
1728
+ # @param account_name [String] Cosmos DB database account name.
1729
+ # @param database_name [String] Cosmos DB database name.
1730
+ # @param container_name [String] Cosmos DB container name.
1731
+ # @param trigger_name [String] Cosmos DB trigger name.
1732
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1733
+ # will be added to the HTTP request.
1734
+ #
1735
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1736
+ #
1737
+ def get_sql_trigger_with_http_info(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
1738
+ get_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers).value!
1739
+ end
1740
+
1741
+ #
1742
+ # Gets the SQL trigger under an existing Azure Cosmos DB database account.
1743
+ #
1744
+ # @param resource_group_name [String] Name of an Azure resource group.
1745
+ # @param account_name [String] Cosmos DB database account name.
1746
+ # @param database_name [String] Cosmos DB database name.
1747
+ # @param container_name [String] Cosmos DB container name.
1748
+ # @param trigger_name [String] Cosmos DB trigger name.
1749
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1750
+ # to the HTTP request.
1751
+ #
1752
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1753
+ #
1754
+ def get_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
1755
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1756
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1757
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1758
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1759
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1760
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1761
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1762
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1763
+ 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?
1764
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1765
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
1766
+ fail ArgumentError, 'trigger_name is nil' if trigger_name.nil?
1767
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1768
+
1769
+
1770
+ request_headers = {}
1771
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1772
+
1773
+ # Set Headers
1774
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1775
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1776
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'
1777
+
1778
+ request_url = @base_url || @client.base_url
1779
+
1780
+ options = {
1781
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1782
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'triggerName' => trigger_name},
1783
+ query_params: {'api-version' => @client.api_version},
1784
+ headers: request_headers.merge(custom_headers || {}),
1785
+ base_url: request_url
1786
+ }
1787
+ promise = @client.make_request_async(:get, path_template, options)
1788
+
1789
+ promise = promise.then do |result|
1790
+ http_response = result.response
1791
+ status_code = http_response.status
1792
+ response_content = http_response.body
1793
+ unless status_code == 200
1794
+ error_model = JSON.load(response_content)
1795
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1796
+ end
1797
+
1798
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1799
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1800
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1801
+ # Deserialize Response
1802
+ if status_code == 200
1803
+ begin
1804
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1805
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlTriggerGetResults.mapper()
1806
+ result.body = @client.deserialize(result_mapper, parsed_response)
1807
+ rescue Exception => e
1808
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1809
+ end
1810
+ end
1811
+
1812
+ result
1813
+ end
1814
+
1815
+ promise.execute
1816
+ end
1817
+
1818
+ #
1819
+ # Create or update an Azure Cosmos DB SQL trigger
1820
+ #
1821
+ # @param resource_group_name [String] Name of an Azure resource group.
1822
+ # @param account_name [String] Cosmos DB database account name.
1823
+ # @param database_name [String] Cosmos DB database name.
1824
+ # @param container_name [String] Cosmos DB container name.
1825
+ # @param trigger_name [String] Cosmos DB trigger name.
1826
+ # @param create_update_sql_trigger_parameters
1827
+ # [SqlTriggerCreateUpdateParameters] The parameters to provide for the current
1828
+ # SQL trigger.
1829
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1830
+ # will be added to the HTTP request.
1831
+ #
1832
+ # @return [SqlTriggerGetResults] operation results.
1833
+ #
1834
+ def create_update_sql_trigger(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:nil)
1835
+ response = create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:custom_headers).value!
1836
+ response.body unless response.nil?
1837
+ end
1838
+
1839
+ #
1840
+ # @param resource_group_name [String] Name of an Azure resource group.
1841
+ # @param account_name [String] Cosmos DB database account name.
1842
+ # @param database_name [String] Cosmos DB database name.
1843
+ # @param container_name [String] Cosmos DB container name.
1844
+ # @param trigger_name [String] Cosmos DB trigger name.
1845
+ # @param create_update_sql_trigger_parameters
1846
+ # [SqlTriggerCreateUpdateParameters] The parameters to provide for the current
1847
+ # SQL trigger.
1848
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1849
+ # will be added to the HTTP request.
1850
+ #
1851
+ # @return [Concurrent::Promise] promise which provides async access to http
1852
+ # response.
1853
+ #
1854
+ def create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:nil)
1855
+ # Send request
1856
+ promise = begin_create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:custom_headers)
1857
+
1858
+ promise = promise.then do |response|
1859
+ # Defining deserialization method.
1860
+ deserialize_method = lambda do |parsed_response|
1861
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlTriggerGetResults.mapper()
1862
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
1863
+ end
1864
+
1865
+ # Waiting for response.
1866
+ @client.get_long_running_operation_result(response, deserialize_method)
1867
+ end
1868
+
1869
+ promise
1870
+ end
1871
+
1872
+ #
1873
+ # Deletes an existing Azure Cosmos DB SQL trigger.
1874
+ #
1875
+ # @param resource_group_name [String] Name of an Azure resource group.
1876
+ # @param account_name [String] Cosmos DB database account name.
1877
+ # @param database_name [String] Cosmos DB database name.
1878
+ # @param container_name [String] Cosmos DB container name.
1879
+ # @param trigger_name [String] Cosmos DB trigger name.
1880
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1881
+ # will be added to the HTTP request.
1882
+ #
1883
+ def delete_sql_trigger(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
1884
+ response = delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers).value!
1885
+ nil
1886
+ end
1887
+
1888
+ #
1889
+ # @param resource_group_name [String] Name of an Azure resource group.
1890
+ # @param account_name [String] Cosmos DB database account name.
1891
+ # @param database_name [String] Cosmos DB database name.
1892
+ # @param container_name [String] Cosmos DB container name.
1893
+ # @param trigger_name [String] Cosmos DB trigger name.
1894
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1895
+ # will be added to the HTTP request.
1896
+ #
1897
+ # @return [Concurrent::Promise] promise which provides async access to http
1898
+ # response.
1899
+ #
1900
+ def delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
1901
+ # Send request
1902
+ promise = begin_delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers)
1903
+
1904
+ promise = promise.then do |response|
1905
+ # Defining deserialization method.
1906
+ deserialize_method = lambda do |parsed_response|
1907
+ end
1908
+
1909
+ # Waiting for response.
1910
+ @client.get_long_running_operation_result(response, deserialize_method)
1911
+ end
1912
+
1913
+ promise
1914
+ end
1915
+
1916
+ #
1917
+ # Create or update an Azure Cosmos DB SQL database
1918
+ #
1919
+ # @param resource_group_name [String] Name of an Azure resource group.
1920
+ # @param account_name [String] Cosmos DB database account name.
1921
+ # @param database_name [String] Cosmos DB database name.
1922
+ # @param create_update_sql_database_parameters
1923
+ # [SqlDatabaseCreateUpdateParameters] The parameters to provide for the current
1924
+ # SQL database.
1925
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1926
+ # will be added to the HTTP request.
1927
+ #
1928
+ # @return [SqlDatabaseGetResults] operation results.
1929
+ #
1930
+ def begin_create_update_sql_database(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:nil)
1931
+ response = begin_create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:custom_headers).value!
1932
+ response.body unless response.nil?
1933
+ end
1934
+
1935
+ #
1936
+ # Create or update an Azure Cosmos DB SQL database
1937
+ #
1938
+ # @param resource_group_name [String] Name of an Azure resource group.
1939
+ # @param account_name [String] Cosmos DB database account name.
1940
+ # @param database_name [String] Cosmos DB database name.
1941
+ # @param create_update_sql_database_parameters
1942
+ # [SqlDatabaseCreateUpdateParameters] The parameters to provide for the current
1943
+ # SQL database.
1944
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1945
+ # will be added to the HTTP request.
1946
+ #
1947
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1948
+ #
1949
+ def begin_create_update_sql_database_with_http_info(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:nil)
1950
+ begin_create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:custom_headers).value!
1951
+ end
1952
+
1953
+ #
1954
+ # Create or update an Azure Cosmos DB SQL database
1955
+ #
1956
+ # @param resource_group_name [String] Name of an Azure resource group.
1957
+ # @param account_name [String] Cosmos DB database account name.
1958
+ # @param database_name [String] Cosmos DB database name.
1959
+ # @param create_update_sql_database_parameters
1960
+ # [SqlDatabaseCreateUpdateParameters] The parameters to provide for the current
1961
+ # SQL database.
1962
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1963
+ # to the HTTP request.
1964
+ #
1965
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1966
+ #
1967
+ def begin_create_update_sql_database_async(resource_group_name, account_name, database_name, create_update_sql_database_parameters, custom_headers:nil)
1968
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1969
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1970
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1971
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1972
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1973
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
1974
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
1975
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
1976
+ 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?
1977
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
1978
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1979
+ fail ArgumentError, 'create_update_sql_database_parameters is nil' if create_update_sql_database_parameters.nil?
1980
+
1981
+
1982
+ request_headers = {}
1983
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1984
+
1985
+ # Set Headers
1986
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1987
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1988
+
1989
+ # Serialize Request
1990
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlDatabaseCreateUpdateParameters.mapper()
1991
+ request_content = @client.serialize(request_mapper, create_update_sql_database_parameters)
1992
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1993
+
1994
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'
1995
+
1996
+ request_url = @base_url || @client.base_url
1997
+
1998
+ options = {
1999
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2000
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
2001
+ query_params: {'api-version' => @client.api_version},
2002
+ body: request_content,
2003
+ headers: request_headers.merge(custom_headers || {}),
2004
+ base_url: request_url
2005
+ }
2006
+ promise = @client.make_request_async(:put, path_template, options)
2007
+
2008
+ promise = promise.then do |result|
2009
+ http_response = result.response
2010
+ status_code = http_response.status
2011
+ response_content = http_response.body
2012
+ unless status_code == 202 || status_code == 200
2013
+ error_model = JSON.load(response_content)
2014
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2015
+ end
2016
+
2017
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2018
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2019
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2020
+ # Deserialize Response
2021
+ if status_code == 200
2022
+ begin
2023
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2024
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlDatabaseGetResults.mapper()
2025
+ result.body = @client.deserialize(result_mapper, parsed_response)
2026
+ rescue Exception => e
2027
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2028
+ end
2029
+ end
2030
+
2031
+ result
2032
+ end
2033
+
2034
+ promise.execute
2035
+ end
2036
+
2037
+ #
2038
+ # Deletes an existing Azure Cosmos DB SQL database.
2039
+ #
2040
+ # @param resource_group_name [String] Name of an Azure resource group.
2041
+ # @param account_name [String] Cosmos DB database account name.
2042
+ # @param database_name [String] Cosmos DB database name.
2043
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2044
+ # will be added to the HTTP request.
2045
+ #
2046
+ #
2047
+ def begin_delete_sql_database(resource_group_name, account_name, database_name, custom_headers:nil)
2048
+ response = begin_delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2049
+ nil
2050
+ end
2051
+
2052
+ #
2053
+ # Deletes an existing Azure Cosmos DB SQL database.
2054
+ #
2055
+ # @param resource_group_name [String] Name of an Azure resource group.
2056
+ # @param account_name [String] Cosmos DB database account name.
2057
+ # @param database_name [String] Cosmos DB database name.
2058
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2059
+ # will be added to the HTTP request.
2060
+ #
2061
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2062
+ #
2063
+ def begin_delete_sql_database_with_http_info(resource_group_name, account_name, database_name, custom_headers:nil)
2064
+ begin_delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:custom_headers).value!
2065
+ end
2066
+
2067
+ #
2068
+ # Deletes an existing Azure Cosmos DB SQL database.
2069
+ #
2070
+ # @param resource_group_name [String] Name of an Azure resource group.
2071
+ # @param account_name [String] Cosmos DB database account name.
2072
+ # @param database_name [String] Cosmos DB database name.
2073
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2074
+ # to the HTTP request.
2075
+ #
2076
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2077
+ #
2078
+ def begin_delete_sql_database_async(resource_group_name, account_name, database_name, custom_headers:nil)
2079
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2080
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2081
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2082
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2083
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2084
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2085
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2086
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2087
+ 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?
2088
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2089
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2090
+
2091
+
2092
+ request_headers = {}
2093
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2094
+
2095
+ # Set Headers
2096
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2097
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2098
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}'
2099
+
2100
+ request_url = @base_url || @client.base_url
2101
+
2102
+ options = {
2103
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2104
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
2105
+ query_params: {'api-version' => @client.api_version},
2106
+ headers: request_headers.merge(custom_headers || {}),
2107
+ base_url: request_url
2108
+ }
2109
+ promise = @client.make_request_async(:delete, path_template, options)
2110
+
2111
+ promise = promise.then do |result|
2112
+ http_response = result.response
2113
+ status_code = http_response.status
2114
+ response_content = http_response.body
2115
+ unless status_code == 202 || status_code == 204
2116
+ error_model = JSON.load(response_content)
2117
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2118
+ end
2119
+
2120
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2121
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2122
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2123
+
2124
+ result
2125
+ end
2126
+
2127
+ promise.execute
2128
+ end
2129
+
2130
+ #
2131
+ # Update RUs per second of an Azure Cosmos DB SQL database
2132
+ #
2133
+ # @param resource_group_name [String] Name of an Azure resource group.
2134
+ # @param account_name [String] Cosmos DB database account name.
2135
+ # @param database_name [String] Cosmos DB database name.
2136
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2137
+ # parameters to provide for the RUs per second of the current SQL database.
2138
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2139
+ # will be added to the HTTP request.
2140
+ #
2141
+ # @return [ThroughputSettingsGetResults] operation results.
2142
+ #
2143
+ def begin_update_sql_database_throughput(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
2144
+ response = begin_update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
2145
+ response.body unless response.nil?
2146
+ end
2147
+
2148
+ #
2149
+ # Update RUs per second of an Azure Cosmos DB SQL database
2150
+ #
2151
+ # @param resource_group_name [String] Name of an Azure resource group.
2152
+ # @param account_name [String] Cosmos DB database account name.
2153
+ # @param database_name [String] Cosmos DB database name.
2154
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2155
+ # parameters to provide for the RUs per second of the current SQL database.
2156
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2157
+ # will be added to the HTTP request.
2158
+ #
2159
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2160
+ #
2161
+ def begin_update_sql_database_throughput_with_http_info(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
2162
+ begin_update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:custom_headers).value!
2163
+ end
2164
+
2165
+ #
2166
+ # Update RUs per second of an Azure Cosmos DB SQL database
2167
+ #
2168
+ # @param resource_group_name [String] Name of an Azure resource group.
2169
+ # @param account_name [String] Cosmos DB database account name.
2170
+ # @param database_name [String] Cosmos DB database name.
2171
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2172
+ # parameters to provide for the RUs per second of the current SQL database.
2173
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2174
+ # to the HTTP request.
2175
+ #
2176
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2177
+ #
2178
+ def begin_update_sql_database_throughput_async(resource_group_name, account_name, database_name, update_throughput_parameters, custom_headers:nil)
2179
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2180
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2181
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2182
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2183
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2184
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2185
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2186
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2187
+ 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?
2188
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2189
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2190
+ fail ArgumentError, 'update_throughput_parameters is nil' if update_throughput_parameters.nil?
2191
+
2192
+
2193
+ request_headers = {}
2194
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2195
+
2196
+ # Set Headers
2197
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2198
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2199
+
2200
+ # Serialize Request
2201
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsUpdateParameters.mapper()
2202
+ request_content = @client.serialize(request_mapper, update_throughput_parameters)
2203
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2204
+
2205
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/throughputSettings/default'
2206
+
2207
+ request_url = @base_url || @client.base_url
2208
+
2209
+ options = {
2210
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2211
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name},
2212
+ query_params: {'api-version' => @client.api_version},
2213
+ body: request_content,
2214
+ headers: request_headers.merge(custom_headers || {}),
2215
+ base_url: request_url
2216
+ }
2217
+ promise = @client.make_request_async(:put, path_template, options)
2218
+
2219
+ promise = promise.then do |result|
2220
+ http_response = result.response
2221
+ status_code = http_response.status
2222
+ response_content = http_response.body
2223
+ unless status_code == 202 || status_code == 200
2224
+ error_model = JSON.load(response_content)
2225
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2226
+ end
2227
+
2228
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2229
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2230
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2231
+ # Deserialize Response
2232
+ if status_code == 200
2233
+ begin
2234
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2235
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
2236
+ result.body = @client.deserialize(result_mapper, parsed_response)
2237
+ rescue Exception => e
2238
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2239
+ end
2240
+ end
2241
+
2242
+ result
2243
+ end
2244
+
2245
+ promise.execute
2246
+ end
2247
+
2248
+ #
2249
+ # Create or update an Azure Cosmos DB SQL container
2250
+ #
2251
+ # @param resource_group_name [String] Name of an Azure resource group.
2252
+ # @param account_name [String] Cosmos DB database account name.
2253
+ # @param database_name [String] Cosmos DB database name.
2254
+ # @param container_name [String] Cosmos DB container name.
2255
+ # @param create_update_sql_container_parameters
2256
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2257
+ # current SQL container.
2258
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2259
+ # will be added to the HTTP request.
2260
+ #
2261
+ # @return [SqlContainerGetResults] operation results.
2262
+ #
2263
+ def begin_create_update_sql_container(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2264
+ response = begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2265
+ response.body unless response.nil?
2266
+ end
2267
+
2268
+ #
2269
+ # Create or update an Azure Cosmos DB SQL container
2270
+ #
2271
+ # @param resource_group_name [String] Name of an Azure resource group.
2272
+ # @param account_name [String] Cosmos DB database account name.
2273
+ # @param database_name [String] Cosmos DB database name.
2274
+ # @param container_name [String] Cosmos DB container name.
2275
+ # @param create_update_sql_container_parameters
2276
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2277
+ # current SQL container.
2278
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2279
+ # will be added to the HTTP request.
2280
+ #
2281
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2282
+ #
2283
+ def begin_create_update_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2284
+ begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:custom_headers).value!
2285
+ end
2286
+
2287
+ #
2288
+ # Create or update an Azure Cosmos DB SQL container
2289
+ #
2290
+ # @param resource_group_name [String] Name of an Azure resource group.
2291
+ # @param account_name [String] Cosmos DB database account name.
2292
+ # @param database_name [String] Cosmos DB database name.
2293
+ # @param container_name [String] Cosmos DB container name.
2294
+ # @param create_update_sql_container_parameters
2295
+ # [SqlContainerCreateUpdateParameters] The parameters to provide for the
2296
+ # current SQL container.
2297
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2298
+ # to the HTTP request.
2299
+ #
2300
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2301
+ #
2302
+ def begin_create_update_sql_container_async(resource_group_name, account_name, database_name, container_name, create_update_sql_container_parameters, custom_headers:nil)
2303
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2304
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2305
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2306
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2307
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2308
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2309
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2310
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2311
+ 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?
2312
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2313
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2314
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2315
+ fail ArgumentError, 'create_update_sql_container_parameters is nil' if create_update_sql_container_parameters.nil?
2316
+
2317
+
2318
+ request_headers = {}
2319
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2320
+
2321
+ # Set Headers
2322
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2323
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2324
+
2325
+ # Serialize Request
2326
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlContainerCreateUpdateParameters.mapper()
2327
+ request_content = @client.serialize(request_mapper, create_update_sql_container_parameters)
2328
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2329
+
2330
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2331
+
2332
+ request_url = @base_url || @client.base_url
2333
+
2334
+ options = {
2335
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2336
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2337
+ query_params: {'api-version' => @client.api_version},
2338
+ body: request_content,
2339
+ headers: request_headers.merge(custom_headers || {}),
2340
+ base_url: request_url
2341
+ }
2342
+ promise = @client.make_request_async(:put, path_template, options)
2343
+
2344
+ promise = promise.then do |result|
2345
+ http_response = result.response
2346
+ status_code = http_response.status
2347
+ response_content = http_response.body
2348
+ unless status_code == 202 || status_code == 200
2349
+ error_model = JSON.load(response_content)
2350
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2351
+ end
2352
+
2353
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2354
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2355
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2356
+ # Deserialize Response
2357
+ if status_code == 200
2358
+ begin
2359
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2360
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlContainerGetResults.mapper()
2361
+ result.body = @client.deserialize(result_mapper, parsed_response)
2362
+ rescue Exception => e
2363
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2364
+ end
2365
+ end
2366
+
2367
+ result
2368
+ end
2369
+
2370
+ promise.execute
2371
+ end
2372
+
2373
+ #
2374
+ # Deletes an existing Azure Cosmos DB SQL container.
2375
+ #
2376
+ # @param resource_group_name [String] Name of an Azure resource group.
2377
+ # @param account_name [String] Cosmos DB database account name.
2378
+ # @param database_name [String] Cosmos DB database name.
2379
+ # @param container_name [String] Cosmos DB container name.
2380
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2381
+ # will be added to the HTTP request.
2382
+ #
2383
+ #
2384
+ def begin_delete_sql_container(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2385
+ response = begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2386
+ nil
2387
+ end
2388
+
2389
+ #
2390
+ # Deletes an existing Azure Cosmos DB SQL container.
2391
+ #
2392
+ # @param resource_group_name [String] Name of an Azure resource group.
2393
+ # @param account_name [String] Cosmos DB database account name.
2394
+ # @param database_name [String] Cosmos DB database name.
2395
+ # @param container_name [String] Cosmos DB container name.
2396
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2397
+ # will be added to the HTTP request.
2398
+ #
2399
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2400
+ #
2401
+ def begin_delete_sql_container_with_http_info(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2402
+ begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:custom_headers).value!
2403
+ end
2404
+
2405
+ #
2406
+ # Deletes an existing Azure Cosmos DB SQL container.
2407
+ #
2408
+ # @param resource_group_name [String] Name of an Azure resource group.
2409
+ # @param account_name [String] Cosmos DB database account name.
2410
+ # @param database_name [String] Cosmos DB database name.
2411
+ # @param container_name [String] Cosmos DB container name.
2412
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2413
+ # to the HTTP request.
2414
+ #
2415
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2416
+ #
2417
+ def begin_delete_sql_container_async(resource_group_name, account_name, database_name, container_name, custom_headers:nil)
2418
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2419
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2420
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2421
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2422
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2423
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2424
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2425
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2426
+ 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?
2427
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2428
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2429
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2430
+
2431
+
2432
+ request_headers = {}
2433
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2434
+
2435
+ # Set Headers
2436
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2437
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2438
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}'
2439
+
2440
+ request_url = @base_url || @client.base_url
2441
+
2442
+ options = {
2443
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2444
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2445
+ query_params: {'api-version' => @client.api_version},
2446
+ headers: request_headers.merge(custom_headers || {}),
2447
+ base_url: request_url
2448
+ }
2449
+ promise = @client.make_request_async(:delete, path_template, options)
2450
+
2451
+ promise = promise.then do |result|
2452
+ http_response = result.response
2453
+ status_code = http_response.status
2454
+ response_content = http_response.body
2455
+ unless status_code == 202 || status_code == 204
2456
+ error_model = JSON.load(response_content)
2457
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2458
+ end
2459
+
2460
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2461
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2462
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2463
+
2464
+ result
2465
+ end
2466
+
2467
+ promise.execute
2468
+ end
2469
+
2470
+ #
2471
+ # Update RUs per second of an Azure Cosmos DB SQL container
2472
+ #
2473
+ # @param resource_group_name [String] Name of an Azure resource group.
2474
+ # @param account_name [String] Cosmos DB database account name.
2475
+ # @param database_name [String] Cosmos DB database name.
2476
+ # @param container_name [String] Cosmos DB container name.
2477
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2478
+ # parameters to provide for the RUs per second of the current SQL container.
2479
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2480
+ # will be added to the HTTP request.
2481
+ #
2482
+ # @return [ThroughputSettingsGetResults] operation results.
2483
+ #
2484
+ def begin_update_sql_container_throughput(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
2485
+ response = begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers).value!
2486
+ response.body unless response.nil?
2487
+ end
2488
+
2489
+ #
2490
+ # Update RUs per second of an Azure Cosmos DB SQL container
2491
+ #
2492
+ # @param resource_group_name [String] Name of an Azure resource group.
2493
+ # @param account_name [String] Cosmos DB database account name.
2494
+ # @param database_name [String] Cosmos DB database name.
2495
+ # @param container_name [String] Cosmos DB container name.
2496
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2497
+ # parameters to provide for the RUs per second of the current SQL container.
2498
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2499
+ # will be added to the HTTP request.
2500
+ #
2501
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2502
+ #
2503
+ def begin_update_sql_container_throughput_with_http_info(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
2504
+ begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:custom_headers).value!
2505
+ end
2506
+
2507
+ #
2508
+ # Update RUs per second of an Azure Cosmos DB SQL container
2509
+ #
2510
+ # @param resource_group_name [String] Name of an Azure resource group.
2511
+ # @param account_name [String] Cosmos DB database account name.
2512
+ # @param database_name [String] Cosmos DB database name.
2513
+ # @param container_name [String] Cosmos DB container name.
2514
+ # @param update_throughput_parameters [ThroughputSettingsUpdateParameters] The
2515
+ # parameters to provide for the RUs per second of the current SQL container.
2516
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2517
+ # to the HTTP request.
2518
+ #
2519
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2520
+ #
2521
+ def begin_update_sql_container_throughput_async(resource_group_name, account_name, database_name, container_name, update_throughput_parameters, custom_headers:nil)
2522
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2523
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2524
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2525
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2526
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2527
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2528
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2529
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2530
+ 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?
2531
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2532
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2533
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2534
+ fail ArgumentError, 'update_throughput_parameters is nil' if update_throughput_parameters.nil?
2535
+
2536
+
2537
+ request_headers = {}
2538
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2539
+
2540
+ # Set Headers
2541
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2542
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2543
+
2544
+ # Serialize Request
2545
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsUpdateParameters.mapper()
2546
+ request_content = @client.serialize(request_mapper, update_throughput_parameters)
2547
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2548
+
2549
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/throughputSettings/default'
2550
+
2551
+ request_url = @base_url || @client.base_url
2552
+
2553
+ options = {
2554
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2555
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name},
2556
+ query_params: {'api-version' => @client.api_version},
2557
+ body: request_content,
2558
+ headers: request_headers.merge(custom_headers || {}),
2559
+ base_url: request_url
2560
+ }
2561
+ promise = @client.make_request_async(:put, path_template, options)
2562
+
2563
+ promise = promise.then do |result|
2564
+ http_response = result.response
2565
+ status_code = http_response.status
2566
+ response_content = http_response.body
2567
+ unless status_code == 202 || status_code == 200
2568
+ error_model = JSON.load(response_content)
2569
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2570
+ end
2571
+
2572
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2573
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2574
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2575
+ # Deserialize Response
2576
+ if status_code == 200
2577
+ begin
2578
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2579
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::ThroughputSettingsGetResults.mapper()
2580
+ result.body = @client.deserialize(result_mapper, parsed_response)
2581
+ rescue Exception => e
2582
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2583
+ end
2584
+ end
2585
+
2586
+ result
2587
+ end
2588
+
2589
+ promise.execute
2590
+ end
2591
+
2592
+ #
2593
+ # Create or update an Azure Cosmos DB SQL storedProcedure
2594
+ #
2595
+ # @param resource_group_name [String] Name of an Azure resource group.
2596
+ # @param account_name [String] Cosmos DB database account name.
2597
+ # @param database_name [String] Cosmos DB database name.
2598
+ # @param container_name [String] Cosmos DB container name.
2599
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2600
+ # @param create_update_sql_stored_procedure_parameters
2601
+ # [SqlStoredProcedureCreateUpdateParameters] The parameters to provide for the
2602
+ # current SQL storedProcedure.
2603
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2604
+ # will be added to the HTTP request.
2605
+ #
2606
+ # @return [SqlStoredProcedureGetResults] operation results.
2607
+ #
2608
+ def begin_create_update_sql_stored_procedure(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:nil)
2609
+ response = begin_create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:custom_headers).value!
2610
+ response.body unless response.nil?
2611
+ end
2612
+
2613
+ #
2614
+ # Create or update an Azure Cosmos DB SQL storedProcedure
2615
+ #
2616
+ # @param resource_group_name [String] Name of an Azure resource group.
2617
+ # @param account_name [String] Cosmos DB database account name.
2618
+ # @param database_name [String] Cosmos DB database name.
2619
+ # @param container_name [String] Cosmos DB container name.
2620
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2621
+ # @param create_update_sql_stored_procedure_parameters
2622
+ # [SqlStoredProcedureCreateUpdateParameters] The parameters to provide for the
2623
+ # current SQL storedProcedure.
2624
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2625
+ # will be added to the HTTP request.
2626
+ #
2627
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2628
+ #
2629
+ def begin_create_update_sql_stored_procedure_with_http_info(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:nil)
2630
+ begin_create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:custom_headers).value!
2631
+ end
2632
+
2633
+ #
2634
+ # Create or update an Azure Cosmos DB SQL storedProcedure
2635
+ #
2636
+ # @param resource_group_name [String] Name of an Azure resource group.
2637
+ # @param account_name [String] Cosmos DB database account name.
2638
+ # @param database_name [String] Cosmos DB database name.
2639
+ # @param container_name [String] Cosmos DB container name.
2640
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2641
+ # @param create_update_sql_stored_procedure_parameters
2642
+ # [SqlStoredProcedureCreateUpdateParameters] The parameters to provide for the
2643
+ # current SQL storedProcedure.
2644
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2645
+ # to the HTTP request.
2646
+ #
2647
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2648
+ #
2649
+ def begin_create_update_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, create_update_sql_stored_procedure_parameters, custom_headers:nil)
2650
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2651
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2652
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2653
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2654
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2655
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2656
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2657
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2658
+ 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?
2659
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2660
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2661
+ fail ArgumentError, 'stored_procedure_name is nil' if stored_procedure_name.nil?
2662
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2663
+ fail ArgumentError, 'create_update_sql_stored_procedure_parameters is nil' if create_update_sql_stored_procedure_parameters.nil?
2664
+
2665
+
2666
+ request_headers = {}
2667
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2668
+
2669
+ # Set Headers
2670
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2671
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2672
+
2673
+ # Serialize Request
2674
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlStoredProcedureCreateUpdateParameters.mapper()
2675
+ request_content = @client.serialize(request_mapper, create_update_sql_stored_procedure_parameters)
2676
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2677
+
2678
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'
2679
+
2680
+ request_url = @base_url || @client.base_url
2681
+
2682
+ options = {
2683
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2684
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'storedProcedureName' => stored_procedure_name},
2685
+ query_params: {'api-version' => @client.api_version},
2686
+ body: request_content,
2687
+ headers: request_headers.merge(custom_headers || {}),
2688
+ base_url: request_url
2689
+ }
2690
+ promise = @client.make_request_async(:put, path_template, options)
2691
+
2692
+ promise = promise.then do |result|
2693
+ http_response = result.response
2694
+ status_code = http_response.status
2695
+ response_content = http_response.body
2696
+ unless status_code == 202 || status_code == 200
2697
+ error_model = JSON.load(response_content)
2698
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2699
+ end
2700
+
2701
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2702
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2703
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2704
+ # Deserialize Response
2705
+ if status_code == 200
2706
+ begin
2707
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2708
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlStoredProcedureGetResults.mapper()
2709
+ result.body = @client.deserialize(result_mapper, parsed_response)
2710
+ rescue Exception => e
2711
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2712
+ end
2713
+ end
2714
+
2715
+ result
2716
+ end
2717
+
2718
+ promise.execute
2719
+ end
2720
+
2721
+ #
2722
+ # Deletes an existing Azure Cosmos DB SQL storedProcedure.
2723
+ #
2724
+ # @param resource_group_name [String] Name of an Azure resource group.
2725
+ # @param account_name [String] Cosmos DB database account name.
2726
+ # @param database_name [String] Cosmos DB database name.
2727
+ # @param container_name [String] Cosmos DB container name.
2728
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2729
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2730
+ # will be added to the HTTP request.
2731
+ #
2732
+ #
2733
+ def begin_delete_sql_stored_procedure(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
2734
+ response = begin_delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers).value!
2735
+ nil
2736
+ end
2737
+
2738
+ #
2739
+ # Deletes an existing Azure Cosmos DB SQL storedProcedure.
2740
+ #
2741
+ # @param resource_group_name [String] Name of an Azure resource group.
2742
+ # @param account_name [String] Cosmos DB database account name.
2743
+ # @param database_name [String] Cosmos DB database name.
2744
+ # @param container_name [String] Cosmos DB container name.
2745
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2746
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2747
+ # will be added to the HTTP request.
2748
+ #
2749
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2750
+ #
2751
+ def begin_delete_sql_stored_procedure_with_http_info(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
2752
+ begin_delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:custom_headers).value!
2753
+ end
2754
+
2755
+ #
2756
+ # Deletes an existing Azure Cosmos DB SQL storedProcedure.
2757
+ #
2758
+ # @param resource_group_name [String] Name of an Azure resource group.
2759
+ # @param account_name [String] Cosmos DB database account name.
2760
+ # @param database_name [String] Cosmos DB database name.
2761
+ # @param container_name [String] Cosmos DB container name.
2762
+ # @param stored_procedure_name [String] Cosmos DB storedProcedure name.
2763
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2764
+ # to the HTTP request.
2765
+ #
2766
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2767
+ #
2768
+ def begin_delete_sql_stored_procedure_async(resource_group_name, account_name, database_name, container_name, stored_procedure_name, custom_headers:nil)
2769
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2770
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2771
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2772
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2773
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2774
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2775
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2776
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2777
+ 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?
2778
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2779
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2780
+ fail ArgumentError, 'stored_procedure_name is nil' if stored_procedure_name.nil?
2781
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2782
+
2783
+
2784
+ request_headers = {}
2785
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2786
+
2787
+ # Set Headers
2788
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2789
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2790
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/storedProcedures/{storedProcedureName}'
2791
+
2792
+ request_url = @base_url || @client.base_url
2793
+
2794
+ options = {
2795
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2796
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'storedProcedureName' => stored_procedure_name},
2797
+ query_params: {'api-version' => @client.api_version},
2798
+ headers: request_headers.merge(custom_headers || {}),
2799
+ base_url: request_url
2800
+ }
2801
+ promise = @client.make_request_async(:delete, path_template, options)
2802
+
2803
+ promise = promise.then do |result|
2804
+ http_response = result.response
2805
+ status_code = http_response.status
2806
+ response_content = http_response.body
2807
+ unless status_code == 202 || status_code == 204
2808
+ error_model = JSON.load(response_content)
2809
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2810
+ end
2811
+
2812
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2813
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2814
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2815
+
2816
+ result
2817
+ end
2818
+
2819
+ promise.execute
2820
+ end
2821
+
2822
+ #
2823
+ # Create or update an Azure Cosmos DB SQL userDefinedFunction
2824
+ #
2825
+ # @param resource_group_name [String] Name of an Azure resource group.
2826
+ # @param account_name [String] Cosmos DB database account name.
2827
+ # @param database_name [String] Cosmos DB database name.
2828
+ # @param container_name [String] Cosmos DB container name.
2829
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2830
+ # name.
2831
+ # @param create_update_sql_user_defined_function_parameters
2832
+ # [SqlUserDefinedFunctionCreateUpdateParameters] The parameters to provide for
2833
+ # the current SQL userDefinedFunction.
2834
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2835
+ # will be added to the HTTP request.
2836
+ #
2837
+ # @return [SqlUserDefinedFunctionGetResults] operation results.
2838
+ #
2839
+ def begin_create_update_sql_user_defined_function(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:nil)
2840
+ response = begin_create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:custom_headers).value!
2841
+ response.body unless response.nil?
2842
+ end
2843
+
2844
+ #
2845
+ # Create or update an Azure Cosmos DB SQL userDefinedFunction
2846
+ #
2847
+ # @param resource_group_name [String] Name of an Azure resource group.
2848
+ # @param account_name [String] Cosmos DB database account name.
2849
+ # @param database_name [String] Cosmos DB database name.
2850
+ # @param container_name [String] Cosmos DB container name.
2851
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2852
+ # name.
2853
+ # @param create_update_sql_user_defined_function_parameters
2854
+ # [SqlUserDefinedFunctionCreateUpdateParameters] The parameters to provide for
2855
+ # the current SQL userDefinedFunction.
2856
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2857
+ # will be added to the HTTP request.
2858
+ #
2859
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2860
+ #
2861
+ def begin_create_update_sql_user_defined_function_with_http_info(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:nil)
2862
+ begin_create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:custom_headers).value!
2863
+ end
2864
+
2865
+ #
2866
+ # Create or update an Azure Cosmos DB SQL userDefinedFunction
2867
+ #
2868
+ # @param resource_group_name [String] Name of an Azure resource group.
2869
+ # @param account_name [String] Cosmos DB database account name.
2870
+ # @param database_name [String] Cosmos DB database name.
2871
+ # @param container_name [String] Cosmos DB container name.
2872
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2873
+ # name.
2874
+ # @param create_update_sql_user_defined_function_parameters
2875
+ # [SqlUserDefinedFunctionCreateUpdateParameters] The parameters to provide for
2876
+ # the current SQL userDefinedFunction.
2877
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2878
+ # to the HTTP request.
2879
+ #
2880
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2881
+ #
2882
+ def begin_create_update_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, create_update_sql_user_defined_function_parameters, custom_headers:nil)
2883
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
2884
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
2885
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
2886
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
2887
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
2888
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
2889
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
2890
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
2891
+ 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?
2892
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
2893
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
2894
+ fail ArgumentError, 'user_defined_function_name is nil' if user_defined_function_name.nil?
2895
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
2896
+ fail ArgumentError, 'create_update_sql_user_defined_function_parameters is nil' if create_update_sql_user_defined_function_parameters.nil?
2897
+
2898
+
2899
+ request_headers = {}
2900
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2901
+
2902
+ # Set Headers
2903
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2904
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2905
+
2906
+ # Serialize Request
2907
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlUserDefinedFunctionCreateUpdateParameters.mapper()
2908
+ request_content = @client.serialize(request_mapper, create_update_sql_user_defined_function_parameters)
2909
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
2910
+
2911
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'
2912
+
2913
+ request_url = @base_url || @client.base_url
2914
+
2915
+ options = {
2916
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2917
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'userDefinedFunctionName' => user_defined_function_name},
2918
+ query_params: {'api-version' => @client.api_version},
2919
+ body: request_content,
2920
+ headers: request_headers.merge(custom_headers || {}),
2921
+ base_url: request_url
2922
+ }
2923
+ promise = @client.make_request_async(:put, path_template, options)
2924
+
2925
+ promise = promise.then do |result|
2926
+ http_response = result.response
2927
+ status_code = http_response.status
2928
+ response_content = http_response.body
2929
+ unless status_code == 202 || status_code == 200
2930
+ error_model = JSON.load(response_content)
2931
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2932
+ end
2933
+
2934
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2935
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
2936
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
2937
+ # Deserialize Response
2938
+ if status_code == 200
2939
+ begin
2940
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2941
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlUserDefinedFunctionGetResults.mapper()
2942
+ result.body = @client.deserialize(result_mapper, parsed_response)
2943
+ rescue Exception => e
2944
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2945
+ end
2946
+ end
2947
+
2948
+ result
2949
+ end
2950
+
2951
+ promise.execute
2952
+ end
2953
+
2954
+ #
2955
+ # Deletes an existing Azure Cosmos DB SQL userDefinedFunction.
2956
+ #
2957
+ # @param resource_group_name [String] Name of an Azure resource group.
2958
+ # @param account_name [String] Cosmos DB database account name.
2959
+ # @param database_name [String] Cosmos DB database name.
2960
+ # @param container_name [String] Cosmos DB container name.
2961
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2962
+ # name.
2963
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2964
+ # will be added to the HTTP request.
2965
+ #
2966
+ #
2967
+ def begin_delete_sql_user_defined_function(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
2968
+ response = begin_delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers).value!
2969
+ nil
2970
+ end
2971
+
2972
+ #
2973
+ # Deletes an existing Azure Cosmos DB SQL userDefinedFunction.
2974
+ #
2975
+ # @param resource_group_name [String] Name of an Azure resource group.
2976
+ # @param account_name [String] Cosmos DB database account name.
2977
+ # @param database_name [String] Cosmos DB database name.
2978
+ # @param container_name [String] Cosmos DB container name.
2979
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2980
+ # name.
2981
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2982
+ # will be added to the HTTP request.
2983
+ #
2984
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2985
+ #
2986
+ def begin_delete_sql_user_defined_function_with_http_info(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
2987
+ begin_delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:custom_headers).value!
2988
+ end
2989
+
2990
+ #
2991
+ # Deletes an existing Azure Cosmos DB SQL userDefinedFunction.
2992
+ #
2993
+ # @param resource_group_name [String] Name of an Azure resource group.
2994
+ # @param account_name [String] Cosmos DB database account name.
2995
+ # @param database_name [String] Cosmos DB database name.
2996
+ # @param container_name [String] Cosmos DB container name.
2997
+ # @param user_defined_function_name [String] Cosmos DB userDefinedFunction
2998
+ # name.
2999
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3000
+ # to the HTTP request.
3001
+ #
3002
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3003
+ #
3004
+ def begin_delete_sql_user_defined_function_async(resource_group_name, account_name, database_name, container_name, user_defined_function_name, custom_headers:nil)
3005
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3006
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3007
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
3008
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
3009
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
3010
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
3011
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
3012
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
3013
+ 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?
3014
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
3015
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
3016
+ fail ArgumentError, 'user_defined_function_name is nil' if user_defined_function_name.nil?
3017
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3018
+
3019
+
3020
+ request_headers = {}
3021
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3022
+
3023
+ # Set Headers
3024
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3025
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3026
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/userDefinedFunctions/{userDefinedFunctionName}'
3027
+
3028
+ request_url = @base_url || @client.base_url
3029
+
3030
+ options = {
3031
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3032
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'userDefinedFunctionName' => user_defined_function_name},
3033
+ query_params: {'api-version' => @client.api_version},
3034
+ headers: request_headers.merge(custom_headers || {}),
3035
+ base_url: request_url
3036
+ }
3037
+ promise = @client.make_request_async(:delete, path_template, options)
3038
+
3039
+ promise = promise.then do |result|
3040
+ http_response = result.response
3041
+ status_code = http_response.status
3042
+ response_content = http_response.body
3043
+ unless status_code == 202 || status_code == 204
3044
+ error_model = JSON.load(response_content)
3045
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3046
+ end
3047
+
3048
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3049
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3050
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3051
+
3052
+ result
3053
+ end
3054
+
3055
+ promise.execute
3056
+ end
3057
+
3058
+ #
3059
+ # Create or update an Azure Cosmos DB SQL trigger
3060
+ #
3061
+ # @param resource_group_name [String] Name of an Azure resource group.
3062
+ # @param account_name [String] Cosmos DB database account name.
3063
+ # @param database_name [String] Cosmos DB database name.
3064
+ # @param container_name [String] Cosmos DB container name.
3065
+ # @param trigger_name [String] Cosmos DB trigger name.
3066
+ # @param create_update_sql_trigger_parameters
3067
+ # [SqlTriggerCreateUpdateParameters] The parameters to provide for the current
3068
+ # SQL trigger.
3069
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3070
+ # will be added to the HTTP request.
3071
+ #
3072
+ # @return [SqlTriggerGetResults] operation results.
3073
+ #
3074
+ def begin_create_update_sql_trigger(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:nil)
3075
+ response = begin_create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:custom_headers).value!
3076
+ response.body unless response.nil?
3077
+ end
3078
+
3079
+ #
3080
+ # Create or update an Azure Cosmos DB SQL trigger
3081
+ #
3082
+ # @param resource_group_name [String] Name of an Azure resource group.
3083
+ # @param account_name [String] Cosmos DB database account name.
3084
+ # @param database_name [String] Cosmos DB database name.
3085
+ # @param container_name [String] Cosmos DB container name.
3086
+ # @param trigger_name [String] Cosmos DB trigger name.
3087
+ # @param create_update_sql_trigger_parameters
3088
+ # [SqlTriggerCreateUpdateParameters] The parameters to provide for the current
3089
+ # SQL trigger.
3090
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3091
+ # will be added to the HTTP request.
3092
+ #
3093
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3094
+ #
3095
+ def begin_create_update_sql_trigger_with_http_info(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:nil)
3096
+ begin_create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:custom_headers).value!
3097
+ end
3098
+
3099
+ #
3100
+ # Create or update an Azure Cosmos DB SQL trigger
3101
+ #
3102
+ # @param resource_group_name [String] Name of an Azure resource group.
3103
+ # @param account_name [String] Cosmos DB database account name.
3104
+ # @param database_name [String] Cosmos DB database name.
3105
+ # @param container_name [String] Cosmos DB container name.
3106
+ # @param trigger_name [String] Cosmos DB trigger name.
3107
+ # @param create_update_sql_trigger_parameters
3108
+ # [SqlTriggerCreateUpdateParameters] The parameters to provide for the current
3109
+ # SQL trigger.
3110
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3111
+ # to the HTTP request.
3112
+ #
3113
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3114
+ #
3115
+ def begin_create_update_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, create_update_sql_trigger_parameters, custom_headers:nil)
3116
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3117
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3118
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
3119
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
3120
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
3121
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
3122
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
3123
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
3124
+ 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?
3125
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
3126
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
3127
+ fail ArgumentError, 'trigger_name is nil' if trigger_name.nil?
3128
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3129
+ fail ArgumentError, 'create_update_sql_trigger_parameters is nil' if create_update_sql_trigger_parameters.nil?
3130
+
3131
+
3132
+ request_headers = {}
3133
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3134
+
3135
+ # Set Headers
3136
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3137
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3138
+
3139
+ # Serialize Request
3140
+ request_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlTriggerCreateUpdateParameters.mapper()
3141
+ request_content = @client.serialize(request_mapper, create_update_sql_trigger_parameters)
3142
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
3143
+
3144
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'
3145
+
3146
+ request_url = @base_url || @client.base_url
3147
+
3148
+ options = {
3149
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3150
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'triggerName' => trigger_name},
3151
+ query_params: {'api-version' => @client.api_version},
3152
+ body: request_content,
3153
+ headers: request_headers.merge(custom_headers || {}),
3154
+ base_url: request_url
3155
+ }
3156
+ promise = @client.make_request_async(:put, path_template, options)
3157
+
3158
+ promise = promise.then do |result|
3159
+ http_response = result.response
3160
+ status_code = http_response.status
3161
+ response_content = http_response.body
3162
+ unless status_code == 202 || status_code == 200
3163
+ error_model = JSON.load(response_content)
3164
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3165
+ end
3166
+
3167
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3168
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3169
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3170
+ # Deserialize Response
3171
+ if status_code == 200
3172
+ begin
3173
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
3174
+ result_mapper = Azure::Cosmosdb::Mgmt::V2019_08_01::Models::SqlTriggerGetResults.mapper()
3175
+ result.body = @client.deserialize(result_mapper, parsed_response)
3176
+ rescue Exception => e
3177
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
3178
+ end
3179
+ end
3180
+
3181
+ result
3182
+ end
3183
+
3184
+ promise.execute
3185
+ end
3186
+
3187
+ #
3188
+ # Deletes an existing Azure Cosmos DB SQL trigger.
3189
+ #
3190
+ # @param resource_group_name [String] Name of an Azure resource group.
3191
+ # @param account_name [String] Cosmos DB database account name.
3192
+ # @param database_name [String] Cosmos DB database name.
3193
+ # @param container_name [String] Cosmos DB container name.
3194
+ # @param trigger_name [String] Cosmos DB trigger name.
3195
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3196
+ # will be added to the HTTP request.
3197
+ #
3198
+ #
3199
+ def begin_delete_sql_trigger(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
3200
+ response = begin_delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers).value!
3201
+ nil
3202
+ end
3203
+
3204
+ #
3205
+ # Deletes an existing Azure Cosmos DB SQL trigger.
3206
+ #
3207
+ # @param resource_group_name [String] Name of an Azure resource group.
3208
+ # @param account_name [String] Cosmos DB database account name.
3209
+ # @param database_name [String] Cosmos DB database name.
3210
+ # @param container_name [String] Cosmos DB container name.
3211
+ # @param trigger_name [String] Cosmos DB trigger name.
3212
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
3213
+ # will be added to the HTTP request.
3214
+ #
3215
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
3216
+ #
3217
+ def begin_delete_sql_trigger_with_http_info(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
3218
+ begin_delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:custom_headers).value!
3219
+ end
3220
+
3221
+ #
3222
+ # Deletes an existing Azure Cosmos DB SQL trigger.
3223
+ #
3224
+ # @param resource_group_name [String] Name of an Azure resource group.
3225
+ # @param account_name [String] Cosmos DB database account name.
3226
+ # @param database_name [String] Cosmos DB database name.
3227
+ # @param container_name [String] Cosmos DB container name.
3228
+ # @param trigger_name [String] Cosmos DB trigger name.
3229
+ # @param [Hash{String => String}] A hash of custom headers that will be added
3230
+ # to the HTTP request.
3231
+ #
3232
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
3233
+ #
3234
+ def begin_delete_sql_trigger_async(resource_group_name, account_name, database_name, container_name, trigger_name, custom_headers:nil)
3235
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
3236
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
3237
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
3238
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
3239
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
3240
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
3241
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '50'" if !account_name.nil? && account_name.length > 50
3242
+ fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '3'" if !account_name.nil? && account_name.length < 3
3243
+ 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?
3244
+ fail ArgumentError, 'database_name is nil' if database_name.nil?
3245
+ fail ArgumentError, 'container_name is nil' if container_name.nil?
3246
+ fail ArgumentError, 'trigger_name is nil' if trigger_name.nil?
3247
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
3248
+
3249
+
3250
+ request_headers = {}
3251
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
3252
+
3253
+ # Set Headers
3254
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
3255
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
3256
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/sqlDatabases/{databaseName}/containers/{containerName}/triggers/{triggerName}'
3257
+
3258
+ request_url = @base_url || @client.base_url
3259
+
3260
+ options = {
3261
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
3262
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'accountName' => account_name,'databaseName' => database_name,'containerName' => container_name,'triggerName' => trigger_name},
3263
+ query_params: {'api-version' => @client.api_version},
3264
+ headers: request_headers.merge(custom_headers || {}),
3265
+ base_url: request_url
3266
+ }
3267
+ promise = @client.make_request_async(:delete, path_template, options)
3268
+
3269
+ promise = promise.then do |result|
3270
+ http_response = result.response
3271
+ status_code = http_response.status
3272
+ response_content = http_response.body
3273
+ unless status_code == 202 || status_code == 204
3274
+ error_model = JSON.load(response_content)
3275
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
3276
+ end
3277
+
3278
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
3279
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
3280
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
3281
+
3282
+ result
3283
+ end
3284
+
3285
+ promise.execute
3286
+ end
3287
+
3288
+ end
3289
+ end