class Azure::CognitiveServices::LuisAuthoring::V3_0_preview::Settings
Attributes
@return [LuisAuthoringClient] reference to the LuisAuthoringClient
Private Class Methods
Creates and initializes a new instance of the Settings
class. @param client service class for accessing basic functionality.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 17 def initialize(client) @client = client end
Private Instance Methods
Gets the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Array] operation results.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 34 def list(app_id, version_id, custom_headers:nil) response = list_async(app_id, version_id, custom_headers:custom_headers).value! response.body unless response.nil? end
Gets the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 63 def list_async(app_id, version_id, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'app_id is nil' if app_id.nil? fail ArgumentError, 'version_id is nil' if version_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}/versions/{versionId}/settings' 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,'versionId' => version_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: 'AppVersionSettingObjectElementType', type: { name: 'Composite', class_name: 'AppVersionSettingObject' } } } } 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
Gets the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 49 def list_with_http_info(app_id, version_id, custom_headers:nil) list_async(app_id, version_id, custom_headers:custom_headers).value! end
Updates the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param list_of_app_version_setting_object [Array<AppVersionSettingObject>] A list of the updated application version settings. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [OperationStatus] operation results.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 145 def update(app_id, version_id, list_of_app_version_setting_object, custom_headers:nil) response = update_async(app_id, version_id, list_of_app_version_setting_object, custom_headers:custom_headers).value! response.body unless response.nil? end
Updates the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param list_of_app_version_setting_object [Array<AppVersionSettingObject>] A list of the updated application version settings. @param [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [Concurrent::Promise] Promise object which holds the HTTP response.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 178 def update_async(app_id, version_id, list_of_app_version_setting_object, custom_headers:nil) fail ArgumentError, '@client.endpoint is nil' if @client.endpoint.nil? fail ArgumentError, 'app_id is nil' if app_id.nil? fail ArgumentError, 'version_id is nil' if version_id.nil? fail ArgumentError, 'list_of_app_version_setting_object is nil' if list_of_app_version_setting_object.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 = { client_side_validation: true, required: true, serialized_name: 'listOfAppVersionSettingObject', type: { name: 'Sequence', element: { client_side_validation: true, required: false, serialized_name: 'AppVersionSettingObjectElementType', type: { name: 'Composite', class_name: 'AppVersionSettingObject' } } } } request_content = @client.serialize(request_mapper, list_of_app_version_setting_object) request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil path_template = 'apps/{appId}/versions/{versionId}/settings' 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,'versionId' => version_id}, body: request_content, headers: request_headers.merge(custom_headers || {}), base_url: request_url } promise = @client.make_request_async(:put, 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::V3_0_preview::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
Updates the settings in a version of the application.
@param app_id The application ID. @param version_id [String] The version ID. @param list_of_app_version_setting_object [Array<AppVersionSettingObject>] A list of the updated application version settings. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.
@return [MsRestAzure::AzureOperationResponse] HTTP response information.
# File lib/3.0-preview/generated/azure_cognitiveservices_luisauthoring/settings.rb, line 162 def update_with_http_info(app_id, version_id, list_of_app_version_setting_object, custom_headers:nil) update_async(app_id, version_id, list_of_app_version_setting_object, custom_headers:custom_headers).value! end