playbooks

package
v0.0.0-...-8eb6d81 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

Playbook Client

Types

PlaybookTriggerType:
- ID          string
- CreatedAt   time.Time
- UpdatedAt   time.Time
- Name        string
- Description string
- Parameters  Object
PlaybookTrigger:
- ID          string
- Tenant      string
- CreatedAt   time.Time
- UpdatedAt   time.Time
- Name        string
- Description string
- Instance    *PlaybookInstance
- Type        *PlaybookTriggerType
- Config      Object
Playbook:
- ID          string
- Tenant      string
- CreatedAt   time.Time
- UpdatedAt   time.Time
- Name        string
- Description string
- Tags        common.Tags
- Requires    []*connectors.ConnectorInterface // connector interfaces used by playbook dsl
- Categories  []*connectors.ConnectorCategory  // connector categories supported by those types
- Versions    []*PlaybookVersion               // versions in sorted order most recent first
- Head        *PlaybookVersion                 // defaults to most recent version but can be rolled back to a previous version
PlaybookVersion:
- id        string
- CreatedAt time.Time
- CreatedBy string
- playbook  *Playbook
- requires  []*connectors.ConnectorInterface
- inputs    Object
- outputs   Object
- dsl       Object
PlaybookInstance:
- ID          string
- Tenant      string
- CreatedAt   time.Time
- CreatedBy   string
- UpdatedAt   time.Time
- Playbook    *Playbook
- Version     *PlaybookVersion
- Tags        common.Tags
- Trigger     *PlaybookTrigger
- Eenabled    bool
- Inputs      Object
- Retries     *PlaybookRetries
- Connections []*connectors.Connection
PlaybookExecution:
- ID        string
- CreatedAt time.Time
- CreatedBy string
- UpdatedAt time.Time
- Tenant    string
- Instance  *PlaybookInstance
- State     string
- Inputs    Object
- Outputs   Object
PlaybookExecutions:
Executions []*PlaybookExecution
TotalCount int
PlaybookRetries:
- InitialInterval    int
- MaximumInterval    int
- BackoffCoefficient float32
- MaximumRetries     int
- MaximumDuration    int

Functions

  • New(url string, timeout time.Duration) Client
  • GetPlaybook(tenantID string, playbookID string) (*Playbook, error)
  • GetPlaybooks(tenantID string, categoryID *string, tags *common.Tags) ([]*Playbook, error)
  • GetPlaybookInstance(tenantID string, playbookInstanceID string) (*PlaybookInstance, error)
  • GetPlaybookInstances(tenantID string, playbookID string) ([]*PlaybookInstance, error)
  • GetPlaybookExecution(tenantID string, playbookExecutionID string) (*PlaybookExecution, error)
  • GetPlaybookExecutions(tenantID string, playbookInstanceID string, pagination common.Pagination) (*PlaybookExecutions, error)
  • GetPlaybookTriggerType(id *string, name *string) (*PlaybookTriggerType, error)
  • GetPlaybookTriggerTypes() ([]*PlaybookTriggerType, error)
  • GetPlaybookTrigger(tenantID string, playbookTriggerID string) (*PlaybookTrigger, error)
  • GetPlaybookTriggers(triggerTypeIDs []string) ([]*PlaybookTrigger, error)
  • CreatePlaybookInstance(tenantID string, playbookID string, input *PlaybookInstanceInput) (*PlaybookInstance, error)
  • UpdatePlaybookInstance(tenantID string, playbookInstanceID string, input *PlaybookInstanceInput) (*PlaybookInstance, error)
  • DeletePlaybookInstance(tenantID string, playbookInstanceID string) (*PlaybookInstance, error)
  • ExecutePlaybookInstance(tenantID string, playbookInstanceID string, params common.Object) (*PlaybookExecution, error)
  • CreatePlaybook(tenantID string, input *PlaybookInput) (*Playbook, error)
  • ClonePlaybook(tenantID string, playbookID string) (*Playbook, error)
  • UpdatePlaybook(tenantID string, playbookID string, input *PlaybookInput) (*Playbook, error)
  • DeletePlaybook(tenantID string, playbookID string) (*Playbook, error)
  • ExecutePlaybook(tenantID string, playbookID string, parameters common.Object) (*PlaybookExecution, error)
  • SetPlaybookInstanceState(tenantID string, playbookInstanceID string, enabled bool) (*PlaybookInstance, error)
  • PlaybookInstanceCreated(ctx context.Context, playbooks common.IDs) (Subscription, error)
  • PlaybookInstanceUpdated(ctx context.Context, playbooks common.IDs) (Subscription, error)
  • PlaybookInstanceDeleted(ctx context.Context, playbooks common.IDs) (Subscription, error)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(url string, opts ...client.Option) *playbookSvc

Types

type ClonePlaybookInput

type ClonePlaybookInput struct {
	PlaybookID common.ID `json:"playbookId"`
	Name       string    `json:"name"`
}

type Metadata

type Metadata struct {
	ID          string      `json:"id" gorm:"type:uuid;primary_key"`
	CreatedAt   time.Time   `json:"created_at"`
	UpdatedAt   time.Time   `json:"updated_at"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Tags        common.Tags `json:"tags"`
	Sequence    *int64      `json:"sequence,omitempty"`
}

type Playbook

type Playbook struct {
	Metadata   `json:",inline" yaml:",inline"`
	Tenant     string                           `json:"tenant"`
	Requires   []*connectors.ConnectorInterface `json:"requires"`   // connector interfaces used by playbook dsl (Contains only the IDs)
	Categories []*connectors.ConnectorCategory  `json:"categories"` // connector categories supported by those types (Contains only the IDs)
	Versions   []*PlaybookVersion               `json:"versions"`   // versions in sorted order most recent first
	Head       *PlaybookVersion                 `json:"head"`       // defaults to most recent version but can be rolled back to a previous version
	Title      *string                          `json:"title"`
}

Playbook is an entry in catalog of available playbooks"

type PlaybookExecution

type PlaybookExecution struct {
	ID        string            `json:"id"`
	CreatedAt time.Time         `json:"createdAt"`
	CreatedBy string            `json:"createdBy"`
	UpdatedAt time.Time         `json:"updatedAt"`
	Tenant    string            `json:"tenant"`
	Instance  *PlaybookInstance `json:"instance"`
	State     string            `json:"state"`
	Inputs    common.Object     `json:"inputs"`
	Outputs   common.Object     `json:"outputs"`
}

PlaybookExecution represents the state of a current playbook execution

type PlaybookExecutions

type PlaybookExecutions struct {
	Executions []*PlaybookExecution
	TotalCount int
}

type PlaybookInput

type PlaybookInput struct {
	common.ObjectMetaInput
	Head       *common.ID            `json:"head"`
	Version    *PlaybookVersionInput `json:"version"`
	Categories common.IDs            `json:"categories" yaml:"categories"`
	Title      *string               `json:"title,omitempty"`
}

PlaybookInput defines the mutable fields of a playbook. Modifications the version will create a new version

type PlaybookInstance

type PlaybookInstance struct {
	Metadata    `json:",inline" yaml:",inline"`
	Tenant      string                   `json:"tenant"`
	CreatedBy   string                   `json:"createdBy"`
	Playbook    *Playbook                `json:"playbook"`
	Version     *PlaybookVersion         `json:"version"`
	Trigger     *PlaybookTrigger         `json:"trigger"`
	Enabled     bool                     `json:"enabled"`
	Inputs      common.Object            `json:"inputs"`
	Retries     *PlaybookRetries         `json:"retries"`
	Connections []*connectors.Connection `json:"connections"`
}

PlaybookInstance defines the configuration of a playbook in a user account"

type PlaybookInstanceInput

type PlaybookInstanceInput struct {
	common.ObjectMetaInput
	Trigger     PlaybookTriggerInput `json:"trigger"`
	Enabled     bool                 `json:"enabled"`
	Inputs      common.Object        `json:"inputs"`
	Connections common.IDs           `json:"connections"`
}

PlaybookInstanceInput defines the mutable fields of a playbook instance

type PlaybookRetries

type PlaybookRetries struct {
	InitialInterval    int     `json:"initialInterval"`
	MaximumInterval    int     `json:"maximumInterval"`
	BackoffCoefficient float32 `json:"backOffCoefficient"`
	MaximumRetries     int     `json:"maximumRetries"`
	MaximumDuration    int     `json:"maximumDuration"`
}

type PlaybookTrigger

type PlaybookTrigger struct {
	ID          string               `json:"id"`
	Tenant      string               `json:"tenant"`
	CreatedAt   time.Time            `json:"createdAt"`
	UpdatedAt   time.Time            `json:"updatedAt"`
	Name        string               `json:"name"`
	Description string               `json:"description"`
	Instance    *PlaybookInstance    `json:"instance"`
	Type        *PlaybookTriggerType `json:"type"`
	Config      common.Object        `json:"config"`
}

PlaybookTrigger defines a set of attributes common to different trigger types

type PlaybookTriggerInput

type PlaybookTriggerInput struct {
	common.ObjectMetaInput
	TypeID common.ID     `json:"typeId"`
	Config common.Object `json:"config"`
}

type PlaybookTriggerType

type PlaybookTriggerType struct {
	ID          string        `json:"id"`
	CreatedAt   time.Time     `json:"createdAt"`
	UpdatedAt   time.Time     `json:"updatedAt"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Parameters  common.Object `json:"parameters"`
}

PlaybookTriggerType defines an available triggering mechanism

type PlaybookVersion

type PlaybookVersion struct {
	ID        string                           `json:"id"`
	CreatedAt time.Time                        `json:"createdAt"`
	CreatedBy string                           `json:"createdBy"`
	Playbook  *Playbook                        `json:"playbook"`
	Requires  []*connectors.ConnectorInterface `json:"retries"`
	Inputs    common.Object                    `json:"inputs"`
	Outputs   common.Object                    `json:"outputs"`
	Dsl       common.Object                    `json:"dsl"`
}

PlaybookVersion maintains a change record of the playbook definition. Multiple versions of a playbook could be in use concurrently"

type PlaybookVersionInput

type PlaybookVersionInput struct {
	Inputs   common.Object `json:"inputs" yaml:"inputs" gorm:"type:JSONB"`
	Outputs  common.Object `json:"outputs" yaml:"outputs" gorm:"type:JSONB"`
	Requires common.IDs    `json:"requires" yaml:"requires" gorm:"type:uuid[]"`
	DSL      common.Object `json:"dsl" yaml:"dsl" gorm:"type:JSONB"`
}

PlaybookVersionInput defines the mutable fields of a playbook version

type Service

type Service interface {
	GetPlaybook(playbookID string, opts ...graphql.RequestOption) (*Playbook, error)
	GetPlaybooks(categoryID *string, tags *common.Tags, opts ...graphql.RequestOption) ([]*Playbook, error)
	GetPlaybookInstance(playbookInstanceID string, opts ...graphql.RequestOption) (*PlaybookInstance, error)
	GetPlaybookInstances(playbookID *string, opts ...graphql.RequestOption) ([]*PlaybookInstance, error)
	GetPlaybookExecution(playbookExecutionID string, opts ...graphql.RequestOption) (*PlaybookExecution, error)
	GetPlaybookExecutions(playbookInstanceID string, pagination common.Pagination, opts ...graphql.RequestOption) (*PlaybookExecutions, error)
	GetPlaybookTriggerType(id *string, name *string, opts ...graphql.RequestOption) (*PlaybookTriggerType, error)
	GetPlaybookTriggerTypes(opts ...graphql.RequestOption) ([]*PlaybookTriggerType, error)
	GetPlaybookTrigger(playbookTriggerID string, opts ...graphql.RequestOption) (*PlaybookTrigger, error)
	GetPlaybookTriggers(triggerTypeIDs []string, opts ...graphql.RequestOption) ([]*PlaybookTrigger, error)
	CreatePlaybookInstance(playbookID string, input *PlaybookInstanceInput, opts ...graphql.RequestOption) (*PlaybookInstance, error)
	UpdatePlaybookInstance(playbookInstanceID string, input *PlaybookInstanceInput, opts ...graphql.RequestOption) (*PlaybookInstance, error)
	DeletePlaybookInstance(playbookInstanceID string, opts ...graphql.RequestOption) (*PlaybookInstance, error)
	ExecutePlaybookInstance(playbookInstanceID string, params common.Object, opts ...graphql.RequestOption) (*PlaybookExecution, error)
	CreatePlaybook(input *PlaybookInput, opts ...graphql.RequestOption) (*Playbook, error)
	ClonePlaybook(input ClonePlaybookInput, opts ...graphql.RequestOption) (*Playbook, error)
	UpdatePlaybook(playbookID string, input *PlaybookInput, opts ...graphql.RequestOption) (*Playbook, error)
	DeletePlaybook(playbookID string, opts ...graphql.RequestOption) (*Playbook, error)
	ExecutePlaybook(playbookID string, parameters common.Object, opts ...graphql.RequestOption) (*PlaybookExecution, error)
	SetPlaybookInstanceState(playbookInstanceID string, enabled bool, opts ...graphql.RequestOption) (*PlaybookInstance, error)
	PlaybookInstanceCreated(ctx context.Context, playbooks common.IDs, options ...graphql.SubscriptionOption) (Subscription, error)
	PlaybookInstanceUpdated(ctx context.Context, playbooks common.IDs, options ...graphql.SubscriptionOption) (Subscription, error)
	PlaybookInstanceDeleted(ctx context.Context, playbooks common.IDs, options ...graphql.SubscriptionOption) (Subscription, error)
}

type Subscription

type Subscription interface {
	Next(ctx context.Context) (*PlaybookInstance, error)
	io.Closer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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