Class: Harbor2Client::WebhookjobApi

Inherits:
Object
  • Object
show all
Defined in:
lib/harbor2_client/api/webhookjob_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WebhookjobApi

Returns a new instance of WebhookjobApi.



19
20
21
# File 'lib/harbor2_client/api/webhookjob_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/harbor2_client/api/webhookjob_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#list_webhook_jobs(project_name_or_id, policy_id, opts = {}) ⇒ Array<WebhookJob>

List project webhook jobs This endpoint returns webhook jobs of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • policy_id

    The policy ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name. (default to false)

  • :q (String)

    Query string to query resources. Supported query patterns are &quot;exact match(k&#x3D;v)&quot;, &quot;fuzzy match(k&#x3D;~v)&quot;, &quot;range(k&#x3D;)&quot;, &quot;list with union releationship(k&#x3D;v2 v3)&quot; and &quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or &#39;), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q&#x3D;xxx&quot; and splitted by &quot;,&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

  • :status (Array<String>)

    The status of webhook job.

Returns:



35
36
37
38
# File 'lib/harbor2_client/api/webhookjob_api.rb', line 35

def list_webhook_jobs(project_name_or_id, policy_id, opts = {})
  data, _status_code, _headers = list_webhook_jobs_with_http_info(project_name_or_id, policy_id, opts)
  data
end

#list_webhook_jobs_with_http_info(project_name_or_id, policy_id, opts = {}) ⇒ Array<(Array<WebhookJob>, Fixnum, Hash)>

List project webhook jobs This endpoint returns webhook jobs of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • policy_id

    The policy ID.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :x_request_id (String)

    An unique ID for the request

  • :x_is_resource_name (BOOLEAN)

    The flag to indicate whether the parameter which supports both name and id in the path is the name of the resource. When the X-Is-Resource-Name is false and the parameter can be converted to an integer, the parameter will be as an id, otherwise, it will be as a name.

  • :q (String)

    Query string to query resources. Supported query patterns are &quot;exact match(k&#x3D;v)&quot;, &quot;fuzzy match(k&#x3D;~v)&quot;, &quot;range(k&#x3D;)&quot;, &quot;list with union releationship(k&#x3D;v2 v3)&quot; and &quot;list with intersetion relationship(k&#x3D;(v1 v2 v3))&quot;. The value of range and list can be string(enclosed by &quot; or &#39;), integer or time(in format &quot;2020-04-09 02:36:00&quot;). All of these query patterns should be put in the query string &quot;q&#x3D;xxx&quot; and splitted by &quot;,&quot;. e.g. q&#x3D;k1&#x3D;v1,k2&#x3D;~v2,k3&#x3D;

  • :sort (String)

    Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending orderr and field2 in descending order with &quot;sort&#x3D;field1,-field2&quot;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

  • :status (Array<String>)

    The status of webhook job.

Returns:

  • (Array<(Array<WebhookJob>, Fixnum, Hash)>)

    Array<WebhookJob> data, response status code and response headers



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/harbor2_client/api/webhookjob_api.rb', line 53

def list_webhook_jobs_with_http_info(project_name_or_id, policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookjobApi.list_webhook_jobs ...'
  end
  # verify the required parameter 'project_name_or_id' is set
  if @api_client.config.client_side_validation && project_name_or_id.nil?
    fail ArgumentError, "Missing the required parameter 'project_name_or_id' when calling WebhookjobApi.list_webhook_jobs"
  end
  # verify the required parameter 'policy_id' is set
  if @api_client.config.client_side_validation && policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'policy_id' when calling WebhookjobApi.list_webhook_jobs"
  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 WebhookjobApi.list_webhook_jobs, 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 WebhookjobApi.list_webhook_jobs, must be smaller than or equal to 100.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/jobs'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s)

  # query parameters
  query_params = {}
  query_params[:'policy_id'] = policy_id
  query_params[:'q'] = opts[:'q'] if !opts[:'q'].nil?
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
  query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :csv) if !opts[:'status'].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?
  header_params[:'X-Is-Resource-Name'] = opts[:'x_is_resource_name'] if !opts[:'x_is_resource_name'].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<WebhookJob>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookjobApi#list_webhook_jobs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end