class SwaggerClient::RobotApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/harbor_swagger_client/api/robot_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

create_robot(robot, opts = {}) click to toggle source

Create a robot account Create a robot account @param robot The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [RobotCreated]

# File lib/harbor_swagger_client/api/robot_api.rb, line 28
def create_robot(robot, opts = {})
  data, _status_code, _headers = create_robot_with_http_info(robot, opts)
  data
end
create_robot_with_http_info(robot, opts = {}) click to toggle source

Create a robot account Create a robot account @param robot The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(RobotCreated, Fixnum, Hash)>] RobotCreated data, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 39
def create_robot_with_http_info(robot, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.create_robot ...'
  end
  # verify the required parameter 'robot' is set
  if @api_client.config.client_side_validation && robot.nil?
    fail ArgumentError, "Missing the required parameter 'robot' when calling RobotApi.create_robot"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.create_robot, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/robots'

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(robot)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RobotCreated')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#create_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
delete_robot(robot_id, opts = {}) click to toggle source

Delete a robot account This endpoint deletes specific robot account information by robot ID. @param robot_id Robot ID @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [nil]

# File lib/harbor_swagger_client/api/robot_api.rb, line 89
def delete_robot(robot_id, opts = {})
  delete_robot_with_http_info(robot_id, opts)
  nil
end
delete_robot_with_http_info(robot_id, opts = {}) click to toggle source

Delete a robot account This endpoint deletes specific robot account information by robot ID. @param robot_id Robot ID @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 100
def delete_robot_with_http_info(robot_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.delete_robot ...'
  end
  # verify the required parameter 'robot_id' is set
  if @api_client.config.client_side_validation && robot_id.nil?
    fail ArgumentError, "Missing the required parameter 'robot_id' when calling RobotApi.delete_robot"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.delete_robot, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#delete_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_robot_by_id(robot_id, opts = {}) click to toggle source

Get a robot account This endpoint returns specific robot account information by robot ID. @param robot_id Robot ID @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Robot]

# File lib/harbor_swagger_client/api/robot_api.rb, line 149
def get_robot_by_id(robot_id, opts = {})
  data, _status_code, _headers = get_robot_by_id_with_http_info(robot_id, opts)
  data
end
get_robot_by_id_with_http_info(robot_id, opts = {}) click to toggle source

Get a robot account This endpoint returns specific robot account information by robot ID. @param robot_id Robot ID @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(Robot, Fixnum, Hash)>] Robot data, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 160
def get_robot_by_id_with_http_info(robot_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.get_robot_by_id ...'
  end
  # verify the required parameter 'robot_id' is set
  if @api_client.config.client_side_validation && robot_id.nil?
    fail ArgumentError, "Missing the required parameter 'robot_id' when calling RobotApi.get_robot_by_id"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.get_robot_by_id, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Robot')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#get_robot_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_robot(opts = {}) click to toggle source

Get robot account List the robot accounts with the specified level and project. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [String] :q Query string to query resources. Supported query patterns are "exact match(k&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. e.g. q=k1=v1,k2=~v2,k3= @option opts [Integer] :page The page number (default to 1) @option opts [Integer] :page_size The size of per page (default to 10) @return [Array<Robot>]

# File lib/harbor_swagger_client/api/robot_api.rb, line 212
def list_robot(opts = {})
  data, _status_code, _headers = list_robot_with_http_info(opts)
  data
end
list_robot_with_http_info(opts = {}) click to toggle source

Get robot account List the robot accounts with the specified level and project. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @option opts [String] :q Query string to query resources. Supported query patterns are "exact match(k&#x3D;v)", "fuzzy match(k&#x3D;~v)", "range(k=[min~max])", "list with union releationship(k&#x3D;{v1 v2 v3})" and "list with intersetion relationship(k&#x3D;(v1 v2 v3))". The value of range and list can be string(enclosed by " or &#39;), integer or time(in format "2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string "q&#x3D;xxx&quot; and splitted by ",&quot;. e.g. q=k1=v1,k2=~v2,k3= @option opts [Integer] :page The page number @option opts [Integer] :page_size The size of per page @return [Array<(Array<Robot>, Fixnum, Hash)>] Array<Robot> data, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 225
def list_robot_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.list_robot ...'
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.list_robot, the character length must be great than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling RobotApi.list_robot, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/robots'

  # query parameters
  query_params = {}
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Robot>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#list_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
refresh_sec(robot_id, robot_sec, opts = {}) click to toggle source

Refresh the robot secret Refresh the robot secret @param robot_id Robot ID @param robot_sec The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [RobotSec]

# File lib/harbor_swagger_client/api/robot_api.rb, line 279
def refresh_sec(robot_id, robot_sec, opts = {})
  data, _status_code, _headers = refresh_sec_with_http_info(robot_id, robot_sec, opts)
  data
end
refresh_sec_with_http_info(robot_id, robot_sec, opts = {}) click to toggle source

Refresh the robot secret Refresh the robot secret @param robot_id Robot ID @param robot_sec The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(RobotSec, Fixnum, Hash)>] RobotSec data, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 291
def refresh_sec_with_http_info(robot_id, robot_sec, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.refresh_sec ...'
  end
  # verify the required parameter 'robot_id' is set
  if @api_client.config.client_side_validation && robot_id.nil?
    fail ArgumentError, "Missing the required parameter 'robot_id' when calling RobotApi.refresh_sec"
  end
  # verify the required parameter 'robot_sec' is set
  if @api_client.config.client_side_validation && robot_sec.nil?
    fail ArgumentError, "Missing the required parameter 'robot_sec' when calling RobotApi.refresh_sec"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.refresh_sec, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(robot_sec)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'RobotSec')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#refresh_sec\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_robot(robot_id, robot, opts = {}) click to toggle source

Update a robot account This endpoint updates specific robot account information by robot ID. @param robot_id Robot ID @param robot The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [nil]

# File lib/harbor_swagger_client/api/robot_api.rb, line 346
def update_robot(robot_id, robot, opts = {})
  update_robot_with_http_info(robot_id, robot, opts)
  nil
end
update_robot_with_http_info(robot_id, robot, opts = {}) click to toggle source

Update a robot account This endpoint updates specific robot account information by robot ID. @param robot_id Robot ID @param robot The JSON object of a robot account. @param [Hash] opts the optional parameters @option opts [String] :x_request_id An unique ID for the request @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers

# File lib/harbor_swagger_client/api/robot_api.rb, line 358
def update_robot_with_http_info(robot_id, robot, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: RobotApi.update_robot ...'
  end
  # verify the required parameter 'robot_id' is set
  if @api_client.config.client_side_validation && robot_id.nil?
    fail ArgumentError, "Missing the required parameter 'robot_id' when calling RobotApi.update_robot"
  end
  # verify the required parameter 'robot' is set
  if @api_client.config.client_side_validation && robot.nil?
    fail ArgumentError, "Missing the required parameter 'robot' when calling RobotApi.update_robot"
  end
  if @api_client.config.client_side_validation && !opts[:'x_request_id'].nil? && opts[:'x_request_id'].to_s.length < 1
    fail ArgumentError, 'invalid value for "opts[:"x_request_id"]" when calling RobotApi.update_robot, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/robots/{robot_id}'.sub('{' + 'robot_id' + '}', robot_id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'X-Request-Id'] = opts[:'x_request_id'] if !opts[:'x_request_id'].nil?

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(robot)
  auth_names = ['basic']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: RobotApi#update_robot\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end