client

package
v0.0.0-...-1db89c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client acts likes a manager of the jobs.

func New

func New(cfg *config.Config, pdAPIKey, slackAPIKey string, logger *zap.Logger, opts ...ClientOption) *Client

New creates a Client for Slack & PagerDuty API.

func (*Client) GetMembers

func (c *Client) GetMembers(cfg *config.Members) (*slackduty.Members, error)

GetMembers get all members that should be a member of the usergroup(s) For can specify Slack user and Pagerduty users, teams, services and also schedules.

func (*Client) Run

func (c *Client) Run() error

Run the job.

type ClientOption

type ClientOption func(*options)

ClientOption are options that developers can configure for the Slackduty clients

func WithExternalTrigger

func WithExternalTrigger() ClientOption

WithExternalTrigger should be used when this process is kicked by external resources(e.g. Cloud Scheduler, Unix crontab).

type PagerdutyClient

type PagerdutyClient interface {
	GetScheduledUser(string) ([]pagerduty.User, error)
	GetService(string) ([]pagerduty.User, error)
	GetTeam(string) ([]pagerduty.User, error)
	GetUser(string) (*pagerduty.User, error)
}

PagerdutyClient is a interface that the PagerDuty client should implement

func NewPagerDutyClient

func NewPagerDutyClient(apiKey string) PagerdutyClient

NewPagerDutyClient creates a new PagerDuty API client

type SlackClient

type SlackClient interface {
	CreateUsergroup() error
	GetUser(string) (*slack.User, error)
	GetUsergroups() ([]slack.UserGroup, error)
	UpdateUsergroup(string, string) error
}

SlackClient is a interface that the Slack client should implement

func NewSlackClient

func NewSlackClient(apiKey string) SlackClient

NewSlackClient creates a new Slack API client

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址