azure_mgmt_resources 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  3. data/lib/2016-02-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  4. data/lib/2016-02-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  5. data/lib/2016-02-01/generated/azure_mgmt_resources/resource_management_client.rb +8 -9
  6. data/lib/2016-07-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  7. data/lib/2016-07-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  8. data/lib/2016-07-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  9. data/lib/2016-07-01/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  10. data/lib/2016-09-01/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  11. data/lib/2016-09-01/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  12. data/lib/2016-09-01/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  13. data/lib/2016-09-01/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  14. data/lib/2017-05-10/generated/azure_mgmt_resources/models/deployment_extended.rb +1 -0
  15. data/lib/2017-05-10/generated/azure_mgmt_resources/models/resource.rb +1 -1
  16. data/lib/2017-05-10/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +1 -1
  17. data/lib/2017-05-10/generated/azure_mgmt_resources/models/tag_details.rb +1 -0
  18. data/lib/2017-05-10/generated/azure_mgmt_resources/models/tag_value.rb +1 -0
  19. data/lib/2017-05-10/generated/azure_mgmt_resources/resource_management_client.rb +7 -6
  20. data/lib/2018-02-01/generated/azure_mgmt_resources.rb +83 -0
  21. data/lib/2018-02-01/generated/azure_mgmt_resources/deployment_operations.rb +350 -0
  22. data/lib/2018-02-01/generated/azure_mgmt_resources/deployments.rb +1136 -0
  23. data/lib/2018-02-01/generated/azure_mgmt_resources/models/alias_path_type.rb +65 -0
  24. data/lib/2018-02-01/generated/azure_mgmt_resources/models/alias_type.rb +66 -0
  25. data/lib/2018-02-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
  26. data/lib/2018-02-01/generated/azure_mgmt_resources/models/debug_setting.rb +54 -0
  27. data/lib/2018-02-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
  28. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment.rb +47 -0
  29. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
  30. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_extended.rb +70 -0
  31. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
  32. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
  33. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
  34. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
  35. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +134 -0
  36. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
  37. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
  38. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +210 -0
  39. data/lib/2018-02-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +60 -0
  40. data/lib/2018-02-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
  41. data/lib/2018-02-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
  42. data/lib/2018-02-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
  43. data/lib/2018-02-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
  44. data/lib/2018-02-01/generated/azure_mgmt_resources/models/identity.rb +73 -0
  45. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
  46. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
  47. data/lib/2018-02-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
  48. data/lib/2018-02-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
  49. data/lib/2018-02-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
  50. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider.rb +92 -0
  51. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
  52. data/lib/2018-02-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +125 -0
  53. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource.rb +101 -0
  54. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group.rb +115 -0
  55. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
  56. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
  57. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
  58. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
  59. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
  60. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
  61. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
  62. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_management_error_with_details.rb +92 -0
  63. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
  64. data/lib/2018-02-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
  65. data/lib/2018-02-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
  66. data/lib/2018-02-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
  67. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
  68. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
  69. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
  70. data/lib/2018-02-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
  71. data/lib/2018-02-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
  72. data/lib/2018-02-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
  73. data/lib/2018-02-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
  74. data/lib/2018-02-01/generated/azure_mgmt_resources/providers.rb +520 -0
  75. data/lib/2018-02-01/generated/azure_mgmt_resources/resource_groups.rb +891 -0
  76. data/lib/2018-02-01/generated/azure_mgmt_resources/resource_management_client.rb +151 -0
  77. data/lib/2018-02-01/generated/azure_mgmt_resources/resources.rb +2178 -0
  78. data/lib/2018-02-01/generated/azure_mgmt_resources/tags.rb +599 -0
  79. data/lib/2018-05-01/generated/azure_mgmt_resources.rb +84 -0
  80. data/lib/2018-05-01/generated/azure_mgmt_resources/deployment_operations.rb +653 -0
  81. data/lib/2018-05-01/generated/azure_mgmt_resources/deployments.rb +2148 -0
  82. data/lib/2018-05-01/generated/azure_mgmt_resources/models/alias_path_type.rb +65 -0
  83. data/lib/2018-05-01/generated/azure_mgmt_resources/models/alias_type.rb +66 -0
  84. data/lib/2018-05-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
  85. data/lib/2018-05-01/generated/azure_mgmt_resources/models/debug_setting.rb +54 -0
  86. data/lib/2018-05-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
  87. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment.rb +58 -0
  88. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
  89. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_extended.rb +81 -0
  90. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
  91. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
  92. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
  93. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
  94. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +134 -0
  95. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
  96. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
  97. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +210 -0
  98. data/lib/2018-05-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +60 -0
  99. data/lib/2018-05-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
  100. data/lib/2018-05-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
  101. data/lib/2018-05-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
  102. data/lib/2018-05-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
  103. data/lib/2018-05-01/generated/azure_mgmt_resources/models/identity.rb +96 -0
  104. data/lib/2018-05-01/generated/azure_mgmt_resources/models/identity_user_assigned_identities_value.rb +60 -0
  105. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
  106. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
  107. data/lib/2018-05-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
  108. data/lib/2018-05-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
  109. data/lib/2018-05-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
  110. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider.rb +92 -0
  111. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
  112. data/lib/2018-05-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +125 -0
  113. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource.rb +101 -0
  114. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group.rb +115 -0
  115. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
  116. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
  117. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
  118. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
  119. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
  120. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
  121. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
  122. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_management_error_with_details.rb +92 -0
  123. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
  124. data/lib/2018-05-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
  125. data/lib/2018-05-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
  126. data/lib/2018-05-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
  127. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
  128. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
  129. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
  130. data/lib/2018-05-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
  131. data/lib/2018-05-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
  132. data/lib/2018-05-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
  133. data/lib/2018-05-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
  134. data/lib/2018-05-01/generated/azure_mgmt_resources/providers.rb +520 -0
  135. data/lib/2018-05-01/generated/azure_mgmt_resources/resource_groups.rb +891 -0
  136. data/lib/2018-05-01/generated/azure_mgmt_resources/resource_management_client.rb +151 -0
  137. data/lib/2018-05-01/generated/azure_mgmt_resources/resources.rb +2178 -0
  138. data/lib/2018-05-01/generated/azure_mgmt_resources/tags.rb +599 -0
  139. data/lib/azure_mgmt_resources.rb +4 -2
  140. data/lib/profiles/latest/modules/resources_profile_module.rb +138 -122
  141. data/lib/version.rb +1 -1
  142. metadata +124 -5
@@ -0,0 +1,2148 @@
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::V2018_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 deployment_name [String] The name of the deployment to delete.
38
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
39
+ # will be added to the HTTP request.
40
+ #
41
+ def delete_at_subscription_scope(deployment_name, custom_headers:nil)
42
+ response = delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
43
+ nil
44
+ end
45
+
46
+ #
47
+ # @param deployment_name [String] The name of the deployment to delete.
48
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
49
+ # will be added to the HTTP request.
50
+ #
51
+ # @return [Concurrent::Promise] promise which provides async access to http
52
+ # response.
53
+ #
54
+ def delete_at_subscription_scope_async(deployment_name, custom_headers:nil)
55
+ # Send request
56
+ promise = begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers)
57
+
58
+ promise = promise.then do |response|
59
+ # Defining deserialization method.
60
+ deserialize_method = lambda do |parsed_response|
61
+ end
62
+
63
+ # Waiting for response.
64
+ @client.get_long_running_operation_result(response, deserialize_method)
65
+ end
66
+
67
+ promise
68
+ end
69
+
70
+ #
71
+ # Checks whether the deployment exists.
72
+ #
73
+ # @param deployment_name [String] The name of the deployment to check.
74
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
75
+ # will be added to the HTTP request.
76
+ #
77
+ # @return [Boolean] operation results.
78
+ #
79
+ def check_existence_at_subscription_scope(deployment_name, custom_headers:nil)
80
+ response = check_existence_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
81
+ response.body unless response.nil?
82
+ end
83
+
84
+ #
85
+ # Checks whether the deployment exists.
86
+ #
87
+ # @param deployment_name [String] The name of the deployment to check.
88
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
89
+ # will be added to the HTTP request.
90
+ #
91
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
92
+ #
93
+ def check_existence_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
94
+ check_existence_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
95
+ end
96
+
97
+ #
98
+ # Checks whether the deployment exists.
99
+ #
100
+ # @param deployment_name [String] The name of the deployment to check.
101
+ # @param [Hash{String => String}] A hash of custom headers that will be added
102
+ # to the HTTP request.
103
+ #
104
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
105
+ #
106
+ def check_existence_at_subscription_scope_async(deployment_name, custom_headers:nil)
107
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
108
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
109
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
110
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
111
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
112
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
113
+
114
+
115
+ request_headers = {}
116
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
117
+
118
+ # Set Headers
119
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
120
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
121
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'
122
+
123
+ request_url = @base_url || @client.base_url
124
+
125
+ options = {
126
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
127
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
128
+ query_params: {'api-version' => @client.api_version},
129
+ headers: request_headers.merge(custom_headers || {}),
130
+ base_url: request_url
131
+ }
132
+ promise = @client.make_request_async(:head, path_template, options)
133
+
134
+ promise = promise.then do |result|
135
+ http_response = result.response
136
+ status_code = http_response.status
137
+ response_content = http_response.body
138
+ unless status_code == 204 || status_code == 404
139
+ error_model = JSON.load(response_content)
140
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
141
+ end
142
+
143
+ result.body = (status_code == 204)
144
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
145
+
146
+ result
147
+ end
148
+
149
+ promise.execute
150
+ end
151
+
152
+ #
153
+ # Deploys resources at subscription scope.
154
+ #
155
+ # You can provide the template and parameters directly in the request or link
156
+ # to JSON files.
157
+ #
158
+ # @param deployment_name [String] The name of the deployment.
159
+ # @param parameters [Deployment] Additional parameters supplied to the
160
+ # operation.
161
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
162
+ # will be added to the HTTP request.
163
+ #
164
+ # @return [DeploymentExtended] operation results.
165
+ #
166
+ def create_or_update_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
167
+ response = create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
168
+ response.body unless response.nil?
169
+ end
170
+
171
+ #
172
+ # @param deployment_name [String] The name of the deployment.
173
+ # @param parameters [Deployment] Additional parameters supplied to the
174
+ # operation.
175
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
176
+ # will be added to the HTTP request.
177
+ #
178
+ # @return [Concurrent::Promise] promise which provides async access to http
179
+ # response.
180
+ #
181
+ def create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
182
+ # Send request
183
+ promise = begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers)
184
+
185
+ promise = promise.then do |response|
186
+ # Defining deserialization method.
187
+ deserialize_method = lambda do |parsed_response|
188
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
189
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
190
+ end
191
+
192
+ # Waiting for response.
193
+ @client.get_long_running_operation_result(response, deserialize_method)
194
+ end
195
+
196
+ promise
197
+ end
198
+
199
+ #
200
+ # Gets a deployment.
201
+ #
202
+ # @param deployment_name [String] The name of the deployment to get.
203
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
204
+ # will be added to the HTTP request.
205
+ #
206
+ # @return [DeploymentExtended] operation results.
207
+ #
208
+ def get_at_subscription_scope(deployment_name, custom_headers:nil)
209
+ response = get_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
210
+ response.body unless response.nil?
211
+ end
212
+
213
+ #
214
+ # Gets a deployment.
215
+ #
216
+ # @param deployment_name [String] The name of the deployment to get.
217
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
218
+ # will be added to the HTTP request.
219
+ #
220
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
221
+ #
222
+ def get_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
223
+ get_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
224
+ end
225
+
226
+ #
227
+ # Gets a deployment.
228
+ #
229
+ # @param deployment_name [String] The name of the deployment to get.
230
+ # @param [Hash{String => String}] A hash of custom headers that will be added
231
+ # to the HTTP request.
232
+ #
233
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
234
+ #
235
+ def get_at_subscription_scope_async(deployment_name, custom_headers:nil)
236
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
237
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
238
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
239
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
240
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
241
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
242
+
243
+
244
+ request_headers = {}
245
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
246
+
247
+ # Set Headers
248
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
249
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
250
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'
251
+
252
+ request_url = @base_url || @client.base_url
253
+
254
+ options = {
255
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
256
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
257
+ query_params: {'api-version' => @client.api_version},
258
+ headers: request_headers.merge(custom_headers || {}),
259
+ base_url: request_url
260
+ }
261
+ promise = @client.make_request_async(:get, path_template, options)
262
+
263
+ promise = promise.then do |result|
264
+ http_response = result.response
265
+ status_code = http_response.status
266
+ response_content = http_response.body
267
+ unless status_code == 200
268
+ error_model = JSON.load(response_content)
269
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
270
+ end
271
+
272
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
273
+ # Deserialize Response
274
+ if status_code == 200
275
+ begin
276
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
277
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
278
+ result.body = @client.deserialize(result_mapper, parsed_response)
279
+ rescue Exception => e
280
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
281
+ end
282
+ end
283
+
284
+ result
285
+ end
286
+
287
+ promise.execute
288
+ end
289
+
290
+ #
291
+ # Cancels a currently running template deployment.
292
+ #
293
+ # You can cancel a deployment only if the provisioningState is Accepted or
294
+ # Running. After the deployment is canceled, the provisioningState is set to
295
+ # Canceled. Canceling a template deployment stops the currently running
296
+ # template deployment and leaves the resources partially deployed.
297
+ #
298
+ # @param deployment_name [String] The name of the deployment to cancel.
299
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
300
+ # will be added to the HTTP request.
301
+ #
302
+ #
303
+ def cancel_at_subscription_scope(deployment_name, custom_headers:nil)
304
+ response = cancel_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
305
+ nil
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 deployment_name [String] The name of the deployment to cancel.
317
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
318
+ # will be added to the HTTP request.
319
+ #
320
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
321
+ #
322
+ def cancel_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
323
+ cancel_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
324
+ end
325
+
326
+ #
327
+ # Cancels a currently running template deployment.
328
+ #
329
+ # You can cancel a deployment only if the provisioningState is Accepted or
330
+ # Running. After the deployment is canceled, the provisioningState is set to
331
+ # Canceled. Canceling a template deployment stops the currently running
332
+ # template deployment and leaves the resources partially deployed.
333
+ #
334
+ # @param deployment_name [String] The name of the deployment to cancel.
335
+ # @param [Hash{String => String}] A hash of custom headers that will be added
336
+ # to the HTTP request.
337
+ #
338
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
339
+ #
340
+ def cancel_at_subscription_scope_async(deployment_name, custom_headers:nil)
341
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
342
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
343
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
344
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
345
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
346
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
347
+
348
+
349
+ request_headers = {}
350
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
351
+
352
+ # Set Headers
353
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
354
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
355
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'
356
+
357
+ request_url = @base_url || @client.base_url
358
+
359
+ options = {
360
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
361
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
362
+ query_params: {'api-version' => @client.api_version},
363
+ headers: request_headers.merge(custom_headers || {}),
364
+ base_url: request_url
365
+ }
366
+ promise = @client.make_request_async(:post, path_template, options)
367
+
368
+ promise = promise.then do |result|
369
+ http_response = result.response
370
+ status_code = http_response.status
371
+ response_content = http_response.body
372
+ unless status_code == 204
373
+ error_model = JSON.load(response_content)
374
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
375
+ end
376
+
377
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
378
+
379
+ result
380
+ end
381
+
382
+ promise.execute
383
+ end
384
+
385
+ #
386
+ # Validates whether the specified template is syntactically correct and will be
387
+ # accepted by Azure Resource Manager..
388
+ #
389
+ # @param deployment_name [String] The name of the deployment.
390
+ # @param parameters [Deployment] Parameters to validate.
391
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
392
+ # will be added to the HTTP request.
393
+ #
394
+ # @return [DeploymentValidateResult] operation results.
395
+ #
396
+ def validate_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
397
+ response = validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
398
+ response.body unless response.nil?
399
+ end
400
+
401
+ #
402
+ # Validates whether the specified template is syntactically correct and will be
403
+ # accepted by Azure Resource Manager..
404
+ #
405
+ # @param deployment_name [String] The name of the deployment.
406
+ # @param parameters [Deployment] Parameters to validate.
407
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
408
+ # will be added to the HTTP request.
409
+ #
410
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
411
+ #
412
+ def validate_at_subscription_scope_with_http_info(deployment_name, parameters, custom_headers:nil)
413
+ validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
414
+ end
415
+
416
+ #
417
+ # Validates whether the specified template is syntactically correct and will be
418
+ # accepted by Azure Resource Manager..
419
+ #
420
+ # @param deployment_name [String] The name of the deployment.
421
+ # @param parameters [Deployment] Parameters to validate.
422
+ # @param [Hash{String => String}] A hash of custom headers that will be added
423
+ # to the HTTP request.
424
+ #
425
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
426
+ #
427
+ def validate_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
428
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
429
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
430
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
431
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
432
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
433
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
434
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
435
+
436
+
437
+ request_headers = {}
438
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
439
+
440
+ # Set Headers
441
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
442
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
443
+
444
+ # Serialize Request
445
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::Deployment.mapper()
446
+ request_content = @client.serialize(request_mapper, parameters)
447
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
448
+
449
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'
450
+
451
+ request_url = @base_url || @client.base_url
452
+
453
+ options = {
454
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
455
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
456
+ query_params: {'api-version' => @client.api_version},
457
+ body: request_content,
458
+ headers: request_headers.merge(custom_headers || {}),
459
+ base_url: request_url
460
+ }
461
+ promise = @client.make_request_async(:post, path_template, options)
462
+
463
+ promise = promise.then do |result|
464
+ http_response = result.response
465
+ status_code = http_response.status
466
+ response_content = http_response.body
467
+ unless status_code == 200 || status_code == 400
468
+ error_model = JSON.load(response_content)
469
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
470
+ end
471
+
472
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
473
+ # Deserialize Response
474
+ if status_code == 200
475
+ begin
476
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
477
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentValidateResult.mapper()
478
+ result.body = @client.deserialize(result_mapper, parsed_response)
479
+ rescue Exception => e
480
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
481
+ end
482
+ end
483
+ # Deserialize Response
484
+ if status_code == 400
485
+ begin
486
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
487
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentValidateResult.mapper()
488
+ result.body = @client.deserialize(result_mapper, parsed_response)
489
+ rescue Exception => e
490
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
491
+ end
492
+ end
493
+
494
+ result
495
+ end
496
+
497
+ promise.execute
498
+ end
499
+
500
+ #
501
+ # Exports the template used for specified deployment.
502
+ #
503
+ # @param deployment_name [String] The name of the deployment from which to get
504
+ # the template.
505
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
506
+ # will be added to the HTTP request.
507
+ #
508
+ # @return [DeploymentExportResult] operation results.
509
+ #
510
+ def export_template_at_subscription_scope(deployment_name, custom_headers:nil)
511
+ response = export_template_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
512
+ response.body unless response.nil?
513
+ end
514
+
515
+ #
516
+ # Exports the template used for specified deployment.
517
+ #
518
+ # @param deployment_name [String] The name of the deployment from which to get
519
+ # the template.
520
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
521
+ # will be added to the HTTP request.
522
+ #
523
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
524
+ #
525
+ def export_template_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
526
+ export_template_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
527
+ end
528
+
529
+ #
530
+ # Exports the template used for specified deployment.
531
+ #
532
+ # @param deployment_name [String] The name of the deployment from which to get
533
+ # the template.
534
+ # @param [Hash{String => String}] A hash of custom headers that will be added
535
+ # to the HTTP request.
536
+ #
537
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
538
+ #
539
+ def export_template_at_subscription_scope_async(deployment_name, custom_headers:nil)
540
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
541
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
542
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
543
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
544
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
545
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
546
+
547
+
548
+ request_headers = {}
549
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
550
+
551
+ # Set Headers
552
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
553
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
554
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'
555
+
556
+ request_url = @base_url || @client.base_url
557
+
558
+ options = {
559
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
560
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
561
+ query_params: {'api-version' => @client.api_version},
562
+ headers: request_headers.merge(custom_headers || {}),
563
+ base_url: request_url
564
+ }
565
+ promise = @client.make_request_async(:post, path_template, options)
566
+
567
+ promise = promise.then do |result|
568
+ http_response = result.response
569
+ status_code = http_response.status
570
+ response_content = http_response.body
571
+ unless status_code == 200
572
+ error_model = JSON.load(response_content)
573
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
574
+ end
575
+
576
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
577
+ # Deserialize Response
578
+ if status_code == 200
579
+ begin
580
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
581
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExportResult.mapper()
582
+ result.body = @client.deserialize(result_mapper, parsed_response)
583
+ rescue Exception => e
584
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
585
+ end
586
+ end
587
+
588
+ result
589
+ end
590
+
591
+ promise.execute
592
+ end
593
+
594
+ #
595
+ # Get all the deployments for a subscription.
596
+ #
597
+ # @param filter [String] The filter to apply on the operation. For example, you
598
+ # can use $filter=provisioningState eq '{state}'.
599
+ # @param top [Integer] The number of results to get. If null is passed, returns
600
+ # all deployments.
601
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
602
+ # will be added to the HTTP request.
603
+ #
604
+ # @return [Array<DeploymentExtended>] operation results.
605
+ #
606
+ def list_at_subscription_scope(filter:nil, top:nil, custom_headers:nil)
607
+ first_page = list_at_subscription_scope_as_lazy(filter:filter, top:top, custom_headers:custom_headers)
608
+ first_page.get_all_items
609
+ end
610
+
611
+ #
612
+ # Get all the deployments for a subscription.
613
+ #
614
+ # @param filter [String] The filter to apply on the operation. For example, you
615
+ # can use $filter=provisioningState eq '{state}'.
616
+ # @param top [Integer] The number of results to get. If null is passed, returns
617
+ # all deployments.
618
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
619
+ # will be added to the HTTP request.
620
+ #
621
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
622
+ #
623
+ def list_at_subscription_scope_with_http_info(filter:nil, top:nil, custom_headers:nil)
624
+ list_at_subscription_scope_async(filter:filter, top:top, custom_headers:custom_headers).value!
625
+ end
626
+
627
+ #
628
+ # Get all the deployments for a subscription.
629
+ #
630
+ # @param filter [String] The filter to apply on the operation. For example, you
631
+ # can use $filter=provisioningState eq '{state}'.
632
+ # @param top [Integer] The number of results to get. If null is passed, returns
633
+ # all deployments.
634
+ # @param [Hash{String => String}] A hash of custom headers that will be added
635
+ # to the HTTP request.
636
+ #
637
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
638
+ #
639
+ def list_at_subscription_scope_async(filter:nil, top:nil, custom_headers:nil)
640
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
641
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
642
+
643
+
644
+ request_headers = {}
645
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
646
+
647
+ # Set Headers
648
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
649
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
650
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/'
651
+
652
+ request_url = @base_url || @client.base_url
653
+
654
+ options = {
655
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
656
+ path_params: {'subscriptionId' => @client.subscription_id},
657
+ query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
658
+ headers: request_headers.merge(custom_headers || {}),
659
+ base_url: request_url
660
+ }
661
+ promise = @client.make_request_async(:get, path_template, options)
662
+
663
+ promise = promise.then do |result|
664
+ http_response = result.response
665
+ status_code = http_response.status
666
+ response_content = http_response.body
667
+ unless status_code == 200
668
+ error_model = JSON.load(response_content)
669
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
670
+ end
671
+
672
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
673
+ # Deserialize Response
674
+ if status_code == 200
675
+ begin
676
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
677
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentListResult.mapper()
678
+ result.body = @client.deserialize(result_mapper, parsed_response)
679
+ rescue Exception => e
680
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
681
+ end
682
+ end
683
+
684
+ result
685
+ end
686
+
687
+ promise.execute
688
+ end
689
+
690
+ #
691
+ # Deletes a deployment from the deployment history.
692
+ #
693
+ # A template deployment that is currently running cannot be deleted. Deleting a
694
+ # template deployment removes the associated deployment operations. Deleting a
695
+ # template deployment does not affect the state of the resource group. This is
696
+ # an asynchronous operation that returns a status of 202 until the template
697
+ # deployment is successfully deleted. The Location response header contains the
698
+ # URI that is used to obtain the status of the process. While the process is
699
+ # running, a call to the URI in the Location header returns a status of 202.
700
+ # When the process finishes, the URI in the Location header returns a status of
701
+ # 204 on success. If the asynchronous request failed, the URI in the Location
702
+ # header returns an error-level status code.
703
+ #
704
+ # @param resource_group_name [String] The name of the resource group with the
705
+ # deployment to delete. The name is case insensitive.
706
+ # @param deployment_name [String] The name of the deployment to delete.
707
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
708
+ # will be added to the HTTP request.
709
+ #
710
+ def delete(resource_group_name, deployment_name, custom_headers:nil)
711
+ response = delete_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
712
+ nil
713
+ end
714
+
715
+ #
716
+ # @param resource_group_name [String] The name of the resource group with the
717
+ # deployment to delete. The name is case insensitive.
718
+ # @param deployment_name [String] The name of the deployment to delete.
719
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
720
+ # will be added to the HTTP request.
721
+ #
722
+ # @return [Concurrent::Promise] promise which provides async access to http
723
+ # response.
724
+ #
725
+ def delete_async(resource_group_name, deployment_name, custom_headers:nil)
726
+ # Send request
727
+ promise = begin_delete_async(resource_group_name, deployment_name, custom_headers:custom_headers)
728
+
729
+ promise = promise.then do |response|
730
+ # Defining deserialization method.
731
+ deserialize_method = lambda do |parsed_response|
732
+ end
733
+
734
+ # Waiting for response.
735
+ @client.get_long_running_operation_result(response, deserialize_method)
736
+ end
737
+
738
+ promise
739
+ end
740
+
741
+ #
742
+ # Checks whether the deployment exists.
743
+ #
744
+ # @param resource_group_name [String] The name of the resource group with the
745
+ # deployment to check. The name is case insensitive.
746
+ # @param deployment_name [String] The name of the deployment to check.
747
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
748
+ # will be added to the HTTP request.
749
+ #
750
+ # @return [Boolean] operation results.
751
+ #
752
+ def check_existence(resource_group_name, deployment_name, custom_headers:nil)
753
+ response = check_existence_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
754
+ response.body unless response.nil?
755
+ end
756
+
757
+ #
758
+ # Checks whether the deployment exists.
759
+ #
760
+ # @param resource_group_name [String] The name of the resource group with the
761
+ # deployment to check. The name is case insensitive.
762
+ # @param deployment_name [String] The name of the deployment to check.
763
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
764
+ # will be added to the HTTP request.
765
+ #
766
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
767
+ #
768
+ def check_existence_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
769
+ check_existence_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
770
+ end
771
+
772
+ #
773
+ # Checks whether the deployment exists.
774
+ #
775
+ # @param resource_group_name [String] The name of the resource group with the
776
+ # deployment to check. The name is case insensitive.
777
+ # @param deployment_name [String] The name of the deployment to check.
778
+ # @param [Hash{String => String}] A hash of custom headers that will be added
779
+ # to the HTTP request.
780
+ #
781
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
782
+ #
783
+ def check_existence_async(resource_group_name, deployment_name, custom_headers:nil)
784
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
785
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
786
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
787
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
788
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
789
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
790
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
791
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
792
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
793
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
794
+
795
+
796
+ request_headers = {}
797
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
798
+
799
+ # Set Headers
800
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
801
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
802
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
803
+
804
+ request_url = @base_url || @client.base_url
805
+
806
+ options = {
807
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
808
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
809
+ query_params: {'api-version' => @client.api_version},
810
+ headers: request_headers.merge(custom_headers || {}),
811
+ base_url: request_url
812
+ }
813
+ promise = @client.make_request_async(:head, path_template, options)
814
+
815
+ promise = promise.then do |result|
816
+ http_response = result.response
817
+ status_code = http_response.status
818
+ response_content = http_response.body
819
+ unless status_code == 204 || status_code == 404
820
+ error_model = JSON.load(response_content)
821
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
822
+ end
823
+
824
+ result.body = (status_code == 204)
825
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
826
+
827
+ result
828
+ end
829
+
830
+ promise.execute
831
+ end
832
+
833
+ #
834
+ # Deploys resources to a resource group.
835
+ #
836
+ # You can provide the template and parameters directly in the request or link
837
+ # to JSON files.
838
+ #
839
+ # @param resource_group_name [String] The name of the resource group to deploy
840
+ # the resources to. The name is case insensitive. The resource group must
841
+ # already exist.
842
+ # @param deployment_name [String] The name of the deployment.
843
+ # @param parameters [Deployment] Additional parameters supplied to the
844
+ # operation.
845
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
846
+ # will be added to the HTTP request.
847
+ #
848
+ # @return [DeploymentExtended] operation results.
849
+ #
850
+ def create_or_update(resource_group_name, deployment_name, parameters, custom_headers:nil)
851
+ response = create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
852
+ response.body unless response.nil?
853
+ end
854
+
855
+ #
856
+ # @param resource_group_name [String] The name of the resource group to deploy
857
+ # the resources to. The name is case insensitive. The resource group must
858
+ # already exist.
859
+ # @param deployment_name [String] The name of the deployment.
860
+ # @param parameters [Deployment] Additional parameters supplied to the
861
+ # operation.
862
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
863
+ # will be added to the HTTP request.
864
+ #
865
+ # @return [Concurrent::Promise] promise which provides async access to http
866
+ # response.
867
+ #
868
+ def create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:nil)
869
+ # Send request
870
+ promise = begin_create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers)
871
+
872
+ promise = promise.then do |response|
873
+ # Defining deserialization method.
874
+ deserialize_method = lambda do |parsed_response|
875
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
876
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
877
+ end
878
+
879
+ # Waiting for response.
880
+ @client.get_long_running_operation_result(response, deserialize_method)
881
+ end
882
+
883
+ promise
884
+ end
885
+
886
+ #
887
+ # Gets a deployment.
888
+ #
889
+ # @param resource_group_name [String] The name of the resource group. The name
890
+ # is case insensitive.
891
+ # @param deployment_name [String] The name of the deployment to get.
892
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
893
+ # will be added to the HTTP request.
894
+ #
895
+ # @return [DeploymentExtended] operation results.
896
+ #
897
+ def get(resource_group_name, deployment_name, custom_headers:nil)
898
+ response = get_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
899
+ response.body unless response.nil?
900
+ end
901
+
902
+ #
903
+ # Gets a deployment.
904
+ #
905
+ # @param resource_group_name [String] The name of the resource group. The name
906
+ # is case insensitive.
907
+ # @param deployment_name [String] The name of the deployment to get.
908
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
909
+ # will be added to the HTTP request.
910
+ #
911
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
912
+ #
913
+ def get_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
914
+ get_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
915
+ end
916
+
917
+ #
918
+ # Gets a deployment.
919
+ #
920
+ # @param resource_group_name [String] The name of the resource group. The name
921
+ # is case insensitive.
922
+ # @param deployment_name [String] The name of the deployment to get.
923
+ # @param [Hash{String => String}] A hash of custom headers that will be added
924
+ # to the HTTP request.
925
+ #
926
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
927
+ #
928
+ def get_async(resource_group_name, deployment_name, custom_headers:nil)
929
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
930
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
931
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
932
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
933
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
934
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
935
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
936
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
937
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
938
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
939
+
940
+
941
+ request_headers = {}
942
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
943
+
944
+ # Set Headers
945
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
946
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
947
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
948
+
949
+ request_url = @base_url || @client.base_url
950
+
951
+ options = {
952
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
953
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
954
+ query_params: {'api-version' => @client.api_version},
955
+ headers: request_headers.merge(custom_headers || {}),
956
+ base_url: request_url
957
+ }
958
+ promise = @client.make_request_async(:get, path_template, options)
959
+
960
+ promise = promise.then do |result|
961
+ http_response = result.response
962
+ status_code = http_response.status
963
+ response_content = http_response.body
964
+ unless status_code == 200
965
+ error_model = JSON.load(response_content)
966
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
967
+ end
968
+
969
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
970
+ # Deserialize Response
971
+ if status_code == 200
972
+ begin
973
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
974
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
975
+ result.body = @client.deserialize(result_mapper, parsed_response)
976
+ rescue Exception => e
977
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
978
+ end
979
+ end
980
+
981
+ result
982
+ end
983
+
984
+ promise.execute
985
+ end
986
+
987
+ #
988
+ # Cancels a currently running template deployment.
989
+ #
990
+ # You can cancel a deployment only if the provisioningState is Accepted or
991
+ # Running. After the deployment is canceled, the provisioningState is set to
992
+ # Canceled. Canceling a template deployment stops the currently running
993
+ # template deployment and leaves the resource group partially deployed.
994
+ #
995
+ # @param resource_group_name [String] The name of the resource group. The name
996
+ # is case insensitive.
997
+ # @param deployment_name [String] The name of the deployment to cancel.
998
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
999
+ # will be added to the HTTP request.
1000
+ #
1001
+ #
1002
+ def cancel(resource_group_name, deployment_name, custom_headers:nil)
1003
+ response = cancel_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1004
+ nil
1005
+ end
1006
+
1007
+ #
1008
+ # Cancels a currently running template deployment.
1009
+ #
1010
+ # You can cancel a deployment only if the provisioningState is Accepted or
1011
+ # Running. After the deployment is canceled, the provisioningState is set to
1012
+ # Canceled. Canceling a template deployment stops the currently running
1013
+ # template deployment and leaves the resource group partially deployed.
1014
+ #
1015
+ # @param resource_group_name [String] The name of the resource group. The name
1016
+ # is case insensitive.
1017
+ # @param deployment_name [String] The name of the deployment to cancel.
1018
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1019
+ # will be added to the HTTP request.
1020
+ #
1021
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1022
+ #
1023
+ def cancel_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
1024
+ cancel_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1025
+ end
1026
+
1027
+ #
1028
+ # Cancels a currently running template deployment.
1029
+ #
1030
+ # You can cancel a deployment only if the provisioningState is Accepted or
1031
+ # Running. After the deployment is canceled, the provisioningState is set to
1032
+ # Canceled. Canceling a template deployment stops the currently running
1033
+ # template deployment and leaves the resource group partially deployed.
1034
+ #
1035
+ # @param resource_group_name [String] The name of the resource group. The name
1036
+ # is case insensitive.
1037
+ # @param deployment_name [String] The name of the deployment to cancel.
1038
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1039
+ # to the HTTP request.
1040
+ #
1041
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1042
+ #
1043
+ def cancel_async(resource_group_name, deployment_name, custom_headers:nil)
1044
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1045
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1046
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1047
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1048
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1049
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1050
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1051
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1052
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1053
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1054
+
1055
+
1056
+ request_headers = {}
1057
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1058
+
1059
+ # Set Headers
1060
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1061
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1062
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel'
1063
+
1064
+ request_url = @base_url || @client.base_url
1065
+
1066
+ options = {
1067
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1068
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1069
+ query_params: {'api-version' => @client.api_version},
1070
+ headers: request_headers.merge(custom_headers || {}),
1071
+ base_url: request_url
1072
+ }
1073
+ promise = @client.make_request_async(:post, path_template, options)
1074
+
1075
+ promise = promise.then do |result|
1076
+ http_response = result.response
1077
+ status_code = http_response.status
1078
+ response_content = http_response.body
1079
+ unless status_code == 204
1080
+ error_model = JSON.load(response_content)
1081
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1082
+ end
1083
+
1084
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1085
+
1086
+ result
1087
+ end
1088
+
1089
+ promise.execute
1090
+ end
1091
+
1092
+ #
1093
+ # Validates whether the specified template is syntactically correct and will be
1094
+ # accepted by Azure Resource Manager..
1095
+ #
1096
+ # @param resource_group_name [String] The name of the resource group the
1097
+ # template will be deployed to. The name is case insensitive.
1098
+ # @param deployment_name [String] The name of the deployment.
1099
+ # @param parameters [Deployment] Parameters to validate.
1100
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1101
+ # will be added to the HTTP request.
1102
+ #
1103
+ # @return [DeploymentValidateResult] operation results.
1104
+ #
1105
+ def validate(resource_group_name, deployment_name, parameters, custom_headers:nil)
1106
+ response = validate_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
1107
+ response.body unless response.nil?
1108
+ end
1109
+
1110
+ #
1111
+ # Validates whether the specified template is syntactically correct and will be
1112
+ # accepted by Azure Resource Manager..
1113
+ #
1114
+ # @param resource_group_name [String] The name of the resource group the
1115
+ # template will be deployed to. The name is case insensitive.
1116
+ # @param deployment_name [String] The name of the deployment.
1117
+ # @param parameters [Deployment] Parameters to validate.
1118
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1119
+ # will be added to the HTTP request.
1120
+ #
1121
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1122
+ #
1123
+ def validate_with_http_info(resource_group_name, deployment_name, parameters, custom_headers:nil)
1124
+ validate_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
1125
+ end
1126
+
1127
+ #
1128
+ # Validates whether the specified template is syntactically correct and will be
1129
+ # accepted by Azure Resource Manager..
1130
+ #
1131
+ # @param resource_group_name [String] The name of the resource group the
1132
+ # template will be deployed to. The name is case insensitive.
1133
+ # @param deployment_name [String] The name of the deployment.
1134
+ # @param parameters [Deployment] Parameters to validate.
1135
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1136
+ # to the HTTP request.
1137
+ #
1138
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1139
+ #
1140
+ def validate_async(resource_group_name, deployment_name, parameters, custom_headers:nil)
1141
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1142
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1143
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1144
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1145
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1146
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1147
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1148
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1149
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1150
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1151
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1152
+
1153
+
1154
+ request_headers = {}
1155
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1156
+
1157
+ # Set Headers
1158
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1159
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1160
+
1161
+ # Serialize Request
1162
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::Deployment.mapper()
1163
+ request_content = @client.serialize(request_mapper, parameters)
1164
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1165
+
1166
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate'
1167
+
1168
+ request_url = @base_url || @client.base_url
1169
+
1170
+ options = {
1171
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1172
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1173
+ query_params: {'api-version' => @client.api_version},
1174
+ body: request_content,
1175
+ headers: request_headers.merge(custom_headers || {}),
1176
+ base_url: request_url
1177
+ }
1178
+ promise = @client.make_request_async(:post, path_template, options)
1179
+
1180
+ promise = promise.then do |result|
1181
+ http_response = result.response
1182
+ status_code = http_response.status
1183
+ response_content = http_response.body
1184
+ unless status_code == 200 || status_code == 400
1185
+ error_model = JSON.load(response_content)
1186
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1187
+ end
1188
+
1189
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-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::V2018_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::V2018_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 resource_group_name [String] The name of the resource group. The name
1221
+ # is case insensitive.
1222
+ # @param deployment_name [String] The name of the deployment from which to get
1223
+ # the template.
1224
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1225
+ # will be added to the HTTP request.
1226
+ #
1227
+ # @return [DeploymentExportResult] operation results.
1228
+ #
1229
+ def export_template(resource_group_name, deployment_name, custom_headers:nil)
1230
+ response = export_template_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1231
+ response.body unless response.nil?
1232
+ end
1233
+
1234
+ #
1235
+ # Exports the template used for specified deployment.
1236
+ #
1237
+ # @param resource_group_name [String] The name of the resource group. The name
1238
+ # is case insensitive.
1239
+ # @param deployment_name [String] The name of the deployment from which to get
1240
+ # the template.
1241
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1242
+ # will be added to the HTTP request.
1243
+ #
1244
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1245
+ #
1246
+ def export_template_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
1247
+ export_template_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1248
+ end
1249
+
1250
+ #
1251
+ # Exports the template used for specified deployment.
1252
+ #
1253
+ # @param resource_group_name [String] The name of the resource group. The name
1254
+ # is case insensitive.
1255
+ # @param deployment_name [String] The name of the deployment from which to get
1256
+ # the template.
1257
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1258
+ # to the HTTP request.
1259
+ #
1260
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1261
+ #
1262
+ def export_template_async(resource_group_name, deployment_name, custom_headers:nil)
1263
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1264
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1265
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1266
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1267
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1268
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1269
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1270
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1271
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1272
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1273
+
1274
+
1275
+ request_headers = {}
1276
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1277
+
1278
+ # Set Headers
1279
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1280
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1281
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate'
1282
+
1283
+ request_url = @base_url || @client.base_url
1284
+
1285
+ options = {
1286
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1287
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1288
+ query_params: {'api-version' => @client.api_version},
1289
+ headers: request_headers.merge(custom_headers || {}),
1290
+ base_url: request_url
1291
+ }
1292
+ promise = @client.make_request_async(:post, path_template, options)
1293
+
1294
+ promise = promise.then do |result|
1295
+ http_response = result.response
1296
+ status_code = http_response.status
1297
+ response_content = http_response.body
1298
+ unless status_code == 200
1299
+ error_model = JSON.load(response_content)
1300
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1301
+ end
1302
+
1303
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1304
+ # Deserialize Response
1305
+ if status_code == 200
1306
+ begin
1307
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1308
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExportResult.mapper()
1309
+ result.body = @client.deserialize(result_mapper, parsed_response)
1310
+ rescue Exception => e
1311
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1312
+ end
1313
+ end
1314
+
1315
+ result
1316
+ end
1317
+
1318
+ promise.execute
1319
+ end
1320
+
1321
+ #
1322
+ # Get all the deployments for a resource group.
1323
+ #
1324
+ # @param resource_group_name [String] The name of the resource group with the
1325
+ # deployments to get. The name is case insensitive.
1326
+ # @param filter [String] The filter to apply on the operation. For example, you
1327
+ # can use $filter=provisioningState eq '{state}'.
1328
+ # @param top [Integer] The number of results to get. If null is passed, returns
1329
+ # all deployments.
1330
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1331
+ # will be added to the HTTP request.
1332
+ #
1333
+ # @return [Array<DeploymentExtended>] operation results.
1334
+ #
1335
+ def list_by_resource_group(resource_group_name, filter:nil, top:nil, custom_headers:nil)
1336
+ first_page = list_by_resource_group_as_lazy(resource_group_name, filter:filter, top:top, custom_headers:custom_headers)
1337
+ first_page.get_all_items
1338
+ end
1339
+
1340
+ #
1341
+ # Get all the deployments for a resource group.
1342
+ #
1343
+ # @param resource_group_name [String] The name of the resource group with the
1344
+ # deployments to get. The name is case insensitive.
1345
+ # @param filter [String] The filter to apply on the operation. For example, you
1346
+ # can use $filter=provisioningState eq '{state}'.
1347
+ # @param top [Integer] The number of results to get. If null is passed, returns
1348
+ # all deployments.
1349
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1350
+ # will be added to the HTTP request.
1351
+ #
1352
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1353
+ #
1354
+ def list_by_resource_group_with_http_info(resource_group_name, filter:nil, top:nil, custom_headers:nil)
1355
+ list_by_resource_group_async(resource_group_name, filter:filter, top:top, custom_headers:custom_headers).value!
1356
+ end
1357
+
1358
+ #
1359
+ # Get all the deployments for a resource group.
1360
+ #
1361
+ # @param resource_group_name [String] The name of the resource group with the
1362
+ # deployments to get. The name is case insensitive.
1363
+ # @param filter [String] The filter to apply on the operation. For example, you
1364
+ # can use $filter=provisioningState eq '{state}'.
1365
+ # @param top [Integer] The number of results to get. If null is passed, returns
1366
+ # all deployments.
1367
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1368
+ # to the HTTP request.
1369
+ #
1370
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1371
+ #
1372
+ def list_by_resource_group_async(resource_group_name, filter:nil, top:nil, custom_headers:nil)
1373
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1374
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1375
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1376
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1377
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1378
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1379
+
1380
+
1381
+ request_headers = {}
1382
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1383
+
1384
+ # Set Headers
1385
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1386
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1387
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/'
1388
+
1389
+ request_url = @base_url || @client.base_url
1390
+
1391
+ options = {
1392
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1393
+ path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
1394
+ query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
1395
+ headers: request_headers.merge(custom_headers || {}),
1396
+ base_url: request_url
1397
+ }
1398
+ promise = @client.make_request_async(:get, path_template, options)
1399
+
1400
+ promise = promise.then do |result|
1401
+ http_response = result.response
1402
+ status_code = http_response.status
1403
+ response_content = http_response.body
1404
+ unless status_code == 200
1405
+ error_model = JSON.load(response_content)
1406
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1407
+ end
1408
+
1409
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1410
+ # Deserialize Response
1411
+ if status_code == 200
1412
+ begin
1413
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1414
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentListResult.mapper()
1415
+ result.body = @client.deserialize(result_mapper, parsed_response)
1416
+ rescue Exception => e
1417
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1418
+ end
1419
+ end
1420
+
1421
+ result
1422
+ end
1423
+
1424
+ promise.execute
1425
+ end
1426
+
1427
+ #
1428
+ # Deletes a deployment from the deployment history.
1429
+ #
1430
+ # A template deployment that is currently running cannot be deleted. Deleting a
1431
+ # template deployment removes the associated deployment operations. This is an
1432
+ # asynchronous operation that returns a status of 202 until the template
1433
+ # deployment is successfully deleted. The Location response header contains the
1434
+ # URI that is used to obtain the status of the process. While the process is
1435
+ # running, a call to the URI in the Location header returns a status of 202.
1436
+ # When the process finishes, the URI in the Location header returns a status of
1437
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1438
+ # header returns an error-level status code.
1439
+ #
1440
+ # @param deployment_name [String] The name of the deployment to delete.
1441
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1442
+ # will be added to the HTTP request.
1443
+ #
1444
+ #
1445
+ def begin_delete_at_subscription_scope(deployment_name, custom_headers:nil)
1446
+ response = begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
1447
+ nil
1448
+ end
1449
+
1450
+ #
1451
+ # Deletes a deployment from the deployment history.
1452
+ #
1453
+ # A template deployment that is currently running cannot be deleted. Deleting a
1454
+ # template deployment removes the associated deployment operations. This is an
1455
+ # asynchronous operation that returns a status of 202 until the template
1456
+ # deployment is successfully deleted. The Location response header contains the
1457
+ # URI that is used to obtain the status of the process. While the process is
1458
+ # running, a call to the URI in the Location header returns a status of 202.
1459
+ # When the process finishes, the URI in the Location header returns a status of
1460
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1461
+ # header returns an error-level status code.
1462
+ #
1463
+ # @param deployment_name [String] The name of the deployment to delete.
1464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1465
+ # will be added to the HTTP request.
1466
+ #
1467
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1468
+ #
1469
+ def begin_delete_at_subscription_scope_with_http_info(deployment_name, custom_headers:nil)
1470
+ begin_delete_at_subscription_scope_async(deployment_name, custom_headers:custom_headers).value!
1471
+ end
1472
+
1473
+ #
1474
+ # Deletes a deployment from the deployment history.
1475
+ #
1476
+ # A template deployment that is currently running cannot be deleted. Deleting a
1477
+ # template deployment removes the associated deployment operations. This is an
1478
+ # asynchronous operation that returns a status of 202 until the template
1479
+ # deployment is successfully deleted. The Location response header contains the
1480
+ # URI that is used to obtain the status of the process. While the process is
1481
+ # running, a call to the URI in the Location header returns a status of 202.
1482
+ # When the process finishes, the URI in the Location header returns a status of
1483
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1484
+ # header returns an error-level status code.
1485
+ #
1486
+ # @param deployment_name [String] The name of the deployment to delete.
1487
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1488
+ # to the HTTP request.
1489
+ #
1490
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1491
+ #
1492
+ def begin_delete_at_subscription_scope_async(deployment_name, custom_headers:nil)
1493
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1494
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1495
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1496
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1497
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1498
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1499
+
1500
+
1501
+ request_headers = {}
1502
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1503
+
1504
+ # Set Headers
1505
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1506
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1507
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'
1508
+
1509
+ request_url = @base_url || @client.base_url
1510
+
1511
+ options = {
1512
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1513
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1514
+ query_params: {'api-version' => @client.api_version},
1515
+ headers: request_headers.merge(custom_headers || {}),
1516
+ base_url: request_url
1517
+ }
1518
+ promise = @client.make_request_async(:delete, path_template, options)
1519
+
1520
+ promise = promise.then do |result|
1521
+ http_response = result.response
1522
+ status_code = http_response.status
1523
+ response_content = http_response.body
1524
+ unless status_code == 202 || status_code == 204
1525
+ error_model = JSON.load(response_content)
1526
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1527
+ end
1528
+
1529
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1530
+
1531
+ result
1532
+ end
1533
+
1534
+ promise.execute
1535
+ end
1536
+
1537
+ #
1538
+ # Deploys resources at subscription scope.
1539
+ #
1540
+ # You can provide the template and parameters directly in the request or link
1541
+ # to JSON files.
1542
+ #
1543
+ # @param deployment_name [String] The name of the deployment.
1544
+ # @param parameters [Deployment] Additional parameters supplied to the
1545
+ # operation.
1546
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1547
+ # will be added to the HTTP request.
1548
+ #
1549
+ # @return [DeploymentExtended] operation results.
1550
+ #
1551
+ def begin_create_or_update_at_subscription_scope(deployment_name, parameters, custom_headers:nil)
1552
+ response = begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
1553
+ response.body unless response.nil?
1554
+ end
1555
+
1556
+ #
1557
+ # Deploys resources at subscription scope.
1558
+ #
1559
+ # You can provide the template and parameters directly in the request or link
1560
+ # to JSON files.
1561
+ #
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 [MsRestAzure::AzureOperationResponse] HTTP response information.
1569
+ #
1570
+ def begin_create_or_update_at_subscription_scope_with_http_info(deployment_name, parameters, custom_headers:nil)
1571
+ begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:custom_headers).value!
1572
+ end
1573
+
1574
+ #
1575
+ # Deploys resources at subscription scope.
1576
+ #
1577
+ # You can provide the template and parameters directly in the request or link
1578
+ # to JSON files.
1579
+ #
1580
+ # @param deployment_name [String] The name of the deployment.
1581
+ # @param parameters [Deployment] Additional parameters supplied to the
1582
+ # operation.
1583
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1584
+ # to the HTTP request.
1585
+ #
1586
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1587
+ #
1588
+ def begin_create_or_update_at_subscription_scope_async(deployment_name, parameters, custom_headers:nil)
1589
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1590
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1591
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1592
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1593
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1594
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1595
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1596
+
1597
+
1598
+ request_headers = {}
1599
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1600
+
1601
+ # Set Headers
1602
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1603
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1604
+
1605
+ # Serialize Request
1606
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::Deployment.mapper()
1607
+ request_content = @client.serialize(request_mapper, parameters)
1608
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1609
+
1610
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}'
1611
+
1612
+ request_url = @base_url || @client.base_url
1613
+
1614
+ options = {
1615
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1616
+ path_params: {'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1617
+ query_params: {'api-version' => @client.api_version},
1618
+ body: request_content,
1619
+ headers: request_headers.merge(custom_headers || {}),
1620
+ base_url: request_url
1621
+ }
1622
+ promise = @client.make_request_async(:put, path_template, options)
1623
+
1624
+ promise = promise.then do |result|
1625
+ http_response = result.response
1626
+ status_code = http_response.status
1627
+ response_content = http_response.body
1628
+ unless status_code == 200 || status_code == 201
1629
+ error_model = JSON.load(response_content)
1630
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1631
+ end
1632
+
1633
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1634
+ # Deserialize Response
1635
+ if status_code == 200
1636
+ begin
1637
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1638
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
1639
+ result.body = @client.deserialize(result_mapper, parsed_response)
1640
+ rescue Exception => e
1641
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1642
+ end
1643
+ end
1644
+ # Deserialize Response
1645
+ if status_code == 201
1646
+ begin
1647
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1648
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
1649
+ result.body = @client.deserialize(result_mapper, parsed_response)
1650
+ rescue Exception => e
1651
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1652
+ end
1653
+ end
1654
+
1655
+ result
1656
+ end
1657
+
1658
+ promise.execute
1659
+ end
1660
+
1661
+ #
1662
+ # Deletes a deployment from the deployment history.
1663
+ #
1664
+ # A template deployment that is currently running cannot be deleted. Deleting a
1665
+ # template deployment removes the associated deployment operations. Deleting a
1666
+ # template deployment does not affect the state of the resource group. This is
1667
+ # an asynchronous operation that returns a status of 202 until the template
1668
+ # deployment is successfully deleted. The Location response header contains the
1669
+ # URI that is used to obtain the status of the process. While the process is
1670
+ # running, a call to the URI in the Location header returns a status of 202.
1671
+ # When the process finishes, the URI in the Location header returns a status of
1672
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1673
+ # header returns an error-level status code.
1674
+ #
1675
+ # @param resource_group_name [String] The name of the resource group with the
1676
+ # deployment to delete. The name is case insensitive.
1677
+ # @param deployment_name [String] The name of the deployment to delete.
1678
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1679
+ # will be added to the HTTP request.
1680
+ #
1681
+ #
1682
+ def begin_delete(resource_group_name, deployment_name, custom_headers:nil)
1683
+ response = begin_delete_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1684
+ nil
1685
+ end
1686
+
1687
+ #
1688
+ # Deletes a deployment from the deployment history.
1689
+ #
1690
+ # A template deployment that is currently running cannot be deleted. Deleting a
1691
+ # template deployment removes the associated deployment operations. Deleting a
1692
+ # template deployment does not affect the state of the resource group. This is
1693
+ # an asynchronous operation that returns a status of 202 until the template
1694
+ # deployment is successfully deleted. The Location response header contains the
1695
+ # URI that is used to obtain the status of the process. While the process is
1696
+ # running, a call to the URI in the Location header returns a status of 202.
1697
+ # When the process finishes, the URI in the Location header returns a status of
1698
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1699
+ # header returns an error-level status code.
1700
+ #
1701
+ # @param resource_group_name [String] The name of the resource group with the
1702
+ # deployment to delete. The name is case insensitive.
1703
+ # @param deployment_name [String] The name of the deployment to delete.
1704
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1705
+ # will be added to the HTTP request.
1706
+ #
1707
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1708
+ #
1709
+ def begin_delete_with_http_info(resource_group_name, deployment_name, custom_headers:nil)
1710
+ begin_delete_async(resource_group_name, deployment_name, custom_headers:custom_headers).value!
1711
+ end
1712
+
1713
+ #
1714
+ # Deletes a deployment from the deployment history.
1715
+ #
1716
+ # A template deployment that is currently running cannot be deleted. Deleting a
1717
+ # template deployment removes the associated deployment operations. Deleting a
1718
+ # template deployment does not affect the state of the resource group. This is
1719
+ # an asynchronous operation that returns a status of 202 until the template
1720
+ # deployment is successfully deleted. The Location response header contains the
1721
+ # URI that is used to obtain the status of the process. While the process is
1722
+ # running, a call to the URI in the Location header returns a status of 202.
1723
+ # When the process finishes, the URI in the Location header returns a status of
1724
+ # 204 on success. If the asynchronous request failed, the URI in the Location
1725
+ # header returns an error-level status code.
1726
+ #
1727
+ # @param resource_group_name [String] The name of the resource group with the
1728
+ # deployment to delete. The name is case insensitive.
1729
+ # @param deployment_name [String] The name of the deployment to delete.
1730
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1731
+ # to the HTTP request.
1732
+ #
1733
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1734
+ #
1735
+ def begin_delete_async(resource_group_name, deployment_name, custom_headers:nil)
1736
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1737
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1738
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1739
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1740
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1741
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1742
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1743
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1744
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1745
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1746
+
1747
+
1748
+ request_headers = {}
1749
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1750
+
1751
+ # Set Headers
1752
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1753
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1754
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
1755
+
1756
+ request_url = @base_url || @client.base_url
1757
+
1758
+ options = {
1759
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1760
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1761
+ query_params: {'api-version' => @client.api_version},
1762
+ headers: request_headers.merge(custom_headers || {}),
1763
+ base_url: request_url
1764
+ }
1765
+ promise = @client.make_request_async(:delete, path_template, options)
1766
+
1767
+ promise = promise.then do |result|
1768
+ http_response = result.response
1769
+ status_code = http_response.status
1770
+ response_content = http_response.body
1771
+ unless status_code == 202 || status_code == 204
1772
+ error_model = JSON.load(response_content)
1773
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1774
+ end
1775
+
1776
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1777
+
1778
+ result
1779
+ end
1780
+
1781
+ promise.execute
1782
+ end
1783
+
1784
+ #
1785
+ # Deploys resources to a resource group.
1786
+ #
1787
+ # You can provide the template and parameters directly in the request or link
1788
+ # to JSON files.
1789
+ #
1790
+ # @param resource_group_name [String] The name of the resource group to deploy
1791
+ # the resources to. The name is case insensitive. The resource group must
1792
+ # already exist.
1793
+ # @param deployment_name [String] The name of the deployment.
1794
+ # @param parameters [Deployment] Additional parameters supplied to the
1795
+ # operation.
1796
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1797
+ # will be added to the HTTP request.
1798
+ #
1799
+ # @return [DeploymentExtended] operation results.
1800
+ #
1801
+ def begin_create_or_update(resource_group_name, deployment_name, parameters, custom_headers:nil)
1802
+ response = begin_create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
1803
+ response.body unless response.nil?
1804
+ end
1805
+
1806
+ #
1807
+ # Deploys resources to a resource group.
1808
+ #
1809
+ # You can provide the template and parameters directly in the request or link
1810
+ # to JSON files.
1811
+ #
1812
+ # @param resource_group_name [String] The name of the resource group to deploy
1813
+ # the resources to. The name is case insensitive. The resource group must
1814
+ # already exist.
1815
+ # @param deployment_name [String] The name of the deployment.
1816
+ # @param parameters [Deployment] Additional parameters supplied to the
1817
+ # operation.
1818
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1819
+ # will be added to the HTTP request.
1820
+ #
1821
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1822
+ #
1823
+ def begin_create_or_update_with_http_info(resource_group_name, deployment_name, parameters, custom_headers:nil)
1824
+ begin_create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:custom_headers).value!
1825
+ end
1826
+
1827
+ #
1828
+ # Deploys resources to a resource group.
1829
+ #
1830
+ # You can provide the template and parameters directly in the request or link
1831
+ # to JSON files.
1832
+ #
1833
+ # @param resource_group_name [String] The name of the resource group to deploy
1834
+ # the resources to. The name is case insensitive. The resource group must
1835
+ # already exist.
1836
+ # @param deployment_name [String] The name of the deployment.
1837
+ # @param parameters [Deployment] Additional parameters supplied to the
1838
+ # operation.
1839
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1840
+ # to the HTTP request.
1841
+ #
1842
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1843
+ #
1844
+ def begin_create_or_update_async(resource_group_name, deployment_name, parameters, custom_headers:nil)
1845
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
1846
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
1847
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
1848
+ fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1849
+ fail ArgumentError, 'deployment_name is nil' if deployment_name.nil?
1850
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MaxLength': '64'" if !deployment_name.nil? && deployment_name.length > 64
1851
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'MinLength': '1'" if !deployment_name.nil? && deployment_name.length < 1
1852
+ fail ArgumentError, "'deployment_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !deployment_name.nil? && deployment_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
1853
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
1854
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
1855
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
1856
+
1857
+
1858
+ request_headers = {}
1859
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1860
+
1861
+ # Set Headers
1862
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1863
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1864
+
1865
+ # Serialize Request
1866
+ request_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::Deployment.mapper()
1867
+ request_content = @client.serialize(request_mapper, parameters)
1868
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
1869
+
1870
+ path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}'
1871
+
1872
+ request_url = @base_url || @client.base_url
1873
+
1874
+ options = {
1875
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1876
+ path_params: {'resourceGroupName' => resource_group_name,'deploymentName' => deployment_name,'subscriptionId' => @client.subscription_id},
1877
+ query_params: {'api-version' => @client.api_version},
1878
+ body: request_content,
1879
+ headers: request_headers.merge(custom_headers || {}),
1880
+ base_url: request_url
1881
+ }
1882
+ promise = @client.make_request_async(:put, path_template, options)
1883
+
1884
+ promise = promise.then do |result|
1885
+ http_response = result.response
1886
+ status_code = http_response.status
1887
+ response_content = http_response.body
1888
+ unless status_code == 200 || status_code == 201
1889
+ error_model = JSON.load(response_content)
1890
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1891
+ end
1892
+
1893
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1894
+ # Deserialize Response
1895
+ if status_code == 200
1896
+ begin
1897
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1898
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
1899
+ result.body = @client.deserialize(result_mapper, parsed_response)
1900
+ rescue Exception => e
1901
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1902
+ end
1903
+ end
1904
+ # Deserialize Response
1905
+ if status_code == 201
1906
+ begin
1907
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1908
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentExtended.mapper()
1909
+ result.body = @client.deserialize(result_mapper, parsed_response)
1910
+ rescue Exception => e
1911
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1912
+ end
1913
+ end
1914
+
1915
+ result
1916
+ end
1917
+
1918
+ promise.execute
1919
+ end
1920
+
1921
+ #
1922
+ # Get all the deployments for a subscription.
1923
+ #
1924
+ # @param next_page_link [String] The NextLink from the previous successful call
1925
+ # to List operation.
1926
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1927
+ # will be added to the HTTP request.
1928
+ #
1929
+ # @return [DeploymentListResult] operation results.
1930
+ #
1931
+ def list_at_subscription_scope_next(next_page_link, custom_headers:nil)
1932
+ response = list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1933
+ response.body unless response.nil?
1934
+ end
1935
+
1936
+ #
1937
+ # Get all the deployments for a subscription.
1938
+ #
1939
+ # @param next_page_link [String] The NextLink from the previous successful call
1940
+ # to List operation.
1941
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1942
+ # will be added to the HTTP request.
1943
+ #
1944
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
1945
+ #
1946
+ def list_at_subscription_scope_next_with_http_info(next_page_link, custom_headers:nil)
1947
+ list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers).value!
1948
+ end
1949
+
1950
+ #
1951
+ # Get all the deployments for a subscription.
1952
+ #
1953
+ # @param next_page_link [String] The NextLink from the previous successful call
1954
+ # to List operation.
1955
+ # @param [Hash{String => String}] A hash of custom headers that will be added
1956
+ # to the HTTP request.
1957
+ #
1958
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1959
+ #
1960
+ def list_at_subscription_scope_next_async(next_page_link, custom_headers:nil)
1961
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1962
+
1963
+
1964
+ request_headers = {}
1965
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1966
+
1967
+ # Set Headers
1968
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1969
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1970
+ path_template = '{nextLink}'
1971
+
1972
+ request_url = @base_url || @client.base_url
1973
+
1974
+ options = {
1975
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1976
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1977
+ headers: request_headers.merge(custom_headers || {}),
1978
+ base_url: request_url
1979
+ }
1980
+ promise = @client.make_request_async(:get, path_template, options)
1981
+
1982
+ promise = promise.then do |result|
1983
+ http_response = result.response
1984
+ status_code = http_response.status
1985
+ response_content = http_response.body
1986
+ unless status_code == 200
1987
+ error_model = JSON.load(response_content)
1988
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1989
+ end
1990
+
1991
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1992
+ # Deserialize Response
1993
+ if status_code == 200
1994
+ begin
1995
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1996
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentListResult.mapper()
1997
+ result.body = @client.deserialize(result_mapper, parsed_response)
1998
+ rescue Exception => e
1999
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2000
+ end
2001
+ end
2002
+
2003
+ result
2004
+ end
2005
+
2006
+ promise.execute
2007
+ end
2008
+
2009
+ #
2010
+ # Get all the deployments for a resource group.
2011
+ #
2012
+ # @param next_page_link [String] The NextLink from the previous successful call
2013
+ # to List operation.
2014
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2015
+ # will be added to the HTTP request.
2016
+ #
2017
+ # @return [DeploymentListResult] operation results.
2018
+ #
2019
+ def list_by_resource_group_next(next_page_link, custom_headers:nil)
2020
+ response = list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2021
+ response.body unless response.nil?
2022
+ end
2023
+
2024
+ #
2025
+ # Get all the deployments for a resource group.
2026
+ #
2027
+ # @param next_page_link [String] The NextLink from the previous successful call
2028
+ # to List operation.
2029
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2030
+ # will be added to the HTTP request.
2031
+ #
2032
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
2033
+ #
2034
+ def list_by_resource_group_next_with_http_info(next_page_link, custom_headers:nil)
2035
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers).value!
2036
+ end
2037
+
2038
+ #
2039
+ # Get all the deployments for a resource group.
2040
+ #
2041
+ # @param next_page_link [String] The NextLink from the previous successful call
2042
+ # to List operation.
2043
+ # @param [Hash{String => String}] A hash of custom headers that will be added
2044
+ # to the HTTP request.
2045
+ #
2046
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
2047
+ #
2048
+ def list_by_resource_group_next_async(next_page_link, custom_headers:nil)
2049
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
2050
+
2051
+
2052
+ request_headers = {}
2053
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
2054
+
2055
+ # Set Headers
2056
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
2057
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
2058
+ path_template = '{nextLink}'
2059
+
2060
+ request_url = @base_url || @client.base_url
2061
+
2062
+ options = {
2063
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
2064
+ skip_encoding_path_params: {'nextLink' => next_page_link},
2065
+ headers: request_headers.merge(custom_headers || {}),
2066
+ base_url: request_url
2067
+ }
2068
+ promise = @client.make_request_async(:get, path_template, options)
2069
+
2070
+ promise = promise.then do |result|
2071
+ http_response = result.response
2072
+ status_code = http_response.status
2073
+ response_content = http_response.body
2074
+ unless status_code == 200
2075
+ error_model = JSON.load(response_content)
2076
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
2077
+ end
2078
+
2079
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
2080
+ # Deserialize Response
2081
+ if status_code == 200
2082
+ begin
2083
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
2084
+ result_mapper = Azure::Resources::Mgmt::V2018_05_01::Models::DeploymentListResult.mapper()
2085
+ result.body = @client.deserialize(result_mapper, parsed_response)
2086
+ rescue Exception => e
2087
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
2088
+ end
2089
+ end
2090
+
2091
+ result
2092
+ end
2093
+
2094
+ promise.execute
2095
+ end
2096
+
2097
+ #
2098
+ # Get all the deployments for a subscription.
2099
+ #
2100
+ # @param filter [String] The filter to apply on the operation. For example, you
2101
+ # can use $filter=provisioningState eq '{state}'.
2102
+ # @param top [Integer] The number of results to get. If null is passed, returns
2103
+ # all deployments.
2104
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2105
+ # will be added to the HTTP request.
2106
+ #
2107
+ # @return [DeploymentListResult] which provide lazy access to pages of the
2108
+ # response.
2109
+ #
2110
+ def list_at_subscription_scope_as_lazy(filter:nil, top:nil, custom_headers:nil)
2111
+ response = list_at_subscription_scope_async(filter:filter, top:top, custom_headers:custom_headers).value!
2112
+ unless response.nil?
2113
+ page = response.body
2114
+ page.next_method = Proc.new do |next_page_link|
2115
+ list_at_subscription_scope_next_async(next_page_link, custom_headers:custom_headers)
2116
+ end
2117
+ page
2118
+ end
2119
+ end
2120
+
2121
+ #
2122
+ # Get all the deployments for a resource group.
2123
+ #
2124
+ # @param resource_group_name [String] The name of the resource group with the
2125
+ # deployments to get. The name is case insensitive.
2126
+ # @param filter [String] The filter to apply on the operation. For example, you
2127
+ # can use $filter=provisioningState eq '{state}'.
2128
+ # @param top [Integer] The number of results to get. If null is passed, returns
2129
+ # all deployments.
2130
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
2131
+ # will be added to the HTTP request.
2132
+ #
2133
+ # @return [DeploymentListResult] which provide lazy access to pages of the
2134
+ # response.
2135
+ #
2136
+ def list_by_resource_group_as_lazy(resource_group_name, filter:nil, top:nil, custom_headers:nil)
2137
+ response = list_by_resource_group_async(resource_group_name, filter:filter, top:top, custom_headers:custom_headers).value!
2138
+ unless response.nil?
2139
+ page = response.body
2140
+ page.next_method = Proc.new do |next_page_link|
2141
+ list_by_resource_group_next_async(next_page_link, custom_headers:custom_headers)
2142
+ end
2143
+ page
2144
+ end
2145
+ end
2146
+
2147
+ end
2148
+ end