azure_mgmt_media_services 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/LICENSE.txt +21 -0
  4. data/Rakefile +5 -0
  5. data/azure_mgmt_media_services.gemspec +34 -0
  6. data/lib/azure_mgmt_media_services.rb +5 -0
  7. data/lib/generated/azure_mgmt_media_services.rb +42 -0
  8. data/lib/generated/azure_mgmt_media_services/media_service_operations.rb +966 -0
  9. data/lib/generated/azure_mgmt_media_services/media_services_management_client.rb +67 -0
  10. data/lib/generated/azure_mgmt_media_services/models/api_endpoint.rb +54 -0
  11. data/lib/generated/azure_mgmt_media_services/models/api_error.rb +54 -0
  12. data/lib/generated/azure_mgmt_media_services/models/check_name_availability_input.rb +60 -0
  13. data/lib/generated/azure_mgmt_media_services/models/check_name_availability_output.rb +68 -0
  14. data/lib/generated/azure_mgmt_media_services/models/entity_name_unavailability_reason.rb +17 -0
  15. data/lib/generated/azure_mgmt_media_services/models/key_type.rb +16 -0
  16. data/lib/generated/azure_mgmt_media_services/models/media_service.rb +116 -0
  17. data/lib/generated/azure_mgmt_media_services/models/media_service_collection.rb +52 -0
  18. data/lib/generated/azure_mgmt_media_services/models/regenerate_key_input.rb +47 -0
  19. data/lib/generated/azure_mgmt_media_services/models/regenerate_key_output.rb +44 -0
  20. data/lib/generated/azure_mgmt_media_services/models/service_keys.rb +84 -0
  21. data/lib/generated/azure_mgmt_media_services/models/storage_account.rb +55 -0
  22. data/lib/generated/azure_mgmt_media_services/models/sync_storage_keys_input.rb +44 -0
  23. data/lib/generated/azure_mgmt_media_services/models/tracked_resource.rb +85 -0
  24. data/lib/generated/azure_mgmt_media_services/module_definition.rb +8 -0
  25. data/lib/generated/azure_mgmt_media_services/version.rb +8 -0
  26. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0f1a0fb3d5a0a7d2282530209b94a3c2de3a10bd
4
+ data.tar.gz: aeac1ea4c65a3abeaa4b32047fdcb85dc194e194
5
+ SHA512:
6
+ metadata.gz: be1afdf4ad85b07fbb9e931b332162585d8189f46f0c9ccca5ed10c5686f04b23beafa974480d6ce29705fb58c8a861988ce8fd473004cac8c666598cee9c57b
7
+ data.tar.gz: bb84bedc42bcbfc0df68945f791ccbbf7ead49526de782ccd82484494838f91f1e55d7ab9f516f6ba8571dd99ea011b4b489c8f4dd925efad959dcecb2f7f2c7
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --color
3
+ --format documentation
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Microsoft Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require "bundler/gem_tasks"
@@ -0,0 +1,34 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ lib = File.expand_path('../lib', __FILE__)
6
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
7
+
8
+ require 'generated/azure_mgmt_media_services/module_definition'
9
+ require 'generated/azure_mgmt_media_services/version'
10
+
11
+ Gem::Specification.new do |spec|
12
+ spec.name = 'azure_mgmt_media_services'
13
+ spec.version = Azure::ARM::MediaServices::VERSION
14
+ spec.authors = 'Microsoft Corporation'
15
+ spec.email = 'azrubyteam@microsoft.com'
16
+ spec.description = 'Microsoft Azure Media Services Management Client Library for Ruby'
17
+ spec.summary = 'Official Ruby client library to consume Microsoft Azure Media Services Management services.'
18
+ spec.homepage = 'https://aka.ms/azure-sdk-for-ruby'
19
+ spec.license = 'MIT'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.bindir = 'bin'
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = ['lib']
25
+
26
+ spec.required_ruby_version = '>= 1.9.3'
27
+
28
+ spec.add_development_dependency 'bundler', '~> 1.9'
29
+ spec.add_development_dependency 'rake', '~> 10'
30
+ spec.add_development_dependency 'rspec', '~> 3'
31
+ spec.add_development_dependency 'dotenv', '~> 2'
32
+
33
+ spec.add_runtime_dependency 'ms_rest_azure', '~> 0.3.0'
34
+ end
@@ -0,0 +1,5 @@
1
+ # encoding: utf-8
2
+ # Copyright (c) Microsoft Corporation. All rights reserved.
3
+ # Licensed under the MIT License. See License.txt in the project root for license information.
4
+
5
+ require 'generated/azure_mgmt_media_services'
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
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 'generated/azure_mgmt_media_services/module_definition'
20
+ require 'ms_rest_azure'
21
+
22
+ module Azure::ARM::MediaServices
23
+ autoload :MediaServiceOperations, 'generated/azure_mgmt_media_services/media_service_operations.rb'
24
+ autoload :MediaServicesManagementClient, 'generated/azure_mgmt_media_services/media_services_management_client.rb'
25
+
26
+ module Models
27
+ autoload :ApiEndpoint, 'generated/azure_mgmt_media_services/models/api_endpoint.rb'
28
+ autoload :ApiError, 'generated/azure_mgmt_media_services/models/api_error.rb'
29
+ autoload :CheckNameAvailabilityInput, 'generated/azure_mgmt_media_services/models/check_name_availability_input.rb'
30
+ autoload :CheckNameAvailabilityOutput, 'generated/azure_mgmt_media_services/models/check_name_availability_output.rb'
31
+ autoload :StorageAccount, 'generated/azure_mgmt_media_services/models/storage_account.rb'
32
+ autoload :MediaServiceCollection, 'generated/azure_mgmt_media_services/models/media_service_collection.rb'
33
+ autoload :RegenerateKeyInput, 'generated/azure_mgmt_media_services/models/regenerate_key_input.rb'
34
+ autoload :RegenerateKeyOutput, 'generated/azure_mgmt_media_services/models/regenerate_key_output.rb'
35
+ autoload :ServiceKeys, 'generated/azure_mgmt_media_services/models/service_keys.rb'
36
+ autoload :SyncStorageKeysInput, 'generated/azure_mgmt_media_services/models/sync_storage_keys_input.rb'
37
+ autoload :TrackedResource, 'generated/azure_mgmt_media_services/models/tracked_resource.rb'
38
+ autoload :MediaService, 'generated/azure_mgmt_media_services/models/media_service.rb'
39
+ autoload :EntityNameUnavailabilityReason, 'generated/azure_mgmt_media_services/models/entity_name_unavailability_reason.rb'
40
+ autoload :KeyType, 'generated/azure_mgmt_media_services/models/key_type.rb'
41
+ end
42
+ end
@@ -0,0 +1,966 @@
1
+ # encoding: utf-8
2
+ # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
3
+ # Changes may cause incorrect behavior and will be lost if the code is
4
+ # regenerated.
5
+
6
+ module Azure::ARM::MediaServices
7
+ #
8
+ # Media Services resource management APIs.
9
+ #
10
+ class MediaServiceOperations
11
+ include Azure::ARM::MediaServices::Models
12
+ include MsRestAzure
13
+
14
+ #
15
+ # Creates and initializes a new instance of the MediaServiceOperations class.
16
+ # @param client service class for accessing basic functionality.
17
+ #
18
+ def initialize(client)
19
+ @client = client
20
+ end
21
+
22
+ # @return reference to the MediaServicesManagementClient
23
+ attr_reader :client
24
+
25
+ #
26
+ # Check whether the Media Service resource name is available. The name must be
27
+ # globally unique.
28
+ #
29
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Properties
30
+ # needed to check the availability of a name.
31
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
32
+ # will be added to the HTTP request.
33
+ #
34
+ # @return [CheckNameAvailabilityOutput] operation results.
35
+ #
36
+ def check_name_availabilty(check_name_availability_input, custom_headers = nil)
37
+ response = check_name_availabilty_async(check_name_availability_input, custom_headers).value!
38
+ response.body unless response.nil?
39
+ end
40
+
41
+ #
42
+ # Check whether the Media Service resource name is available. The name must be
43
+ # globally unique.
44
+ #
45
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Properties
46
+ # needed to check the availability of a name.
47
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
48
+ # will be added to the HTTP request.
49
+ #
50
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
51
+ #
52
+ def check_name_availabilty_with_http_info(check_name_availability_input, custom_headers = nil)
53
+ check_name_availabilty_async(check_name_availability_input, custom_headers).value!
54
+ end
55
+
56
+ #
57
+ # Check whether the Media Service resource name is available. The name must be
58
+ # globally unique.
59
+ #
60
+ # @param check_name_availability_input [CheckNameAvailabilityInput] Properties
61
+ # needed to check the availability of a name.
62
+ # @param [Hash{String => String}] A hash of custom headers that will be added
63
+ # to the HTTP request.
64
+ #
65
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
66
+ #
67
+ def check_name_availabilty_async(check_name_availability_input, custom_headers = nil)
68
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
69
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
70
+ fail ArgumentError, 'check_name_availability_input is nil' if check_name_availability_input.nil?
71
+
72
+
73
+ request_headers = {}
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
+
79
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
80
+
81
+ # Serialize Request
82
+ request_mapper = CheckNameAvailabilityInput.mapper()
83
+ request_content = @client.serialize(request_mapper, check_name_availability_input, 'check_name_availability_input')
84
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
85
+
86
+ path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Media/CheckNameAvailability'
87
+ options = {
88
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
89
+ path_params: {'subscriptionId' => @client.subscription_id},
90
+ query_params: {'api-version' => @client.api_version},
91
+ body: request_content,
92
+ headers: request_headers.merge(custom_headers || {})
93
+ }
94
+
95
+ request_url = @base_url || @client.base_url
96
+
97
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
98
+ promise = request.run_promise do |req|
99
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
100
+ end
101
+
102
+ promise = promise.then do |http_response|
103
+ status_code = http_response.status
104
+ response_content = http_response.body
105
+ unless status_code == 200
106
+ error_model = JSON.load(response_content)
107
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
108
+ end
109
+
110
+ # Create Result
111
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
112
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
113
+ # Deserialize Response
114
+ if status_code == 200
115
+ begin
116
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
117
+ result_mapper = CheckNameAvailabilityOutput.mapper()
118
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
119
+ rescue Exception => e
120
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
121
+ end
122
+ end
123
+
124
+ result
125
+ end
126
+
127
+ promise.execute
128
+ end
129
+
130
+ #
131
+ # List all of the Media Services in a resource group.
132
+ #
133
+ # @param resource_group_name [String] Name of the resource group within the
134
+ # Azure subscription.
135
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
136
+ # will be added to the HTTP request.
137
+ #
138
+ # @return [MediaServiceCollection] operation results.
139
+ #
140
+ def list_by_resource_group(resource_group_name, custom_headers = nil)
141
+ response = list_by_resource_group_async(resource_group_name, custom_headers).value!
142
+ response.body unless response.nil?
143
+ end
144
+
145
+ #
146
+ # List all of the Media Services in a resource group.
147
+ #
148
+ # @param resource_group_name [String] Name of the resource group within the
149
+ # Azure subscription.
150
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
151
+ # will be added to the HTTP request.
152
+ #
153
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
154
+ #
155
+ def list_by_resource_group_with_http_info(resource_group_name, custom_headers = nil)
156
+ list_by_resource_group_async(resource_group_name, custom_headers).value!
157
+ end
158
+
159
+ #
160
+ # List all of the Media Services in a resource group.
161
+ #
162
+ # @param resource_group_name [String] Name of the resource group within the
163
+ # Azure subscription.
164
+ # @param [Hash{String => String}] A hash of custom headers that will be added
165
+ # to the HTTP request.
166
+ #
167
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
168
+ #
169
+ def list_by_resource_group_async(resource_group_name, custom_headers = nil)
170
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
171
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
172
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
173
+
174
+
175
+ request_headers = {}
176
+
177
+ # Set Headers
178
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
179
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
180
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices'
181
+ options = {
182
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
183
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name},
184
+ query_params: {'api-version' => @client.api_version},
185
+ headers: request_headers.merge(custom_headers || {})
186
+ }
187
+
188
+ request_url = @base_url || @client.base_url
189
+
190
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
191
+ promise = request.run_promise do |req|
192
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
193
+ end
194
+
195
+ promise = promise.then do |http_response|
196
+ status_code = http_response.status
197
+ response_content = http_response.body
198
+ unless status_code == 200
199
+ error_model = JSON.load(response_content)
200
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
201
+ end
202
+
203
+ # Create Result
204
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
205
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
206
+ # Deserialize Response
207
+ if status_code == 200
208
+ begin
209
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
210
+ result_mapper = MediaServiceCollection.mapper()
211
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
212
+ rescue Exception => e
213
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
214
+ end
215
+ end
216
+
217
+ result
218
+ end
219
+
220
+ promise.execute
221
+ end
222
+
223
+ #
224
+ # Get a Media Service.
225
+ #
226
+ # @param resource_group_name [String] Name of the resource group within the
227
+ # Azure subscription.
228
+ # @param media_service_name [String] Name of the Media Service.
229
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
230
+ # will be added to the HTTP request.
231
+ #
232
+ # @return [MediaService] operation results.
233
+ #
234
+ def get(resource_group_name, media_service_name, custom_headers = nil)
235
+ response = get_async(resource_group_name, media_service_name, custom_headers).value!
236
+ response.body unless response.nil?
237
+ end
238
+
239
+ #
240
+ # Get a Media Service.
241
+ #
242
+ # @param resource_group_name [String] Name of the resource group within the
243
+ # Azure subscription.
244
+ # @param media_service_name [String] Name of the Media Service.
245
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
246
+ # will be added to the HTTP request.
247
+ #
248
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
249
+ #
250
+ def get_with_http_info(resource_group_name, media_service_name, custom_headers = nil)
251
+ get_async(resource_group_name, media_service_name, custom_headers).value!
252
+ end
253
+
254
+ #
255
+ # Get a Media Service.
256
+ #
257
+ # @param resource_group_name [String] Name of the resource group within the
258
+ # Azure subscription.
259
+ # @param media_service_name [String] Name of the Media Service.
260
+ # @param [Hash{String => String}] A hash of custom headers that will be added
261
+ # to the HTTP request.
262
+ #
263
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
264
+ #
265
+ def get_async(resource_group_name, media_service_name, custom_headers = nil)
266
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
267
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
268
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
269
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
270
+
271
+
272
+ request_headers = {}
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 = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}'
278
+ options = {
279
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
280
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
281
+ query_params: {'api-version' => @client.api_version},
282
+ headers: request_headers.merge(custom_headers || {})
283
+ }
284
+
285
+ request_url = @base_url || @client.base_url
286
+
287
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
288
+ promise = request.run_promise do |req|
289
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
290
+ end
291
+
292
+ promise = promise.then do |http_response|
293
+ status_code = http_response.status
294
+ response_content = http_response.body
295
+ unless status_code == 200
296
+ error_model = JSON.load(response_content)
297
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
298
+ end
299
+
300
+ # Create Result
301
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
302
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
303
+ # Deserialize Response
304
+ if status_code == 200
305
+ begin
306
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
307
+ result_mapper = MediaService.mapper()
308
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
309
+ rescue Exception => e
310
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
311
+ end
312
+ end
313
+
314
+ result
315
+ end
316
+
317
+ promise.execute
318
+ end
319
+
320
+ #
321
+ # Create a Media Service.
322
+ #
323
+ # @param resource_group_name [String] Name of the resource group within the
324
+ # Azure subscription.
325
+ # @param media_service_name [String] Name of the Media Service.
326
+ # @param media_service [MediaService] Media Service properties needed for
327
+ # creation.
328
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
329
+ # will be added to the HTTP request.
330
+ #
331
+ # @return [MediaService] operation results.
332
+ #
333
+ def create(resource_group_name, media_service_name, media_service, custom_headers = nil)
334
+ response = create_async(resource_group_name, media_service_name, media_service, custom_headers).value!
335
+ response.body unless response.nil?
336
+ end
337
+
338
+ #
339
+ # Create a Media Service.
340
+ #
341
+ # @param resource_group_name [String] Name of the resource group within the
342
+ # Azure subscription.
343
+ # @param media_service_name [String] Name of the Media Service.
344
+ # @param media_service [MediaService] Media Service properties needed for
345
+ # creation.
346
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
347
+ # will be added to the HTTP request.
348
+ #
349
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
350
+ #
351
+ def create_with_http_info(resource_group_name, media_service_name, media_service, custom_headers = nil)
352
+ create_async(resource_group_name, media_service_name, media_service, custom_headers).value!
353
+ end
354
+
355
+ #
356
+ # Create a Media Service.
357
+ #
358
+ # @param resource_group_name [String] Name of the resource group within the
359
+ # Azure subscription.
360
+ # @param media_service_name [String] Name of the Media Service.
361
+ # @param media_service [MediaService] Media Service properties needed for
362
+ # creation.
363
+ # @param [Hash{String => String}] A hash of custom headers that will be added
364
+ # to the HTTP request.
365
+ #
366
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
367
+ #
368
+ def create_async(resource_group_name, media_service_name, media_service, custom_headers = nil)
369
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
370
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
371
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
372
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
373
+ fail ArgumentError, 'media_service is nil' if media_service.nil?
374
+
375
+
376
+ request_headers = {}
377
+
378
+ # Set Headers
379
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
380
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
381
+
382
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
383
+
384
+ # Serialize Request
385
+ request_mapper = MediaService.mapper()
386
+ request_content = @client.serialize(request_mapper, media_service, 'media_service')
387
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
388
+
389
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}'
390
+ options = {
391
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
392
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
393
+ query_params: {'api-version' => @client.api_version},
394
+ body: request_content,
395
+ headers: request_headers.merge(custom_headers || {})
396
+ }
397
+
398
+ request_url = @base_url || @client.base_url
399
+
400
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :put, options)
401
+ promise = request.run_promise do |req|
402
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
403
+ end
404
+
405
+ promise = promise.then do |http_response|
406
+ status_code = http_response.status
407
+ response_content = http_response.body
408
+ unless status_code == 200 || status_code == 201
409
+ error_model = JSON.load(response_content)
410
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
411
+ end
412
+
413
+ # Create Result
414
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
415
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
416
+ # Deserialize Response
417
+ if status_code == 200
418
+ begin
419
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
420
+ result_mapper = MediaService.mapper()
421
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
422
+ rescue Exception => e
423
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
424
+ end
425
+ end
426
+ # Deserialize Response
427
+ if status_code == 201
428
+ begin
429
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
430
+ result_mapper = MediaService.mapper()
431
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
432
+ rescue Exception => e
433
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
434
+ end
435
+ end
436
+
437
+ result
438
+ end
439
+
440
+ promise.execute
441
+ end
442
+
443
+ #
444
+ # Delete a Media Service.
445
+ #
446
+ # @param resource_group_name [String] Name of the resource group within the
447
+ # Azure subscription.
448
+ # @param media_service_name [String] Name of the Media Service.
449
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
450
+ # will be added to the HTTP request.
451
+ #
452
+ #
453
+ def delete(resource_group_name, media_service_name, custom_headers = nil)
454
+ response = delete_async(resource_group_name, media_service_name, custom_headers).value!
455
+ nil
456
+ end
457
+
458
+ #
459
+ # Delete a Media Service.
460
+ #
461
+ # @param resource_group_name [String] Name of the resource group within the
462
+ # Azure subscription.
463
+ # @param media_service_name [String] Name of the Media Service.
464
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
465
+ # will be added to the HTTP request.
466
+ #
467
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
468
+ #
469
+ def delete_with_http_info(resource_group_name, media_service_name, custom_headers = nil)
470
+ delete_async(resource_group_name, media_service_name, custom_headers).value!
471
+ end
472
+
473
+ #
474
+ # Delete a Media Service.
475
+ #
476
+ # @param resource_group_name [String] Name of the resource group within the
477
+ # Azure subscription.
478
+ # @param media_service_name [String] Name of the Media Service.
479
+ # @param [Hash{String => String}] A hash of custom headers that will be added
480
+ # to the HTTP request.
481
+ #
482
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
483
+ #
484
+ def delete_async(resource_group_name, media_service_name, custom_headers = nil)
485
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
486
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
487
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
488
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
489
+
490
+
491
+ request_headers = {}
492
+
493
+ # Set Headers
494
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
495
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
496
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}'
497
+ options = {
498
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
499
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
500
+ query_params: {'api-version' => @client.api_version},
501
+ headers: request_headers.merge(custom_headers || {})
502
+ }
503
+
504
+ request_url = @base_url || @client.base_url
505
+
506
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :delete, options)
507
+ promise = request.run_promise do |req|
508
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
509
+ end
510
+
511
+ promise = promise.then do |http_response|
512
+ status_code = http_response.status
513
+ response_content = http_response.body
514
+ unless status_code == 200
515
+ error_model = JSON.load(response_content)
516
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
517
+ end
518
+
519
+ # Create Result
520
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
521
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
522
+
523
+ result
524
+ end
525
+
526
+ promise.execute
527
+ end
528
+
529
+ #
530
+ # Update a Media Service.
531
+ #
532
+ # @param resource_group_name [String] Name of the resource group within the
533
+ # Azure subscription.
534
+ # @param media_service_name [String] Name of the Media Service.
535
+ # @param media_service [MediaService] Media Service properties needed for
536
+ # update.
537
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
538
+ # will be added to the HTTP request.
539
+ #
540
+ # @return [MediaService] operation results.
541
+ #
542
+ def update(resource_group_name, media_service_name, media_service, custom_headers = nil)
543
+ response = update_async(resource_group_name, media_service_name, media_service, custom_headers).value!
544
+ response.body unless response.nil?
545
+ end
546
+
547
+ #
548
+ # Update a Media Service.
549
+ #
550
+ # @param resource_group_name [String] Name of the resource group within the
551
+ # Azure subscription.
552
+ # @param media_service_name [String] Name of the Media Service.
553
+ # @param media_service [MediaService] Media Service properties needed for
554
+ # update.
555
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
556
+ # will be added to the HTTP request.
557
+ #
558
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
559
+ #
560
+ def update_with_http_info(resource_group_name, media_service_name, media_service, custom_headers = nil)
561
+ update_async(resource_group_name, media_service_name, media_service, custom_headers).value!
562
+ end
563
+
564
+ #
565
+ # Update a Media Service.
566
+ #
567
+ # @param resource_group_name [String] Name of the resource group within the
568
+ # Azure subscription.
569
+ # @param media_service_name [String] Name of the Media Service.
570
+ # @param media_service [MediaService] Media Service properties needed for
571
+ # update.
572
+ # @param [Hash{String => String}] A hash of custom headers that will be added
573
+ # to the HTTP request.
574
+ #
575
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
576
+ #
577
+ def update_async(resource_group_name, media_service_name, media_service, custom_headers = nil)
578
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
579
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
580
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
581
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
582
+ fail ArgumentError, 'media_service is nil' if media_service.nil?
583
+
584
+
585
+ request_headers = {}
586
+
587
+ # Set Headers
588
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
589
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
590
+
591
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
592
+
593
+ # Serialize Request
594
+ request_mapper = MediaService.mapper()
595
+ request_content = @client.serialize(request_mapper, media_service, 'media_service')
596
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
597
+
598
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}'
599
+ options = {
600
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
601
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
602
+ query_params: {'api-version' => @client.api_version},
603
+ body: request_content,
604
+ headers: request_headers.merge(custom_headers || {})
605
+ }
606
+
607
+ request_url = @base_url || @client.base_url
608
+
609
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :patch, options)
610
+ promise = request.run_promise do |req|
611
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
612
+ end
613
+
614
+ promise = promise.then do |http_response|
615
+ status_code = http_response.status
616
+ response_content = http_response.body
617
+ unless status_code == 200
618
+ error_model = JSON.load(response_content)
619
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
620
+ end
621
+
622
+ # Create Result
623
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
624
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
625
+ # Deserialize Response
626
+ if status_code == 200
627
+ begin
628
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
629
+ result_mapper = MediaService.mapper()
630
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
631
+ rescue Exception => e
632
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
633
+ end
634
+ end
635
+
636
+ result
637
+ end
638
+
639
+ promise.execute
640
+ end
641
+
642
+ #
643
+ # Regenerate the key for a Media Service.
644
+ #
645
+ # @param resource_group_name [String] Name of the resource group within the
646
+ # Azure subscription.
647
+ # @param media_service_name [String] Name of the Media Service.
648
+ # @param regenerate_key_input [RegenerateKeyInput] Properties needed to
649
+ # regenerate the Media Service key.
650
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
651
+ # will be added to the HTTP request.
652
+ #
653
+ # @return [RegenerateKeyOutput] operation results.
654
+ #
655
+ def regenerate_key(resource_group_name, media_service_name, regenerate_key_input, custom_headers = nil)
656
+ response = regenerate_key_async(resource_group_name, media_service_name, regenerate_key_input, custom_headers).value!
657
+ response.body unless response.nil?
658
+ end
659
+
660
+ #
661
+ # Regenerate the key for a Media Service.
662
+ #
663
+ # @param resource_group_name [String] Name of the resource group within the
664
+ # Azure subscription.
665
+ # @param media_service_name [String] Name of the Media Service.
666
+ # @param regenerate_key_input [RegenerateKeyInput] Properties needed to
667
+ # regenerate the Media Service key.
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 regenerate_key_with_http_info(resource_group_name, media_service_name, regenerate_key_input, custom_headers = nil)
674
+ regenerate_key_async(resource_group_name, media_service_name, regenerate_key_input, custom_headers).value!
675
+ end
676
+
677
+ #
678
+ # Regenerate the key for a Media Service.
679
+ #
680
+ # @param resource_group_name [String] Name of the resource group within the
681
+ # Azure subscription.
682
+ # @param media_service_name [String] Name of the Media Service.
683
+ # @param regenerate_key_input [RegenerateKeyInput] Properties needed to
684
+ # regenerate the Media Service key.
685
+ # @param [Hash{String => String}] A hash of custom headers that will be added
686
+ # to the HTTP request.
687
+ #
688
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
689
+ #
690
+ def regenerate_key_async(resource_group_name, media_service_name, regenerate_key_input, custom_headers = nil)
691
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
692
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
693
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
694
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
695
+ fail ArgumentError, 'regenerate_key_input is nil' if regenerate_key_input.nil?
696
+
697
+
698
+ request_headers = {}
699
+
700
+ # Set Headers
701
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
702
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
703
+
704
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
705
+
706
+ # Serialize Request
707
+ request_mapper = RegenerateKeyInput.mapper()
708
+ request_content = @client.serialize(request_mapper, regenerate_key_input, 'regenerate_key_input')
709
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
710
+
711
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/regenerateKey'
712
+ options = {
713
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
714
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
715
+ query_params: {'api-version' => @client.api_version},
716
+ body: request_content,
717
+ headers: request_headers.merge(custom_headers || {})
718
+ }
719
+
720
+ request_url = @base_url || @client.base_url
721
+
722
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
723
+ promise = request.run_promise do |req|
724
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
725
+ end
726
+
727
+ promise = promise.then do |http_response|
728
+ status_code = http_response.status
729
+ response_content = http_response.body
730
+ unless status_code == 200 || status_code == 202
731
+ error_model = JSON.load(response_content)
732
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
733
+ end
734
+
735
+ # Create Result
736
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
737
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
738
+ # Deserialize Response
739
+ if status_code == 200
740
+ begin
741
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
742
+ result_mapper = RegenerateKeyOutput.mapper()
743
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
744
+ rescue Exception => e
745
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
746
+ end
747
+ end
748
+
749
+ result
750
+ end
751
+
752
+ promise.execute
753
+ end
754
+
755
+ #
756
+ # List the keys for a Media Service.
757
+ #
758
+ # @param resource_group_name [String] Name of the resource group within the
759
+ # Azure subscription.
760
+ # @param media_service_name [String] Name of the Media Service.
761
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
762
+ # will be added to the HTTP request.
763
+ #
764
+ # @return [ServiceKeys] operation results.
765
+ #
766
+ def list_keys(resource_group_name, media_service_name, custom_headers = nil)
767
+ response = list_keys_async(resource_group_name, media_service_name, custom_headers).value!
768
+ response.body unless response.nil?
769
+ end
770
+
771
+ #
772
+ # List the keys for a Media Service.
773
+ #
774
+ # @param resource_group_name [String] Name of the resource group within the
775
+ # Azure subscription.
776
+ # @param media_service_name [String] Name of the Media Service.
777
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
778
+ # will be added to the HTTP request.
779
+ #
780
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
781
+ #
782
+ def list_keys_with_http_info(resource_group_name, media_service_name, custom_headers = nil)
783
+ list_keys_async(resource_group_name, media_service_name, custom_headers).value!
784
+ end
785
+
786
+ #
787
+ # List the keys for a Media Service.
788
+ #
789
+ # @param resource_group_name [String] Name of the resource group within the
790
+ # Azure subscription.
791
+ # @param media_service_name [String] Name of the Media Service.
792
+ # @param [Hash{String => String}] A hash of custom headers that will be added
793
+ # to the HTTP request.
794
+ #
795
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
796
+ #
797
+ def list_keys_async(resource_group_name, media_service_name, custom_headers = nil)
798
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
799
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
800
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
801
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
802
+
803
+
804
+ request_headers = {}
805
+
806
+ # Set Headers
807
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
808
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
809
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/listKeys'
810
+ options = {
811
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
812
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
813
+ query_params: {'api-version' => @client.api_version},
814
+ headers: request_headers.merge(custom_headers || {})
815
+ }
816
+
817
+ request_url = @base_url || @client.base_url
818
+
819
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
820
+ promise = request.run_promise do |req|
821
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
822
+ end
823
+
824
+ promise = promise.then do |http_response|
825
+ status_code = http_response.status
826
+ response_content = http_response.body
827
+ unless status_code == 200 || status_code == 202
828
+ error_model = JSON.load(response_content)
829
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
830
+ end
831
+
832
+ # Create Result
833
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
834
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
835
+ # Deserialize Response
836
+ if status_code == 200
837
+ begin
838
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
839
+ result_mapper = ServiceKeys.mapper()
840
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
841
+ rescue Exception => e
842
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
843
+ end
844
+ end
845
+
846
+ result
847
+ end
848
+
849
+ promise.execute
850
+ end
851
+
852
+ #
853
+ # Synchronize the keys for a storage account to the Media Service.
854
+ #
855
+ # @param resource_group_name [String] Name of the resource group within the
856
+ # Azure subscription.
857
+ # @param media_service_name [String] Name of the Media Service.
858
+ # @param sync_storage_keys_input [SyncStorageKeysInput] Properties needed to
859
+ # sycnronize the keys for a storage account to the Media Service.
860
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
861
+ # will be added to the HTTP request.
862
+ #
863
+ # @return [MediaService] operation results.
864
+ #
865
+ def sync_storage_keys(resource_group_name, media_service_name, sync_storage_keys_input, custom_headers = nil)
866
+ response = sync_storage_keys_async(resource_group_name, media_service_name, sync_storage_keys_input, custom_headers).value!
867
+ response.body unless response.nil?
868
+ end
869
+
870
+ #
871
+ # Synchronize the keys for a storage account to the Media Service.
872
+ #
873
+ # @param resource_group_name [String] Name of the resource group within the
874
+ # Azure subscription.
875
+ # @param media_service_name [String] Name of the Media Service.
876
+ # @param sync_storage_keys_input [SyncStorageKeysInput] Properties needed to
877
+ # sycnronize the keys for a storage account to the Media Service.
878
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
879
+ # will be added to the HTTP request.
880
+ #
881
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
882
+ #
883
+ def sync_storage_keys_with_http_info(resource_group_name, media_service_name, sync_storage_keys_input, custom_headers = nil)
884
+ sync_storage_keys_async(resource_group_name, media_service_name, sync_storage_keys_input, custom_headers).value!
885
+ end
886
+
887
+ #
888
+ # Synchronize the keys for a storage account to the Media Service.
889
+ #
890
+ # @param resource_group_name [String] Name of the resource group within the
891
+ # Azure subscription.
892
+ # @param media_service_name [String] Name of the Media Service.
893
+ # @param sync_storage_keys_input [SyncStorageKeysInput] Properties needed to
894
+ # sycnronize the keys for a storage account to the Media Service.
895
+ # @param [Hash{String => String}] A hash of custom headers that will be added
896
+ # to the HTTP request.
897
+ #
898
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
899
+ #
900
+ def sync_storage_keys_async(resource_group_name, media_service_name, sync_storage_keys_input, custom_headers = nil)
901
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
902
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
903
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
904
+ fail ArgumentError, 'media_service_name is nil' if media_service_name.nil?
905
+ fail ArgumentError, 'sync_storage_keys_input is nil' if sync_storage_keys_input.nil?
906
+
907
+
908
+ request_headers = {}
909
+
910
+ # Set Headers
911
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
912
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
913
+
914
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
915
+
916
+ # Serialize Request
917
+ request_mapper = SyncStorageKeysInput.mapper()
918
+ request_content = @client.serialize(request_mapper, sync_storage_keys_input, 'sync_storage_keys_input')
919
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
920
+
921
+ path_template = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Media/mediaservices/{mediaServiceName}/syncStorageKeys'
922
+ options = {
923
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
924
+ path_params: {'subscriptionId' => @client.subscription_id,'resourceGroupName' => resource_group_name,'mediaServiceName' => media_service_name},
925
+ query_params: {'api-version' => @client.api_version},
926
+ body: request_content,
927
+ headers: request_headers.merge(custom_headers || {})
928
+ }
929
+
930
+ request_url = @base_url || @client.base_url
931
+
932
+ request = MsRest::HttpOperationRequest.new(request_url, path_template, :post, options)
933
+ promise = request.run_promise do |req|
934
+ @client.credentials.sign_request(req) unless @client.credentials.nil?
935
+ end
936
+
937
+ promise = promise.then do |http_response|
938
+ status_code = http_response.status
939
+ response_content = http_response.body
940
+ unless status_code == 200 || status_code == 202
941
+ error_model = JSON.load(response_content)
942
+ fail MsRest::HttpOperationError.new(request, http_response, error_model)
943
+ end
944
+
945
+ # Create Result
946
+ result = MsRestAzure::AzureOperationResponse.new(request, http_response)
947
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
948
+ # Deserialize Response
949
+ if status_code == 200
950
+ begin
951
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
952
+ result_mapper = MediaService.mapper()
953
+ result.body = @client.deserialize(result_mapper, parsed_response, 'result.body')
954
+ rescue Exception => e
955
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
956
+ end
957
+ end
958
+
959
+ result
960
+ end
961
+
962
+ promise.execute
963
+ end
964
+
965
+ end
966
+ end