Class: Infrawrench::JiraNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.jira

Instance Attribute Summary collapse

Instance Method Summary collapse

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.

Parameters:



8486
8487
8488
8489
# File 'lib/infrawrench/client.rb', line 8486

def initialize(transport)
  @transport = transport
  @projects = JiraProjectsNamespace.new(@transport)
end

Instance Attribute Details

#projectsJiraProjectsNamespace (readonly)

Returns client.jira.projects.

Returns:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Ok — see sig/infrawrench/sdk.rbs.

Raises:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as Hash — see sig/infrawrench/sdk.rbs.

Raises:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as CreateJiraIssueInput.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (create_jira_issue_input)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as CreateJiraIssueResult — see sig/infrawrench/sdk.rbs.

Raises:



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: request_options
  )
end

Look up filed issues for a set of findings

Requires permission: jira:read.

GET /api/org/orgId/jira/links

Raises on 400: Bad request

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • source_kind (String, nil) (defaults to: nil)
  • source_id (Array<String>, nil) (defaults to: nil)

    Repeat to narrow to specific findings. Omit to return every link of the kind — this is the batch lookup a list view makes once instead of one request per row.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • source_kind: (jira_source_kind, nil) (defaults to: nil)
  • source_id: (Array[String], nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<JiraIssueLink> — see sig/infrawrench/sdk.rbs.

Raises:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as JiraIntegrationInput.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (jira_integration_input)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as JiraIntegration & Hash — see sig/infrawrench/sdk.rbs.

Raises:



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

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as JiraVerifyInput.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • body: (jira_verify_input, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as JiraVerifyResult — see sig/infrawrench/sdk.rbs.

Raises:



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: request_options
  )
end