azure_mgmt_subscriptions 0.18.4 → 0.18.5

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/lib/2016-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  3. data/lib/2017-11-01-preview/generated/azure_mgmt_subscriptions/subscription_definitions_client.rb +1 -1
  4. data/lib/2018-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  5. data/lib/2018-11-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  6. data/lib/2019-03-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  7. data/lib/2019-06-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  8. data/lib/2019-10-01-preview/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  9. data/lib/2019-11-01/generated/azure_mgmt_subscriptions/subscription_client.rb +1 -1
  10. data/lib/2020-09-01/generated/azure_mgmt_subscriptions.rb +46 -0
  11. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/alias_model.rb +429 -0
  12. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb +47 -0
  13. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/enabled_subscription_id.rb +47 -0
  14. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/error_response.rb +57 -0
  15. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/error_response_body.rb +48 -0
  16. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation.rb +58 -0
  17. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation_display.rb +69 -0
  18. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb +68 -0
  19. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/provisioning_state.rb +17 -0
  20. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_list_result.rb +68 -0
  21. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request.rb +47 -0
  22. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request_properties.rb +83 -0
  23. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response.rb +83 -0
  24. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response_properties.rb +59 -0
  25. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb +47 -0
  26. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/subscription_name.rb +46 -0
  27. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/models/workload.rb +16 -0
  28. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/module_definition.rb +9 -0
  29. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/operations.rb +110 -0
  30. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/subscription.rb +304 -0
  31. data/lib/2020-09-01/generated/azure_mgmt_subscriptions/subscription_client.rb +137 -0
  32. data/lib/azure_mgmt_subscriptions.rb +1 -0
  33. data/lib/profiles/latest/modules/subscriptions_profile_module.rb +92 -72
  34. data/lib/version.rb +1 -1
  35. metadata +24 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df02adacc495ad3190c2578d032d7756210465261186c0305d77cf9ed17524bd
4
- data.tar.gz: fd3ede2ea97dc2d1c3196865296656000918e895a87d3dd4888c9ad3d20709c4
3
+ metadata.gz: 3af1bd1d2a52295d4f10d9da1de66c4c4ca82a9a194e482ceccc23cd2c8f4b21
4
+ data.tar.gz: 724d6753e8d2cc4b488700477a07ce294c6cb7d1bd28dddb5b4bc9dd18cb0629
5
5
  SHA512:
6
- metadata.gz: efb7ea931dd647c531f850bd30b0f4915ff7644cccc24c3cff866747f57af5dd276743856065b92e770f80f181432b056977e6e1679c13425be3bd2bbf2dfb16
7
- data.tar.gz: 756ff7b0366f89a481274e89e791653dadaa568ded9fb62b20ec83f0ddea105a3913ed62e3c742c97056bbe5238deb40b6b9a7800143d10de3d07f1f72cb58f4
6
+ metadata.gz: eaf6017f205aef0dd38a78383998385a4e68937b957a884dca05439085eae45586b3b15600e5de8f61a86bf36c39e7669d147ab9bc94c39e664e9aed52c179be
7
+ data.tar.gz: 471bdd4653fd432a744444c252f0e7f0934c624b41a22cc83a895203467304ce836d4e3c056b54b251e06df6a76616f88b6dd49cec4d4346f003c97c4da51f1b
@@ -129,7 +129,7 @@ module Azure::Subscriptions::Mgmt::V2016_06_01
129
129
  #
130
130
  def add_telemetry
131
131
  sdk_information = 'azure_mgmt_subscriptions'
132
- sdk_information = "#{sdk_information}/0.18.4"
132
+ sdk_information = "#{sdk_information}/0.18.5"
133
133
  add_user_agent_information(sdk_information)
134
134
  end
135
135
  end
@@ -127,7 +127,7 @@ module Azure::Subscriptions::Mgmt::V2017_11_01_preview
127
127
  #
128
128
  def add_telemetry
129
129
  sdk_information = 'azure_mgmt_subscriptions'
130
- sdk_information = "#{sdk_information}/0.18.4"
130
+ sdk_information = "#{sdk_information}/0.18.5"
131
131
  add_user_agent_information(sdk_information)
132
132
  end
133
133
  end
@@ -126,7 +126,7 @@ module Azure::Subscriptions::Mgmt::V2018_03_01_preview
126
126
  #
127
127
  def add_telemetry
128
128
  sdk_information = 'azure_mgmt_subscriptions'
129
- sdk_information = "#{sdk_information}/0.18.4"
129
+ sdk_information = "#{sdk_information}/0.18.5"
130
130
  add_user_agent_information(sdk_information)
131
131
  end
132
132
  end
@@ -127,7 +127,7 @@ module Azure::Subscriptions::Mgmt::V2018_11_01_preview
127
127
  #
128
128
  def add_telemetry
129
129
  sdk_information = 'azure_mgmt_subscriptions'
130
- sdk_information = "#{sdk_information}/0.18.4"
130
+ sdk_information = "#{sdk_information}/0.18.5"
131
131
  add_user_agent_information(sdk_information)
132
132
  end
133
133
  end
@@ -122,7 +122,7 @@ module Azure::Subscriptions::Mgmt::V2019_03_01_preview
122
122
  #
123
123
  def add_telemetry
124
124
  sdk_information = 'azure_mgmt_subscriptions'
125
- sdk_information = "#{sdk_information}/0.18.4"
125
+ sdk_information = "#{sdk_information}/0.18.5"
126
126
  add_user_agent_information(sdk_information)
127
127
  end
128
128
  end
@@ -129,7 +129,7 @@ module Azure::Subscriptions::Mgmt::V2019_06_01
129
129
  #
130
130
  def add_telemetry
131
131
  sdk_information = 'azure_mgmt_subscriptions'
132
- sdk_information = "#{sdk_information}/0.18.4"
132
+ sdk_information = "#{sdk_information}/0.18.5"
133
133
  add_user_agent_information(sdk_information)
134
134
  end
135
135
  end
@@ -130,7 +130,7 @@ module Azure::Subscriptions::Mgmt::V2019_10_01_preview
130
130
  #
131
131
  def add_telemetry
132
132
  sdk_information = 'azure_mgmt_subscriptions'
133
- sdk_information = "#{sdk_information}/0.18.4"
133
+ sdk_information = "#{sdk_information}/0.18.5"
134
134
  add_user_agent_information(sdk_information)
135
135
  end
136
136
  end
@@ -129,7 +129,7 @@ module Azure::Subscriptions::Mgmt::V2019_11_01
129
129
  #
130
130
  def add_telemetry
131
131
  sdk_information = 'azure_mgmt_subscriptions'
132
- sdk_information = "#{sdk_information}/0.18.4"
132
+ sdk_information = "#{sdk_information}/0.18.5"
133
133
  add_user_agent_information(sdk_information)
134
134
  end
135
135
  end
@@ -0,0 +1,46 @@
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
+ require 'uri'
7
+ require 'cgi'
8
+ require 'date'
9
+ require 'json'
10
+ require 'base64'
11
+ require 'erb'
12
+ require 'securerandom'
13
+ require 'time'
14
+ require 'timeliness'
15
+ require 'faraday'
16
+ require 'faraday-cookie_jar'
17
+ require 'concurrent'
18
+ require 'ms_rest'
19
+ require '2020-09-01/generated/azure_mgmt_subscriptions/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::Subscriptions::Mgmt::V2020_09_01
23
+ autoload :Subscription, '2020-09-01/generated/azure_mgmt_subscriptions/subscription.rb'
24
+ autoload :Operations, '2020-09-01/generated/azure_mgmt_subscriptions/operations.rb'
25
+ autoload :AliasModel, '2020-09-01/generated/azure_mgmt_subscriptions/alias_model.rb'
26
+ autoload :SubscriptionClient, '2020-09-01/generated/azure_mgmt_subscriptions/subscription_client.rb'
27
+
28
+ module Models
29
+ autoload :Operation, '2020-09-01/generated/azure_mgmt_subscriptions/models/operation.rb'
30
+ autoload :ErrorResponse, '2020-09-01/generated/azure_mgmt_subscriptions/models/error_response.rb'
31
+ autoload :OperationListResult, '2020-09-01/generated/azure_mgmt_subscriptions/models/operation_list_result.rb'
32
+ autoload :CanceledSubscriptionId, '2020-09-01/generated/azure_mgmt_subscriptions/models/canceled_subscription_id.rb'
33
+ autoload :PutAliasRequestProperties, '2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request_properties.rb'
34
+ autoload :EnabledSubscriptionId, '2020-09-01/generated/azure_mgmt_subscriptions/models/enabled_subscription_id.rb'
35
+ autoload :PutAliasRequest, '2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_request.rb'
36
+ autoload :OperationDisplay, '2020-09-01/generated/azure_mgmt_subscriptions/models/operation_display.rb'
37
+ autoload :PutAliasResponseProperties, '2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response_properties.rb'
38
+ autoload :RenamedSubscriptionId, '2020-09-01/generated/azure_mgmt_subscriptions/models/renamed_subscription_id.rb'
39
+ autoload :PutAliasResponse, '2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_response.rb'
40
+ autoload :ErrorResponseBody, '2020-09-01/generated/azure_mgmt_subscriptions/models/error_response_body.rb'
41
+ autoload :PutAliasListResult, '2020-09-01/generated/azure_mgmt_subscriptions/models/put_alias_list_result.rb'
42
+ autoload :SubscriptionName, '2020-09-01/generated/azure_mgmt_subscriptions/models/subscription_name.rb'
43
+ autoload :Workload, '2020-09-01/generated/azure_mgmt_subscriptions/models/workload.rb'
44
+ autoload :ProvisioningState, '2020-09-01/generated/azure_mgmt_subscriptions/models/provisioning_state.rb'
45
+ end
46
+ end
@@ -0,0 +1,429 @@
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::Subscriptions::Mgmt::V2020_09_01
7
+ #
8
+ # Subscription client provides an interface to create and manage Azure
9
+ # subscriptions programmatically.
10
+ #
11
+ class AliasModel
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the AliasModel class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return [SubscriptionClient] reference to the SubscriptionClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Create Alias Subscription.
27
+ #
28
+ # @param alias_name [String] Alias Name
29
+ # @param body [PutAliasRequest]
30
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
31
+ # will be added to the HTTP request.
32
+ #
33
+ # @return [PutAliasResponse] operation results.
34
+ #
35
+ def create(alias_name, body, custom_headers:nil)
36
+ response = create_async(alias_name, body, custom_headers:custom_headers).value!
37
+ response.body unless response.nil?
38
+ end
39
+
40
+ #
41
+ # @param alias_name [String] Alias Name
42
+ # @param body [PutAliasRequest]
43
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
44
+ # will be added to the HTTP request.
45
+ #
46
+ # @return [Concurrent::Promise] promise which provides async access to http
47
+ # response.
48
+ #
49
+ def create_async(alias_name, body, custom_headers:nil)
50
+ # Send request
51
+ promise = begin_create_async(alias_name, body, custom_headers:custom_headers)
52
+
53
+ promise = promise.then do |response|
54
+ # Defining deserialization method.
55
+ deserialize_method = lambda do |parsed_response|
56
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasResponse.mapper()
57
+ parsed_response = @client.deserialize(result_mapper, parsed_response)
58
+ end
59
+
60
+ # Waiting for response.
61
+ @client.get_long_running_operation_result(response, deserialize_method)
62
+ end
63
+
64
+ promise
65
+ end
66
+
67
+ #
68
+ # Get Alias Subscription.
69
+ #
70
+ # @param alias_name [String] Alias Name
71
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
72
+ # will be added to the HTTP request.
73
+ #
74
+ # @return [PutAliasResponse] operation results.
75
+ #
76
+ def get(alias_name, custom_headers:nil)
77
+ response = get_async(alias_name, custom_headers:custom_headers).value!
78
+ response.body unless response.nil?
79
+ end
80
+
81
+ #
82
+ # Get Alias Subscription.
83
+ #
84
+ # @param alias_name [String] Alias Name
85
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
86
+ # will be added to the HTTP request.
87
+ #
88
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
89
+ #
90
+ def get_with_http_info(alias_name, custom_headers:nil)
91
+ get_async(alias_name, custom_headers:custom_headers).value!
92
+ end
93
+
94
+ #
95
+ # Get Alias Subscription.
96
+ #
97
+ # @param alias_name [String] Alias Name
98
+ # @param [Hash{String => String}] A hash of custom headers that will be added
99
+ # to the HTTP request.
100
+ #
101
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
102
+ #
103
+ def get_async(alias_name, custom_headers:nil)
104
+ fail ArgumentError, 'alias_name is nil' if alias_name.nil?
105
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
106
+
107
+
108
+ request_headers = {}
109
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
110
+
111
+ # Set Headers
112
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
113
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
114
+ path_template = 'providers/Microsoft.Subscription/aliases/{aliasName}'
115
+
116
+ request_url = @base_url || @client.base_url
117
+
118
+ options = {
119
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
120
+ path_params: {'aliasName' => alias_name},
121
+ query_params: {'api-version' => @client.api_version},
122
+ headers: request_headers.merge(custom_headers || {}),
123
+ base_url: request_url
124
+ }
125
+ promise = @client.make_request_async(:get, path_template, options)
126
+
127
+ promise = promise.then do |result|
128
+ http_response = result.response
129
+ status_code = http_response.status
130
+ response_content = http_response.body
131
+ unless status_code == 200
132
+ error_model = JSON.load(response_content)
133
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
134
+ end
135
+
136
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
137
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
138
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
139
+ # Deserialize Response
140
+ if status_code == 200
141
+ begin
142
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
143
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasResponse.mapper()
144
+ result.body = @client.deserialize(result_mapper, parsed_response)
145
+ rescue Exception => e
146
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
147
+ end
148
+ end
149
+
150
+ result
151
+ end
152
+
153
+ promise.execute
154
+ end
155
+
156
+ #
157
+ # Delete Alias.
158
+ #
159
+ # @param alias_name [String] Alias Name
160
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
161
+ # will be added to the HTTP request.
162
+ #
163
+ #
164
+ def delete(alias_name, custom_headers:nil)
165
+ response = delete_async(alias_name, custom_headers:custom_headers).value!
166
+ nil
167
+ end
168
+
169
+ #
170
+ # Delete Alias.
171
+ #
172
+ # @param alias_name [String] Alias Name
173
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
174
+ # will be added to the HTTP request.
175
+ #
176
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
177
+ #
178
+ def delete_with_http_info(alias_name, custom_headers:nil)
179
+ delete_async(alias_name, custom_headers:custom_headers).value!
180
+ end
181
+
182
+ #
183
+ # Delete Alias.
184
+ #
185
+ # @param alias_name [String] Alias Name
186
+ # @param [Hash{String => String}] A hash of custom headers that will be added
187
+ # to the HTTP request.
188
+ #
189
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
190
+ #
191
+ def delete_async(alias_name, custom_headers:nil)
192
+ fail ArgumentError, 'alias_name is nil' if alias_name.nil?
193
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
194
+
195
+
196
+ request_headers = {}
197
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
198
+
199
+ # Set Headers
200
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
201
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
202
+ path_template = 'providers/Microsoft.Subscription/aliases/{aliasName}'
203
+
204
+ request_url = @base_url || @client.base_url
205
+
206
+ options = {
207
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
208
+ path_params: {'aliasName' => alias_name},
209
+ query_params: {'api-version' => @client.api_version},
210
+ headers: request_headers.merge(custom_headers || {}),
211
+ base_url: request_url
212
+ }
213
+ promise = @client.make_request_async(:delete, path_template, options)
214
+
215
+ promise = promise.then do |result|
216
+ http_response = result.response
217
+ status_code = http_response.status
218
+ response_content = http_response.body
219
+ unless status_code == 200 || status_code == 204
220
+ error_model = JSON.load(response_content)
221
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
222
+ end
223
+
224
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
225
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
226
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
227
+
228
+ result
229
+ end
230
+
231
+ promise.execute
232
+ end
233
+
234
+ #
235
+ # Get Alias Subscription.
236
+ #
237
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
238
+ # will be added to the HTTP request.
239
+ #
240
+ # @return [PutAliasListResult] operation results.
241
+ #
242
+ def list(custom_headers:nil)
243
+ response = list_async(custom_headers:custom_headers).value!
244
+ response.body unless response.nil?
245
+ end
246
+
247
+ #
248
+ # Get Alias Subscription.
249
+ #
250
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
251
+ # will be added to the HTTP request.
252
+ #
253
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
254
+ #
255
+ def list_with_http_info(custom_headers:nil)
256
+ list_async(custom_headers:custom_headers).value!
257
+ end
258
+
259
+ #
260
+ # Get Alias Subscription.
261
+ #
262
+ # @param [Hash{String => String}] A hash of custom headers that will be added
263
+ # to the HTTP request.
264
+ #
265
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
266
+ #
267
+ def list_async(custom_headers:nil)
268
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
269
+
270
+
271
+ request_headers = {}
272
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
273
+
274
+ # Set Headers
275
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
276
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
277
+ path_template = 'providers/Microsoft.Subscription/aliases'
278
+
279
+ request_url = @base_url || @client.base_url
280
+
281
+ options = {
282
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
283
+ query_params: {'api-version' => @client.api_version},
284
+ headers: request_headers.merge(custom_headers || {}),
285
+ base_url: request_url
286
+ }
287
+ promise = @client.make_request_async(:get, path_template, options)
288
+
289
+ promise = promise.then do |result|
290
+ http_response = result.response
291
+ status_code = http_response.status
292
+ response_content = http_response.body
293
+ unless status_code == 200
294
+ error_model = JSON.load(response_content)
295
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
296
+ end
297
+
298
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
299
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
300
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
301
+ # Deserialize Response
302
+ if status_code == 200
303
+ begin
304
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
305
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasListResult.mapper()
306
+ result.body = @client.deserialize(result_mapper, parsed_response)
307
+ rescue Exception => e
308
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
309
+ end
310
+ end
311
+
312
+ result
313
+ end
314
+
315
+ promise.execute
316
+ end
317
+
318
+ #
319
+ # Create Alias Subscription.
320
+ #
321
+ # @param alias_name [String] Alias Name
322
+ # @param body [PutAliasRequest]
323
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
324
+ # will be added to the HTTP request.
325
+ #
326
+ # @return [PutAliasResponse] operation results.
327
+ #
328
+ def begin_create(alias_name, body, custom_headers:nil)
329
+ response = begin_create_async(alias_name, body, custom_headers:custom_headers).value!
330
+ response.body unless response.nil?
331
+ end
332
+
333
+ #
334
+ # Create Alias Subscription.
335
+ #
336
+ # @param alias_name [String] Alias Name
337
+ # @param body [PutAliasRequest]
338
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
339
+ # will be added to the HTTP request.
340
+ #
341
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
342
+ #
343
+ def begin_create_with_http_info(alias_name, body, custom_headers:nil)
344
+ begin_create_async(alias_name, body, custom_headers:custom_headers).value!
345
+ end
346
+
347
+ #
348
+ # Create Alias Subscription.
349
+ #
350
+ # @param alias_name [String] Alias Name
351
+ # @param body [PutAliasRequest]
352
+ # @param [Hash{String => String}] A hash of custom headers that will be added
353
+ # to the HTTP request.
354
+ #
355
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
356
+ #
357
+ def begin_create_async(alias_name, body, custom_headers:nil)
358
+ fail ArgumentError, 'alias_name is nil' if alias_name.nil?
359
+ fail ArgumentError, 'body is nil' if body.nil?
360
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
361
+
362
+
363
+ request_headers = {}
364
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
365
+
366
+ # Set Headers
367
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
368
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
369
+
370
+ # Serialize Request
371
+ request_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasRequest.mapper()
372
+ request_content = @client.serialize(request_mapper, body)
373
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
374
+
375
+ path_template = 'providers/Microsoft.Subscription/aliases/{aliasName}'
376
+
377
+ request_url = @base_url || @client.base_url
378
+
379
+ options = {
380
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
381
+ path_params: {'aliasName' => alias_name},
382
+ query_params: {'api-version' => @client.api_version},
383
+ body: request_content,
384
+ headers: request_headers.merge(custom_headers || {}),
385
+ base_url: request_url
386
+ }
387
+ promise = @client.make_request_async(:put, path_template, options)
388
+
389
+ promise = promise.then do |result|
390
+ http_response = result.response
391
+ status_code = http_response.status
392
+ response_content = http_response.body
393
+ unless status_code == 200 || status_code == 201
394
+ error_model = JSON.load(response_content)
395
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
396
+ end
397
+
398
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
399
+ result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
400
+ result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
401
+ # Deserialize Response
402
+ if status_code == 200
403
+ begin
404
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
405
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasResponse.mapper()
406
+ result.body = @client.deserialize(result_mapper, parsed_response)
407
+ rescue Exception => e
408
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
409
+ end
410
+ end
411
+ # Deserialize Response
412
+ if status_code == 201
413
+ begin
414
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
415
+ result_mapper = Azure::Subscriptions::Mgmt::V2020_09_01::Models::PutAliasResponse.mapper()
416
+ result.body = @client.deserialize(result_mapper, parsed_response)
417
+ rescue Exception => e
418
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
419
+ end
420
+ end
421
+
422
+ result
423
+ end
424
+
425
+ promise.execute
426
+ end
427
+
428
+ end
429
+ end