class Azure::CognitiveServices::Customvisiontraining::V3_0::CustomvisiontrainingClient

A service client - single point of access to the REST API.

Attributes

accept_language[RW]

@return [String] The preferred language for the response.

api_key[RW]

@return [String] API key.

base_url[R]

@return [String] the base URI of the service.

credentials[R]

@return Credentials needed for the client to connect to Azure.

endpoint[RW]

@return [String] Supported Cognitive Services endpoints.

generate_client_request_id[RW]

@return [Boolean] Whether a unique x-ms-client-request-id should be generated. When set to true a unique x-ms-client-request-id value is generated and included in each request. Default is true.

long_running_operation_retry_timeout[RW]

@return [Integer] The retry timeout in seconds for Long Running Operations. Default value is 30.

Public Class Methods

new(credentials = nil, options = nil) click to toggle source

Creates initializes a new instance of the CustomvisiontrainingClient class. @param credentials [MsRest::ServiceClientCredentials] credentials to authorize HTTP requests made by the service client. @param options [Array] filters to be applied to the HTTP requests.

Calls superclass method
# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 43
def initialize(credentials = nil, options = nil)
  super(credentials, options)
  @base_url = '{Endpoint}/customvision/v3.0/training'

  fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil?
  @credentials = credentials

  @accept_language = 'en-US'
  @long_running_operation_retry_timeout = 30
  @generate_client_request_id = true
  add_telemetry
end

Public Instance Methods

create_image_regions(project_id, batch, custom_headers:nil) click to toggle source

Create a set of image regions.

This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.

@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageRegionCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 745
def create_image_regions(project_id, batch, custom_headers:nil)
  response = create_image_regions_async(project_id, batch, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_image_regions_async(project_id, batch, custom_headers:nil) click to toggle source

Create a set of image regions.

This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.

@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 784
def create_image_regions_async(project_id, batch, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'batch is nil' if batch.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageRegionCreateBatch.mapper()
  request_content = self.serialize(request_mapper,  batch)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/images/regions'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageRegionCreateSummary.mapper()
        result.body = self.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
create_image_regions_with_http_info(project_id, batch, custom_headers:nil) click to toggle source

Create a set of image regions.

This API accepts a batch of image regions, and optionally tags, to update existing images with region information. There is a limit of 64 entries in the batch.

@param project_id The project id. @param batch [ImageRegionCreateBatch] Batch of image regions which include a tag and bounding box. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 765
def create_image_regions_with_http_info(project_id, batch, custom_headers:nil)
  create_image_regions_async(project_id, batch, custom_headers:custom_headers).value!
end
create_image_tags(project_id, batch, custom_headers:nil) click to toggle source

Associate a set of images with a set of tags.

@param project_id The project id. @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageTagCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 544
def create_image_tags(project_id, batch, custom_headers:nil)
  response = create_image_tags_async(project_id, batch, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_image_tags_async(project_id, batch, custom_headers:nil) click to toggle source

Associate a set of images with a set of tags.

@param project_id The project id. @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 575
def create_image_tags_async(project_id, batch, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'batch is nil' if batch.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageTagCreateBatch.mapper()
  request_content = self.serialize(request_mapper,  batch)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/images/tags'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageTagCreateSummary.mapper()
        result.body = self.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
create_image_tags_with_http_info(project_id, batch, custom_headers:nil) click to toggle source

Associate a set of images with a set of tags.

@param project_id The project id. @param batch [ImageTagCreateBatch] Batch of image tags. Limited to 128 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 560
def create_image_tags_with_http_info(project_id, batch, custom_headers:nil)
  create_image_tags_async(project_id, batch, custom_headers:custom_headers).value!
end
create_images_from_data(project_id, image_data, tag_ids:nil, custom_headers:nil) click to toggle source

Add the provided images to the set of training images.

This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param tag_ids The tags ids with which to tag each image. Limited to 20. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1377
def create_images_from_data(project_id, image_data, tag_ids:nil, custom_headers:nil)
  response = create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_images_from_data_async(project_id, image_data, tag_ids:nil, custom_headers:nil) click to toggle source

Add the provided images to the set of training images.

This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param tag_ids The tags ids with which to tag each image. Limited to 20. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1418
def create_images_from_data_async(project_id, image_data, tag_ids:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MaxItems': '20'" if !tag_ids.nil? && tag_ids.length > 20
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MinItems': '0'" if !tag_ids.nil? && tag_ids.length < 0
  fail ArgumentError, 'image_data is nil' if image_data.nil?
  fail ArgumentError, 'api_key is nil' if api_key.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'multipart/form-data'

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

  # Set Form Data
  form_data = {}
  form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?

  path_template = 'projects/{projectId}/images'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      body: URI.encode_www_form(form_data),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageCreateSummary.mapper()
        result.body = self.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
create_images_from_data_with_http_info(project_id, image_data, tag_ids:nil, custom_headers:nil) click to toggle source

Add the provided images to the set of training images.

This API accepts body content as multipart/form-data and application/octet-stream. When using multipart multiple image files can be sent at once, with a maximum of 64 files

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param tag_ids The tags ids with which to tag each image. Limited to 20. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1398
def create_images_from_data_with_http_info(project_id, image_data, tag_ids:nil, custom_headers:nil)
  create_images_from_data_async(project_id, image_data, tag_ids:tag_ids, custom_headers:custom_headers).value!
end
create_images_from_files(project_id, batch, custom_headers:nil) click to toggle source

Add the provided batch of images to the set of training images.

This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1583
def create_images_from_files(project_id, batch, custom_headers:nil)
  response = create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_images_from_files_async(project_id, batch, custom_headers:nil) click to toggle source

Add the provided batch of images to the set of training images.

This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1620
def create_images_from_files_async(project_id, batch, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'batch is nil' if batch.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageFileCreateBatch.mapper()
  request_content = self.serialize(request_mapper,  batch)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/images/files'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageCreateSummary.mapper()
        result.body = self.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
create_images_from_files_with_http_info(project_id, batch, custom_headers:nil) click to toggle source

Add the provided batch of images to the set of training images.

This API accepts a batch of files, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageFileCreateBatch] The batch of image files to add. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1602
def create_images_from_files_with_http_info(project_id, batch, custom_headers:nil)
  create_images_from_files_async(project_id, batch, custom_headers:custom_headers).value!
end
create_images_from_predictions(project_id, batch, custom_headers:nil) click to toggle source

Add the specified predicted images to the set of training images.

This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1807
def create_images_from_predictions(project_id, batch, custom_headers:nil)
  response = create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_images_from_predictions_async(project_id, batch, custom_headers:nil) click to toggle source

Add the specified predicted images to the set of training images.

This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1844
def create_images_from_predictions_async(project_id, batch, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'batch is nil' if batch.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageIdCreateBatch.mapper()
  request_content = self.serialize(request_mapper,  batch)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/images/predictions'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageCreateSummary.mapper()
        result.body = self.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
create_images_from_predictions_with_http_info(project_id, batch, custom_headers:nil) click to toggle source

Add the specified predicted images to the set of training images.

This API creates a batch of images from predicted images specified. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageIdCreateBatch] Image and tag ids. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1826
def create_images_from_predictions_with_http_info(project_id, batch, custom_headers:nil)
  create_images_from_predictions_async(project_id, batch, custom_headers:custom_headers).value!
end
create_images_from_urls(project_id, batch, custom_headers:nil) click to toggle source

Add the provided images urls to the set of training images.

This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageCreateSummary] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1695
def create_images_from_urls(project_id, batch, custom_headers:nil)
  response = create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_images_from_urls_async(project_id, batch, custom_headers:nil) click to toggle source

Add the provided images urls to the set of training images.

This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1732
def create_images_from_urls_async(project_id, batch, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'batch is nil' if batch.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageUrlCreateBatch.mapper()
  request_content = self.serialize(request_mapper,  batch)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/images/urls'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageCreateSummary.mapper()
        result.body = self.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
create_images_from_urls_with_http_info(project_id, batch, custom_headers:nil) click to toggle source

Add the provided images urls to the set of training images.

This API accepts a batch of urls, and optionally tags, to create images. There is a limit of 64 images and 20 tags.

@param project_id The project id. @param batch [ImageUrlCreateBatch] Image urls and tag ids. Limited to 64 images and 20 tags per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1714
def create_images_from_urls_with_http_info(project_id, batch, custom_headers:nil)
  create_images_from_urls_async(project_id, batch, custom_headers:custom_headers).value!
end
create_project(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil) click to toggle source

Create a project.

@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param target_export_platforms [Array<Enum>] List of platforms the trained model is intending exporting to. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Project] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2929
def create_project(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil)
  response = create_project_async(name, description:description, domain_id:domain_id, classification_type:classification_type, target_export_platforms:target_export_platforms, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_project_async(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil) click to toggle source

Create a project.

@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param target_export_platforms [Array<Enum>] List of platforms the trained model is intending exporting to. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2970
def create_project_async(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      query_params: {'name' => name,'description' => description,'domainId' => domain_id,'classificationType' => classification_type,'targetExportPlatforms' => target_export_platforms.nil? ? nil : target_export_platforms.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Project.mapper()
        result.body = self.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
create_project_with_http_info(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil) click to toggle source

Create a project.

@param name [String] Name of the project. @param description [String] The description of the project. @param domain_id The id of the domain to use for this project. Defaults to General. @param classification_type [Enum] The type of classifier to create for this project. Possible values include: 'Multiclass', 'Multilabel' @param target_export_platforms [Array<Enum>] List of platforms the trained model is intending exporting to. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2950
def create_project_with_http_info(name, description:nil, domain_id:nil, classification_type:nil, target_export_platforms:nil, custom_headers:nil)
  create_project_async(name, description:description, domain_id:domain_id, classification_type:classification_type, target_export_platforms:target_export_platforms, custom_headers:custom_headers).value!
end
create_tag(project_id, name, description:nil, type:nil, custom_headers:nil) click to toggle source

Create a tag for the project.

@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Tag] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4606
def create_tag(project_id, name, description:nil, type:nil, custom_headers:nil)
  response = create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
create_tag_async(project_id, name, description:nil, type:nil, custom_headers:nil) click to toggle source

Create a tag for the project.

@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4641
def create_tag_async(project_id, name, description:nil, type:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'name is nil' if name.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/tags'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'name' => name,'description' => description,'type' => type},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Tag.mapper()
        result.body = self.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
create_tag_with_http_info(project_id, name, description:nil, type:nil, custom_headers:nil) click to toggle source

Create a tag for the project.

@param project_id The project id. @param name [String] The tag name. @param description [String] Optional description for the tag. @param type [Enum] Optional type for the tag. Possible values include: 'Regular', 'Negative' @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4624
def create_tag_with_http_info(project_id, name, description:nil, type:nil, custom_headers:nil)
  create_tag_async(project_id, name, description:description, type:type, custom_headers:custom_headers).value!
end
delete_image_regions(project_id, region_ids, custom_headers:nil) click to toggle source

Delete a set of image regions.

@param project_id The project id. @param region_ids Regions to delete. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 854
def delete_image_regions(project_id, region_ids, custom_headers:nil)
  response = delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value!
  nil
end
delete_image_regions_async(project_id, region_ids, custom_headers:nil) click to toggle source

Delete a set of image regions.

@param project_id The project id. @param region_ids Regions to delete. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 883
def delete_image_regions_async(project_id, region_ids, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'region_ids is nil' if region_ids.nil?
  fail ArgumentError, "'region_ids' should satisfy the constraint - 'MaxItems': '64'" if !region_ids.nil? && region_ids.length > 64
  fail ArgumentError, "'region_ids' should satisfy the constraint - 'MinItems': '0'" if !region_ids.nil? && region_ids.length < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/regions'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'regionIds' => region_ids.nil? ? nil : region_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_image_regions_with_http_info(project_id, region_ids, custom_headers:nil) click to toggle source

Delete a set of image regions.

@param project_id The project id. @param region_ids Regions to delete. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 869
def delete_image_regions_with_http_info(project_id, region_ids, custom_headers:nil)
  delete_image_regions_async(project_id, region_ids, custom_headers:custom_headers).value!
end
delete_image_tags(project_id, image_ids, tag_ids, custom_headers:nil) click to toggle source

Remove a set of tags from a set of images.

@param project_id The project id. @param image_ids Image ids. Limited to 64 images. @param tag_ids Tags to be deleted from the specified images. Limited to 20 tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 647
def delete_image_tags(project_id, image_ids, tag_ids, custom_headers:nil)
  response = delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:custom_headers).value!
  nil
end
delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:nil) click to toggle source

Remove a set of tags from a set of images.

@param project_id The project id. @param image_ids Image ids. Limited to 64 images. @param tag_ids Tags to be deleted from the specified images. Limited to 20 tags. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 680
def delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'image_ids is nil' if image_ids.nil?
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MaxItems': '64'" if !image_ids.nil? && image_ids.length > 64
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MinItems': '0'" if !image_ids.nil? && image_ids.length < 0
  fail ArgumentError, 'tag_ids is nil' if tag_ids.nil?
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MaxItems': '20'" if !tag_ids.nil? && tag_ids.length > 20
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MinItems': '0'" if !tag_ids.nil? && tag_ids.length < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/tags'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(','),'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_image_tags_with_http_info(project_id, image_ids, tag_ids, custom_headers:nil) click to toggle source

Remove a set of tags from a set of images.

@param project_id The project id. @param image_ids Image ids. Limited to 64 images. @param tag_ids Tags to be deleted from the specified images. Limited to 20 tags. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 664
def delete_image_tags_with_http_info(project_id, image_ids, tag_ids, custom_headers:nil)
  delete_image_tags_async(project_id, image_ids, tag_ids, custom_headers:custom_headers).value!
end
delete_images(project_id, image_ids, custom_headers:nil) click to toggle source

Delete images from the set of training images.

@param project_id The project id. @param image_ids Ids of the images to be deleted. Limited to 256 images per batch. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1491
def delete_images(project_id, image_ids, custom_headers:nil)
  response = delete_images_async(project_id, image_ids, custom_headers:custom_headers).value!
  nil
end
delete_images_async(project_id, image_ids, custom_headers:nil) click to toggle source

Delete images from the set of training images.

@param project_id The project id. @param image_ids Ids of the images to be deleted. Limited to 256 images per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1522
def delete_images_async(project_id, image_ids, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'image_ids is nil' if image_ids.nil?
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MaxItems': '256'" if !image_ids.nil? && image_ids.length > 256
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MinItems': '0'" if !image_ids.nil? && image_ids.length < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_images_with_http_info(project_id, image_ids, custom_headers:nil) click to toggle source

Delete images from the set of training images.

@param project_id The project id. @param image_ids Ids of the images to be deleted. Limited to 256 images per batch. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1507
def delete_images_with_http_info(project_id, image_ids, custom_headers:nil)
  delete_images_async(project_id, image_ids, custom_headers:custom_headers).value!
end
delete_iteration(project_id, iteration_id, custom_headers:nil) click to toggle source

Delete a specific iteration of a project.

@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3611
def delete_iteration(project_id, iteration_id, custom_headers:nil)
  response = delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
  nil
end
delete_iteration_async(project_id, iteration_id, custom_headers:nil) click to toggle source

Delete a specific iteration of a project.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3640
def delete_iteration_async(project_id, iteration_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_iteration_with_http_info(project_id, iteration_id, custom_headers:nil) click to toggle source

Delete a specific iteration of a project.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3626
def delete_iteration_with_http_info(project_id, iteration_id, custom_headers:nil)
  delete_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
end
delete_prediction(project_id, ids, custom_headers:nil) click to toggle source

Delete a set of predicted images and their associated prediction results.

@param project_id The project id. @param ids The prediction ids. Limited to 64. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2019
def delete_prediction(project_id, ids, custom_headers:nil)
  response = delete_prediction_async(project_id, ids, custom_headers:custom_headers).value!
  nil
end
delete_prediction_async(project_id, ids, custom_headers:nil) click to toggle source

Delete a set of predicted images and their associated prediction results.

@param project_id The project id. @param ids The prediction ids. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2048
def delete_prediction_async(project_id, ids, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'ids is nil' if ids.nil?
  fail ArgumentError, "'ids' should satisfy the constraint - 'MaxItems': '64'" if !ids.nil? && ids.length > 64
  fail ArgumentError, "'ids' should satisfy the constraint - 'MinItems': '0'" if !ids.nil? && ids.length < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/predictions'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'ids' => ids.nil? ? nil : ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_prediction_with_http_info(project_id, ids, custom_headers:nil) click to toggle source

Delete a set of predicted images and their associated prediction results.

@param project_id The project id. @param ids The prediction ids. Limited to 64. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2034
def delete_prediction_with_http_info(project_id, ids, custom_headers:nil)
  delete_prediction_async(project_id, ids, custom_headers:custom_headers).value!
end
delete_project(project_id, custom_headers:nil) click to toggle source

Delete a specific project.

@param project_id The project id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3120
def delete_project(project_id, custom_headers:nil)
  response = delete_project_async(project_id, custom_headers:custom_headers).value!
  nil
end
delete_project_async(project_id, custom_headers:nil) click to toggle source

Delete a specific project.

@param project_id The project 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3147
def delete_project_async(project_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_project_with_http_info(project_id, custom_headers:nil) click to toggle source

Delete a specific project.

@param project_id The project 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3134
def delete_project_with_http_info(project_id, custom_headers:nil)
  delete_project_async(project_id, custom_headers:custom_headers).value!
end
delete_tag(project_id, tag_id, custom_headers:nil) click to toggle source

Delete a tag from the project.

@param project_id The project id. @param tag_id Id of the tag to be deleted. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4307
def delete_tag(project_id, tag_id, custom_headers:nil)
  response = delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value!
  nil
end
delete_tag_async(project_id, tag_id, custom_headers:nil) click to toggle source

Delete a tag from the project.

@param project_id The project id. @param tag_id Id of the tag to be deleted. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4336
def delete_tag_async(project_id, tag_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'tag_id is nil' if tag_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/tags/{tagId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'tagId' => tag_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
delete_tag_with_http_info(project_id, tag_id, custom_headers:nil) click to toggle source

Delete a tag from the project.

@param project_id The project id. @param tag_id Id of the tag to be deleted. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4322
def delete_tag_with_http_info(project_id, tag_id, custom_headers:nil)
  delete_tag_async(project_id, tag_id, custom_headers:custom_headers).value!
end
export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) click to toggle source

Export a trained iteration.

@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM' @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Export] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4105
def export_iteration(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
  response = export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
export_iteration_async(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) click to toggle source

Export a trained iteration.

@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM' @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4142
def export_iteration_async(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'platform is nil' if platform.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/export'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      query_params: {'platform' => platform,'flavor' => flavor},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Export.mapper()
        result.body = self.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
export_iteration_with_http_info(project_id, iteration_id, platform, flavor:nil, custom_headers:nil) click to toggle source

Export a trained iteration.

@param project_id The project id. @param iteration_id The iteration id. @param platform [Enum] The target platform. Possible values include: 'CoreML', 'TensorFlow', 'DockerFile', 'ONNX', 'VAIDK' @param flavor [Enum] The flavor of the target platform. Possible values include: 'Linux', 'Windows', 'ONNX10', 'ONNX12', 'ARM' @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4124
def export_iteration_with_http_info(project_id, iteration_id, platform, flavor:nil, custom_headers:nil)
  export_iteration_async(project_id, iteration_id, platform, flavor:flavor, custom_headers:custom_headers).value!
end
get_domain(domain_id, custom_headers:nil) click to toggle source

Get information about a specific domain.

@param domain_id The id of the domain to get information about. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Domain] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 223
def get_domain(domain_id, custom_headers:nil)
  response = get_domain_async(domain_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_domain_async(domain_id, custom_headers:nil) click to toggle source

Get information about a specific domain.

@param domain_id The id of the domain to get information about. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 250
def get_domain_async(domain_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'domain_id is nil' if domain_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'domains/{domainId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'domainId' => domain_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Domain.mapper()
        result.body = self.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_domain_with_http_info(domain_id, custom_headers:nil) click to toggle source

Get information about a specific domain.

@param domain_id The id of the domain to get information about. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 237
def get_domain_with_http_info(domain_id, custom_headers:nil)
  get_domain_async(domain_id, custom_headers:custom_headers).value!
end
get_domains(custom_headers:nil) click to toggle source

Get a list of the available domains.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 122
def get_domains(custom_headers:nil)
  response = get_domains_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_domains_async(custom_headers:nil) click to toggle source

Get a list of the available domains.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 147
def get_domains_async(custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'domains'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'DomainElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Domain'
                }
            }
          }
        }
        result.body = self.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_domains_with_http_info(custom_headers:nil) click to toggle source

Get a list of the available domains.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 135
def get_domains_with_http_info(custom_headers:nil)
  get_domains_async(custom_headers:custom_headers).value!
end
get_exports(project_id, iteration_id, custom_headers:nil) click to toggle source

Get the list of exports for a specific iteration.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3992
def get_exports(project_id, iteration_id, custom_headers:nil)
  response = get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_exports_async(project_id, iteration_id, custom_headers:nil) click to toggle source

Get the list of exports for a specific iteration.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4021
def get_exports_async(project_id, iteration_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/export'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ExportElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Export'
                }
            }
          }
        }
        result.body = self.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_exports_with_http_info(project_id, iteration_id, custom_headers:nil) click to toggle source

Get the list of exports for a specific iteration.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4007
def get_exports_with_http_info(project_id, iteration_id, custom_headers:nil)
  get_exports_async(project_id, iteration_id, custom_headers:custom_headers).value!
end
get_image_performance_count(project_id, iteration_id, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Number] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2706
def get_image_performance_count(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
  response = get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_image_performance_count_async(project_id, iteration_id, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2751
def get_image_performance_count_async(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images/count'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'Number'
          }
        }
        result.body = self.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_image_performance_count_with_http_info(project_id, iteration_id, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds} that have prediction results from training for the provided iteration {iterationId}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2729
def get_image_performance_count_with_http_info(project_id, iteration_id, tag_ids:nil, custom_headers:nil)
  get_image_performance_count_async(project_id, iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
end
get_image_performances(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get image with its prediction for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2552
def get_image_performances(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  response = get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_image_performances_async(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get image with its prediction for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2613
def get_image_performances_async(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MaxItems': '20'" if !tag_ids.nil? && tag_ids.length > 20
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MinItems': '0'" if !tag_ids.nil? && tag_ids.length < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '256'" if !take.nil? && take > 256
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/performance/images'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      query_params: {'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ImagePerformanceElementType',
                type: {
                  name: 'Composite',
                  class_name: 'ImagePerformance'
                }
            }
          }
        }
        result.body = self.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_image_performances_with_http_info(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get image with its prediction for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2583
def get_image_performances_with_http_info(project_id, iteration_id, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  get_image_performances_async(project_id, iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
end
get_image_region_proposals(project_id, image_id, custom_headers:nil) click to toggle source

Get region proposals for an image. Returns empty array if no proposals are found.

This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.

@param project_id The project id. @param image_id The image id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImageRegionProposal] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1919
def get_image_region_proposals(project_id, image_id, custom_headers:nil)
  response = get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_image_region_proposals_async(project_id, image_id, custom_headers:nil) click to toggle source

Get region proposals for an image. Returns empty array if no proposals are found.

This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.

@param project_id The project id. @param image_id The image 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1956
def get_image_region_proposals_async(project_id, image_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'image_id is nil' if image_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/{imageId}/regionproposals'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'imageId' => image_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageRegionProposal.mapper()
        result.body = self.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_image_region_proposals_with_http_info(project_id, image_id, custom_headers:nil) click to toggle source

Get region proposals for an image. Returns empty array if no proposals are found.

This API will get region proposals for an image along with confidences for the region. It returns an empty array if no proposals are found.

@param project_id The project id. @param image_id The image 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1938
def get_image_region_proposals_with_http_info(project_id, image_id, custom_headers:nil)
  get_image_region_proposals_async(project_id, image_id, custom_headers:custom_headers).value!
end
get_images_by_ids(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) click to toggle source

Get images by id for a given project iteration.

This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param image_ids The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1250
def get_images_by_ids(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
  response = get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_images_by_ids_async(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) click to toggle source

Get images by id for a given project iteration.

This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param image_ids The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1289
def get_images_by_ids_async(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MaxItems': '256'" if !image_ids.nil? && image_ids.length > 256
  fail ArgumentError, "'image_ids' should satisfy the constraint - 'MinItems': '0'" if !image_ids.nil? && image_ids.length < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/id'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'imageIds' => image_ids.nil? ? nil : image_ids.join(','),'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ImageElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Image'
                }
            }
          }
        }
        result.body = self.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_images_by_ids_with_http_info(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil) click to toggle source

Get images by id for a given project iteration.

This API will return a set of Images for the specified tags and optionally iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param image_ids The list of image ids to retrieve. Limited to 256. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1270
def get_images_by_ids_with_http_info(project_id, image_ids:nil, iteration_id:nil, custom_headers:nil)
  get_images_by_ids_async(project_id, image_ids:image_ids, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
get_iteration(project_id, iteration_id, custom_headers:nil) click to toggle source

Get a specific iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Iteration] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3519
def get_iteration(project_id, iteration_id, custom_headers:nil)
  response = get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_iteration_async(project_id, iteration_id, custom_headers:nil) click to toggle source

Get a specific iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3548
def get_iteration_async(project_id, iteration_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Iteration.mapper()
        result.body = self.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_iteration_performance(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) click to toggle source

Get detailed performance information about an iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [IterationPerformance] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2436
def get_iteration_performance(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
  response = get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_iteration_performance_async(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) click to toggle source

Get detailed performance information about an iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2471
def get_iteration_performance_async(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/performance'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      query_params: {'threshold' => threshold,'overlapThreshold' => overlap_threshold},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::IterationPerformance.mapper()
        result.body = self.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_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil) click to toggle source

Get detailed performance information about an iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @param threshold [Float] The threshold used to determine true predictions. @param overlap_threshold [Float] If applicable, the bounding box overlap threshold used to determine true predictions. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2454
def get_iteration_performance_with_http_info(project_id, iteration_id, threshold:nil, overlap_threshold:nil, custom_headers:nil)
  get_iteration_performance_async(project_id, iteration_id, threshold:threshold, overlap_threshold:overlap_threshold, custom_headers:custom_headers).value!
end
get_iteration_with_http_info(project_id, iteration_id, custom_headers:nil) click to toggle source

Get a specific iteration.

@param project_id The id of the project the iteration belongs to. @param iteration_id The id of the iteration to get. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3534
def get_iteration_with_http_info(project_id, iteration_id, custom_headers:nil)
  get_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
end
get_iterations(project_id, custom_headers:nil) click to toggle source

Get iterations for the project.

@param project_id The project 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3413
def get_iterations(project_id, custom_headers:nil)
  response = get_iterations_async(project_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_iterations_async(project_id, custom_headers:nil) click to toggle source

Get iterations for the project.

@param project_id The project 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3440
def get_iterations_async(project_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'IterationElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Iteration'
                }
            }
          }
        }
        result.body = self.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_iterations_with_http_info(project_id, custom_headers:nil) click to toggle source

Get iterations for the project.

@param project_id The project 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3427
def get_iterations_with_http_info(project_id, custom_headers:nil)
  get_iterations_async(project_id, custom_headers:custom_headers).value!
end
get_project(project_id, custom_headers:nil) click to toggle source

Get a specific project.

@param project_id The id of the project to get. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Project] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3032
def get_project(project_id, custom_headers:nil)
  response = get_project_async(project_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_project_async(project_id, custom_headers:nil) click to toggle source

Get a specific project.

@param project_id The id of the project to get. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3059
def get_project_async(project_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Project.mapper()
        result.body = self.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_project_with_http_info(project_id, custom_headers:nil) click to toggle source

Get a specific project.

@param project_id The id of the project to get. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3046
def get_project_with_http_info(project_id, custom_headers:nil)
  get_project_async(project_id, custom_headers:custom_headers).value!
end
get_projects(custom_headers:nil) click to toggle source

Get your projects.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2821
def get_projects(custom_headers:nil)
  response = get_projects_async(custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_projects_async(custom_headers:nil) click to toggle source

Get your projects.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2846
def get_projects_async(custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ProjectElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Project'
                }
            }
          }
        }
        result.body = self.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_projects_with_http_info(custom_headers:nil) click to toggle source

Get your projects.

@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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2834
def get_projects_with_http_info(custom_headers:nil)
  get_projects_async(custom_headers:custom_headers).value!
end
get_tag(project_id, tag_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get information about a specific tag.

@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Tag] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4210
def get_tag(project_id, tag_id, iteration_id:nil, custom_headers:nil)
  response = get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_tag_async(project_id, tag_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get information about a specific tag.

@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4243
def get_tag_async(project_id, tag_id, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'tag_id is nil' if tag_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/tags/{tagId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'tagId' => tag_id},
      query_params: {'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Tag.mapper()
        result.body = self.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_tag_with_http_info(project_id, tag_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get information about a specific tag.

@param project_id The project this tag belongs to. @param tag_id The tag id. @param iteration_id The iteration to retrieve this tag from. Optional, defaults to current training set. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4227
def get_tag_with_http_info(project_id, tag_id, iteration_id:nil, custom_headers:nil)
  get_tag_async(project_id, tag_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Number] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 319
def get_tagged_image_count(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
  response = get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_tagged_image_count_async(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 360
def get_tagged_image_count_async(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/tagged/count'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(',')},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'Number'
          }
        }
        result.body = self.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_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil) click to toggle source

Gets the number of images tagged with the provided {tagIds}.

The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images to count. Defaults to all tags when null. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 340
def get_tagged_image_count_with_http_info(project_id, iteration_id:nil, tag_ids:nil, custom_headers:nil)
  get_tagged_image_count_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, custom_headers:custom_headers).value!
end
get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get tagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 956
def get_tagged_images(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  response = get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_tagged_images_async(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get tagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1017
def get_tagged_images_async(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MaxItems': '20'" if !tag_ids.nil? && tag_ids.length > 20
  fail ArgumentError, "'tag_ids' should satisfy the constraint - 'MinItems': '0'" if !tag_ids.nil? && tag_ids.length < 0
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '256'" if !take.nil? && take > 256
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/tagged'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id,'tagIds' => tag_ids.nil? ? nil : tag_ids.join(','),'orderBy' => order_by,'take' => take,'skip' => skip},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ImageElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Image'
                }
            }
          }
        }
        result.body = self.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_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get tagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch. The filtering is on an and/or relationship. For example, if the provided tag ids are for the “Dog” and “Cat” tags, then only images tagged with Dog and/or Cat will be returned

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param tag_ids A list of tags ids to filter the images. Defaults to all tagged images when null. Limited to 20. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 987
def get_tagged_images_with_http_info(project_id, iteration_id:nil, tag_ids:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  get_tagged_images_async(project_id, iteration_id:iteration_id, tag_ids:tag_ids, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
end
get_tags(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get the tags for a given project and iteration.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4494
def get_tags(project_id, iteration_id:nil, custom_headers:nil)
  response = get_tags_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_tags_async(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get the tags for a given project and iteration.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4523
def get_tags_async(project_id, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/tags'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'TagElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Tag'
                }
            }
          }
        }
        result.body = self.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_tags_with_http_info(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Get the tags for a given project and iteration.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4509
def get_tags_with_http_info(project_id, iteration_id:nil, custom_headers:nil)
  get_tags_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
get_untagged_image_count(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Gets the number of untagged images.

This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Number] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 435
def get_untagged_image_count(project_id, iteration_id:nil, custom_headers:nil)
  response = get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_untagged_image_count_async(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Gets the number of untagged images.

This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 472
def get_untagged_image_count_async(project_id, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/untagged/count'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'Number'
          }
        }
        result.body = self.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_untagged_image_count_with_http_info(project_id, iteration_id:nil, custom_headers:nil) click to toggle source

Gets the number of untagged images.

This API returns the images which have no tags for a given project and optionally an iteration. If no iteration is specified the current workspace is used.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 454
def get_untagged_image_count_with_http_info(project_id, iteration_id:nil, custom_headers:nil)
  get_untagged_image_count_async(project_id, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
get_untagged_images(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get untagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1112
def get_untagged_images(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  response = get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
get_untagged_images_async(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get untagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1163
def get_untagged_images_async(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMaximum': '256'" if !take.nil? && take > 256
  fail ArgumentError, "'take' should satisfy the constraint - 'InclusiveMinimum': '0'" if !take.nil? && take < 0
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/images/untagged'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id,'orderBy' => order_by,'take' => take,'skip' => skip},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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?
    # 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: 'ImageElementType',
                type: {
                  name: 'Composite',
                  class_name: 'Image'
                }
            }
          }
        }
        result.body = self.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_untagged_images_with_http_info(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil) click to toggle source

Get untagged images for a given project iteration.

This API supports batching and range selection. By default it will only return first 50 images matching images. Use the {take} and {skip} parameters to control how many images to return in a given batch.

@param project_id The project id. @param iteration_id The iteration id. Defaults to workspace. @param order_by [Enum] The ordering. Defaults to newest. Possible values include: 'Newest', 'Oldest' @param take [Integer] Maximum number of images to return. Defaults to 50, limited to 256. @param skip [Integer] Number of images to skip before beginning the image batch. Defaults to 0. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 1138
def get_untagged_images_with_http_info(project_id, iteration_id:nil, order_by:nil, take:50, skip:0, custom_headers:nil)
  get_untagged_images_async(project_id, iteration_id:iteration_id, order_by:order_by, take:take, skip:skip, custom_headers:custom_headers).value!
end
make_request(method, path, options = {}) click to toggle source

Makes a request and returns the body of the response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Hash{String=>String}] containing the body of the response. Example:

request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
path = "/path"
options = {
  body: request_content,
  query_params: {'api-version' => '2016-02-01'}
}
result = @client.make_request(:put, path, options)
# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 72
def make_request(method, path, options = {})
  result = make_request_with_http_info(method, path, options)
  result.body unless result.nil?
end
make_request_async(method, path, options = {}) click to toggle source

Makes a request asynchronously. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [Concurrent::Promise] Promise object which holds the HTTP response.

Calls superclass method
# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 97
def make_request_async(method, path, options = {})
  fail ArgumentError, 'method is nil' if method.nil?
  fail ArgumentError, 'path is nil' if path.nil?

  request_url = options[:base_url] || @base_url
  if(!options[:headers].nil? && !options[:headers]['Content-Type'].nil?)
    @request_headers['Content-Type'] = options[:headers]['Content-Type']
  end

  request_headers = @request_headers
  request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
  options.merge!({headers: request_headers.merge(options[:headers] || {})})
  options.merge!({credentials: @credentials}) unless @credentials.nil?

  super(request_url, method, path, options)
end
make_request_with_http_info(method, path, options = {}) click to toggle source

Makes a request and returns the operation response. @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete. @param path [String] the path, relative to {base_url}. @param options [Hash{String=>String}] specifying any request options like :body. @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 84
def make_request_with_http_info(method, path, options = {})
  result = make_request_async(method, path, options).value!
  result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
  result
end
publish_iteration(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil) click to toggle source

Publish a specific iteration.

@param project_id The project id. @param iteration_id The iteration id. @param publish_name [String] The name to give the published iteration. @param prediction_id [String] The id of the prediction resource to publish to. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Boolean] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3801
def publish_iteration(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil)
  response = publish_iteration_async(project_id, iteration_id, publish_name, prediction_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
publish_iteration_async(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil) click to toggle source

Publish a specific iteration.

@param project_id The project id. @param iteration_id The iteration id. @param publish_name [String] The name to give the published iteration. @param prediction_id [String] The id of the prediction resource to publish to. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3836
def publish_iteration_async(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'publish_name is nil' if publish_name.nil?
  fail ArgumentError, 'prediction_id is nil' if prediction_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/publish'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      query_params: {'publishName' => publish_name,'predictionId' => prediction_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # 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: 'Boolean'
          }
        }
        result.body = self.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
publish_iteration_with_http_info(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil) click to toggle source

Publish a specific iteration.

@param project_id The project id. @param iteration_id The iteration id. @param publish_name [String] The name to give the published iteration. @param prediction_id [String] The id of the prediction resource to publish to. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3819
def publish_iteration_with_http_info(project_id, iteration_id, publish_name, prediction_id, custom_headers:nil)
  publish_iteration_async(project_id, iteration_id, publish_name, prediction_id, custom_headers:custom_headers).value!
end
query_predictions(project_id, query, custom_headers:nil) click to toggle source

Get images that were sent to your prediction endpoint.

@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [PredictionQueryResult] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2331
def query_predictions(project_id, query, custom_headers:nil)
  response = query_predictions_async(project_id, query, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
query_predictions_async(project_id, query, custom_headers:nil) click to toggle source

Get images that were sent to your prediction endpoint.

@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2362
def query_predictions_async(project_id, query, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'query is nil' if query.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::PredictionQueryToken.mapper()
  request_content = self.serialize(request_mapper,  query)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/predictions/query'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::PredictionQueryResult.mapper()
        result.body = self.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
query_predictions_with_http_info(project_id, query, custom_headers:nil) click to toggle source

Get images that were sent to your prediction endpoint.

@param project_id The project id. @param query [PredictionQueryToken] Parameters used to query the predictions. Limited to combining 2 tags. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2347
def query_predictions_with_http_info(project_id, query, custom_headers:nil)
  query_predictions_async(project_id, query, custom_headers:custom_headers).value!
end
quick_test_image(project_id, image_data, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image.

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImagePrediction] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2222
def quick_test_image(project_id, image_data, iteration_id:nil, custom_headers:nil)
  response = quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
quick_test_image_async(project_id, image_data, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image.

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2259
def quick_test_image_async(project_id, image_data, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'image_data is nil' if image_data.nil?
  fail ArgumentError, 'api_key is nil' if api_key.nil?


  request_headers = {}
  request_headers['Content-Type'] = 'multipart/form-data'

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

  # Set Form Data
  form_data = {}
  form_data['imageData'] = image_data.to_s unless image_data.to_s.nil?

  path_template = 'projects/{projectId}/quicktest/image'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      body: URI.encode_www_form(form_data),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImagePrediction.mapper()
        result.body = self.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
quick_test_image_url(project_id, image_url, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image url.

@param project_id The project to evaluate against. @param image_url [ImageUrl] An ImageUrl that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [ImagePrediction] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2109
def quick_test_image_url(project_id, image_url, iteration_id:nil, custom_headers:nil)
  response = quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
quick_test_image_url_async(project_id, image_url, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image url.

@param project_id The project to evaluate against. @param image_url [ImageUrl] An ImageUrl that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2146
def quick_test_image_url_async(project_id, image_url, iteration_id:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'image_url is nil' if image_url.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImageUrl.mapper()
  request_content = self.serialize(request_mapper,  image_url)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/quicktest/url'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'iterationId' => iteration_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::ImagePrediction.mapper()
        result.body = self.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
quick_test_image_url_with_http_info(project_id, image_url, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image url.

@param project_id The project to evaluate against. @param image_url [ImageUrl] An ImageUrl that contains the url of the image to be evaluated. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2128
def quick_test_image_url_with_http_info(project_id, image_url, iteration_id:nil, custom_headers:nil)
  quick_test_image_url_async(project_id, image_url, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
quick_test_image_with_http_info(project_id, image_data, iteration_id:nil, custom_headers:nil) click to toggle source

Quick test an image.

@param project_id The project id. @param image_data Binary image data. Supported formats are JPEG, GIF, PNG, and BMP. Supports images up to 6MB. @param iteration_id Optional. Specifies the id of a particular iteration to evaluate against. The default iteration for the project will be used when not specified. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 2241
def quick_test_image_with_http_info(project_id, image_data, iteration_id:nil, custom_headers:nil)
  quick_test_image_async(project_id, image_data, iteration_id:iteration_id, custom_headers:custom_headers).value!
end
train_project(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil) click to toggle source

Queues project for training.

@param project_id The project id. @param training_type [Enum] The type of training to use to train the project (default: Regular). Possible values include: 'Regular', 'Advanced' @param reserved_budget_in_hours [Integer] The number of hours reserved as budget for training (if applicable). @param force_train [Boolean] Whether to force train even if dataset and configuration does not change (default: false). @param notification_email_address [String] The email address to send notification to when training finishes (default: null). @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Iteration] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3307
def train_project(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
  response = train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
train_project_async(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil) click to toggle source

Queues project for training.

@param project_id The project id. @param training_type [Enum] The type of training to use to train the project (default: Regular). Possible values include: 'Regular', 'Advanced' @param reserved_budget_in_hours [Integer] The number of hours reserved as budget for training (if applicable). @param force_train [Boolean] Whether to force train even if dataset and configuration does not change (default: false). @param notification_email_address [String] The email address to send notification to when training finishes (default: null). @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3350
def train_project_async(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/train'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      query_params: {'trainingType' => training_type,'reservedBudgetInHours' => reserved_budget_in_hours,'forceTrain' => force_train,'notificationEmailAddress' => notification_email_address},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Iteration.mapper()
        result.body = self.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
train_project_with_http_info(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil) click to toggle source

Queues project for training.

@param project_id The project id. @param training_type [Enum] The type of training to use to train the project (default: Regular). Possible values include: 'Regular', 'Advanced' @param reserved_budget_in_hours [Integer] The number of hours reserved as budget for training (if applicable). @param force_train [Boolean] Whether to force train even if dataset and configuration does not change (default: false). @param notification_email_address [String] The email address to send notification to when training finishes (default: null). @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3329
def train_project_with_http_info(project_id, training_type:nil, reserved_budget_in_hours:0, force_train:false, notification_email_address:nil, custom_headers:nil)
  train_project_async(project_id, training_type:training_type, reserved_budget_in_hours:reserved_budget_in_hours, force_train:force_train, notification_email_address:notification_email_address, custom_headers:custom_headers).value!
end
unpublish_iteration(project_id, iteration_id, custom_headers:nil) click to toggle source

Unpublish a specific iteration.

@param project_id The project id. @param iteration_id The iteration id. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3909
def unpublish_iteration(project_id, iteration_id, custom_headers:nil)
  response = unpublish_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
  nil
end
unpublish_iteration_async(project_id, iteration_id, custom_headers:nil) click to toggle source

Unpublish a specific iteration.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3938
def unpublish_iteration_async(project_id, iteration_id, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?
  path_template = 'projects/{projectId}/iterations/{iterationId}/publish'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.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 == 204
      error_model = JSON.load(response_content)
      fail MsRestAzure::AzureOperationError.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
  end

  promise.execute
end
unpublish_iteration_with_http_info(project_id, iteration_id, custom_headers:nil) click to toggle source

Unpublish a specific iteration.

@param project_id The project id. @param iteration_id The iteration 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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3924
def unpublish_iteration_with_http_info(project_id, iteration_id, custom_headers:nil)
  unpublish_iteration_async(project_id, iteration_id, custom_headers:custom_headers).value!
end
update_iteration(project_id, iteration_id, updated_iteration, custom_headers:nil) click to toggle source

Update a specific iteration.

@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Iteration] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3695
def update_iteration(project_id, iteration_id, updated_iteration, custom_headers:nil)
  response = update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:nil) click to toggle source

Update a specific iteration.

@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3726
def update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'iteration_id is nil' if iteration_id.nil?
  fail ArgumentError, 'updated_iteration is nil' if updated_iteration.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Iteration.mapper()
  request_content = self.serialize(request_mapper,  updated_iteration)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/iterations/{iterationId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'iterationId' => iteration_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:patch, 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Iteration.mapper()
        result.body = self.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
update_iteration_with_http_info(project_id, iteration_id, updated_iteration, custom_headers:nil) click to toggle source

Update a specific iteration.

@param project_id Project id. @param iteration_id Iteration id. @param updated_iteration [Iteration] The updated iteration model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3711
def update_iteration_with_http_info(project_id, iteration_id, updated_iteration, custom_headers:nil)
  update_iteration_async(project_id, iteration_id, updated_iteration, custom_headers:custom_headers).value!
end
update_project(project_id, updated_project, custom_headers:nil) click to toggle source

Update a specific project.

@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Project] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3200
def update_project(project_id, updated_project, custom_headers:nil)
  response = update_project_async(project_id, updated_project, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_project_async(project_id, updated_project, custom_headers:nil) click to toggle source

Update a specific project.

@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3229
def update_project_async(project_id, updated_project, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'updated_project is nil' if updated_project.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Project.mapper()
  request_content = self.serialize(request_mapper,  updated_project)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:patch, 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Project.mapper()
        result.body = self.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
update_project_with_http_info(project_id, updated_project, custom_headers:nil) click to toggle source

Update a specific project.

@param project_id The id of the project to update. @param updated_project [Project] The updated project model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 3215
def update_project_with_http_info(project_id, updated_project, custom_headers:nil)
  update_project_async(project_id, updated_project, custom_headers:custom_headers).value!
end
update_tag(project_id, tag_id, updated_tag, custom_headers:nil) click to toggle source

Update a tag.

@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @param custom_headers [Hash{String => String}] A hash of custom headers that will be added to the HTTP request.

@return [Tag] operation results.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4391
def update_tag(project_id, tag_id, updated_tag, custom_headers:nil)
  response = update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value!
  response.body unless response.nil?
end
update_tag_async(project_id, tag_id, updated_tag, custom_headers:nil) click to toggle source

Update a tag.

@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4422
def update_tag_async(project_id, tag_id, updated_tag, custom_headers:nil)
  fail ArgumentError, 'endpoint is nil' if endpoint.nil?
  fail ArgumentError, 'project_id is nil' if project_id.nil?
  fail ArgumentError, 'tag_id is nil' if tag_id.nil?
  fail ArgumentError, 'updated_tag is nil' if updated_tag.nil?
  fail ArgumentError, 'api_key is nil' if api_key.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['Training-Key'] = api_key unless api_key.nil?
  request_headers['accept-language'] = accept_language unless accept_language.nil?

  # Serialize Request
  request_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Tag.mapper()
  request_content = self.serialize(request_mapper,  updated_tag)
  request_content = request_content != nil ? JSON.generate(request_content, quirks_mode: true) : nil

  path_template = 'projects/{projectId}/tags/{tagId}'

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

  options = {
      middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
      path_params: {'projectId' => project_id,'tagId' => tag_id},
      body: request_content,
      headers: request_headers.merge(custom_headers || {}),
      base_url: request_url
  }
  promise = self.make_request_async(:patch, 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?
    # Deserialize Response
    if status_code == 200
      begin
        parsed_response = response_content.to_s.empty? ? nil : JSON.load(response_content)
        result_mapper = Azure::CognitiveServices::Customvisiontraining::V3_0::Models::Tag.mapper()
        result.body = self.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
update_tag_with_http_info(project_id, tag_id, updated_tag, custom_headers:nil) click to toggle source

Update a tag.

@param project_id The project id. @param tag_id The id of the target tag. @param updated_tag [Tag] The updated tag model. @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/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4407
def update_tag_with_http_info(project_id, tag_id, updated_tag, custom_headers:nil)
  update_tag_async(project_id, tag_id, updated_tag, custom_headers:custom_headers).value!
end

Private Instance Methods

add_telemetry() click to toggle source

Adds telemetry information.

# File lib/3.0/generated/azure_cognitiveservices_customvisiontraining/customvisiontraining_client.rb, line 4701
def add_telemetry
    sdk_information = 'azure_cognitiveservices_customvisiontraining'
    sdk_information = "#{sdk_information}/0.17.3"
    add_user_agent_information(sdk_information)
end