Class: Harbor2Client::WebhookApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ WebhookApi

Returns a new instance of WebhookApi.



19
20
21
# File 'lib/harbor2_client/api/webhook_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/webhook_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#create_webhook_policy_of_project(project_name_or_id, policy, opts = {}) ⇒ nil

Create project webhook policy. This endpoint create a webhook policy if the project does not have one.

Parameters:

  • project_name_or_id

    The name or id of the project

  • policy

    Properties "targets" and "event_types" needed.

  • 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)

Returns:

  • (nil)


30
31
32
33
# File 'lib/harbor2_client/api/webhook_api.rb', line 30

def create_webhook_policy_of_project(project_name_or_id, policy, opts = {})
  create_webhook_policy_of_project_with_http_info(project_name_or_id, policy, opts)
  nil
end

#create_webhook_policy_of_project_with_http_info(project_name_or_id, policy, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Create project webhook policy. This endpoint create a webhook policy if the project does not have one.

Parameters:

  • project_name_or_id

    The name or id of the project

  • policy

    Properties &quot;targets&quot; and &quot;event_types&quot; needed.

  • 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.

Returns:

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

    nil, response status code and response headers



43
44
45
46
47
48
49
50
51
52
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
# File 'lib/harbor2_client/api/webhook_api.rb', line 43

def create_webhook_policy_of_project_with_http_info(project_name_or_id, policy, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.create_webhook_policy_of_project ...'
  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 WebhookApi.create_webhook_policy_of_project"
  end
  # verify the required parameter 'policy' is set
  if @api_client.config.client_side_validation && policy.nil?
    fail ArgumentError, "Missing the required parameter 'policy' when calling WebhookApi.create_webhook_policy_of_project"
  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 WebhookApi.create_webhook_policy_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/policies'.sub('{' + 'project_name_or_id' + '}', project_name_or_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?
  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 = @api_client.object_to_http_body(policy)
  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)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#create_webhook_policy_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_webhook_policy_of_project(project_name_or_id, webhook_policy_id, opts = {}) ⇒ nil

Delete webhook policy of a project This endpoint is aimed to delete webhookpolicy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • 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)

Returns:

  • (nil)


99
100
101
102
# File 'lib/harbor2_client/api/webhook_api.rb', line 99

def delete_webhook_policy_of_project(project_name_or_id, webhook_policy_id, opts = {})
  delete_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts)
  nil
end

#delete_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Delete webhook policy of a project This endpoint is aimed to delete webhookpolicy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • 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.

Returns:

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

    nil, response status code and response headers



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/harbor2_client/api/webhook_api.rb', line 112

def delete_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.delete_webhook_policy_of_project ...'
  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 WebhookApi.delete_webhook_policy_of_project"
  end
  # verify the required parameter 'webhook_policy_id' is set
  if @api_client.config.client_side_validation && webhook_policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_policy_id' when calling WebhookApi.delete_webhook_policy_of_project"
  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 WebhookApi.delete_webhook_policy_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'webhook_policy_id' + '}', webhook_policy_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?
  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(: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: WebhookApi#delete_webhook_policy_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_supported_event_types(project_name_or_id, opts = {}) ⇒ SupportedWebhookEventTypes

Get supported event types and notify types. Get supportted event types and notify types.

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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)

Returns:



167
168
169
170
# File 'lib/harbor2_client/api/webhook_api.rb', line 167

def get_supported_event_types(project_name_or_id, opts = {})
  data, _status_code, _headers = get_supported_event_types_with_http_info(project_name_or_id, opts)
  data
end

#get_supported_event_types_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(SupportedWebhookEventTypes, Fixnum, Hash)>

Get supported event types and notify types. Get supportted event types and notify types.

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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.

Returns:

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

    SupportedWebhookEventTypes data, response status code and response headers



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/harbor2_client/api/webhook_api.rb', line 179

def get_supported_event_types_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_supported_event_types ...'
  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 WebhookApi.get_supported_event_types"
  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 WebhookApi.get_supported_event_types, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/events'.sub('{' + 'project_name_or_id' + '}', project_name_or_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?
  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 => 'SupportedWebhookEventTypes')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#get_supported_event_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_webhook_policy_of_project(project_name_or_id, webhook_policy_id, opts = {}) ⇒ WebhookPolicy

Get project webhook policy This endpoint returns specified webhook policy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • 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)

Returns:



232
233
234
235
# File 'lib/harbor2_client/api/webhook_api.rb', line 232

def get_webhook_policy_of_project(project_name_or_id, webhook_policy_id, opts = {})
  data, _status_code, _headers = get_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts)
  data
end

#get_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts = {}) ⇒ Array<(WebhookPolicy, Fixnum, Hash)>

Get project webhook policy This endpoint returns specified webhook policy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • 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.

Returns:

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

    WebhookPolicy data, response status code and response headers



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/harbor2_client/api/webhook_api.rb', line 245

def get_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.get_webhook_policy_of_project ...'
  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 WebhookApi.get_webhook_policy_of_project"
  end
  # verify the required parameter 'webhook_policy_id' is set
  if @api_client.config.client_side_validation && webhook_policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_policy_id' when calling WebhookApi.get_webhook_policy_of_project"
  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 WebhookApi.get_webhook_policy_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'webhook_policy_id' + '}', webhook_policy_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?
  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 => 'WebhookPolicy')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#get_webhook_policy_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#last_trigger(project_name_or_id, opts = {}) ⇒ Array<WebhookLastTrigger>

Get project webhook policy last trigger info This endpoint returns last trigger information of project webhook policy.

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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)

Returns:



301
302
303
304
# File 'lib/harbor2_client/api/webhook_api.rb', line 301

def last_trigger(project_name_or_id, opts = {})
  data, _status_code, _headers = last_trigger_with_http_info(project_name_or_id, opts)
  data
end

#last_trigger_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(Array<WebhookLastTrigger>, Fixnum, Hash)>

Get project webhook policy last trigger info This endpoint returns last trigger information of project webhook policy.

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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.

Returns:

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

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



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/harbor2_client/api/webhook_api.rb', line 313

def last_trigger_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.last_trigger ...'
  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 WebhookApi.last_trigger"
  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 WebhookApi.last_trigger, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/lasttrigger'.sub('{' + 'project_name_or_id' + '}', project_name_or_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?
  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<WebhookLastTrigger>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#last_trigger\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_webhook_policies_of_project(project_name_or_id, opts = {}) ⇒ Array<WebhookPolicy>

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

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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)

  • :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;

  • :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;

  • :page (Integer)

    The page number (default to 1)

  • :page_size (Integer)

    The size of per page (default to 10)

Returns:



369
370
371
372
# File 'lib/harbor2_client/api/webhook_api.rb', line 369

def list_webhook_policies_of_project(project_name_or_id, opts = {})
  data, _status_code, _headers = list_webhook_policies_of_project_with_http_info(project_name_or_id, opts)
  data
end

#list_webhook_policies_of_project_with_http_info(project_name_or_id, opts = {}) ⇒ Array<(Array<WebhookPolicy>, Fixnum, Hash)>

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

Parameters:

  • project_name_or_id

    The name or id of the project

  • 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.

  • :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;

  • :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;

  • :page (Integer)

    The page number

  • :page_size (Integer)

    The size of per page

Returns:

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

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



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/harbor2_client/api/webhook_api.rb', line 385

def list_webhook_policies_of_project_with_http_info(project_name_or_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.list_webhook_policies_of_project ...'
  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 WebhookApi.list_webhook_policies_of_project"
  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 WebhookApi.list_webhook_policies_of_project, 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 WebhookApi.list_webhook_policies_of_project, must be smaller than or equal to 100.'
  end

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

  # query parameters
  query_params = {}
  query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?
  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?
  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<WebhookPolicy>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: WebhookApi#list_webhook_policies_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#update_webhook_policy_of_project(project_name_or_id, webhook_policy_id, policy, opts = {}) ⇒ nil

Update webhook policy of a project. This endpoint is aimed to update the webhook policy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • policy

    All properties needed except &quot;id&quot;, &quot;project_id&quot;, &quot;creation_time&quot;, &quot;update_time&quot;.

  • 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)

Returns:

  • (nil)


447
448
449
450
# File 'lib/harbor2_client/api/webhook_api.rb', line 447

def update_webhook_policy_of_project(project_name_or_id, webhook_policy_id, policy, opts = {})
  update_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, policy, opts)
  nil
end

#update_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, policy, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Update webhook policy of a project. This endpoint is aimed to update the webhook policy of a project.

Parameters:

  • project_name_or_id

    The name or id of the project

  • webhook_policy_id

    The ID of the webhook policy

  • policy

    All properties needed except &quot;id&quot;, &quot;project_id&quot;, &quot;creation_time&quot;, &quot;update_time&quot;.

  • 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.

Returns:

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

    nil, response status code and response headers



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/harbor2_client/api/webhook_api.rb', line 461

def update_webhook_policy_of_project_with_http_info(project_name_or_id, webhook_policy_id, policy, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: WebhookApi.update_webhook_policy_of_project ...'
  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 WebhookApi.update_webhook_policy_of_project"
  end
  # verify the required parameter 'webhook_policy_id' is set
  if @api_client.config.client_side_validation && webhook_policy_id.nil?
    fail ArgumentError, "Missing the required parameter 'webhook_policy_id' when calling WebhookApi.update_webhook_policy_of_project"
  end
  # verify the required parameter 'policy' is set
  if @api_client.config.client_side_validation && policy.nil?
    fail ArgumentError, "Missing the required parameter 'policy' when calling WebhookApi.update_webhook_policy_of_project"
  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 WebhookApi.update_webhook_policy_of_project, the character length must be great than or equal to 1.'
  end

  # resource path
  local_var_path = '/projects/{project_name_or_id}/webhook/policies/{webhook_policy_id}'.sub('{' + 'project_name_or_id' + '}', project_name_or_id.to_s).sub('{' + 'webhook_policy_id' + '}', webhook_policy_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?
  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 = @api_client.object_to_http_body(policy)
  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: WebhookApi#update_webhook_policy_of_project\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end