Class: Infrawrench::SlackChannelsNamespace

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

Overview

client.slack.channels

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SlackChannelsNamespace

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 SlackChannelsNamespace.

Parameters:



4591
4592
4593
# File 'lib/infrawrench/client.rb', line 4591

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(org_id: nil, body: nil, request_options: nil) ⇒ Hash

Route alerts to a Slack channel

Adds a channel, or updates the trigger opt-ins of one already added. Each trigger defaults to enabled.

POST /api/org/orgId/slack/channels

Raises on 400: Bad request

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.

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

    Request body, shaped as SlackChannelCreate.

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

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

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

Returns:

  • (Hash)

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

Raises:



4612
4613
4614
4615
4616
4617
4618
4619
4620
# File 'lib/infrawrench/client.rb', line 4612

def create(org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/slack/channels",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#delete(id:, org_id: nil, request_options: nil) ⇒ Hash

Stop routing alerts to a channel

DELETE /api/org/orgId/slack/channels/id

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.

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

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

  • id: (String)
  • 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:



4634
4635
4636
4637
4638
4639
4640
4641
# File 'lib/infrawrench/client.rb', line 4634

def delete(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/slack/channels/{id}",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

#update(id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Change which alerts a channel receives

PATCH /api/org/orgId/slack/channels/id

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.

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

    Request body, shaped as SlackChannelUpdate.

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

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

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

Returns:

  • (Hash)

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

Raises:



4656
4657
4658
4659
4660
4661
4662
4663
4664
# File 'lib/infrawrench/client.rb', line 4656

def update(id:, org_id: nil, body: nil, request_options: nil)
  @transport.request(
    http_method: "PATCH",
    path: "/api/org/{orgId}/slack/channels/{id}",
    path_params: { "orgId" => org_id, "id" => id },
    body: body,
    request_options: request_options
  )
end