azure_mgmt_resources 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/2016-02-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2016-06-01/generated/azure_mgmt_resources/subscription_client.rb +1 -1
- data/lib/2016-07-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2016-09-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2017-05-10/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2018-02-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2018-05-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2018-06-01/generated/azure_mgmt_resources/application_client.rb +1 -1
- data/lib/2019-03-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2019-05-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2019-05-10/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2019-07-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/2019-10-01/generated/azure_mgmt_resources.rb +111 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/deployment_operations.rb +1590 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/deployments.rb +6276 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_model.rb +102 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_path.rb +77 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_pattern.rb +70 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_pattern_type.rb +16 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_type.rb +17 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/change_type.rb +20 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/debug_setting.rb +53 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment.rb +77 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_extended.rb +113 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +162 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +284 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +61 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if_properties.rb +108 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if_settings.rb +48 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/error_additional_info.rb +59 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/error_response.rb +117 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource_expanded.rb +179 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/identity.rb +96 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/identity_user_assigned_identities_value.rb +60 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation_display.rb +80 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation_list_result.rb +100 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/property_change_type.rb +18 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider.rb +104 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +137 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/provisioning_operation.rb +24 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource.rb +110 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group.rb +128 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_reference.rb +47 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/scoped_deployment.rb +77 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/scoped_deployment_what_if.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags.rb +54 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_patch_operation.rb +17 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_patch_resource.rb +59 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_resource.rb +83 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/template_hash_result.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_change.rb +105 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_operation_result.rb +80 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_property_change.rb +101 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_result_format.rb +16 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/operations.rb +219 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/providers.rb +846 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/resource_groups.rb +964 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/resource_management_client.rb +155 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/resources.rb +2354 -0
- data/lib/2019-10-01/generated/azure_mgmt_resources/tags_operations.rb +1078 -0
- data/lib/2020-06-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
- data/lib/azure_mgmt_resources.rb +10 -9
- data/lib/version.rb +1 -1
- metadata +90 -3
@@ -0,0 +1,964 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Code generated by Microsoft (R) AutoRest Code Generator.
|
3
|
+
# Changes may cause incorrect behavior and will be lost if the code is
|
4
|
+
# regenerated.
|
5
|
+
|
6
|
+
module Azure::Resources::Mgmt::V2019_10_01
|
7
|
+
#
|
8
|
+
# Provides operations for working with resources and resource groups.
|
9
|
+
#
|
10
|
+
class ResourceGroups
|
11
|
+
include MsRestAzure
|
12
|
+
|
13
|
+
#
|
14
|
+
# Creates and initializes a new instance of the ResourceGroups 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
|
+
# Checks whether a resource group exists.
|
26
|
+
#
|
27
|
+
# @param resource_group_name [String] The name of the resource group to check.
|
28
|
+
# The name is case insensitive.
|
29
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
30
|
+
# will be added to the HTTP request.
|
31
|
+
#
|
32
|
+
# @return [Boolean] operation results.
|
33
|
+
#
|
34
|
+
def check_existence(resource_group_name, custom_headers:nil)
|
35
|
+
response = check_existence_async(resource_group_name, custom_headers:custom_headers).value!
|
36
|
+
response.body unless response.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Checks whether a resource group exists.
|
41
|
+
#
|
42
|
+
# @param resource_group_name [String] The name of the resource group to check.
|
43
|
+
# The name is case insensitive.
|
44
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
45
|
+
# will be added to the HTTP request.
|
46
|
+
#
|
47
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
48
|
+
#
|
49
|
+
def check_existence_with_http_info(resource_group_name, custom_headers:nil)
|
50
|
+
check_existence_async(resource_group_name, custom_headers:custom_headers).value!
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# Checks whether a resource group exists.
|
55
|
+
#
|
56
|
+
# @param resource_group_name [String] The name of the resource group to check.
|
57
|
+
# The name is case insensitive.
|
58
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
59
|
+
# to the HTTP request.
|
60
|
+
#
|
61
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
62
|
+
#
|
63
|
+
def check_existence_async(resource_group_name, custom_headers:nil)
|
64
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
65
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
66
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
67
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
68
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
69
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
70
|
+
|
71
|
+
|
72
|
+
request_headers = {}
|
73
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
74
|
+
|
75
|
+
# Set Headers
|
76
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
77
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
78
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
|
79
|
+
|
80
|
+
request_url = @base_url || @client.base_url
|
81
|
+
|
82
|
+
options = {
|
83
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
84
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
85
|
+
query_params: {'api-version' => @client.api_version},
|
86
|
+
headers: request_headers.merge(custom_headers || {}),
|
87
|
+
base_url: request_url
|
88
|
+
}
|
89
|
+
promise = @client.make_request_async(:head, path_template, options)
|
90
|
+
|
91
|
+
promise = promise.then do |result|
|
92
|
+
http_response = result.response
|
93
|
+
status_code = http_response.status
|
94
|
+
response_content = http_response.body
|
95
|
+
unless status_code == 204 || status_code == 404
|
96
|
+
error_model = JSON.load(response_content)
|
97
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
98
|
+
end
|
99
|
+
|
100
|
+
result.body = (status_code == 204)
|
101
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
102
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
103
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
104
|
+
|
105
|
+
result
|
106
|
+
end
|
107
|
+
|
108
|
+
promise.execute
|
109
|
+
end
|
110
|
+
|
111
|
+
#
|
112
|
+
# Creates or updates a resource group.
|
113
|
+
#
|
114
|
+
# @param resource_group_name [String] The name of the resource group to create
|
115
|
+
# or update. Can include alphanumeric, underscore, parentheses, hyphen, period
|
116
|
+
# (except at end), and Unicode characters that match the allowed characters.
|
117
|
+
# @param parameters [ResourceGroup] Parameters supplied to the create or update
|
118
|
+
# a resource group.
|
119
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
120
|
+
# will be added to the HTTP request.
|
121
|
+
#
|
122
|
+
# @return [ResourceGroup] operation results.
|
123
|
+
#
|
124
|
+
def create_or_update(resource_group_name, parameters, custom_headers:nil)
|
125
|
+
response = create_or_update_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
126
|
+
response.body unless response.nil?
|
127
|
+
end
|
128
|
+
|
129
|
+
#
|
130
|
+
# Creates or updates a resource group.
|
131
|
+
#
|
132
|
+
# @param resource_group_name [String] The name of the resource group to create
|
133
|
+
# or update. Can include alphanumeric, underscore, parentheses, hyphen, period
|
134
|
+
# (except at end), and Unicode characters that match the allowed characters.
|
135
|
+
# @param parameters [ResourceGroup] Parameters supplied to the create or update
|
136
|
+
# a resource group.
|
137
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
138
|
+
# will be added to the HTTP request.
|
139
|
+
#
|
140
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
141
|
+
#
|
142
|
+
def create_or_update_with_http_info(resource_group_name, parameters, custom_headers:nil)
|
143
|
+
create_or_update_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# Creates or updates a resource group.
|
148
|
+
#
|
149
|
+
# @param resource_group_name [String] The name of the resource group to create
|
150
|
+
# or update. Can include alphanumeric, underscore, parentheses, hyphen, period
|
151
|
+
# (except at end), and Unicode characters that match the allowed characters.
|
152
|
+
# @param parameters [ResourceGroup] Parameters supplied to the create or update
|
153
|
+
# a resource group.
|
154
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
155
|
+
# to the HTTP request.
|
156
|
+
#
|
157
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
158
|
+
#
|
159
|
+
def create_or_update_async(resource_group_name, parameters, custom_headers:nil)
|
160
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
161
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
162
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
163
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
164
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
165
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
166
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
167
|
+
|
168
|
+
|
169
|
+
request_headers = {}
|
170
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
171
|
+
|
172
|
+
# Set Headers
|
173
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
174
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
175
|
+
|
176
|
+
# Serialize Request
|
177
|
+
request_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroup.mapper()
|
178
|
+
request_content = @client.serialize(request_mapper, parameters)
|
179
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
180
|
+
|
181
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
|
182
|
+
|
183
|
+
request_url = @base_url || @client.base_url
|
184
|
+
|
185
|
+
options = {
|
186
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
187
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
188
|
+
query_params: {'api-version' => @client.api_version},
|
189
|
+
body: request_content,
|
190
|
+
headers: request_headers.merge(custom_headers || {}),
|
191
|
+
base_url: request_url
|
192
|
+
}
|
193
|
+
promise = @client.make_request_async(:put, path_template, options)
|
194
|
+
|
195
|
+
promise = promise.then do |result|
|
196
|
+
http_response = result.response
|
197
|
+
status_code = http_response.status
|
198
|
+
response_content = http_response.body
|
199
|
+
unless status_code == 200 || status_code == 201
|
200
|
+
error_model = JSON.load(response_content)
|
201
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
202
|
+
end
|
203
|
+
|
204
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
205
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
206
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
207
|
+
# Deserialize Response
|
208
|
+
if status_code == 200
|
209
|
+
begin
|
210
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
211
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroup.mapper()
|
212
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
213
|
+
rescue Exception => e
|
214
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
# Deserialize Response
|
218
|
+
if status_code == 201
|
219
|
+
begin
|
220
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
221
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroup.mapper()
|
222
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
223
|
+
rescue Exception => e
|
224
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
result
|
229
|
+
end
|
230
|
+
|
231
|
+
promise.execute
|
232
|
+
end
|
233
|
+
|
234
|
+
#
|
235
|
+
# Deletes a resource group.
|
236
|
+
#
|
237
|
+
# When you delete a resource group, all of its resources are also deleted.
|
238
|
+
# Deleting a resource group deletes all of its template deployments and
|
239
|
+
# currently stored operations.
|
240
|
+
#
|
241
|
+
# @param resource_group_name [String] The name of the resource group to delete.
|
242
|
+
# The name is case insensitive.
|
243
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
244
|
+
# will be added to the HTTP request.
|
245
|
+
#
|
246
|
+
def delete(resource_group_name, custom_headers:nil)
|
247
|
+
response = delete_async(resource_group_name, custom_headers:custom_headers).value!
|
248
|
+
nil
|
249
|
+
end
|
250
|
+
|
251
|
+
#
|
252
|
+
# @param resource_group_name [String] The name of the resource group to delete.
|
253
|
+
# The name is case insensitive.
|
254
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
255
|
+
# will be added to the HTTP request.
|
256
|
+
#
|
257
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
258
|
+
# response.
|
259
|
+
#
|
260
|
+
def delete_async(resource_group_name, custom_headers:nil)
|
261
|
+
# Send request
|
262
|
+
promise = begin_delete_async(resource_group_name, custom_headers:custom_headers)
|
263
|
+
|
264
|
+
promise = promise.then do |response|
|
265
|
+
# Defining deserialization method.
|
266
|
+
deserialize_method = lambda do |parsed_response|
|
267
|
+
end
|
268
|
+
|
269
|
+
# Waiting for response.
|
270
|
+
@client.get_long_running_operation_result(response, deserialize_method)
|
271
|
+
end
|
272
|
+
|
273
|
+
promise
|
274
|
+
end
|
275
|
+
|
276
|
+
#
|
277
|
+
# Gets a resource group.
|
278
|
+
#
|
279
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
280
|
+
# The name is case insensitive.
|
281
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
282
|
+
# will be added to the HTTP request.
|
283
|
+
#
|
284
|
+
# @return [ResourceGroup] operation results.
|
285
|
+
#
|
286
|
+
def get(resource_group_name, custom_headers:nil)
|
287
|
+
response = get_async(resource_group_name, custom_headers:custom_headers).value!
|
288
|
+
response.body unless response.nil?
|
289
|
+
end
|
290
|
+
|
291
|
+
#
|
292
|
+
# Gets a resource group.
|
293
|
+
#
|
294
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
295
|
+
# The name is case insensitive.
|
296
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
297
|
+
# will be added to the HTTP request.
|
298
|
+
#
|
299
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
300
|
+
#
|
301
|
+
def get_with_http_info(resource_group_name, custom_headers:nil)
|
302
|
+
get_async(resource_group_name, custom_headers:custom_headers).value!
|
303
|
+
end
|
304
|
+
|
305
|
+
#
|
306
|
+
# Gets a resource group.
|
307
|
+
#
|
308
|
+
# @param resource_group_name [String] The name of the resource group to get.
|
309
|
+
# The name is case insensitive.
|
310
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
311
|
+
# to the HTTP request.
|
312
|
+
#
|
313
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
314
|
+
#
|
315
|
+
def get_async(resource_group_name, custom_headers:nil)
|
316
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
317
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
318
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
319
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
320
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
321
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
322
|
+
|
323
|
+
|
324
|
+
request_headers = {}
|
325
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
326
|
+
|
327
|
+
# Set Headers
|
328
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
329
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
330
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
|
331
|
+
|
332
|
+
request_url = @base_url || @client.base_url
|
333
|
+
|
334
|
+
options = {
|
335
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
336
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
337
|
+
query_params: {'api-version' => @client.api_version},
|
338
|
+
headers: request_headers.merge(custom_headers || {}),
|
339
|
+
base_url: request_url
|
340
|
+
}
|
341
|
+
promise = @client.make_request_async(:get, path_template, options)
|
342
|
+
|
343
|
+
promise = promise.then do |result|
|
344
|
+
http_response = result.response
|
345
|
+
status_code = http_response.status
|
346
|
+
response_content = http_response.body
|
347
|
+
unless status_code == 200
|
348
|
+
error_model = JSON.load(response_content)
|
349
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
350
|
+
end
|
351
|
+
|
352
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
353
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
354
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
355
|
+
# Deserialize Response
|
356
|
+
if status_code == 200
|
357
|
+
begin
|
358
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
359
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroup.mapper()
|
360
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
361
|
+
rescue Exception => e
|
362
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
|
366
|
+
result
|
367
|
+
end
|
368
|
+
|
369
|
+
promise.execute
|
370
|
+
end
|
371
|
+
|
372
|
+
#
|
373
|
+
# Updates a resource group.
|
374
|
+
#
|
375
|
+
# Resource groups can be updated through a simple PATCH operation to a group
|
376
|
+
# address. The format of the request is the same as that for creating a
|
377
|
+
# resource group. If a field is unspecified, the current value is retained.
|
378
|
+
#
|
379
|
+
# @param resource_group_name [String] The name of the resource group to update.
|
380
|
+
# The name is case insensitive.
|
381
|
+
# @param parameters [ResourceGroupPatchable] Parameters supplied to update a
|
382
|
+
# resource group.
|
383
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
384
|
+
# will be added to the HTTP request.
|
385
|
+
#
|
386
|
+
# @return [ResourceGroup] operation results.
|
387
|
+
#
|
388
|
+
def update(resource_group_name, parameters, custom_headers:nil)
|
389
|
+
response = update_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
390
|
+
response.body unless response.nil?
|
391
|
+
end
|
392
|
+
|
393
|
+
#
|
394
|
+
# Updates a resource group.
|
395
|
+
#
|
396
|
+
# Resource groups can be updated through a simple PATCH operation to a group
|
397
|
+
# address. The format of the request is the same as that for creating a
|
398
|
+
# resource group. If a field is unspecified, the current value is retained.
|
399
|
+
#
|
400
|
+
# @param resource_group_name [String] The name of the resource group to update.
|
401
|
+
# The name is case insensitive.
|
402
|
+
# @param parameters [ResourceGroupPatchable] Parameters supplied to update a
|
403
|
+
# resource group.
|
404
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
405
|
+
# will be added to the HTTP request.
|
406
|
+
#
|
407
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
408
|
+
#
|
409
|
+
def update_with_http_info(resource_group_name, parameters, custom_headers:nil)
|
410
|
+
update_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
411
|
+
end
|
412
|
+
|
413
|
+
#
|
414
|
+
# Updates a resource group.
|
415
|
+
#
|
416
|
+
# Resource groups can be updated through a simple PATCH operation to a group
|
417
|
+
# address. The format of the request is the same as that for creating a
|
418
|
+
# resource group. If a field is unspecified, the current value is retained.
|
419
|
+
#
|
420
|
+
# @param resource_group_name [String] The name of the resource group to update.
|
421
|
+
# The name is case insensitive.
|
422
|
+
# @param parameters [ResourceGroupPatchable] Parameters supplied to update a
|
423
|
+
# resource group.
|
424
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
425
|
+
# to the HTTP request.
|
426
|
+
#
|
427
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
428
|
+
#
|
429
|
+
def update_async(resource_group_name, parameters, custom_headers:nil)
|
430
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
431
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
432
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
433
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
434
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
435
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
436
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
437
|
+
|
438
|
+
|
439
|
+
request_headers = {}
|
440
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
441
|
+
|
442
|
+
# Set Headers
|
443
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
444
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
445
|
+
|
446
|
+
# Serialize Request
|
447
|
+
request_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroupPatchable.mapper()
|
448
|
+
request_content = @client.serialize(request_mapper, parameters)
|
449
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
450
|
+
|
451
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
|
452
|
+
|
453
|
+
request_url = @base_url || @client.base_url
|
454
|
+
|
455
|
+
options = {
|
456
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
457
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
458
|
+
query_params: {'api-version' => @client.api_version},
|
459
|
+
body: request_content,
|
460
|
+
headers: request_headers.merge(custom_headers || {}),
|
461
|
+
base_url: request_url
|
462
|
+
}
|
463
|
+
promise = @client.make_request_async(:patch, path_template, options)
|
464
|
+
|
465
|
+
promise = promise.then do |result|
|
466
|
+
http_response = result.response
|
467
|
+
status_code = http_response.status
|
468
|
+
response_content = http_response.body
|
469
|
+
unless status_code == 200
|
470
|
+
error_model = JSON.load(response_content)
|
471
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
472
|
+
end
|
473
|
+
|
474
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
475
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
476
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
477
|
+
# Deserialize Response
|
478
|
+
if status_code == 200
|
479
|
+
begin
|
480
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
481
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroup.mapper()
|
482
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
483
|
+
rescue Exception => e
|
484
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
result
|
489
|
+
end
|
490
|
+
|
491
|
+
promise.execute
|
492
|
+
end
|
493
|
+
|
494
|
+
#
|
495
|
+
# Captures the specified resource group as a template.
|
496
|
+
#
|
497
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
498
|
+
# is case insensitive.
|
499
|
+
# @param parameters [ExportTemplateRequest] Parameters for exporting the
|
500
|
+
# template.
|
501
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
502
|
+
# will be added to the HTTP request.
|
503
|
+
#
|
504
|
+
# @return [ResourceGroupExportResult] operation results.
|
505
|
+
#
|
506
|
+
def export_template(resource_group_name, parameters, custom_headers:nil)
|
507
|
+
response = export_template_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
508
|
+
response.body unless response.nil?
|
509
|
+
end
|
510
|
+
|
511
|
+
#
|
512
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
513
|
+
# is case insensitive.
|
514
|
+
# @param parameters [ExportTemplateRequest] Parameters for exporting the
|
515
|
+
# template.
|
516
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
517
|
+
# will be added to the HTTP request.
|
518
|
+
#
|
519
|
+
# @return [Concurrent::Promise] promise which provides async access to http
|
520
|
+
# response.
|
521
|
+
#
|
522
|
+
def export_template_async(resource_group_name, parameters, custom_headers:nil)
|
523
|
+
# Send request
|
524
|
+
promise = begin_export_template_async(resource_group_name, parameters, custom_headers:custom_headers)
|
525
|
+
|
526
|
+
promise = promise.then do |response|
|
527
|
+
# Defining deserialization method.
|
528
|
+
deserialize_method = lambda do |parsed_response|
|
529
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroupExportResult.mapper()
|
530
|
+
parsed_response = @client.deserialize(result_mapper, parsed_response)
|
531
|
+
end
|
532
|
+
|
533
|
+
# Waiting for response.
|
534
|
+
@client.get_long_running_operation_result(response, deserialize_method, FinalStateVia::LOCATION)
|
535
|
+
end
|
536
|
+
|
537
|
+
promise
|
538
|
+
end
|
539
|
+
|
540
|
+
#
|
541
|
+
# Gets all the resource groups for a subscription.
|
542
|
+
#
|
543
|
+
# @param filter [String] The filter to apply on the operation.<br><br>You can
|
544
|
+
# filter by tag names and values. For example, to filter for a tag name and
|
545
|
+
# value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
|
546
|
+
# @param top [Integer] The number of results to return. If null is passed,
|
547
|
+
# returns all resource groups.
|
548
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
549
|
+
# will be added to the HTTP request.
|
550
|
+
#
|
551
|
+
# @return [Array<ResourceGroup>] operation results.
|
552
|
+
#
|
553
|
+
def list(filter:nil, top:nil, custom_headers:nil)
|
554
|
+
first_page = list_as_lazy(filter:filter, top:top, custom_headers:custom_headers)
|
555
|
+
first_page.get_all_items
|
556
|
+
end
|
557
|
+
|
558
|
+
#
|
559
|
+
# Gets all the resource groups for a subscription.
|
560
|
+
#
|
561
|
+
# @param filter [String] The filter to apply on the operation.<br><br>You can
|
562
|
+
# filter by tag names and values. For example, to filter for a tag name and
|
563
|
+
# value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
|
564
|
+
# @param top [Integer] The number of results to return. If null is passed,
|
565
|
+
# returns all resource groups.
|
566
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
567
|
+
# will be added to the HTTP request.
|
568
|
+
#
|
569
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
570
|
+
#
|
571
|
+
def list_with_http_info(filter:nil, top:nil, custom_headers:nil)
|
572
|
+
list_async(filter:filter, top:top, custom_headers:custom_headers).value!
|
573
|
+
end
|
574
|
+
|
575
|
+
#
|
576
|
+
# Gets all the resource groups for a subscription.
|
577
|
+
#
|
578
|
+
# @param filter [String] The filter to apply on the operation.<br><br>You can
|
579
|
+
# filter by tag names and values. For example, to filter for a tag name and
|
580
|
+
# value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
|
581
|
+
# @param top [Integer] The number of results to return. If null is passed,
|
582
|
+
# returns all resource groups.
|
583
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
584
|
+
# to the HTTP request.
|
585
|
+
#
|
586
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
587
|
+
#
|
588
|
+
def list_async(filter:nil, top:nil, custom_headers:nil)
|
589
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
590
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
591
|
+
|
592
|
+
|
593
|
+
request_headers = {}
|
594
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
595
|
+
|
596
|
+
# Set Headers
|
597
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
598
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
599
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups'
|
600
|
+
|
601
|
+
request_url = @base_url || @client.base_url
|
602
|
+
|
603
|
+
options = {
|
604
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
605
|
+
path_params: {'subscriptionId' => @client.subscription_id},
|
606
|
+
query_params: {'$filter' => filter,'$top' => top,'api-version' => @client.api_version},
|
607
|
+
headers: request_headers.merge(custom_headers || {}),
|
608
|
+
base_url: request_url
|
609
|
+
}
|
610
|
+
promise = @client.make_request_async(:get, path_template, options)
|
611
|
+
|
612
|
+
promise = promise.then do |result|
|
613
|
+
http_response = result.response
|
614
|
+
status_code = http_response.status
|
615
|
+
response_content = http_response.body
|
616
|
+
unless status_code == 200
|
617
|
+
error_model = JSON.load(response_content)
|
618
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
619
|
+
end
|
620
|
+
|
621
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
622
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
623
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
624
|
+
# Deserialize Response
|
625
|
+
if status_code == 200
|
626
|
+
begin
|
627
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
628
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroupListResult.mapper()
|
629
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
630
|
+
rescue Exception => e
|
631
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
result
|
636
|
+
end
|
637
|
+
|
638
|
+
promise.execute
|
639
|
+
end
|
640
|
+
|
641
|
+
#
|
642
|
+
# Deletes a resource group.
|
643
|
+
#
|
644
|
+
# When you delete a resource group, all of its resources are also deleted.
|
645
|
+
# Deleting a resource group deletes all of its template deployments and
|
646
|
+
# currently stored operations.
|
647
|
+
#
|
648
|
+
# @param resource_group_name [String] The name of the resource group to delete.
|
649
|
+
# The name is case insensitive.
|
650
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
651
|
+
# will be added to the HTTP request.
|
652
|
+
#
|
653
|
+
#
|
654
|
+
def begin_delete(resource_group_name, custom_headers:nil)
|
655
|
+
response = begin_delete_async(resource_group_name, custom_headers:custom_headers).value!
|
656
|
+
nil
|
657
|
+
end
|
658
|
+
|
659
|
+
#
|
660
|
+
# Deletes a resource group.
|
661
|
+
#
|
662
|
+
# When you delete a resource group, all of its resources are also deleted.
|
663
|
+
# Deleting a resource group deletes all of its template deployments and
|
664
|
+
# currently stored operations.
|
665
|
+
#
|
666
|
+
# @param resource_group_name [String] The name of the resource group to delete.
|
667
|
+
# The name is case insensitive.
|
668
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
669
|
+
# will be added to the HTTP request.
|
670
|
+
#
|
671
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
672
|
+
#
|
673
|
+
def begin_delete_with_http_info(resource_group_name, custom_headers:nil)
|
674
|
+
begin_delete_async(resource_group_name, custom_headers:custom_headers).value!
|
675
|
+
end
|
676
|
+
|
677
|
+
#
|
678
|
+
# Deletes a resource group.
|
679
|
+
#
|
680
|
+
# When you delete a resource group, all of its resources are also deleted.
|
681
|
+
# Deleting a resource group deletes all of its template deployments and
|
682
|
+
# currently stored operations.
|
683
|
+
#
|
684
|
+
# @param resource_group_name [String] The name of the resource group to delete.
|
685
|
+
# The name is case insensitive.
|
686
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
687
|
+
# to the HTTP request.
|
688
|
+
#
|
689
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
690
|
+
#
|
691
|
+
def begin_delete_async(resource_group_name, custom_headers:nil)
|
692
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
693
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
694
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
695
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
696
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
697
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
698
|
+
|
699
|
+
|
700
|
+
request_headers = {}
|
701
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
702
|
+
|
703
|
+
# Set Headers
|
704
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
705
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
706
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}'
|
707
|
+
|
708
|
+
request_url = @base_url || @client.base_url
|
709
|
+
|
710
|
+
options = {
|
711
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
712
|
+
path_params: {'resourceGroupName' => resource_group_name,'subscriptionId' => @client.subscription_id},
|
713
|
+
query_params: {'api-version' => @client.api_version},
|
714
|
+
headers: request_headers.merge(custom_headers || {}),
|
715
|
+
base_url: request_url
|
716
|
+
}
|
717
|
+
promise = @client.make_request_async(:delete, path_template, options)
|
718
|
+
|
719
|
+
promise = promise.then do |result|
|
720
|
+
http_response = result.response
|
721
|
+
status_code = http_response.status
|
722
|
+
response_content = http_response.body
|
723
|
+
unless status_code == 200 || status_code == 202
|
724
|
+
error_model = JSON.load(response_content)
|
725
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
726
|
+
end
|
727
|
+
|
728
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
729
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
730
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
731
|
+
|
732
|
+
result
|
733
|
+
end
|
734
|
+
|
735
|
+
promise.execute
|
736
|
+
end
|
737
|
+
|
738
|
+
#
|
739
|
+
# Captures the specified resource group as a template.
|
740
|
+
#
|
741
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
742
|
+
# is case insensitive.
|
743
|
+
# @param parameters [ExportTemplateRequest] Parameters for exporting the
|
744
|
+
# template.
|
745
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
746
|
+
# will be added to the HTTP request.
|
747
|
+
#
|
748
|
+
# @return [ResourceGroupExportResult] operation results.
|
749
|
+
#
|
750
|
+
def begin_export_template(resource_group_name, parameters, custom_headers:nil)
|
751
|
+
response = begin_export_template_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
752
|
+
response.body unless response.nil?
|
753
|
+
end
|
754
|
+
|
755
|
+
#
|
756
|
+
# Captures the specified resource group as a template.
|
757
|
+
#
|
758
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
759
|
+
# is case insensitive.
|
760
|
+
# @param parameters [ExportTemplateRequest] Parameters for exporting the
|
761
|
+
# template.
|
762
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
763
|
+
# will be added to the HTTP request.
|
764
|
+
#
|
765
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
766
|
+
#
|
767
|
+
def begin_export_template_with_http_info(resource_group_name, parameters, custom_headers:nil)
|
768
|
+
begin_export_template_async(resource_group_name, parameters, custom_headers:custom_headers).value!
|
769
|
+
end
|
770
|
+
|
771
|
+
#
|
772
|
+
# Captures the specified resource group as a template.
|
773
|
+
#
|
774
|
+
# @param resource_group_name [String] The name of the resource group. The name
|
775
|
+
# is case insensitive.
|
776
|
+
# @param parameters [ExportTemplateRequest] Parameters for exporting the
|
777
|
+
# template.
|
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 begin_export_template_async(resource_group_name, parameters, custom_headers:nil)
|
784
|
+
fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
|
785
|
+
fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
|
786
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MaxLength': '90'" if !resource_group_name.nil? && resource_group_name.length > 90
|
787
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'MinLength': '1'" if !resource_group_name.nil? && resource_group_name.length < 1
|
788
|
+
fail ArgumentError, "'resource_group_name' should satisfy the constraint - 'Pattern': '^[-\w\._\(\)]+$'" if !resource_group_name.nil? && resource_group_name.match(Regexp.new('^^[-\w\._\(\)]+$$')).nil?
|
789
|
+
fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
|
790
|
+
fail ArgumentError, 'parameters is nil' if parameters.nil?
|
791
|
+
|
792
|
+
|
793
|
+
request_headers = {}
|
794
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
795
|
+
|
796
|
+
# Set Headers
|
797
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
798
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
799
|
+
|
800
|
+
# Serialize Request
|
801
|
+
request_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ExportTemplateRequest.mapper()
|
802
|
+
request_content = @client.serialize(request_mapper, parameters)
|
803
|
+
request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
|
804
|
+
|
805
|
+
path_template = 'subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate'
|
806
|
+
|
807
|
+
request_url = @base_url || @client.base_url
|
808
|
+
|
809
|
+
options = {
|
810
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
811
|
+
path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
|
812
|
+
query_params: {'api-version' => @client.api_version},
|
813
|
+
body: request_content,
|
814
|
+
headers: request_headers.merge(custom_headers || {}),
|
815
|
+
base_url: request_url
|
816
|
+
}
|
817
|
+
promise = @client.make_request_async(:post, path_template, options)
|
818
|
+
|
819
|
+
promise = promise.then do |result|
|
820
|
+
http_response = result.response
|
821
|
+
status_code = http_response.status
|
822
|
+
response_content = http_response.body
|
823
|
+
unless status_code == 200 || status_code == 202
|
824
|
+
error_model = JSON.load(response_content)
|
825
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
826
|
+
end
|
827
|
+
|
828
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
829
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
830
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
831
|
+
# Deserialize Response
|
832
|
+
if status_code == 200
|
833
|
+
begin
|
834
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
835
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroupExportResult.mapper()
|
836
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
837
|
+
rescue Exception => e
|
838
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
839
|
+
end
|
840
|
+
end
|
841
|
+
|
842
|
+
result
|
843
|
+
end
|
844
|
+
|
845
|
+
promise.execute
|
846
|
+
end
|
847
|
+
|
848
|
+
#
|
849
|
+
# Gets all the resource groups for a subscription.
|
850
|
+
#
|
851
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
852
|
+
# to List operation.
|
853
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
854
|
+
# will be added to the HTTP request.
|
855
|
+
#
|
856
|
+
# @return [ResourceGroupListResult] operation results.
|
857
|
+
#
|
858
|
+
def list_next(next_page_link, custom_headers:nil)
|
859
|
+
response = list_next_async(next_page_link, custom_headers:custom_headers).value!
|
860
|
+
response.body unless response.nil?
|
861
|
+
end
|
862
|
+
|
863
|
+
#
|
864
|
+
# Gets all the resource groups for a subscription.
|
865
|
+
#
|
866
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
867
|
+
# to List operation.
|
868
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
869
|
+
# will be added to the HTTP request.
|
870
|
+
#
|
871
|
+
# @return [MsRestAzure::AzureOperationResponse] HTTP response information.
|
872
|
+
#
|
873
|
+
def list_next_with_http_info(next_page_link, custom_headers:nil)
|
874
|
+
list_next_async(next_page_link, custom_headers:custom_headers).value!
|
875
|
+
end
|
876
|
+
|
877
|
+
#
|
878
|
+
# Gets all the resource groups for a subscription.
|
879
|
+
#
|
880
|
+
# @param next_page_link [String] The NextLink from the previous successful call
|
881
|
+
# to List operation.
|
882
|
+
# @param [Hash{String => String}] A hash of custom headers that will be added
|
883
|
+
# to the HTTP request.
|
884
|
+
#
|
885
|
+
# @return [Concurrent::Promise] Promise object which holds the HTTP response.
|
886
|
+
#
|
887
|
+
def list_next_async(next_page_link, custom_headers:nil)
|
888
|
+
fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
|
889
|
+
|
890
|
+
|
891
|
+
request_headers = {}
|
892
|
+
request_headers['Content-Type'] = 'application/json; charset=utf-8'
|
893
|
+
|
894
|
+
# Set Headers
|
895
|
+
request_headers['x-ms-client-request-id'] = SecureRandom.uuid
|
896
|
+
request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
|
897
|
+
path_template = '{nextLink}'
|
898
|
+
|
899
|
+
request_url = @base_url || @client.base_url
|
900
|
+
|
901
|
+
options = {
|
902
|
+
middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
|
903
|
+
skip_encoding_path_params: {'nextLink' => next_page_link},
|
904
|
+
headers: request_headers.merge(custom_headers || {}),
|
905
|
+
base_url: request_url
|
906
|
+
}
|
907
|
+
promise = @client.make_request_async(:get, path_template, options)
|
908
|
+
|
909
|
+
promise = promise.then do |result|
|
910
|
+
http_response = result.response
|
911
|
+
status_code = http_response.status
|
912
|
+
response_content = http_response.body
|
913
|
+
unless status_code == 200
|
914
|
+
error_model = JSON.load(response_content)
|
915
|
+
fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
|
916
|
+
end
|
917
|
+
|
918
|
+
result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
|
919
|
+
result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
|
920
|
+
result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
|
921
|
+
# Deserialize Response
|
922
|
+
if status_code == 200
|
923
|
+
begin
|
924
|
+
parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
|
925
|
+
result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::ResourceGroupListResult.mapper()
|
926
|
+
result.body = @client.deserialize(result_mapper, parsed_response)
|
927
|
+
rescue Exception => e
|
928
|
+
fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
|
929
|
+
end
|
930
|
+
end
|
931
|
+
|
932
|
+
result
|
933
|
+
end
|
934
|
+
|
935
|
+
promise.execute
|
936
|
+
end
|
937
|
+
|
938
|
+
#
|
939
|
+
# Gets all the resource groups for a subscription.
|
940
|
+
#
|
941
|
+
# @param filter [String] The filter to apply on the operation.<br><br>You can
|
942
|
+
# filter by tag names and values. For example, to filter for a tag name and
|
943
|
+
# value, use $filter=tagName eq 'tag1' and tagValue eq 'Value1'
|
944
|
+
# @param top [Integer] The number of results to return. If null is passed,
|
945
|
+
# returns all resource groups.
|
946
|
+
# @param custom_headers [Hash{String => String}] A hash of custom headers that
|
947
|
+
# will be added to the HTTP request.
|
948
|
+
#
|
949
|
+
# @return [ResourceGroupListResult] which provide lazy access to pages of the
|
950
|
+
# response.
|
951
|
+
#
|
952
|
+
def list_as_lazy(filter:nil, top:nil, custom_headers:nil)
|
953
|
+
response = list_async(filter:filter, top:top, custom_headers:custom_headers).value!
|
954
|
+
unless response.nil?
|
955
|
+
page = response.body
|
956
|
+
page.next_method = Proc.new do |next_page_link|
|
957
|
+
list_next_async(next_page_link, custom_headers:custom_headers)
|
958
|
+
end
|
959
|
+
page
|
960
|
+
end
|
961
|
+
end
|
962
|
+
|
963
|
+
end
|
964
|
+
end
|