azure_mgmt_cognitive_services 0.12.0 → 0.13.0

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 (32) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generated/azure_mgmt_cognitive_services.rb +1 -2
  3. data/lib/generated/azure_mgmt_cognitive_services/accounts.rb +735 -1
  4. data/lib/generated/azure_mgmt_cognitive_services/check_sku_availability.rb +1 -1
  5. data/lib/generated/azure_mgmt_cognitive_services/cognitive_services_management_client.rb +1 -5
  6. data/lib/generated/azure_mgmt_cognitive_services/models/check_sku_availability_parameter.rb +1 -1
  7. data/lib/generated/azure_mgmt_cognitive_services/models/check_sku_availability_result.rb +1 -1
  8. data/lib/generated/azure_mgmt_cognitive_services/models/check_sku_availability_result_list.rb +1 -1
  9. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account.rb +1 -1
  10. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_create_parameters.rb +1 -1
  11. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_enumerate_skus_result.rb +1 -1
  12. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_keys.rb +1 -1
  13. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_list_result.rb +1 -1
  14. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_update_parameters.rb +1 -1
  15. data/lib/generated/azure_mgmt_cognitive_services/models/cognitive_services_resource_and_sku.rb +1 -1
  16. data/lib/generated/azure_mgmt_cognitive_services/models/error.rb +1 -1
  17. data/lib/generated/azure_mgmt_cognitive_services/models/error_body.rb +1 -1
  18. data/lib/generated/azure_mgmt_cognitive_services/models/key_name.rb +1 -1
  19. data/lib/generated/azure_mgmt_cognitive_services/models/kind.rb +1 -1
  20. data/lib/generated/azure_mgmt_cognitive_services/models/operation_display_info.rb +1 -1
  21. data/lib/generated/azure_mgmt_cognitive_services/models/operation_entity.rb +1 -1
  22. data/lib/generated/azure_mgmt_cognitive_services/models/operation_entity_list_result.rb +1 -1
  23. data/lib/generated/azure_mgmt_cognitive_services/models/provisioning_state.rb +1 -1
  24. data/lib/generated/azure_mgmt_cognitive_services/models/regenerate_key_parameters.rb +1 -1
  25. data/lib/generated/azure_mgmt_cognitive_services/models/sku.rb +1 -1
  26. data/lib/generated/azure_mgmt_cognitive_services/models/sku_name.rb +1 -1
  27. data/lib/generated/azure_mgmt_cognitive_services/models/sku_tier.rb +1 -1
  28. data/lib/generated/azure_mgmt_cognitive_services/module_definition.rb +1 -1
  29. data/lib/generated/azure_mgmt_cognitive_services/operations.rb +1 -1
  30. data/lib/generated/azure_mgmt_cognitive_services/version.rb +2 -2
  31. metadata +2 -3
  32. data/lib/generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb +0 -759
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83f589339f5e50e12b6ab6aa830aefb53ef5ffa9
4
- data.tar.gz: 6f3d65dd34a9cc1fecdabad8689cccca19be6a94
3
+ metadata.gz: 6b45adfa134c9d1a899b84446805463bc1075b51
4
+ data.tar.gz: b8d646cbf41ccc03e03419c00a8d2a7875618f8a
5
5
  SHA512:
6
- metadata.gz: 4d71e607a77d80214a7aa26e9709bf994857fda51572bb3613716823a0c8a09c3b864e5b31bbb93abc4ddfade487e3e7dc356ee9fa3d825b03fb50eb227ba32b
7
- data.tar.gz: eb844f2428332b46cf9717b06f7a889c6ddd0dd5b90cf8801e7c4fe064ff8e2220024c8f6b9acd7810dcd1ccda05fd9bdb46254364a242739639c37202665de4
6
+ metadata.gz: 0e99af1b003cbea73cc8de1d92daa2178e3be8a1c390a4bc22d2f8d542298cbd432e21e5c1eae4f455b77babf09d4699cfe2f340536ab054aaf604b4ad1e17c6
7
+ data.tar.gz: 7f0db260a83cbec88a7f9a8fed50eb846f33f0cac4a2484a1a0a82d5b1d1ac8201aff3f54ac3a87166f9e3ebd7e1b4ed52093bc992c25c732f1da475a52b2b0c
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -20,7 +20,6 @@ require 'generated/azure_mgmt_cognitive_services/module_definition'
20
20
  require 'ms_rest_azure'
21
21
 
22
22
  module Azure::ARM::CognitiveServices
23
- autoload :CognitiveServicesAccounts, 'generated/azure_mgmt_cognitive_services/cognitive_services_accounts.rb'
24
23
  autoload :Accounts, 'generated/azure_mgmt_cognitive_services/accounts.rb'
25
24
  autoload :Operations, 'generated/azure_mgmt_cognitive_services/operations.rb'
26
25
  autoload :CheckSkuAvailability, 'generated/azure_mgmt_cognitive_services/check_sku_availability.rb'
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- # Code generated by Microsoft (R) AutoRest Code Generator 1.2.2.0
2
+ # Code generated by Microsoft (R) AutoRest Code Generator.
3
3
  # Changes may cause incorrect behavior and will be lost if the code is
4
4
  # regenerated.
5
5
 
@@ -21,6 +21,435 @@ module Azure::ARM::CognitiveServices
21
21
  # @return [CognitiveServicesManagementClient] reference to the CognitiveServicesManagementClient
22
22
  attr_reader :client
23
23
 
24
+ #
25
+ # Create Cognitive Services Account. Accounts is a resource group wide resource
26
+ # type. It holds the keys for developer to access intelligent APIs. It's also
27
+ # the resource type for billing.
28
+ #
29
+ # @param resource_group_name [String] The name of the resource group within the
30
+ # user's subscription.
31
+ # @param account_name [String] The name of Cognitive Services account.
32
+ # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
33
+ # to provide for the created account.
34
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
+ # will be added to the HTTP request.
36
+ #
37
+ # @return [CognitiveServicesAccount] operation results.
38
+ #
39
+ def create(resource_group_name, account_name, parameters, custom_headers = nil)
40
+ response = create_async(resource_group_name, account_name, parameters, custom_headers).value!
41
+ response.body unless response.nil?
42
+ end
43
+
44
+ #
45
+ # Create Cognitive Services Account. Accounts is a resource group wide resource
46
+ # type. It holds the keys for developer to access intelligent APIs. It's also
47
+ # the resource type for billing.
48
+ #
49
+ # @param resource_group_name [String] The name of the resource group within the
50
+ # user's subscription.
51
+ # @param account_name [String] The name of Cognitive Services account.
52
+ # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
53
+ # to provide for the created account.
54
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
+ # will be added to the HTTP request.
56
+ #
57
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
+ #
59
+ def create_with_http_info(resource_group_name, account_name, parameters, custom_headers = nil)
60
+ create_async(resource_group_name, account_name, parameters, custom_headers).value!
61
+ end
62
+
63
+ #
64
+ # Create Cognitive Services Account. Accounts is a resource group wide resource
65
+ # type. It holds the keys for developer to access intelligent APIs. It's also
66
+ # the resource type for billing.
67
+ #
68
+ # @param resource_group_name [String] The name of the resource group within the
69
+ # user's subscription.
70
+ # @param account_name [String] The name of Cognitive Services account.
71
+ # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
72
+ # to provide for the created account.
73
+ # @param [Hash{String => String}] A hash of custom headers that will be added
74
+ # to the HTTP request.
75
+ #
76
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
+ #
78
+ def create_async(resource_group_name, account_name, parameters, custom_headers = nil)
79
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
81
+ fail ArgumentError, 'parameters is nil' if parameters.nil?
82
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
83
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
84
+
85
+
86
+ request_headers = {}
87
+
88
+ # Set Headers
89
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
90
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
91
+
92
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
93
+
94
+ # Serialize Request
95
+ request_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountCreateParameters.mapper()
96
+ request_content = @client.serialize(request_mapper, parameters)
97
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
98
+
99
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
100
+
101
+ request_url = @base_url || @client.base_url
102
+
103
+ options = {
104
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
105
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
106
+ query_params: {'api-version' => @client.api_version},
107
+ body: request_content,
108
+ headers: request_headers.merge(custom_headers || {}),
109
+ base_url: request_url
110
+ }
111
+ promise = @client.make_request_async(:put, path_template, options)
112
+
113
+ promise = promise.then do |result|
114
+ http_response = result.response
115
+ status_code = http_response.status
116
+ response_content = http_response.body
117
+ unless status_code == 200 || status_code == 201
118
+ error_model = JSON.load(response_content)
119
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
120
+ end
121
+
122
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
123
+ # Deserialize Response
124
+ if status_code == 200
125
+ begin
126
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
127
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccount.mapper()
128
+ result.body = @client.deserialize(result_mapper, parsed_response)
129
+ rescue Exception => e
130
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
131
+ end
132
+ end
133
+ # Deserialize Response
134
+ if status_code == 201
135
+ begin
136
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
137
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccount.mapper()
138
+ result.body = @client.deserialize(result_mapper, parsed_response)
139
+ rescue Exception => e
140
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
141
+ end
142
+ end
143
+
144
+ result
145
+ end
146
+
147
+ promise.execute
148
+ end
149
+
150
+ #
151
+ # Updates a Cognitive Services account
152
+ #
153
+ # @param resource_group_name [String] The name of the resource group within the
154
+ # user's subscription.
155
+ # @param account_name [String] The name of Cognitive Services account.
156
+ # @param sku [Sku] Gets or sets the SKU of the resource.
157
+ # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
158
+ # that describe the resource. These tags can be used in viewing and grouping
159
+ # this resource (across resource groups). A maximum of 15 tags can be provided
160
+ # for a resource. Each tag must have a key no greater than 128 characters and
161
+ # value no greater than 256 characters.
162
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
163
+ # will be added to the HTTP request.
164
+ #
165
+ # @return [CognitiveServicesAccount] operation results.
166
+ #
167
+ def update(resource_group_name, account_name, sku = nil, tags = nil, custom_headers = nil)
168
+ response = update_async(resource_group_name, account_name, sku, tags, custom_headers).value!
169
+ response.body unless response.nil?
170
+ end
171
+
172
+ #
173
+ # Updates a Cognitive Services account
174
+ #
175
+ # @param resource_group_name [String] The name of the resource group within the
176
+ # user's subscription.
177
+ # @param account_name [String] The name of Cognitive Services account.
178
+ # @param sku [Sku] Gets or sets the SKU of the resource.
179
+ # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
180
+ # that describe the resource. These tags can be used in viewing and grouping
181
+ # this resource (across resource groups). A maximum of 15 tags can be provided
182
+ # for a resource. Each tag must have a key no greater than 128 characters and
183
+ # value no greater than 256 characters.
184
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
185
+ # will be added to the HTTP request.
186
+ #
187
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
188
+ #
189
+ def update_with_http_info(resource_group_name, account_name, sku = nil, tags = nil, custom_headers = nil)
190
+ update_async(resource_group_name, account_name, sku, tags, custom_headers).value!
191
+ end
192
+
193
+ #
194
+ # Updates a Cognitive Services account
195
+ #
196
+ # @param resource_group_name [String] The name of the resource group within the
197
+ # user's subscription.
198
+ # @param account_name [String] The name of Cognitive Services account.
199
+ # @param sku [Sku] Gets or sets the SKU of the resource.
200
+ # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
201
+ # that describe the resource. These tags can be used in viewing and grouping
202
+ # this resource (across resource groups). A maximum of 15 tags can be provided
203
+ # for a resource. Each tag must have a key no greater than 128 characters and
204
+ # value no greater than 256 characters.
205
+ # @param [Hash{String => String}] A hash of custom headers that will be added
206
+ # to the HTTP request.
207
+ #
208
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
209
+ #
210
+ def update_async(resource_group_name, account_name, sku = nil, tags = nil, custom_headers = nil)
211
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
212
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
213
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
214
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
215
+
216
+ parameters = CognitiveServicesAccountUpdateParameters.new
217
+ unless sku.nil? && tags.nil?
218
+ parameters.sku = sku
219
+ parameters.tags = tags
220
+ end
221
+
222
+ request_headers = {}
223
+
224
+ # Set Headers
225
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
226
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
227
+
228
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
229
+
230
+ # Serialize Request
231
+ request_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountUpdateParameters.mapper()
232
+ request_content = @client.serialize(request_mapper, parameters)
233
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
234
+
235
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
236
+
237
+ request_url = @base_url || @client.base_url
238
+
239
+ options = {
240
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
241
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
242
+ query_params: {'api-version' => @client.api_version},
243
+ body: request_content,
244
+ headers: request_headers.merge(custom_headers || {}),
245
+ base_url: request_url
246
+ }
247
+ promise = @client.make_request_async(:patch, path_template, options)
248
+
249
+ promise = promise.then do |result|
250
+ http_response = result.response
251
+ status_code = http_response.status
252
+ response_content = http_response.body
253
+ unless status_code == 200
254
+ error_model = JSON.load(response_content)
255
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
256
+ end
257
+
258
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
259
+ # Deserialize Response
260
+ if status_code == 200
261
+ begin
262
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
263
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccount.mapper()
264
+ result.body = @client.deserialize(result_mapper, parsed_response)
265
+ rescue Exception => e
266
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
267
+ end
268
+ end
269
+
270
+ result
271
+ end
272
+
273
+ promise.execute
274
+ end
275
+
276
+ #
277
+ # Deletes a Cognitive Services account from the resource group.
278
+ #
279
+ # @param resource_group_name [String] The name of the resource group within the
280
+ # user's subscription.
281
+ # @param account_name [String] The name of Cognitive Services account.
282
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
283
+ # will be added to the HTTP request.
284
+ #
285
+ #
286
+ def delete(resource_group_name, account_name, custom_headers = nil)
287
+ response = delete_async(resource_group_name, account_name, custom_headers).value!
288
+ nil
289
+ end
290
+
291
+ #
292
+ # Deletes a Cognitive Services account from the resource group.
293
+ #
294
+ # @param resource_group_name [String] The name of the resource group within the
295
+ # user's subscription.
296
+ # @param account_name [String] The name of Cognitive Services account.
297
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
298
+ # will be added to the HTTP request.
299
+ #
300
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
301
+ #
302
+ def delete_with_http_info(resource_group_name, account_name, custom_headers = nil)
303
+ delete_async(resource_group_name, account_name, custom_headers).value!
304
+ end
305
+
306
+ #
307
+ # Deletes a Cognitive Services account from the resource group.
308
+ #
309
+ # @param resource_group_name [String] The name of the resource group within the
310
+ # user's subscription.
311
+ # @param account_name [String] The name of Cognitive Services account.
312
+ # @param [Hash{String => String}] A hash of custom headers that will be added
313
+ # to the HTTP request.
314
+ #
315
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
316
+ #
317
+ def delete_async(resource_group_name, account_name, custom_headers = nil)
318
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
319
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
320
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
321
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
322
+
323
+
324
+ request_headers = {}
325
+
326
+ # Set Headers
327
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
328
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
329
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
330
+
331
+ request_url = @base_url || @client.base_url
332
+
333
+ options = {
334
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
335
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
336
+ query_params: {'api-version' => @client.api_version},
337
+ headers: request_headers.merge(custom_headers || {}),
338
+ base_url: request_url
339
+ }
340
+ promise = @client.make_request_async(:delete, path_template, options)
341
+
342
+ promise = promise.then do |result|
343
+ http_response = result.response
344
+ status_code = http_response.status
345
+ response_content = http_response.body
346
+ unless status_code == 200 || status_code == 204
347
+ error_model = JSON.load(response_content)
348
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
349
+ end
350
+
351
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
352
+
353
+ result
354
+ end
355
+
356
+ promise.execute
357
+ end
358
+
359
+ #
360
+ # Returns a Cognitive Services account specified by the parameters.
361
+ #
362
+ # @param resource_group_name [String] The name of the resource group within the
363
+ # user's subscription.
364
+ # @param account_name [String] The name of Cognitive Services account.
365
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
366
+ # will be added to the HTTP request.
367
+ #
368
+ # @return [CognitiveServicesAccount] operation results.
369
+ #
370
+ def get_properties(resource_group_name, account_name, custom_headers = nil)
371
+ response = get_properties_async(resource_group_name, account_name, custom_headers).value!
372
+ response.body unless response.nil?
373
+ end
374
+
375
+ #
376
+ # Returns a Cognitive Services account specified by the parameters.
377
+ #
378
+ # @param resource_group_name [String] The name of the resource group within the
379
+ # user's subscription.
380
+ # @param account_name [String] The name of Cognitive Services account.
381
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
382
+ # will be added to the HTTP request.
383
+ #
384
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
385
+ #
386
+ def get_properties_with_http_info(resource_group_name, account_name, custom_headers = nil)
387
+ get_properties_async(resource_group_name, account_name, custom_headers).value!
388
+ end
389
+
390
+ #
391
+ # Returns a Cognitive Services account specified by the parameters.
392
+ #
393
+ # @param resource_group_name [String] The name of the resource group within the
394
+ # user's subscription.
395
+ # @param account_name [String] The name of Cognitive Services account.
396
+ # @param [Hash{String => String}] A hash of custom headers that will be added
397
+ # to the HTTP request.
398
+ #
399
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
400
+ #
401
+ def get_properties_async(resource_group_name, account_name, custom_headers = nil)
402
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
403
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
404
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
405
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
406
+
407
+
408
+ request_headers = {}
409
+
410
+ # Set Headers
411
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
412
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
413
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
414
+
415
+ request_url = @base_url || @client.base_url
416
+
417
+ options = {
418
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
419
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
420
+ query_params: {'api-version' => @client.api_version},
421
+ headers: request_headers.merge(custom_headers || {}),
422
+ base_url: request_url
423
+ }
424
+ promise = @client.make_request_async(:get, path_template, options)
425
+
426
+ promise = promise.then do |result|
427
+ http_response = result.response
428
+ status_code = http_response.status
429
+ response_content = http_response.body
430
+ unless status_code == 200
431
+ error_model = JSON.load(response_content)
432
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
433
+ end
434
+
435
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
436
+ # Deserialize Response
437
+ if status_code == 200
438
+ begin
439
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
440
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccount.mapper()
441
+ result.body = @client.deserialize(result_mapper, parsed_response)
442
+ rescue Exception => e
443
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
444
+ end
445
+ end
446
+
447
+ result
448
+ end
449
+
450
+ promise.execute
451
+ end
452
+
24
453
  #
25
454
  # Returns all the resources of a particular type belonging to a resource group
26
455
  #
@@ -194,6 +623,311 @@ module Azure::ARM::CognitiveServices
194
623
  promise.execute
195
624
  end
196
625
 
626
+ #
627
+ # Lists the account keys for the specified Cognitive Services account.
628
+ #
629
+ # @param resource_group_name [String] The name of the resource group within the
630
+ # user's subscription.
631
+ # @param account_name [String] The name of Cognitive Services account.
632
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
633
+ # will be added to the HTTP request.
634
+ #
635
+ # @return [CognitiveServicesAccountKeys] operation results.
636
+ #
637
+ def list_keys(resource_group_name, account_name, custom_headers = nil)
638
+ response = list_keys_async(resource_group_name, account_name, custom_headers).value!
639
+ response.body unless response.nil?
640
+ end
641
+
642
+ #
643
+ # Lists the account keys for the specified Cognitive Services account.
644
+ #
645
+ # @param resource_group_name [String] The name of the resource group within the
646
+ # user's subscription.
647
+ # @param account_name [String] The name of Cognitive Services account.
648
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
649
+ # will be added to the HTTP request.
650
+ #
651
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
652
+ #
653
+ def list_keys_with_http_info(resource_group_name, account_name, custom_headers = nil)
654
+ list_keys_async(resource_group_name, account_name, custom_headers).value!
655
+ end
656
+
657
+ #
658
+ # Lists the account keys for the specified Cognitive Services account.
659
+ #
660
+ # @param resource_group_name [String] The name of the resource group within the
661
+ # user's subscription.
662
+ # @param account_name [String] The name of Cognitive Services account.
663
+ # @param [Hash{String => String}] A hash of custom headers that will be added
664
+ # to the HTTP request.
665
+ #
666
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
667
+ #
668
+ def list_keys_async(resource_group_name, account_name, custom_headers = nil)
669
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
670
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
671
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
672
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
673
+
674
+
675
+ request_headers = {}
676
+
677
+ # Set Headers
678
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
679
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
680
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys'
681
+
682
+ request_url = @base_url || @client.base_url
683
+
684
+ options = {
685
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
686
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
687
+ query_params: {'api-version' => @client.api_version},
688
+ headers: request_headers.merge(custom_headers || {}),
689
+ base_url: request_url
690
+ }
691
+ promise = @client.make_request_async(:post, path_template, options)
692
+
693
+ promise = promise.then do |result|
694
+ http_response = result.response
695
+ status_code = http_response.status
696
+ response_content = http_response.body
697
+ unless status_code == 200
698
+ error_model = JSON.load(response_content)
699
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
700
+ end
701
+
702
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
703
+ # Deserialize Response
704
+ if status_code == 200
705
+ begin
706
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
707
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountKeys.mapper()
708
+ result.body = @client.deserialize(result_mapper, parsed_response)
709
+ rescue Exception => e
710
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
711
+ end
712
+ end
713
+
714
+ result
715
+ end
716
+
717
+ promise.execute
718
+ end
719
+
720
+ #
721
+ # Regenerates the specified account key for the specified Cognitive Services
722
+ # account.
723
+ #
724
+ # @param resource_group_name [String] The name of the resource group within the
725
+ # user's subscription.
726
+ # @param account_name [String] The name of Cognitive Services account.
727
+ # @param key_name [KeyName] key name to generate (Key1|Key2). Possible values
728
+ # include: 'Key1', 'Key2'
729
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
730
+ # will be added to the HTTP request.
731
+ #
732
+ # @return [CognitiveServicesAccountKeys] operation results.
733
+ #
734
+ def regenerate_key(resource_group_name, account_name, key_name, custom_headers = nil)
735
+ response = regenerate_key_async(resource_group_name, account_name, key_name, custom_headers).value!
736
+ response.body unless response.nil?
737
+ end
738
+
739
+ #
740
+ # Regenerates the specified account key for the specified Cognitive Services
741
+ # account.
742
+ #
743
+ # @param resource_group_name [String] The name of the resource group within the
744
+ # user's subscription.
745
+ # @param account_name [String] The name of Cognitive Services account.
746
+ # @param key_name [KeyName] key name to generate (Key1|Key2). Possible values
747
+ # include: 'Key1', 'Key2'
748
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
749
+ # will be added to the HTTP request.
750
+ #
751
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
752
+ #
753
+ def regenerate_key_with_http_info(resource_group_name, account_name, key_name, custom_headers = nil)
754
+ regenerate_key_async(resource_group_name, account_name, key_name, custom_headers).value!
755
+ end
756
+
757
+ #
758
+ # Regenerates the specified account key for the specified Cognitive Services
759
+ # account.
760
+ #
761
+ # @param resource_group_name [String] The name of the resource group within the
762
+ # user's subscription.
763
+ # @param account_name [String] The name of Cognitive Services account.
764
+ # @param key_name [KeyName] key name to generate (Key1|Key2). Possible values
765
+ # include: 'Key1', 'Key2'
766
+ # @param [Hash{String => String}] A hash of custom headers that will be added
767
+ # to the HTTP request.
768
+ #
769
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
770
+ #
771
+ def regenerate_key_async(resource_group_name, account_name, key_name, custom_headers = nil)
772
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
773
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
774
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
775
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
776
+ fail ArgumentError, 'key_name is nil' if key_name.nil?
777
+
778
+ parameters = RegenerateKeyParameters.new
779
+ unless key_name.nil?
780
+ parameters.key_name = key_name
781
+ end
782
+
783
+ request_headers = {}
784
+
785
+ # Set Headers
786
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
787
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
788
+
789
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
790
+
791
+ # Serialize Request
792
+ request_mapper = Azure::ARM::CognitiveServices::Models::RegenerateKeyParameters.mapper()
793
+ request_content = @client.serialize(request_mapper, parameters)
794
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
795
+
796
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey'
797
+
798
+ request_url = @base_url || @client.base_url
799
+
800
+ options = {
801
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
802
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
803
+ query_params: {'api-version' => @client.api_version},
804
+ body: request_content,
805
+ headers: request_headers.merge(custom_headers || {}),
806
+ base_url: request_url
807
+ }
808
+ promise = @client.make_request_async(:post, path_template, options)
809
+
810
+ promise = promise.then do |result|
811
+ http_response = result.response
812
+ status_code = http_response.status
813
+ response_content = http_response.body
814
+ unless status_code == 200
815
+ error_model = JSON.load(response_content)
816
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
817
+ end
818
+
819
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
820
+ # Deserialize Response
821
+ if status_code == 200
822
+ begin
823
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
824
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountKeys.mapper()
825
+ result.body = @client.deserialize(result_mapper, parsed_response)
826
+ rescue Exception => e
827
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
828
+ end
829
+ end
830
+
831
+ result
832
+ end
833
+
834
+ promise.execute
835
+ end
836
+
837
+ #
838
+ # List available SKUs for the requested Cognitive Services account
839
+ #
840
+ # @param resource_group_name [String] The name of the resource group within the
841
+ # user's subscription.
842
+ # @param account_name [String] The name of Cognitive Services account.
843
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
844
+ # will be added to the HTTP request.
845
+ #
846
+ # @return [CognitiveServicesAccountEnumerateSkusResult] operation results.
847
+ #
848
+ def list_skus(resource_group_name, account_name, custom_headers = nil)
849
+ response = list_skus_async(resource_group_name, account_name, custom_headers).value!
850
+ response.body unless response.nil?
851
+ end
852
+
853
+ #
854
+ # List available SKUs for the requested Cognitive Services account
855
+ #
856
+ # @param resource_group_name [String] The name of the resource group within the
857
+ # user's subscription.
858
+ # @param account_name [String] The name of Cognitive Services account.
859
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
860
+ # will be added to the HTTP request.
861
+ #
862
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
863
+ #
864
+ def list_skus_with_http_info(resource_group_name, account_name, custom_headers = nil)
865
+ list_skus_async(resource_group_name, account_name, custom_headers).value!
866
+ end
867
+
868
+ #
869
+ # List available SKUs for the requested Cognitive Services account
870
+ #
871
+ # @param resource_group_name [String] The name of the resource group within the
872
+ # user's subscription.
873
+ # @param account_name [String] The name of Cognitive Services account.
874
+ # @param [Hash{String => String}] A hash of custom headers that will be added
875
+ # to the HTTP request.
876
+ #
877
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
878
+ #
879
+ def list_skus_async(resource_group_name, account_name, custom_headers = nil)
880
+ fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
881
+ fail ArgumentError, 'account_name is nil' if account_name.nil?
882
+ fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
883
+ fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
884
+
885
+
886
+ request_headers = {}
887
+
888
+ # Set Headers
889
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
890
+ request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
891
+ path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus'
892
+
893
+ request_url = @base_url || @client.base_url
894
+
895
+ options = {
896
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
897
+ path_params: {'resourceGroupName' => resource_group_name,'accountName' => account_name,'subscriptionId' => @client.subscription_id},
898
+ query_params: {'api-version' => @client.api_version},
899
+ headers: request_headers.merge(custom_headers || {}),
900
+ base_url: request_url
901
+ }
902
+ promise = @client.make_request_async(:get, path_template, options)
903
+
904
+ promise = promise.then do |result|
905
+ http_response = result.response
906
+ status_code = http_response.status
907
+ response_content = http_response.body
908
+ unless status_code == 200
909
+ error_model = JSON.load(response_content)
910
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
911
+ end
912
+
913
+ result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
914
+ # Deserialize Response
915
+ if status_code == 200
916
+ begin
917
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
918
+ result_mapper = Azure::ARM::CognitiveServices::Models::CognitiveServicesAccountEnumerateSkusResult.mapper()
919
+ result.body = @client.deserialize(result_mapper, parsed_response)
920
+ rescue Exception => e
921
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
922
+ end
923
+ end
924
+
925
+ result
926
+ end
927
+
928
+ promise.execute
929
+ end
930
+
197
931
  #
198
932
  # Returns all the resources of a particular type belonging to a resource group
199
933
  #