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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-02-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  3. data/lib/2016-06-01/generated/azure_mgmt_resources/subscription_client.rb +1 -1
  4. data/lib/2016-07-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  5. data/lib/2016-09-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  6. data/lib/2017-05-10/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  7. data/lib/2018-02-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  8. data/lib/2018-05-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  9. data/lib/2018-06-01/generated/azure_mgmt_resources/application_client.rb +1 -1
  10. data/lib/2019-03-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  11. data/lib/2019-05-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  12. data/lib/2019-05-10/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  13. data/lib/2019-07-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  14. data/lib/2019-10-01/generated/azure_mgmt_resources.rb +111 -0
  15. data/lib/2019-10-01/generated/azure_mgmt_resources/deployment_operations.rb +1590 -0
  16. data/lib/2019-10-01/generated/azure_mgmt_resources/deployments.rb +6276 -0
  17. data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_model.rb +102 -0
  18. data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_path.rb +77 -0
  19. data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_pattern.rb +70 -0
  20. data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_pattern_type.rb +16 -0
  21. data/lib/2019-10-01/generated/azure_mgmt_resources/models/alias_type.rb +17 -0
  22. data/lib/2019-10-01/generated/azure_mgmt_resources/models/basic_dependency.rb +68 -0
  23. data/lib/2019-10-01/generated/azure_mgmt_resources/models/change_type.rb +20 -0
  24. data/lib/2019-10-01/generated/azure_mgmt_resources/models/debug_setting.rb +53 -0
  25. data/lib/2019-10-01/generated/azure_mgmt_resources/models/dependency.rb +88 -0
  26. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment.rb +77 -0
  27. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_export_result.rb +46 -0
  28. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_extended.rb +113 -0
  29. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_extended_filter.rb +46 -0
  30. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_list_result.rb +99 -0
  31. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_mode.rb +16 -0
  32. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operation.rb +71 -0
  33. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operation_properties.rb +162 -0
  34. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_operations_list_result.rb +99 -0
  35. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_properties.rb +136 -0
  36. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_properties_extended.rb +284 -0
  37. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_validate_result.rb +61 -0
  38. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if.rb +58 -0
  39. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if_properties.rb +108 -0
  40. data/lib/2019-10-01/generated/azure_mgmt_resources/models/deployment_what_if_settings.rb +48 -0
  41. data/lib/2019-10-01/generated/azure_mgmt_resources/models/error_additional_info.rb +59 -0
  42. data/lib/2019-10-01/generated/azure_mgmt_resources/models/error_response.rb +117 -0
  43. data/lib/2019-10-01/generated/azure_mgmt_resources/models/export_template_request.rb +69 -0
  44. data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource.rb +158 -0
  45. data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource_expanded.rb +179 -0
  46. data/lib/2019-10-01/generated/azure_mgmt_resources/models/generic_resource_filter.rb +68 -0
  47. data/lib/2019-10-01/generated/azure_mgmt_resources/models/http_message.rb +46 -0
  48. data/lib/2019-10-01/generated/azure_mgmt_resources/models/identity.rb +96 -0
  49. data/lib/2019-10-01/generated/azure_mgmt_resources/models/identity_user_assigned_identities_value.rb +60 -0
  50. data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment.rb +60 -0
  51. data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment_extended.rb +73 -0
  52. data/lib/2019-10-01/generated/azure_mgmt_resources/models/on_error_deployment_type.rb +16 -0
  53. data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation.rb +58 -0
  54. data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation_display.rb +80 -0
  55. data/lib/2019-10-01/generated/azure_mgmt_resources/models/operation_list_result.rb +100 -0
  56. data/lib/2019-10-01/generated/azure_mgmt_resources/models/parameters_link.rb +58 -0
  57. data/lib/2019-10-01/generated/azure_mgmt_resources/models/plan.rb +90 -0
  58. data/lib/2019-10-01/generated/azure_mgmt_resources/models/property_change_type.rb +18 -0
  59. data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider.rb +104 -0
  60. data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider_list_result.rb +99 -0
  61. data/lib/2019-10-01/generated/azure_mgmt_resources/models/provider_resource_type.rb +137 -0
  62. data/lib/2019-10-01/generated/azure_mgmt_resources/models/provisioning_operation.rb +24 -0
  63. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource.rb +110 -0
  64. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group.rb +128 -0
  65. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_export_result.rb +58 -0
  66. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_filter.rb +57 -0
  67. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_list_result.rb +99 -0
  68. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_patchable.rb +90 -0
  69. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_group_properties.rb +47 -0
  70. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_identity_type.rb +18 -0
  71. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_list_result.rb +99 -0
  72. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_provider_operation_display_properties.rb +91 -0
  73. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resource_reference.rb +47 -0
  74. data/lib/2019-10-01/generated/azure_mgmt_resources/models/resources_move_info.rb +65 -0
  75. data/lib/2019-10-01/generated/azure_mgmt_resources/models/scoped_deployment.rb +77 -0
  76. data/lib/2019-10-01/generated/azure_mgmt_resources/models/scoped_deployment_what_if.rb +58 -0
  77. data/lib/2019-10-01/generated/azure_mgmt_resources/models/sku.rb +101 -0
  78. data/lib/2019-10-01/generated/azure_mgmt_resources/models/sub_resource.rb +46 -0
  79. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_count.rb +57 -0
  80. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_details.rb +92 -0
  81. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tag_value.rb +70 -0
  82. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags.rb +54 -0
  83. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_list_result.rb +99 -0
  84. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_patch_operation.rb +17 -0
  85. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_patch_resource.rb +59 -0
  86. data/lib/2019-10-01/generated/azure_mgmt_resources/models/tags_resource.rb +83 -0
  87. data/lib/2019-10-01/generated/azure_mgmt_resources/models/target_resource.rb +68 -0
  88. data/lib/2019-10-01/generated/azure_mgmt_resources/models/template_hash_result.rb +58 -0
  89. data/lib/2019-10-01/generated/azure_mgmt_resources/models/template_link.rb +58 -0
  90. data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_change.rb +105 -0
  91. data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_operation_result.rb +80 -0
  92. data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_property_change.rb +101 -0
  93. data/lib/2019-10-01/generated/azure_mgmt_resources/models/what_if_result_format.rb +16 -0
  94. data/lib/2019-10-01/generated/azure_mgmt_resources/module_definition.rb +9 -0
  95. data/lib/2019-10-01/generated/azure_mgmt_resources/operations.rb +219 -0
  96. data/lib/2019-10-01/generated/azure_mgmt_resources/providers.rb +846 -0
  97. data/lib/2019-10-01/generated/azure_mgmt_resources/resource_groups.rb +964 -0
  98. data/lib/2019-10-01/generated/azure_mgmt_resources/resource_management_client.rb +155 -0
  99. data/lib/2019-10-01/generated/azure_mgmt_resources/resources.rb +2354 -0
  100. data/lib/2019-10-01/generated/azure_mgmt_resources/tags_operations.rb +1078 -0
  101. data/lib/2020-06-01/generated/azure_mgmt_resources/resource_management_client.rb +1 -1
  102. data/lib/azure_mgmt_resources.rb +10 -9
  103. data/lib/version.rb +1 -1
  104. metadata +90 -3
@@ -0,0 +1,1078 @@
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 TagsOperations
11
+ include MsRestAzure
12
+
13
+ #
14
+ # Creates and initializes a new instance of the TagsOperations 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 predefined tag value for a predefined tag name.
26
+ #
27
+ # This operation allows deleting a value from the list of predefined values for
28
+ # an existing predefined tag name. The value being deleted must not be in use
29
+ # as a tag value for the given tag name for any resource.
30
+ #
31
+ # @param tag_name [String] The name of the tag.
32
+ # @param tag_value [String] The value of the tag to delete.
33
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
34
+ # will be added to the HTTP request.
35
+ #
36
+ #
37
+ def delete_value(tag_name, tag_value, custom_headers:nil)
38
+ response = delete_value_async(tag_name, tag_value, custom_headers:custom_headers).value!
39
+ nil
40
+ end
41
+
42
+ #
43
+ # Deletes a predefined tag value for a predefined tag name.
44
+ #
45
+ # This operation allows deleting a value from the list of predefined values for
46
+ # an existing predefined tag name. The value being deleted must not be in use
47
+ # as a tag value for the given tag name for any resource.
48
+ #
49
+ # @param tag_name [String] The name of the tag.
50
+ # @param tag_value [String] The value of the tag to delete.
51
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
52
+ # will be added to the HTTP request.
53
+ #
54
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
55
+ #
56
+ def delete_value_with_http_info(tag_name, tag_value, custom_headers:nil)
57
+ delete_value_async(tag_name, tag_value, custom_headers:custom_headers).value!
58
+ end
59
+
60
+ #
61
+ # Deletes a predefined tag value for a predefined tag name.
62
+ #
63
+ # This operation allows deleting a value from the list of predefined values for
64
+ # an existing predefined tag name. The value being deleted must not be in use
65
+ # as a tag value for the given tag name for any resource.
66
+ #
67
+ # @param tag_name [String] The name of the tag.
68
+ # @param tag_value [String] The value of the tag to delete.
69
+ # @param [Hash{String => String}] A hash of custom headers that will be added
70
+ # to the HTTP request.
71
+ #
72
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
73
+ #
74
+ def delete_value_async(tag_name, tag_value, custom_headers:nil)
75
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
76
+ fail ArgumentError, 'tag_value is nil' if tag_value.nil?
77
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
78
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
79
+
80
+
81
+ request_headers = {}
82
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
83
+
84
+ # Set Headers
85
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
86
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
87
+ path_template = 'subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'
88
+
89
+ request_url = @base_url || @client.base_url
90
+
91
+ options = {
92
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
93
+ path_params: {'tagName' => tag_name,'tagValue' => tag_value,'subscriptionId' => @client.subscription_id},
94
+ query_params: {'api-version' => @client.api_version},
95
+ headers: request_headers.merge(custom_headers || {}),
96
+ base_url: request_url
97
+ }
98
+ promise = @client.make_request_async(:delete, path_template, options)
99
+
100
+ promise = promise.then do |result|
101
+ http_response = result.response
102
+ status_code = http_response.status
103
+ response_content = http_response.body
104
+ unless status_code == 200 || status_code == 204
105
+ error_model = JSON.load(response_content)
106
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
107
+ end
108
+
109
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
110
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
111
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
112
+
113
+ result
114
+ end
115
+
116
+ promise.execute
117
+ end
118
+
119
+ #
120
+ # Creates a predefined value for a predefined tag name.
121
+ #
122
+ # This operation allows adding a value to the list of predefined values for an
123
+ # existing predefined tag name. A tag value can have a maximum of 256
124
+ # characters.
125
+ #
126
+ # @param tag_name [String] The name of the tag.
127
+ # @param tag_value [String] The value of the tag to create.
128
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
129
+ # will be added to the HTTP request.
130
+ #
131
+ # @return [TagValue] operation results.
132
+ #
133
+ def create_or_update_value(tag_name, tag_value, custom_headers:nil)
134
+ response = create_or_update_value_async(tag_name, tag_value, custom_headers:custom_headers).value!
135
+ response.body unless response.nil?
136
+ end
137
+
138
+ #
139
+ # Creates a predefined value for a predefined tag name.
140
+ #
141
+ # This operation allows adding a value to the list of predefined values for an
142
+ # existing predefined tag name. A tag value can have a maximum of 256
143
+ # characters.
144
+ #
145
+ # @param tag_name [String] The name of the tag.
146
+ # @param tag_value [String] The value of the tag to create.
147
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
148
+ # will be added to the HTTP request.
149
+ #
150
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
151
+ #
152
+ def create_or_update_value_with_http_info(tag_name, tag_value, custom_headers:nil)
153
+ create_or_update_value_async(tag_name, tag_value, custom_headers:custom_headers).value!
154
+ end
155
+
156
+ #
157
+ # Creates a predefined value for a predefined tag name.
158
+ #
159
+ # This operation allows adding a value to the list of predefined values for an
160
+ # existing predefined tag name. A tag value can have a maximum of 256
161
+ # characters.
162
+ #
163
+ # @param tag_name [String] The name of the tag.
164
+ # @param tag_value [String] The value of the tag to create.
165
+ # @param [Hash{String => String}] A hash of custom headers that will be added
166
+ # to the HTTP request.
167
+ #
168
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
169
+ #
170
+ def create_or_update_value_async(tag_name, tag_value, custom_headers:nil)
171
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
172
+ fail ArgumentError, 'tag_value is nil' if tag_value.nil?
173
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
174
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
175
+
176
+
177
+ request_headers = {}
178
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
179
+
180
+ # Set Headers
181
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
182
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
183
+ path_template = 'subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}'
184
+
185
+ request_url = @base_url || @client.base_url
186
+
187
+ options = {
188
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
189
+ path_params: {'tagName' => tag_name,'tagValue' => tag_value,'subscriptionId' => @client.subscription_id},
190
+ query_params: {'api-version' => @client.api_version},
191
+ headers: request_headers.merge(custom_headers || {}),
192
+ base_url: request_url
193
+ }
194
+ promise = @client.make_request_async(:put, path_template, options)
195
+
196
+ promise = promise.then do |result|
197
+ http_response = result.response
198
+ status_code = http_response.status
199
+ response_content = http_response.body
200
+ unless status_code == 200 || status_code == 201
201
+ error_model = JSON.load(response_content)
202
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
203
+ end
204
+
205
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
206
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
207
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
208
+ # Deserialize Response
209
+ if status_code == 200
210
+ begin
211
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
212
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagValue.mapper()
213
+ result.body = @client.deserialize(result_mapper, parsed_response)
214
+ rescue Exception => e
215
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
216
+ end
217
+ end
218
+ # Deserialize Response
219
+ if status_code == 201
220
+ begin
221
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
222
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagValue.mapper()
223
+ result.body = @client.deserialize(result_mapper, parsed_response)
224
+ rescue Exception => e
225
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
226
+ end
227
+ end
228
+
229
+ result
230
+ end
231
+
232
+ promise.execute
233
+ end
234
+
235
+ #
236
+ # Creates a predefined tag name.
237
+ #
238
+ # This operation allows adding a name to the list of predefined tag names for
239
+ # the given subscription. A tag name can have a maximum of 512 characters and
240
+ # is case-insensitive. Tag names cannot have the following prefixes which are
241
+ # reserved for Azure use: 'microsoft', 'azure', 'windows'.
242
+ #
243
+ # @param tag_name [String] The name of the tag to create.
244
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
245
+ # will be added to the HTTP request.
246
+ #
247
+ # @return [TagDetails] operation results.
248
+ #
249
+ def create_or_update(tag_name, custom_headers:nil)
250
+ response = create_or_update_async(tag_name, custom_headers:custom_headers).value!
251
+ response.body unless response.nil?
252
+ end
253
+
254
+ #
255
+ # Creates a predefined tag name.
256
+ #
257
+ # This operation allows adding a name to the list of predefined tag names for
258
+ # the given subscription. A tag name can have a maximum of 512 characters and
259
+ # is case-insensitive. Tag names cannot have the following prefixes which are
260
+ # reserved for Azure use: 'microsoft', 'azure', 'windows'.
261
+ #
262
+ # @param tag_name [String] The name of the tag to create.
263
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
264
+ # will be added to the HTTP request.
265
+ #
266
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
267
+ #
268
+ def create_or_update_with_http_info(tag_name, custom_headers:nil)
269
+ create_or_update_async(tag_name, custom_headers:custom_headers).value!
270
+ end
271
+
272
+ #
273
+ # Creates a predefined tag name.
274
+ #
275
+ # This operation allows adding a name to the list of predefined tag names for
276
+ # the given subscription. A tag name can have a maximum of 512 characters and
277
+ # is case-insensitive. Tag names cannot have the following prefixes which are
278
+ # reserved for Azure use: 'microsoft', 'azure', 'windows'.
279
+ #
280
+ # @param tag_name [String] The name of the tag to create.
281
+ # @param [Hash{String => String}] A hash of custom headers that will be added
282
+ # to the HTTP request.
283
+ #
284
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
285
+ #
286
+ def create_or_update_async(tag_name, custom_headers:nil)
287
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
288
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
289
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
290
+
291
+
292
+ request_headers = {}
293
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
294
+
295
+ # Set Headers
296
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
297
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
298
+ path_template = 'subscriptions/{subscriptionId}/tagNames/{tagName}'
299
+
300
+ request_url = @base_url || @client.base_url
301
+
302
+ options = {
303
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
304
+ path_params: {'tagName' => tag_name,'subscriptionId' => @client.subscription_id},
305
+ query_params: {'api-version' => @client.api_version},
306
+ headers: request_headers.merge(custom_headers || {}),
307
+ base_url: request_url
308
+ }
309
+ promise = @client.make_request_async(:put, path_template, options)
310
+
311
+ promise = promise.then do |result|
312
+ http_response = result.response
313
+ status_code = http_response.status
314
+ response_content = http_response.body
315
+ unless status_code == 200 || status_code == 201
316
+ error_model = JSON.load(response_content)
317
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
318
+ end
319
+
320
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
321
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
322
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
323
+ # Deserialize Response
324
+ if status_code == 200
325
+ begin
326
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
327
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagDetails.mapper()
328
+ result.body = @client.deserialize(result_mapper, parsed_response)
329
+ rescue Exception => e
330
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
331
+ end
332
+ end
333
+ # Deserialize Response
334
+ if status_code == 201
335
+ begin
336
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
337
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagDetails.mapper()
338
+ result.body = @client.deserialize(result_mapper, parsed_response)
339
+ rescue Exception => e
340
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
341
+ end
342
+ end
343
+
344
+ result
345
+ end
346
+
347
+ promise.execute
348
+ end
349
+
350
+ #
351
+ # Deletes a predefined tag name.
352
+ #
353
+ # This operation allows deleting a name from the list of predefined tag names
354
+ # for the given subscription. The name being deleted must not be in use as a
355
+ # tag name for any resource. All predefined values for the given name must have
356
+ # already been deleted.
357
+ #
358
+ # @param tag_name [String] The name of the tag.
359
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
360
+ # will be added to the HTTP request.
361
+ #
362
+ #
363
+ def delete(tag_name, custom_headers:nil)
364
+ response = delete_async(tag_name, custom_headers:custom_headers).value!
365
+ nil
366
+ end
367
+
368
+ #
369
+ # Deletes a predefined tag name.
370
+ #
371
+ # This operation allows deleting a name from the list of predefined tag names
372
+ # for the given subscription. The name being deleted must not be in use as a
373
+ # tag name for any resource. All predefined values for the given name must have
374
+ # already been deleted.
375
+ #
376
+ # @param tag_name [String] The name of the tag.
377
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
378
+ # will be added to the HTTP request.
379
+ #
380
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
381
+ #
382
+ def delete_with_http_info(tag_name, custom_headers:nil)
383
+ delete_async(tag_name, custom_headers:custom_headers).value!
384
+ end
385
+
386
+ #
387
+ # Deletes a predefined tag name.
388
+ #
389
+ # This operation allows deleting a name from the list of predefined tag names
390
+ # for the given subscription. The name being deleted must not be in use as a
391
+ # tag name for any resource. All predefined values for the given name must have
392
+ # already been deleted.
393
+ #
394
+ # @param tag_name [String] The name of the tag.
395
+ # @param [Hash{String => String}] A hash of custom headers that will be added
396
+ # to the HTTP request.
397
+ #
398
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
399
+ #
400
+ def delete_async(tag_name, custom_headers:nil)
401
+ fail ArgumentError, 'tag_name is nil' if tag_name.nil?
402
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
403
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
404
+
405
+
406
+ request_headers = {}
407
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
408
+
409
+ # Set Headers
410
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
411
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
412
+ path_template = 'subscriptions/{subscriptionId}/tagNames/{tagName}'
413
+
414
+ request_url = @base_url || @client.base_url
415
+
416
+ options = {
417
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
418
+ path_params: {'tagName' => tag_name,'subscriptionId' => @client.subscription_id},
419
+ query_params: {'api-version' => @client.api_version},
420
+ headers: request_headers.merge(custom_headers || {}),
421
+ base_url: request_url
422
+ }
423
+ promise = @client.make_request_async(:delete, path_template, options)
424
+
425
+ promise = promise.then do |result|
426
+ http_response = result.response
427
+ status_code = http_response.status
428
+ response_content = http_response.body
429
+ unless status_code == 200 || status_code == 204
430
+ error_model = JSON.load(response_content)
431
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
432
+ end
433
+
434
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
435
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
436
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
437
+
438
+ result
439
+ end
440
+
441
+ promise.execute
442
+ end
443
+
444
+ #
445
+ # Gets a summary of tag usage under the subscription.
446
+ #
447
+ # This operation performs a union of predefined tags, resource tags, resource
448
+ # group tags and subscription tags, and returns a summary of usage for each tag
449
+ # name and value under the given subscription. In case of a large number of
450
+ # tags, this operation may return a previously cached result.
451
+ #
452
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
453
+ # will be added to the HTTP request.
454
+ #
455
+ # @return [Array<TagDetails>] operation results.
456
+ #
457
+ def list(custom_headers:nil)
458
+ first_page = list_as_lazy(custom_headers:custom_headers)
459
+ first_page.get_all_items
460
+ end
461
+
462
+ #
463
+ # Gets a summary of tag usage under the subscription.
464
+ #
465
+ # This operation performs a union of predefined tags, resource tags, resource
466
+ # group tags and subscription tags, and returns a summary of usage for each tag
467
+ # name and value under the given subscription. In case of a large number of
468
+ # tags, this operation may return a previously cached result.
469
+ #
470
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
471
+ # will be added to the HTTP request.
472
+ #
473
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
474
+ #
475
+ def list_with_http_info(custom_headers:nil)
476
+ list_async(custom_headers:custom_headers).value!
477
+ end
478
+
479
+ #
480
+ # Gets a summary of tag usage under the subscription.
481
+ #
482
+ # This operation performs a union of predefined tags, resource tags, resource
483
+ # group tags and subscription tags, and returns a summary of usage for each tag
484
+ # name and value under the given subscription. In case of a large number of
485
+ # tags, this operation may return a previously cached result.
486
+ #
487
+ # @param [Hash{String => String}] A hash of custom headers that will be added
488
+ # to the HTTP request.
489
+ #
490
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
491
+ #
492
+ def list_async(custom_headers:nil)
493
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
494
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
495
+
496
+
497
+ request_headers = {}
498
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
499
+
500
+ # Set Headers
501
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
502
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
503
+ path_template = 'subscriptions/{subscriptionId}/tagNames'
504
+
505
+ request_url = @base_url || @client.base_url
506
+
507
+ options = {
508
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
509
+ path_params: {'subscriptionId' => @client.subscription_id},
510
+ query_params: {'api-version' => @client.api_version},
511
+ headers: request_headers.merge(custom_headers || {}),
512
+ base_url: request_url
513
+ }
514
+ promise = @client.make_request_async(:get, path_template, options)
515
+
516
+ promise = promise.then do |result|
517
+ http_response = result.response
518
+ status_code = http_response.status
519
+ response_content = http_response.body
520
+ unless status_code == 200
521
+ error_model = JSON.load(response_content)
522
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
523
+ end
524
+
525
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
526
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
527
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
528
+ # Deserialize Response
529
+ if status_code == 200
530
+ begin
531
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
532
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsListResult.mapper()
533
+ result.body = @client.deserialize(result_mapper, parsed_response)
534
+ rescue Exception => e
535
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
536
+ end
537
+ end
538
+
539
+ result
540
+ end
541
+
542
+ promise.execute
543
+ end
544
+
545
+ #
546
+ # Creates or updates the entire set of tags on a resource or subscription.
547
+ #
548
+ # This operation allows adding or replacing the entire set of tags on the
549
+ # specified resource or subscription. The specified entity can have a maximum
550
+ # of 50 tags.
551
+ #
552
+ # @param scope [String] The resource scope.
553
+ # @param parameters [TagsResource]
554
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
555
+ # will be added to the HTTP request.
556
+ #
557
+ # @return [TagsResource] operation results.
558
+ #
559
+ def create_or_update_at_scope(scope, parameters, custom_headers:nil)
560
+ response = create_or_update_at_scope_async(scope, parameters, custom_headers:custom_headers).value!
561
+ response.body unless response.nil?
562
+ end
563
+
564
+ #
565
+ # Creates or updates the entire set of tags on a resource or subscription.
566
+ #
567
+ # This operation allows adding or replacing the entire set of tags on the
568
+ # specified resource or subscription. The specified entity can have a maximum
569
+ # of 50 tags.
570
+ #
571
+ # @param scope [String] The resource scope.
572
+ # @param parameters [TagsResource]
573
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
574
+ # will be added to the HTTP request.
575
+ #
576
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
577
+ #
578
+ def create_or_update_at_scope_with_http_info(scope, parameters, custom_headers:nil)
579
+ create_or_update_at_scope_async(scope, parameters, custom_headers:custom_headers).value!
580
+ end
581
+
582
+ #
583
+ # Creates or updates the entire set of tags on a resource or subscription.
584
+ #
585
+ # This operation allows adding or replacing the entire set of tags on the
586
+ # specified resource or subscription. The specified entity can have a maximum
587
+ # of 50 tags.
588
+ #
589
+ # @param scope [String] The resource scope.
590
+ # @param parameters [TagsResource]
591
+ # @param [Hash{String => String}] A hash of custom headers that will be added
592
+ # to the HTTP request.
593
+ #
594
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
595
+ #
596
+ def create_or_update_at_scope_async(scope, parameters, custom_headers:nil)
597
+ fail ArgumentError, 'scope is nil' if scope.nil?
598
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
599
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
600
+
601
+
602
+ request_headers = {}
603
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
604
+
605
+ # Set Headers
606
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
607
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
608
+
609
+ # Serialize Request
610
+ request_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsResource.mapper()
611
+ request_content = @client.serialize(request_mapper, parameters)
612
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
613
+
614
+ path_template = '{scope}/providers/Microsoft.Resources/tags/default'
615
+
616
+ request_url = @base_url || @client.base_url
617
+
618
+ options = {
619
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
620
+ skip_encoding_path_params: {'scope' => scope},
621
+ query_params: {'api-version' => @client.api_version},
622
+ body: request_content,
623
+ headers: request_headers.merge(custom_headers || {}),
624
+ base_url: request_url
625
+ }
626
+ promise = @client.make_request_async(:put, path_template, options)
627
+
628
+ promise = promise.then do |result|
629
+ http_response = result.response
630
+ status_code = http_response.status
631
+ response_content = http_response.body
632
+ unless status_code == 200
633
+ error_model = JSON.load(response_content)
634
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
635
+ end
636
+
637
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
638
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
639
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
640
+ # Deserialize Response
641
+ if status_code == 200
642
+ begin
643
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
644
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsResource.mapper()
645
+ result.body = @client.deserialize(result_mapper, parsed_response)
646
+ rescue Exception => e
647
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
648
+ end
649
+ end
650
+
651
+ result
652
+ end
653
+
654
+ promise.execute
655
+ end
656
+
657
+ #
658
+ # Selectively updates the set of tags on a resource or subscription.
659
+ #
660
+ # This operation allows replacing, merging or selectively deleting tags on the
661
+ # specified resource or subscription. The specified entity can have a maximum
662
+ # of 50 tags at the end of the operation. The 'replace' option replaces the
663
+ # entire set of existing tags with a new set. The 'merge' option allows adding
664
+ # tags with new names and updating the values of tags with existing names. The
665
+ # 'delete' option allows selectively deleting tags based on given names or
666
+ # name/value pairs.
667
+ #
668
+ # @param scope [String] The resource scope.
669
+ # @param parameters [TagsPatchResource]
670
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
671
+ # will be added to the HTTP request.
672
+ #
673
+ # @return [TagsResource] operation results.
674
+ #
675
+ def update_at_scope(scope, parameters, custom_headers:nil)
676
+ response = update_at_scope_async(scope, parameters, custom_headers:custom_headers).value!
677
+ response.body unless response.nil?
678
+ end
679
+
680
+ #
681
+ # Selectively updates the set of tags on a resource or subscription.
682
+ #
683
+ # This operation allows replacing, merging or selectively deleting tags on the
684
+ # specified resource or subscription. The specified entity can have a maximum
685
+ # of 50 tags at the end of the operation. The 'replace' option replaces the
686
+ # entire set of existing tags with a new set. The 'merge' option allows adding
687
+ # tags with new names and updating the values of tags with existing names. The
688
+ # 'delete' option allows selectively deleting tags based on given names or
689
+ # name/value pairs.
690
+ #
691
+ # @param scope [String] The resource scope.
692
+ # @param parameters [TagsPatchResource]
693
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
694
+ # will be added to the HTTP request.
695
+ #
696
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
697
+ #
698
+ def update_at_scope_with_http_info(scope, parameters, custom_headers:nil)
699
+ update_at_scope_async(scope, parameters, custom_headers:custom_headers).value!
700
+ end
701
+
702
+ #
703
+ # Selectively updates the set of tags on a resource or subscription.
704
+ #
705
+ # This operation allows replacing, merging or selectively deleting tags on the
706
+ # specified resource or subscription. The specified entity can have a maximum
707
+ # of 50 tags at the end of the operation. The 'replace' option replaces the
708
+ # entire set of existing tags with a new set. The 'merge' option allows adding
709
+ # tags with new names and updating the values of tags with existing names. The
710
+ # 'delete' option allows selectively deleting tags based on given names or
711
+ # name/value pairs.
712
+ #
713
+ # @param scope [String] The resource scope.
714
+ # @param parameters [TagsPatchResource]
715
+ # @param [Hash{String => String}] A hash of custom headers that will be added
716
+ # to the HTTP request.
717
+ #
718
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
719
+ #
720
+ def update_at_scope_async(scope, parameters, custom_headers:nil)
721
+ fail ArgumentError, 'scope is nil' if scope.nil?
722
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
723
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
724
+
725
+
726
+ request_headers = {}
727
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
728
+
729
+ # Set Headers
730
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
731
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
732
+
733
+ # Serialize Request
734
+ request_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsPatchResource.mapper()
735
+ request_content = @client.serialize(request_mapper, parameters)
736
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
737
+
738
+ path_template = '{scope}/providers/Microsoft.Resources/tags/default'
739
+
740
+ request_url = @base_url || @client.base_url
741
+
742
+ options = {
743
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
744
+ skip_encoding_path_params: {'scope' => scope},
745
+ query_params: {'api-version' => @client.api_version},
746
+ body: request_content,
747
+ headers: request_headers.merge(custom_headers || {}),
748
+ base_url: request_url
749
+ }
750
+ promise = @client.make_request_async(:patch, path_template, options)
751
+
752
+ promise = promise.then do |result|
753
+ http_response = result.response
754
+ status_code = http_response.status
755
+ response_content = http_response.body
756
+ unless status_code == 200
757
+ error_model = JSON.load(response_content)
758
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
759
+ end
760
+
761
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
762
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
763
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
764
+ # Deserialize Response
765
+ if status_code == 200
766
+ begin
767
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
768
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsResource.mapper()
769
+ result.body = @client.deserialize(result_mapper, parsed_response)
770
+ rescue Exception => e
771
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
772
+ end
773
+ end
774
+
775
+ result
776
+ end
777
+
778
+ promise.execute
779
+ end
780
+
781
+ #
782
+ # Gets the entire set of tags on a resource or subscription.
783
+ #
784
+ # @param scope [String] The resource scope.
785
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
786
+ # will be added to the HTTP request.
787
+ #
788
+ # @return [TagsResource] operation results.
789
+ #
790
+ def get_at_scope(scope, custom_headers:nil)
791
+ response = get_at_scope_async(scope, custom_headers:custom_headers).value!
792
+ response.body unless response.nil?
793
+ end
794
+
795
+ #
796
+ # Gets the entire set of tags on a resource or subscription.
797
+ #
798
+ # @param scope [String] The resource scope.
799
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
800
+ # will be added to the HTTP request.
801
+ #
802
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
803
+ #
804
+ def get_at_scope_with_http_info(scope, custom_headers:nil)
805
+ get_at_scope_async(scope, custom_headers:custom_headers).value!
806
+ end
807
+
808
+ #
809
+ # Gets the entire set of tags on a resource or subscription.
810
+ #
811
+ # @param scope [String] The resource scope.
812
+ # @param [Hash{String => String}] A hash of custom headers that will be added
813
+ # to the HTTP request.
814
+ #
815
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
816
+ #
817
+ def get_at_scope_async(scope, custom_headers:nil)
818
+ fail ArgumentError, 'scope is nil' if scope.nil?
819
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
820
+
821
+
822
+ request_headers = {}
823
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
824
+
825
+ # Set Headers
826
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
827
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
828
+ path_template = '{scope}/providers/Microsoft.Resources/tags/default'
829
+
830
+ request_url = @base_url || @client.base_url
831
+
832
+ options = {
833
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
834
+ skip_encoding_path_params: {'scope' => scope},
835
+ query_params: {'api-version' => @client.api_version},
836
+ headers: request_headers.merge(custom_headers || {}),
837
+ base_url: request_url
838
+ }
839
+ promise = @client.make_request_async(:get, path_template, options)
840
+
841
+ promise = promise.then do |result|
842
+ http_response = result.response
843
+ status_code = http_response.status
844
+ response_content = http_response.body
845
+ unless status_code == 200
846
+ error_model = JSON.load(response_content)
847
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
848
+ end
849
+
850
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
851
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
852
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
853
+ # Deserialize Response
854
+ if status_code == 200
855
+ begin
856
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
857
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsResource.mapper()
858
+ result.body = @client.deserialize(result_mapper, parsed_response)
859
+ rescue Exception => e
860
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
861
+ end
862
+ end
863
+
864
+ result
865
+ end
866
+
867
+ promise.execute
868
+ end
869
+
870
+ #
871
+ # Deletes the entire set of tags on a resource or subscription.
872
+ #
873
+ # @param scope [String] The resource scope.
874
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
875
+ # will be added to the HTTP request.
876
+ #
877
+ #
878
+ def delete_at_scope(scope, custom_headers:nil)
879
+ response = delete_at_scope_async(scope, custom_headers:custom_headers).value!
880
+ nil
881
+ end
882
+
883
+ #
884
+ # Deletes the entire set of tags on a resource or subscription.
885
+ #
886
+ # @param scope [String] The resource scope.
887
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
888
+ # will be added to the HTTP request.
889
+ #
890
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
891
+ #
892
+ def delete_at_scope_with_http_info(scope, custom_headers:nil)
893
+ delete_at_scope_async(scope, custom_headers:custom_headers).value!
894
+ end
895
+
896
+ #
897
+ # Deletes the entire set of tags on a resource or subscription.
898
+ #
899
+ # @param scope [String] The resource scope.
900
+ # @param [Hash{String => String}] A hash of custom headers that will be added
901
+ # to the HTTP request.
902
+ #
903
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
904
+ #
905
+ def delete_at_scope_async(scope, custom_headers:nil)
906
+ fail ArgumentError, 'scope is nil' if scope.nil?
907
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
908
+
909
+
910
+ request_headers = {}
911
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
912
+
913
+ # Set Headers
914
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
915
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
916
+ path_template = '{scope}/providers/Microsoft.Resources/tags/default'
917
+
918
+ request_url = @base_url || @client.base_url
919
+
920
+ options = {
921
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
922
+ skip_encoding_path_params: {'scope' => scope},
923
+ query_params: {'api-version' => @client.api_version},
924
+ headers: request_headers.merge(custom_headers || {}),
925
+ base_url: request_url
926
+ }
927
+ promise = @client.make_request_async(:delete, path_template, options)
928
+
929
+ promise = promise.then do |result|
930
+ http_response = result.response
931
+ status_code = http_response.status
932
+ response_content = http_response.body
933
+ unless status_code == 200
934
+ error_model = JSON.load(response_content)
935
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
936
+ end
937
+
938
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
939
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
940
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
941
+
942
+ result
943
+ end
944
+
945
+ promise.execute
946
+ end
947
+
948
+ #
949
+ # Gets a summary of tag usage under the subscription.
950
+ #
951
+ # This operation performs a union of predefined tags, resource tags, resource
952
+ # group tags and subscription tags, and returns a summary of usage for each tag
953
+ # name and value under the given subscription. In case of a large number of
954
+ # tags, this operation may return a previously cached result.
955
+ #
956
+ # @param next_page_link [String] The NextLink from the previous successful call
957
+ # to List operation.
958
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
959
+ # will be added to the HTTP request.
960
+ #
961
+ # @return [TagsListResult] operation results.
962
+ #
963
+ def list_next(next_page_link, custom_headers:nil)
964
+ response = list_next_async(next_page_link, custom_headers:custom_headers).value!
965
+ response.body unless response.nil?
966
+ end
967
+
968
+ #
969
+ # Gets a summary of tag usage under the subscription.
970
+ #
971
+ # This operation performs a union of predefined tags, resource tags, resource
972
+ # group tags and subscription tags, and returns a summary of usage for each tag
973
+ # name and value under the given subscription. In case of a large number of
974
+ # tags, this operation may return a previously cached result.
975
+ #
976
+ # @param next_page_link [String] The NextLink from the previous successful call
977
+ # to List operation.
978
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
979
+ # will be added to the HTTP request.
980
+ #
981
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
982
+ #
983
+ def list_next_with_http_info(next_page_link, custom_headers:nil)
984
+ list_next_async(next_page_link, custom_headers:custom_headers).value!
985
+ end
986
+
987
+ #
988
+ # Gets a summary of tag usage under the subscription.
989
+ #
990
+ # This operation performs a union of predefined tags, resource tags, resource
991
+ # group tags and subscription tags, and returns a summary of usage for each tag
992
+ # name and value under the given subscription. In case of a large number of
993
+ # tags, this operation may return a previously cached result.
994
+ #
995
+ # @param next_page_link [String] The NextLink from the previous successful call
996
+ # to List operation.
997
+ # @param [Hash{String => String}] A hash of custom headers that will be added
998
+ # to the HTTP request.
999
+ #
1000
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
1001
+ #
1002
+ def list_next_async(next_page_link, custom_headers:nil)
1003
+ fail ArgumentError, 'next_page_link is nil' if next_page_link.nil?
1004
+
1005
+
1006
+ request_headers = {}
1007
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
1008
+
1009
+ # Set Headers
1010
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
1011
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
1012
+ path_template = '{nextLink}'
1013
+
1014
+ request_url = @base_url || @client.base_url
1015
+
1016
+ options = {
1017
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
1018
+ skip_encoding_path_params: {'nextLink' => next_page_link},
1019
+ headers: request_headers.merge(custom_headers || {}),
1020
+ base_url: request_url
1021
+ }
1022
+ promise = @client.make_request_async(:get, path_template, options)
1023
+
1024
+ promise = promise.then do |result|
1025
+ http_response = result.response
1026
+ status_code = http_response.status
1027
+ response_content = http_response.body
1028
+ unless status_code == 200
1029
+ error_model = JSON.load(response_content)
1030
+ fail MsRestAzure::AzureOperationError.new(result.request, http_response, error_model)
1031
+ end
1032
+
1033
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
1034
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
1035
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
1036
+ # Deserialize Response
1037
+ if status_code == 200
1038
+ begin
1039
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
1040
+ result_mapper = Azure::Resources::Mgmt::V2019_10_01::Models::TagsListResult.mapper()
1041
+ result.body = @client.deserialize(result_mapper, parsed_response)
1042
+ rescue Exception => e
1043
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
1044
+ end
1045
+ end
1046
+
1047
+ result
1048
+ end
1049
+
1050
+ promise.execute
1051
+ end
1052
+
1053
+ #
1054
+ # Gets a summary of tag usage under the subscription.
1055
+ #
1056
+ # This operation performs a union of predefined tags, resource tags, resource
1057
+ # group tags and subscription tags, and returns a summary of usage for each tag
1058
+ # name and value under the given subscription. In case of a large number of
1059
+ # tags, this operation may return a previously cached result.
1060
+ #
1061
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
1062
+ # will be added to the HTTP request.
1063
+ #
1064
+ # @return [TagsListResult] which provide lazy access to pages of the response.
1065
+ #
1066
+ def list_as_lazy(custom_headers:nil)
1067
+ response = list_async(custom_headers:custom_headers).value!
1068
+ unless response.nil?
1069
+ page = response.body
1070
+ page.next_method = Proc.new do |next_page_link|
1071
+ list_next_async(next_page_link, custom_headers:custom_headers)
1072
+ end
1073
+ page
1074
+ end
1075
+ end
1076
+
1077
+ end
1078
+ end