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:



8411
8412
8413
8414
# File 'lib/infrawrench/client.rb', line 8411

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

Instance Attribute Details

#projectsJiraProjectsNamespace (readonly)

Returns client.jira.projects.

Returns:



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

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:



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



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



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



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



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



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