azure_mgmt_resources 0.17.5 → 0.17.6

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