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.
8486 8487 8488 8489 |
# File 'lib/infrawrench/client.rb', line 8486 def initialize(transport) @transport = transport @projects = JiraProjectsNamespace.new(@transport) end |
Instance Attribute Details
#projects ⇒ JiraProjectsNamespace (readonly)
Returns client.jira.projects.
8482 8483 8484 |
# File 'lib/infrawrench/client.rb', line 8482 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
8507 8508 8509 8510 8511 8512 8513 8514 |
# File 'lib/infrawrench/client.rb', line 8507 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
8529 8530 8531 8532 8533 8534 8535 8536 |
# File 'lib/infrawrench/client.rb', line 8529 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
8559 8560 8561 8562 8563 8564 8565 8566 8567 |
# File 'lib/infrawrench/client.rb', line 8559 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
8587 8588 8589 8590 8591 8592 8593 8594 8595 |
# File 'lib/infrawrench/client.rb', line 8587 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
8612 8613 8614 8615 8616 8617 8618 8619 8620 |
# File 'lib/infrawrench/client.rb', line 8612 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
8642 8643 8644 8645 8646 8647 8648 8649 8650 |
# File 'lib/infrawrench/client.rb', line 8642 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 |