Help us shape the future of Go! Take the 2026 Go Developer Survey

integrations

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JiraTypeCloudBasic  = "CLOUD_BASIC"
	JiraTypeCloudScoped = "CLOUD_SCOPED"
	JiraTypeOnPremBasic = "ON_PREM_BASIC"
)

Values of the Jira "type" property. The API picks the request shape from it.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDatadogConfigurationRequest

type CreateDatadogConfigurationRequest struct {
	Alias           string   `json:"alias"`
	IsDefault       bool     `json:"isDefault"`
	ApiKey          string   `json:"apiKey"`
	AppKey          string   `json:"appKey"`
	Region          string   `json:"region"`
	Environments    []string `json:"environments"`
	CustomSubdomain string   `json:"customSubdomain,omitempty"`
}

func (CreateDatadogConfigurationRequest) MarshalJSON

func (r CreateDatadogConfigurationRequest) MarshalJSON() ([]byte, error)

MarshalJSON sends an empty list for nil environments, because the API rejects null.

type CreateGitlabConfigurationRequest

type CreateGitlabConfigurationRequest struct {
	Alias                string   `json:"alias"`
	IsDefault            bool     `json:"isDefault"`
	Host                 string   `json:"host,omitempty"`
	PersonalAccessToken  string   `json:"personalAccessToken"`
	HidePersonalProjects bool     `json:"hidePersonalProjects"`
	GroupNames           []string `json:"groupNames"`
}

func (CreateGitlabConfigurationRequest) MarshalJSON

func (r CreateGitlabConfigurationRequest) MarshalJSON() ([]byte, error)

MarshalJSON sends an empty list for nil group names, because the API rejects null.

type CreateIncidentIoConfigurationRequest

type CreateIncidentIoConfigurationRequest struct {
	Alias     string `json:"alias"`
	IsDefault bool   `json:"isDefault"`
	ApiKey    string `json:"apiKey"`
}

type DatadogConfiguration

type DatadogConfiguration struct {
	Alias           string   `json:"alias"`
	IsDefault       bool     `json:"isDefault"`
	Environments    []string `json:"environments"`
	Region          string   `json:"region"`
	CustomSubdomain string   `json:"customSubdomain,omitempty"`
	LastFourApiKey  string   `json:"lastFourApiKey"`
	LastFourAppKey  string   `json:"lastFourAppKey"`
}

DatadogConfiguration is one Datadog integration configuration. The API never returns the full API key or application key, only their last four characters.

func (DatadogConfiguration) GetAlias

func (c DatadogConfiguration) GetAlias() string

type GitlabConfiguration

type GitlabConfiguration struct {
	Alias                string   `json:"alias"`
	Host                 string   `json:"host,omitempty"`
	IsDefault            bool     `json:"isDefault"`
	LastFour             string   `json:"lastFour"`
	HidePersonalProjects bool     `json:"hidePersonalProjects"`
	GroupNames           []string `json:"groupNames"`
}

GitlabConfiguration is a GitLab configuration. The API returns only the last four characters of the token.

func (GitlabConfiguration) GetAlias

func (c GitlabConfiguration) GetAlias() string

type IncidentIoConfiguration

type IncidentIoConfiguration struct {
	Alias     string `json:"alias"`
	IsDefault bool   `json:"isDefault"`
	LastFour  string `json:"lastFour"`
}

IncidentIoConfiguration is an incident.io configuration. The API returns only the last four characters of the key.

func (IncidentIoConfiguration) GetAlias

func (c IncidentIoConfiguration) GetAlias() string

type JiraConfiguration

type JiraConfiguration struct {
	Alias        string `json:"alias"`
	IsDefault    bool   `json:"isDefault"`
	Type         string `json:"type"`
	Subdomain    string `json:"subdomain,omitempty"`
	BaseUrl      string `json:"baseUrl,omitempty"`
	Host         string `json:"host,omitempty"`
	FrontendHost string `json:"frontendHost,omitempty"`
	LastFour     string `json:"lastFour,omitempty"`
	Email        string `json:"email,omitempty"`
	Username     string `json:"username,omitempty"`
}

JiraConfiguration is a Jira configuration. The API never returns the API token, the password, or the cloud ID.

func (JiraConfiguration) GetAlias

func (c JiraConfiguration) GetAlias() string

type JiraConfigurationRequest

type JiraConfigurationRequest struct {
	Type         string `json:"type"`
	Alias        string `json:"alias"`
	IsDefault    bool   `json:"isDefault"`
	Subdomain    string `json:"subdomain,omitempty"`
	Email        string `json:"email,omitempty"`
	ApiToken     string `json:"apiToken,omitempty"`
	BaseUrl      string `json:"baseUrl,omitempty"`
	CloudId      string `json:"cloudId,omitempty"`
	Host         string `json:"host,omitempty"`
	Username     string `json:"username,omitempty"`
	Password     string `json:"password,omitempty"`
	FrontendHost string `json:"frontendHost,omitempty"`
}

JiraConfigurationRequest is the create and update body. Unlike the other integrations, Jira uses one shape for both, because the API selects the update shape by the same "type" property. On update, an omitted field keeps its current value, and the API ignores Host, FrontendHost, and CloudId: they cannot change after creation. Each type uses a subset of the fields; the others stay empty and are not sent. BaseUrl takes the wire values "jira.com", "atlassian.net", or "api.atlassian.com/ex/jira".

type MultiInstanceClient

type MultiInstanceClient[C any, U any, R MultiInstanceConfiguration] struct {
	// contains filtered or unexported fields
}

MultiInstanceClient calls the configuration routes that every multi-instance integration shares.

func (*MultiInstanceClient[C, U, R]) Create

func (c *MultiInstanceClient[C, U, R]) Create(ctx context.Context, alias string, req C) (R, error)

Create calls POST <base>/configuration and returns the new configuration, found by alias in the response. alias must equal the alias in req.

func (*MultiInstanceClient[C, U, R]) Delete

func (c *MultiInstanceClient[C, U, R]) Delete(ctx context.Context, alias string) error

Delete calls DELETE <base>/configuration/:alias.

func (*MultiInstanceClient[C, U, R]) Get

func (c *MultiInstanceClient[C, U, R]) Get(ctx context.Context, alias string) (R, error)

Get finds a configuration by alias in the list response. GET <base>/configuration/:alias returns 400, not 404, for an unknown alias, so the list gives a reliable not-found signal.

func (*MultiInstanceClient[C, U, R]) List

func (c *MultiInstanceClient[C, U, R]) List(ctx context.Context) ([]R, error)

List calls GET <base>/configurations.

func (*MultiInstanceClient[C, U, R]) Update

func (c *MultiInstanceClient[C, U, R]) Update(ctx context.Context, currentAlias string, newAlias string, req U) (R, error)

Update calls PUT <base>/configuration/:currentAlias. The body can rename the configuration: newAlias must equal the alias in req, and the result is found by it.

type MultiInstanceClientInterface

type MultiInstanceClientInterface[C any, U any, R MultiInstanceConfiguration] interface {
	List(ctx context.Context) ([]R, error)
	Get(ctx context.Context, alias string) (R, error)
	Create(ctx context.Context, alias string, req C) (R, error)
	Update(ctx context.Context, currentAlias string, newAlias string, req U) (R, error)
	Delete(ctx context.Context, alias string) error
}

MultiInstanceClientInterface is the API of a multi-instance integration.

func Datadog

Datadog returns the client for the Datadog configurations.

func Gitlab

Gitlab returns the client for the GitLab configurations.

func IncidentIo

IncidentIo returns the client for the incident.io configurations.

func Jira

Jira returns the client for the Jira configurations.

type MultiInstanceConfiguration

type MultiInstanceConfiguration interface {
	GetAlias() string
}

MultiInstanceConfiguration is a configuration of an integration that supports several configurations per tenant.

type PagerDutyConfiguration

type PagerDutyConfiguration struct {
	LastFour        string `json:"lastFour"`
	IsTokenReadonly bool   `json:"isTokenReadonly"`
}

PagerDutyConfiguration is the PagerDuty configuration. The API returns only the last four characters of the token.

type PagerDutyConfigurationRequest

type PagerDutyConfigurationRequest struct {
	Token           string `json:"token"`
	IsTokenReadonly bool   `json:"isTokenReadonly"`
}

PagerDutyConfigurationRequest is the body of POST and PUT /api/v1/pagerduty/configuration. PUT replaces the whole configuration, so it takes the same body as POST.

type SingleInstanceClient

type SingleInstanceClient[C any, R any] struct {
	// contains filtered or unexported fields
}

SingleInstanceClient calls the configuration routes that every single-instance integration shares. A tenant has at most one configuration, so no route takes an alias.

func (*SingleInstanceClient[C, R]) Create

func (c *SingleInstanceClient[C, R]) Create(ctx context.Context, req C) (R, error)

Create calls POST <base>/configuration. The API rejects it when a configuration exists.

func (*SingleInstanceClient[C, R]) Delete

func (c *SingleInstanceClient[C, R]) Delete(ctx context.Context) error

Delete calls DELETE <base>/configurations. The API succeeds also when no configuration exists.

func (*SingleInstanceClient[C, R]) Get

func (c *SingleInstanceClient[C, R]) Get(ctx context.Context) (R, error)

Get calls GET <base>/default-configuration. The API returns 404 when no configuration exists.

func (*SingleInstanceClient[C, R]) Replace

func (c *SingleInstanceClient[C, R]) Replace(ctx context.Context, req C) (R, error)

Replace calls PUT <base>/configuration with the full configuration. The API creates one when none exists.

type SingleInstanceClientInterface

type SingleInstanceClientInterface[C any, R any] interface {
	Get(ctx context.Context) (R, error)
	Create(ctx context.Context, req C) (R, error)
	Replace(ctx context.Context, req C) (R, error)
	Delete(ctx context.Context) error
}

SingleInstanceClientInterface is the API of a single-instance integration.

func PagerDuty

PagerDuty returns the client for the PagerDuty configuration.

type UpdateDatadogConfigurationRequest

type UpdateDatadogConfigurationRequest struct {
	Alias           string   `json:"alias"`
	IsDefault       bool     `json:"isDefault"`
	Environments    []string `json:"environments"`
	ApiKey          string   `json:"apiKey,omitempty"`
	AppKey          string   `json:"appKey,omitempty"`
	Region          string   `json:"region,omitempty"`
	CustomSubdomain string   `json:"customSubdomain,omitempty"`
}

UpdateDatadogConfigurationRequest is the body of an update. Alias is the new alias; the current alias goes in the path. The API keeps the current value of each optional field that the request omits, so an update cannot remove the custom subdomain.

func (UpdateDatadogConfigurationRequest) MarshalJSON

func (r UpdateDatadogConfigurationRequest) MarshalJSON() ([]byte, error)

MarshalJSON sends an empty list for nil environments, because the API rejects null.

type UpdateGitlabConfigurationRequest

type UpdateGitlabConfigurationRequest struct {
	Alias                string   `json:"alias"`
	IsDefault            bool     `json:"isDefault"`
	HidePersonalProjects bool     `json:"hidePersonalProjects"`
	GroupNames           []string `json:"groupNames"`
	PersonalAccessToken  string   `json:"personalAccessToken,omitempty"`
}

UpdateGitlabConfigurationRequest has no host: the API ignores a host on update.

func (UpdateGitlabConfigurationRequest) MarshalJSON

func (r UpdateGitlabConfigurationRequest) MarshalJSON() ([]byte, error)

MarshalJSON sends an empty list for nil group names, because the API rejects null.

type UpdateIncidentIoConfigurationRequest

type UpdateIncidentIoConfigurationRequest struct {
	Alias     string `json:"alias"`
	IsDefault bool   `json:"isDefault"`
	ApiKey    string `json:"apiKey,omitempty"`
}

Jump to

Keyboard shortcuts

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