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.
8795 8796 8797 8798 |
# File 'lib/infrawrench/client.rb', line 8795 def initialize(transport) @transport = transport @projects = JiraProjectsNamespace.new(@transport) end |
Instance Attribute Details
#projects ⇒ JiraProjectsNamespace (readonly)
Returns client.jira.projects.
8791 8792 8793 |
# File 'lib/infrawrench/client.rb', line 8791 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
8816 8817 8818 8819 8820 8821 8822 8823 |
# File 'lib/infrawrench/client.rb', line 8816 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
8838 8839 8840 8841 8842 8843 8844 8845 |
# File 'lib/infrawrench/client.rb', line 8838 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
8868 8869 8870 8871 8872 8873 8874 8875 8876 |
# File 'lib/infrawrench/client.rb', line 8868 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
8896 8897 8898 8899 8900 8901 8902 8903 8904 |
# File 'lib/infrawrench/client.rb', line 8896 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
8921 8922 8923 8924 8925 8926 8927 8928 8929 |
# File 'lib/infrawrench/client.rb', line 8921 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
8951 8952 8953 8954 8955 8956 8957 8958 8959 |
# File 'lib/infrawrench/client.rb', line 8951 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 |