integrationkey

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 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 DB

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

func NewDB

func NewDB(ctx context.Context, db *sql.DB) (*DB, error)

func (*DB) Authorize

func (db *DB) Authorize(ctx context.Context, tok authtoken.Token, t Type) (context.Context, error)

func (*DB) Create

func (db *DB) Create(ctx context.Context, i *IntegrationKey) (*IntegrationKey, error)

func (*DB) CreateKeyTx

func (db *DB) CreateKeyTx(ctx context.Context, tx *sql.Tx, i *IntegrationKey) (*IntegrationKey, error)

func (*DB) Delete

func (db *DB) Delete(ctx context.Context, id string) error

func (*DB) DeleteManyTx

func (db *DB) DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error

func (*DB) DeleteTx

func (db *DB) DeleteTx(ctx context.Context, tx *sql.Tx, id string) error

func (*DB) FindAllByService

func (db *DB) FindAllByService(ctx context.Context, serviceID string) ([]IntegrationKey, error)

func (*DB) FindOne

func (db *DB) FindOne(ctx context.Context, id string) (*IntegrationKey, error)

func (*DB) GetServiceID

func (db *DB) GetServiceID(ctx context.Context, id string, t Type) (string, error)

type IntegrationKey

type IntegrationKey struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Type      Type   `json:"type"`
	ServiceID string `json:"service_id"`
}

func (IntegrationKey) Normalize

func (i IntegrationKey) Normalize() (*IntegrationKey, error)

type Store

type Store interface {
	Authorize(ctx context.Context, tok authtoken.Token, integrationType Type) (context.Context, error)
	GetServiceID(ctx context.Context, id string, integrationType Type) (string, error)
	Create(ctx context.Context, i *IntegrationKey) (*IntegrationKey, error)
	CreateKeyTx(context.Context, *sql.Tx, *IntegrationKey) (*IntegrationKey, error)
	FindOne(ctx context.Context, id string) (*IntegrationKey, error)
	FindAllByService(ctx context.Context, id string) ([]IntegrationKey, error)
	Delete(ctx context.Context, id string) error
	DeleteTx(ctx context.Context, tx *sql.Tx, id string) error
	DeleteManyTx(ctx context.Context, tx *sql.Tx, ids []string) error
}

type Type

type Type string

Type is the entity that needs an integration.

const (
	TypeGrafana                Type = "grafana"
	TypeSite24x7               Type = "site24x7"
	TypePrometheusAlertmanager Type = "prometheusAlertmanager"
	TypeGeneric                Type = "generic"
	TypeEmail                  Type = "email"
)

Types

func (*Type) Scan

func (s *Type) Scan(value interface{}) error

func (Type) Value

func (s Type) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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