Class: Azure::CognitiveServices::LuisAuthoring::V2_0::AzureAccounts

Inherits:
Object
  • Object
show all
Includes:
MsRestAzure
Defined in:
lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb

Overview

AzureAccounts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ AzureAccounts

Creates and initializes a new instance of the AzureAccounts class.

Parameters:

  • client

    service class for accessing basic functionality.



17
18
19
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 17

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientLuisAuthoringClient (readonly)

Returns reference to the LuisAuthoringClient.

Returns:



22
23
24
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 22

def client
  @client
end

Instance Method Details

#assign_to_app(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ OperationStatus

apps - Assign a LUIS Azure account to an application

Assigns an Azure account to the application.

information object. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (OperationStatus)

    operation results.



37
38
39
40
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 37

def assign_to_app(app_id, azure_account_info_object:nil, custom_headers:nil)
  response = assign_to_app_async(app_id, azure_account_info_object:, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#assign_to_app_async(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ Concurrent::Promise

apps - Assign a LUIS Azure account to an application

Assigns an Azure account to the application.

information object. to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 72

def assign_to_app_async(app_id, azure_account_info_object:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::AzureAccountInfoObject.mapper()
  request_content = @client.serialize(request_mapper,  )
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/azureaccounts'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:post, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 201
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 201
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#assign_to_app_with_http_info(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

apps - Assign a LUIS Azure account to an application

Assigns an Azure account to the application.

information object. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



55
56
57
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 55

def assign_to_app_with_http_info(app_id, azure_account_info_object:nil, custom_headers:nil)
  assign_to_app_async(app_id, azure_account_info_object:, custom_headers:custom_headers).value!
end

#get_assigned(app_id, custom_headers: nil) ⇒ Array

apps - Get LUIS Azure accounts assigned to the application

Gets the LUIS Azure accounts assigned to the application for the user using his ARM token.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



144
145
146
147
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 144

def get_assigned(app_id, custom_headers:nil)
  response = get_assigned_async(app_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#get_assigned_async(app_id, custom_headers: nil) ⇒ Concurrent::Promise

apps - Get LUIS Azure accounts assigned to the application

Gets the LUIS Azure accounts assigned to the application for the user using his ARM token.

to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 177

def get_assigned_async(app_id, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'apps/{appId}/azureaccounts'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'AzureAccountInfoObjectElementType',
                type: {
                  name: 'Composite',
                  class_name: 'AzureAccountInfoObject'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#get_assigned_with_http_info(app_id, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

apps - Get LUIS Azure accounts assigned to the application

Gets the LUIS Azure accounts assigned to the application for the user using his ARM token.

will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



161
162
163
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 161

def get_assigned_with_http_info(app_id, custom_headers:nil)
  get_assigned_async(app_id, custom_headers:custom_headers).value!
end

#list_user_luisaccounts(custom_headers: nil) ⇒ Array

user - Get LUIS Azure accounts

Gets the LUIS Azure accounts for the user using his ARM token.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (Array)

    operation results.



364
365
366
367
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 364

def list_user_luisaccounts(custom_headers:nil)
  response = list_user_luisaccounts_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#list_user_luisaccounts_async(custom_headers: nil) ⇒ Concurrent::Promise

user - Get LUIS Azure accounts

Gets the LUIS Azure accounts for the user using his ARM token.

to the HTTP request.

Parameters:

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 393

def list_user_luisaccounts_async(custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
  path_template = 'azureaccounts'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:get, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = {
          client_side_validation: true,
          required: false,
          serialized_name: 'parsed_response',
          type: {
            name: 'Sequence',
            element: {
                client_side_validation: true,
                required: false,
                serialized_name: 'AzureAccountInfoObjectElementType',
                type: {
                  name: 'Composite',
                  class_name: 'AzureAccountInfoObject'
                }
            }
          }
        }
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#list_user_luisaccounts_with_http_info(custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

user - Get LUIS Azure accounts

Gets the LUIS Azure accounts for the user using his ARM token.

will be added to the HTTP request.

Parameters:

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



379
380
381
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 379

def list_user_luisaccounts_with_http_info(custom_headers:nil)
  list_user_luisaccounts_async(custom_headers:custom_headers).value!
end

#remove_from_app(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ OperationStatus

apps - Removes an assigned LUIS Azure account from an application

Removes assigned Azure account from the application.

information object. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (OperationStatus)

    operation results.



259
260
261
262
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 259

def remove_from_app(app_id, azure_account_info_object:nil, custom_headers:nil)
  response = remove_from_app_async(app_id, azure_account_info_object:, custom_headers:custom_headers).value!
  response.body unless response.nil?
end

#remove_from_app_async(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ Concurrent::Promise

apps - Removes an assigned LUIS Azure account from an application

Removes assigned Azure account from the application.

information object. to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • A (Hash{String => String})

    hash of custom headers that will be added

Returns:

  • (Concurrent::Promise)

    Promise object which holds the HTTP response.



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 294

def remove_from_app_async(app_id, azure_account_info_object:nil, custom_headers:nil)
  fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil?
  fail ArgumentError, 'app_id is nil' if app_id.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'application/json; charset=utf-8'

  # Set Headers
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::AzureAccountInfoObject.mapper()
  request_content = @client.serialize(request_mapper,  )
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'apps/{appId}/azureaccounts'

  request_url = @base_url || @client.base_url
request_url = request_url.gsub('{Endpoint}', @client.endpoint)

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'appId' => app_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = @client.make_request_async(:delete, path_template, options)

  promise = promise.then do |result|
    http_response = result.response
    status_code = http_response.status
    response_content = http_response.body
    unless status_code == 200
      error_model = JSON.load(response_content)
      fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
    end

    result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
    result.correlation_request_id = http_response['x-ms-correlation-request-id'] unless http_response['x-ms-correlation-request-id'].nil?
    result.client_request_id = http_response['x-ms-client-request-id'] unless http_response['x-ms-client-request-id'].nil?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::LuisAuthoring::V2_0::Models::OperationStatus.mapper()
        result.body = @client.deserialize(result_mapper, parsed_response)
      rescue Exception => e
        fail MsRest::DeserializationError.new('Error occurred in deserializing the response', e.message, e.backtrace, result)
      end
    end

    result
  end

  promise.execute
end

#remove_from_app_with_http_info(app_id, azure_account_info_object: nil, custom_headers: nil) ⇒ MsRestAzure::AzureOperationResponse

apps - Removes an assigned LUIS Azure account from an application

Removes assigned Azure account from the application.

information object. will be added to the HTTP request.

Parameters:

  • app_id

    The application ID.

  • azure_account_info_object (AzureAccountInfoObject) (defaults to: nil)

    The Azure account

  • custom_headers (Hash{String => String}) (defaults to: nil)

    A hash of custom headers that

Returns:

  • (MsRestAzure::AzureOperationResponse)

    HTTP response information.



277
278
279
# File 'lib/2.0/generated/azure_cognitiveservices_luisauthoring/azure_accounts.rb', line 277

def remove_from_app_with_http_info(app_id, azure_account_info_object:nil, custom_headers:nil)
  remove_from_app_async(app_id, azure_account_info_object:, custom_headers:custom_headers).value!
end