azure_mgmt_cognitive_services 0.18.3 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1378ee1f6b58727f27590e190d66144b679d9002c50423c19e99a88c9a48d0c
4
- data.tar.gz: f3828501da4992fa5fb0cc59a53487d562d5bd4ca7110492e49fd205f23b1f7e
3
+ metadata.gz: 0e3c0c700465ebbea494650bbde0a913b27c736e7b07ecac5ca41d7989a0d39a
4
+ data.tar.gz: 4d6fc253907a96595b05d84552954b9ea5e8e8a77b669800582df0c131968697
5
5
  SHA512:
6
- metadata.gz: ec783d14a1538fb32e6204b5d81d83343b9be128fabb25c7391e0f3f3102a75a4bc21881ca3436b9f292dab8fab41e8db7900a2175997492e7e019cad6320cef
7
- data.tar.gz: bbeff43f6d6ce6f6460982d15f86446b38d347d602252f9145349d5506bf6fba1eea9c2f6cb06f914d08220bb8389f9f4b85cf6d3ed5777809b913e420083722
6
+ metadata.gz: a88a11544722fee02d5b2cbcd4491198d08ffed54819824ad9d34b57feb639169a41df56da45bdc1364a287a979990f7b1ebf8e960c9f34820a0013bae05a28f
7
+ data.tar.gz: 340f6fd959d3a1abd6adcf9e2d2f5547e8480764a18d1f2e8aae983eaac7c5c3492a35ce8023383066b448459f7ce3f4b6dac2233a163ba78cecc7118e4acb5f
@@ -125,7 +125,7 @@ module Azure::CognitiveServices::Mgmt::V2016_02_01_preview
125
125
  #
126
126
  def add_telemetry
127
127
  sdk_information = 'azure_mgmt_cognitive_services'
128
- sdk_information = "#{sdk_information}/0.18.3"
128
+ sdk_information = "#{sdk_information}/0.19.0"
129
129
  add_user_agent_information(sdk_information)
130
130
  end
131
131
  end
@@ -23,17 +23,16 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
23
23
  autoload :Accounts, '2017-04-18/generated/azure_mgmt_cognitive_services/accounts.rb'
24
24
  autoload :ResourceSkus, '2017-04-18/generated/azure_mgmt_cognitive_services/resource_skus.rb'
25
25
  autoload :Operations, '2017-04-18/generated/azure_mgmt_cognitive_services/operations.rb'
26
- autoload :CheckSkuAvailability, '2017-04-18/generated/azure_mgmt_cognitive_services/check_sku_availability.rb'
27
26
  autoload :CognitiveServicesManagementClient, '2017-04-18/generated/azure_mgmt_cognitive_services/cognitive_services_management_client.rb'
28
27
 
29
28
  module Models
30
29
  autoload :UsagesResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/usages_result.rb'
31
30
  autoload :ErrorBody, '2017-04-18/generated/azure_mgmt_cognitive_services/models/error_body.rb'
32
- autoload :CognitiveServicesAccountCreateParameters, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_create_parameters.rb'
33
- autoload :Error, '2017-04-18/generated/azure_mgmt_cognitive_services/models/error.rb'
34
31
  autoload :IpRule, '2017-04-18/generated/azure_mgmt_cognitive_services/models/ip_rule.rb'
35
- autoload :OperationDisplayInfo, '2017-04-18/generated/azure_mgmt_cognitive_services/models/operation_display_info.rb'
32
+ autoload :Error, '2017-04-18/generated/azure_mgmt_cognitive_services/models/error.rb'
36
33
  autoload :NetworkRuleSet, '2017-04-18/generated/azure_mgmt_cognitive_services/models/network_rule_set.rb'
34
+ autoload :OperationDisplayInfo, '2017-04-18/generated/azure_mgmt_cognitive_services/models/operation_display_info.rb'
35
+ autoload :CognitiveServicesAccountProperties, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_properties.rb'
37
36
  autoload :OperationEntity, '2017-04-18/generated/azure_mgmt_cognitive_services/models/operation_entity.rb'
38
37
  autoload :CognitiveServicesAccountListResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_list_result.rb'
39
38
  autoload :OperationEntityListResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/operation_entity_list_result.rb'
@@ -43,7 +42,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
43
42
  autoload :CheckSkuAvailabilityResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/check_sku_availability_result.rb'
44
43
  autoload :Usage, '2017-04-18/generated/azure_mgmt_cognitive_services/models/usage.rb'
45
44
  autoload :CheckSkuAvailabilityResultList, '2017-04-18/generated/azure_mgmt_cognitive_services/models/check_sku_availability_result_list.rb'
46
- autoload :CognitiveServicesAccountUpdateParameters, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_update_parameters.rb'
45
+ autoload :VirtualNetworkRule, '2017-04-18/generated/azure_mgmt_cognitive_services/models/virtual_network_rule.rb'
47
46
  autoload :CheckDomainAvailabilityParameter, '2017-04-18/generated/azure_mgmt_cognitive_services/models/check_domain_availability_parameter.rb'
48
47
  autoload :CognitiveServicesAccount, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account.rb'
49
48
  autoload :CheckDomainAvailabilityResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/check_domain_availability_result.rb'
@@ -53,12 +52,11 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
53
52
  autoload :ResourceSkuRestrictions, '2017-04-18/generated/azure_mgmt_cognitive_services/models/resource_sku_restrictions.rb'
54
53
  autoload :CognitiveServicesAccountKeys, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_keys.rb'
55
54
  autoload :ResourceSku, '2017-04-18/generated/azure_mgmt_cognitive_services/models/resource_sku.rb'
56
- autoload :VirtualNetworkRule, '2017-04-18/generated/azure_mgmt_cognitive_services/models/virtual_network_rule.rb'
55
+ autoload :CognitiveServicesAccountApiProperties, '2017-04-18/generated/azure_mgmt_cognitive_services/models/cognitive_services_account_api_properties.rb'
57
56
  autoload :ResourceSkusResult, '2017-04-18/generated/azure_mgmt_cognitive_services/models/resource_skus_result.rb'
58
57
  autoload :MetricName, '2017-04-18/generated/azure_mgmt_cognitive_services/models/metric_name.rb'
59
58
  autoload :SkuTier, '2017-04-18/generated/azure_mgmt_cognitive_services/models/sku_tier.rb'
60
59
  autoload :ProvisioningState, '2017-04-18/generated/azure_mgmt_cognitive_services/models/provisioning_state.rb'
61
- autoload :NetworkRuleBypassOptions, '2017-04-18/generated/azure_mgmt_cognitive_services/models/network_rule_bypass_options.rb'
62
60
  autoload :NetworkRuleAction, '2017-04-18/generated/azure_mgmt_cognitive_services/models/network_rule_action.rb'
63
61
  autoload :KeyName, '2017-04-18/generated/azure_mgmt_cognitive_services/models/key_name.rb'
64
62
  autoload :UnitType, '2017-04-18/generated/azure_mgmt_cognitive_services/models/unit_type.rb'
@@ -29,15 +29,15 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
29
29
  # @param resource_group_name [String] The name of the resource group within the
30
30
  # user's subscription.
31
31
  # @param account_name [String] The name of Cognitive Services account.
32
- # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
33
- # to provide for the created account.
32
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
33
+ # created account.
34
34
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
35
35
  # will be added to the HTTP request.
36
36
  #
37
37
  # @return [CognitiveServicesAccount] operation results.
38
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:custom_headers).value!
39
+ def create(resource_group_name, account_name, account, custom_headers:nil)
40
+ response = create_async(resource_group_name, account_name, account, custom_headers:custom_headers).value!
41
41
  response.body unless response.nil?
42
42
  end
43
43
 
@@ -49,15 +49,15 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
49
49
  # @param resource_group_name [String] The name of the resource group within the
50
50
  # user's subscription.
51
51
  # @param account_name [String] The name of Cognitive Services account.
52
- # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
53
- # to provide for the created account.
52
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
53
+ # created account.
54
54
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
55
55
  # will be added to the HTTP request.
56
56
  #
57
57
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
58
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:custom_headers).value!
59
+ def create_with_http_info(resource_group_name, account_name, account, custom_headers:nil)
60
+ create_async(resource_group_name, account_name, account, custom_headers:custom_headers).value!
61
61
  end
62
62
 
63
63
  #
@@ -68,20 +68,20 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
68
68
  # @param resource_group_name [String] The name of the resource group within the
69
69
  # user's subscription.
70
70
  # @param account_name [String] The name of Cognitive Services account.
71
- # @param parameters [CognitiveServicesAccountCreateParameters] The parameters
72
- # to provide for the created account.
71
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
72
+ # created account.
73
73
  # @param [Hash{String => String}] A hash of custom headers that will be added
74
74
  # to the HTTP request.
75
75
  #
76
76
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
77
77
  #
78
- def create_async(resource_group_name, account_name, parameters, custom_headers:nil)
78
+ def create_async(resource_group_name, account_name, account, custom_headers:nil)
79
79
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
80
80
  fail ArgumentError, 'account_name is nil' if account_name.nil?
81
81
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '64'" if !account_name.nil? && account_name.length > 64
82
82
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '2'" if !account_name.nil? && account_name.length < 2
83
83
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
84
- fail ArgumentError, 'parameters is nil' if parameters.nil?
84
+ fail ArgumentError, 'account is nil' if account.nil?
85
85
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
86
86
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
87
87
 
@@ -94,8 +94,8 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
94
94
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
95
95
 
96
96
  # Serialize Request
97
- request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccountCreateParameters.mapper()
98
- request_content = @client.serialize(request_mapper, parameters)
97
+ request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccount.mapper()
98
+ request_content = @client.serialize(request_mapper, account)
99
99
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
100
100
 
101
101
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
@@ -116,7 +116,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
116
116
  http_response = result.response
117
117
  status_code = http_response.status
118
118
  response_content = http_response.body
119
- unless status_code == 200 || status_code == 201
119
+ unless status_code == 200 || status_code == 201 || status_code == 202
120
120
  error_model = JSON.load(response_content)
121
121
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
122
122
  end
@@ -144,6 +144,16 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
144
144
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
145
145
  end
146
146
  end
147
+ # Deserialize Response
148
+ if status_code == 202
149
+ begin
150
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
151
+ result_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccount.mapper()
152
+ result.body = @client.deserialize(result_mapper, parsed_response)
153
+ rescue Exception => e
154
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
155
+ end
156
+ end
147
157
 
148
158
  result
149
159
  end
@@ -157,21 +167,15 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
157
167
  # @param resource_group_name [String] The name of the resource group within the
158
168
  # user's subscription.
159
169
  # @param account_name [String] The name of Cognitive Services account.
160
- # @param sku [Sku] Gets or sets the SKU of the resource.
161
- # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
162
- # that describe the resource. These tags can be used in viewing and grouping
163
- # this resource (across resource groups). A maximum of 15 tags can be provided
164
- # for a resource. Each tag must have a key no greater than 128 characters and
165
- # value no greater than 256 characters.
166
- # @param properties Additional properties for Account. Only provided fields
167
- # will be updated.
170
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
171
+ # created account.
168
172
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
169
173
  # will be added to the HTTP request.
170
174
  #
171
175
  # @return [CognitiveServicesAccount] operation results.
172
176
  #
173
- def update(resource_group_name, account_name, sku:nil, tags:nil, properties:nil, custom_headers:nil)
174
- response = update_async(resource_group_name, account_name, sku:sku, tags:tags, properties:properties, custom_headers:custom_headers).value!
177
+ def update(resource_group_name, account_name, account, custom_headers:nil)
178
+ response = update_async(resource_group_name, account_name, account, custom_headers:custom_headers).value!
175
179
  response.body unless response.nil?
176
180
  end
177
181
 
@@ -181,21 +185,15 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
181
185
  # @param resource_group_name [String] The name of the resource group within the
182
186
  # user's subscription.
183
187
  # @param account_name [String] The name of Cognitive Services account.
184
- # @param sku [Sku] Gets or sets the SKU of the resource.
185
- # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
186
- # that describe the resource. These tags can be used in viewing and grouping
187
- # this resource (across resource groups). A maximum of 15 tags can be provided
188
- # for a resource. Each tag must have a key no greater than 128 characters and
189
- # value no greater than 256 characters.
190
- # @param properties Additional properties for Account. Only provided fields
191
- # will be updated.
188
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
189
+ # created account.
192
190
  # @param custom_headers [Hash{String => String}] A hash of custom headers that
193
191
  # will be added to the HTTP request.
194
192
  #
195
193
  # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
196
194
  #
197
- def update_with_http_info(resource_group_name, account_name, sku:nil, tags:nil, properties:nil, custom_headers:nil)
198
- update_async(resource_group_name, account_name, sku:sku, tags:tags, properties:properties, custom_headers:custom_headers).value!
195
+ def update_with_http_info(resource_group_name, account_name, account, custom_headers:nil)
196
+ update_async(resource_group_name, account_name, account, custom_headers:custom_headers).value!
199
197
  end
200
198
 
201
199
  #
@@ -204,34 +202,23 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
204
202
  # @param resource_group_name [String] The name of the resource group within the
205
203
  # user's subscription.
206
204
  # @param account_name [String] The name of Cognitive Services account.
207
- # @param sku [Sku] Gets or sets the SKU of the resource.
208
- # @param tags [Hash{String => String}] Gets or sets a list of key value pairs
209
- # that describe the resource. These tags can be used in viewing and grouping
210
- # this resource (across resource groups). A maximum of 15 tags can be provided
211
- # for a resource. Each tag must have a key no greater than 128 characters and
212
- # value no greater than 256 characters.
213
- # @param properties Additional properties for Account. Only provided fields
214
- # will be updated.
205
+ # @param account [CognitiveServicesAccount] The parameters to provide for the
206
+ # created account.
215
207
  # @param [Hash{String => String}] A hash of custom headers that will be added
216
208
  # to the HTTP request.
217
209
  #
218
210
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
219
211
  #
220
- def update_async(resource_group_name, account_name, sku:nil, tags:nil, properties:nil, custom_headers:nil)
212
+ def update_async(resource_group_name, account_name, account, custom_headers:nil)
221
213
  fail ArgumentError, 'resource_group_name is nil' if resource_group_name.nil?
222
214
  fail ArgumentError, 'account_name is nil' if account_name.nil?
223
215
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MaxLength': '64'" if !account_name.nil? && account_name.length > 64
224
216
  fail ArgumentError, "'account_name' should satisfy the constraint - 'MinLength': '2'" if !account_name.nil? && account_name.length < 2
225
217
  fail ArgumentError, "'account_name' should satisfy the constraint - 'Pattern': '^[a-zA-Z0-9][a-zA-Z0-9_.-]*$'" if !account_name.nil? && account_name.match(Regexp.new('^^[a-zA-Z0-9][a-zA-Z0-9_.-]*$$')).nil?
218
+ fail ArgumentError, 'account is nil' if account.nil?
226
219
  fail ArgumentError, '@client.api_version is nil' if @client.api_version.nil?
227
220
  fail ArgumentError, '@client.subscription_id is nil' if @client.subscription_id.nil?
228
221
 
229
- parameters = CognitiveServicesAccountUpdateParameters.new
230
- unless sku.nil? && tags.nil? && properties.nil?
231
- parameters.sku = sku
232
- parameters.tags = tags
233
- parameters.properties = properties
234
- end
235
222
 
236
223
  request_headers = {}
237
224
  request_headers['Content-Type'] = 'application/json; charset=utf-8'
@@ -241,8 +228,8 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
241
228
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
242
229
 
243
230
  # Serialize Request
244
- request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccountUpdateParameters.mapper()
245
- request_content = @client.serialize(request_mapper, parameters)
231
+ request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccount.mapper()
232
+ request_content = @client.serialize(request_mapper, account)
246
233
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
247
234
 
248
235
  path_template = 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}'
@@ -263,7 +250,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
263
250
  http_response = result.response
264
251
  status_code = http_response.status
265
252
  response_content = http_response.body
266
- unless status_code == 200
253
+ unless status_code == 200 || status_code == 202
267
254
  error_model = JSON.load(response_content)
268
255
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
269
256
  end
@@ -281,6 +268,16 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
281
268
  fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
282
269
  end
283
270
  end
271
+ # Deserialize Response
272
+ if status_code == 202
273
+ begin
274
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
275
+ result_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CognitiveServicesAccount.mapper()
276
+ result.body = @client.deserialize(result_mapper, parsed_response)
277
+ rescue Exception => e
278
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
279
+ end
280
+ end
284
281
 
285
282
  result
286
283
  end
@@ -362,7 +359,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
362
359
  http_response = result.response
363
360
  status_code = http_response.status
364
361
  response_content = http_response.body
365
- unless status_code == 200 || status_code == 204
362
+ unless status_code == 200 || status_code == 202 || status_code == 204
366
363
  error_model = JSON.load(response_content)
367
364
  fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
368
365
  end
@@ -45,9 +45,6 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
45
45
  # @return [Operations] operations
46
46
  attr_reader :operations
47
47
 
48
- # @return [CheckSkuAvailability] check_sku_availability
49
- attr_reader :check_sku_availability
50
-
51
48
  #
52
49
  # Creates initializes a new instance of the CognitiveServicesManagementClient class.
53
50
  # @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client.
@@ -64,7 +61,6 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
64
61
  @accounts = Accounts.new(self)
65
62
  @resource_skus = ResourceSkus.new(self)
66
63
  @operations = Operations.new(self)
67
- @check_sku_availability = CheckSkuAvailability.new(self)
68
64
  @api_version = '2017-04-18'
69
65
  @accept_language = 'en-US'
70
66
  @long_running_operation_retry_timeout = 30
@@ -130,6 +126,121 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
130
126
  super(request_url, method, path, options)
131
127
  end
132
128
 
129
+ #
130
+ # Check available SKUs.
131
+ #
132
+ # @param location [String] Resource location.
133
+ # @param skus [Array<String>] The SKU of the resource.
134
+ # @param kind [String] The Kind of the resource.
135
+ # @param type [String] The Type of the resource.
136
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
137
+ # will be added to the HTTP request.
138
+ #
139
+ # @return [CheckSkuAvailabilityResultList] operation results.
140
+ #
141
+ def check_sku_availability(location, skus, kind, type, custom_headers:nil)
142
+ response = check_sku_availability_async(location, skus, kind, type, custom_headers:custom_headers).value!
143
+ response.body unless response.nil?
144
+ end
145
+
146
+ #
147
+ # Check available SKUs.
148
+ #
149
+ # @param location [String] Resource location.
150
+ # @param skus [Array<String>] The SKU of the resource.
151
+ # @param kind [String] The Kind of the resource.
152
+ # @param type [String] The Type of the resource.
153
+ # @param custom_headers [Hash{String => String}] A hash of custom headers that
154
+ # will be added to the HTTP request.
155
+ #
156
+ # @return [MsRestAzure::AzureOperationResponse] HTTP response information.
157
+ #
158
+ def check_sku_availability_with_http_info(location, skus, kind, type, custom_headers:nil)
159
+ check_sku_availability_async(location, skus, kind, type, custom_headers:custom_headers).value!
160
+ end
161
+
162
+ #
163
+ # Check available SKUs.
164
+ #
165
+ # @param location [String] Resource location.
166
+ # @param skus [Array<String>] The SKU of the resource.
167
+ # @param kind [String] The Kind of the resource.
168
+ # @param type [String] The Type of the resource.
169
+ # @param [Hash{String => String}] A hash of custom headers that will be added
170
+ # to the HTTP request.
171
+ #
172
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
173
+ #
174
+ def check_sku_availability_async(location, skus, kind, type, custom_headers:nil)
175
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
176
+ fail ArgumentError, 'api_version is nil' if api_version.nil?
177
+ fail ArgumentError, 'location is nil' if location.nil?
178
+ fail ArgumentError, 'skus is nil' if skus.nil?
179
+ fail ArgumentError, 'kind is nil' if kind.nil?
180
+ fail ArgumentError, 'type is nil' if type.nil?
181
+
182
+ parameters = CheckSkuAvailabilityParameter.new
183
+ unless skus.nil? && kind.nil? && type.nil?
184
+ parameters.skus = skus
185
+ parameters.kind = kind
186
+ parameters.type = type
187
+ end
188
+
189
+ request_headers = {}
190
+ request_headers['Content-Type'] = 'application/json; charset=utf-8'
191
+
192
+ # Set Headers
193
+ request_headers['x-ms-client-request-id'] = SecureRandom.uuid
194
+ request_headers['accept-language'] = accept_language unless accept_language.nil?
195
+
196
+ # Serialize Request
197
+ request_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CheckSkuAvailabilityParameter.mapper()
198
+ request_content = self.serialize(request_mapper, parameters)
199
+ request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
200
+
201
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability'
202
+
203
+ request_url = @base_url || self.base_url
204
+
205
+ options = {
206
+ middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
207
+ path_params: {'subscriptionId' => subscription_id,'location' => location},
208
+ query_params: {'api-version' => api_version},
209
+ body: request_content,
210
+ headers: request_headers.merge(custom_headers || {}),
211
+ base_url: request_url
212
+ }
213
+ promise = self.make_request_async(:post, 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
220
+ error_model = JSON.load(response_content)
221
+ fail MsRestAzure::AzureOperationError.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
+ # Deserialize Response
228
+ if status_code == 200
229
+ begin
230
+ parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
231
+ result_mapper = Azure::CognitiveServices::Mgmt::V2017_04_18::Models::CheckSkuAvailabilityResultList.mapper()
232
+ result.body = self.deserialize(result_mapper, parsed_response)
233
+ rescue Exception => e
234
+ fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
235
+ end
236
+ end
237
+
238
+ result
239
+ end
240
+
241
+ promise.execute
242
+ end
243
+
133
244
  #
134
245
  # Check whether a domain is available.
135
246
  #
@@ -170,6 +281,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
170
281
  # @return [Concurrent::Promise] Promise object which holds the HTTP response.
171
282
  #
172
283
  def check_domain_availability_async(subdomain_name, type, custom_headers:nil)
284
+ fail ArgumentError, 'subscription_id is nil' if subscription_id.nil?
173
285
  fail ArgumentError, 'api_version is nil' if api_version.nil?
174
286
  fail ArgumentError, 'subdomain_name is nil' if subdomain_name.nil?
175
287
  fail ArgumentError, 'type is nil' if type.nil?
@@ -192,12 +304,13 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
192
304
  request_content = self.serialize(request_mapper, parameters)
193
305
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil
194
306
 
195
- path_template = 'providers/Microsoft.CognitiveServices/checkDomainAvailability'
307
+ path_template = 'subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability'
196
308
 
197
309
  request_url = @base_url || self.base_url
198
310
 
199
311
  options = {
200
312
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
313
+ path_params: {'subscriptionId' => subscription_id},
201
314
  query_params: {'api-version' => api_version},
202
315
  body: request_content,
203
316
  headers: request_headers.merge(custom_headers || {}),
@@ -241,7 +354,7 @@ module Azure::CognitiveServices::Mgmt::V2017_04_18
241
354
  #
242
355
  def add_telemetry
243
356
  sdk_information = 'azure_mgmt_cognitive_services'
244
- sdk_information = "#{sdk_information}/0.18.3"
357
+ sdk_information = "#{sdk_information}/0.19.0"
245
358
  add_user_agent_information(sdk_information)
246
359
  end
247
360
  end