Class: Infrawrench::JiraNamespace
- Inherits:
-
Object
- Object
- Infrawrench::JiraNamespace
- Defined in:
- lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs
Overview
client.jira
Instance Attribute Summary collapse
-
#projects ⇒ JiraProjectsNamespace
readonly
client.jira.projects.
Instance Method Summary collapse
-
#delete(org_id: nil, request_options: nil) ⇒ Hash
Disconnect Jira.
-
#get(org_id: nil, request_options: nil) ⇒ Hash
Get the org's Jira connection.
-
#initialize(transport) ⇒ JiraNamespace
constructor
private
A new instance of JiraNamespace.
-
#issues(body:, org_id: nil, request_options: nil) ⇒ Hash
File a finding as a Jira issue.
-
#links(org_id: nil, source_kind: nil, source_id: nil, request_options: nil) ⇒ Array<Hash>
Look up filed issues for a set of findings.
-
#update(body:, org_id: nil, request_options: nil) ⇒ Hash
Connect Jira, or update the connection.
-
#verify(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Check Jira credentials.
Constructor Details
#initialize(transport) ⇒ JiraNamespace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of JiraNamespace.
8411 8412 8413 8414 |
# File 'lib/infrawrench/client.rb', line 8411 def initialize(transport) @transport = transport @projects = JiraProjectsNamespace.new(@transport) end |
Instance Attribute Details
#projects ⇒ JiraProjectsNamespace (readonly)
Returns client.jira.projects.
8407 8408 8409 |
# File 'lib/infrawrench/client.rb', line 8407 def projects @projects end |
Instance Method Details
#delete(org_id: nil, request_options: nil) ⇒ Hash
Disconnect Jira
Issue links already recorded are kept, so filed findings stay marked as filed.
Requires permission: jira:write.
DELETE /api/org/orgId/jira
Raises on 404: Not found
8432 8433 8434 8435 8436 8437 8438 8439 |
# File 'lib/infrawrench/client.rb', line 8432 def delete(org_id: nil, request_options: nil) @transport.request( http_method: "DELETE", path: "/api/org/{orgId}/jira", path_params: { "orgId" => org_id }, request_options: ) end |
#get(org_id: nil, request_options: nil) ⇒ Hash
Get the org's Jira connection
The stored API token is never returned; tokenHint stands in for it.
Requires permission: jira:read.
GET /api/org/orgId/jira
8454 8455 8456 8457 8458 8459 8460 8461 |
# File 'lib/infrawrench/client.rb', line 8454 def get(org_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/jira", path_params: { "orgId" => org_id }, request_options: ) end |
#issues(body:, org_id: nil, request_options: nil) ⇒ Hash
File a finding as a Jira issue
Creates the issue, then records the link between it and the finding. The link is what lets a list view show "already filed" instead of offering the button again.
Requires permission: jira:write.
POST /api/org/orgId/jira/issues
Raises on 400: Bad request
Raises on 502: Jira refused to create the issue, or was unreachable
8484 8485 8486 8487 8488 8489 8490 8491 8492 |
# File 'lib/infrawrench/client.rb', line 8484 def issues(body:, org_id: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/jira/issues", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#links(org_id: nil, source_kind: nil, source_id: nil, request_options: nil) ⇒ Array<Hash>
Look up filed issues for a set of findings
Requires permission: jira:read.
GET /api/org/orgId/jira/links
Raises on 400: Bad request
8512 8513 8514 8515 8516 8517 8518 8519 8520 |
# File 'lib/infrawrench/client.rb', line 8512 def links(org_id: nil, source_kind: nil, source_id: nil, request_options: nil) @transport.request( http_method: "GET", path: "/api/org/{orgId}/jira/links", path_params: { "orgId" => org_id }, query: { "sourceKind" => source_kind, "sourceId" => source_id }, request_options: ) end |
#update(body:, org_id: nil, request_options: nil) ⇒ Hash
Connect Jira, or update the connection
Requires permission: jira:write.
PUT /api/org/orgId/jira
Raises on 400: Bad request
8537 8538 8539 8540 8541 8542 8543 8544 8545 |
# File 'lib/infrawrench/client.rb', line 8537 def update(body:, org_id: nil, request_options: nil) @transport.request( http_method: "PUT", path: "/api/org/{orgId}/jira", path_params: { "orgId" => org_id }, body: body, request_options: ) end |
#verify(org_id: nil, body: nil, request_options: nil) ⇒ Hash
Check Jira credentials
Calls GET /rest/api/3/myself on the site, so a wrong email or a revoked token is reported on the settings form rather than on the first attempt to file an issue.
Requires permission: jira:write.
POST /api/org/orgId/jira/verify
Raises on 400: Bad request
Raises on 502: Jira rejected the credentials or was unreachable
8567 8568 8569 8570 8571 8572 8573 8574 8575 |
# File 'lib/infrawrench/client.rb', line 8567 def verify(org_id: nil, body: nil, request_options: nil) @transport.request( http_method: "POST", path: "/api/org/{orgId}/jira/verify", path_params: { "orgId" => org_id }, body: body, request_options: ) end |