connectors

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

README

Connectors SDK

Types

Context:
- TenantID     string
- UserID       string
- Connections []*Connection
Connection:
- ID          string             
- CreatedAt   time.Time          
- UpdatedAt   time.Time          
- Name        string           
- Description string             
- Tags        common.Tags           
- Connector   *Connector         
- Actions     []*ConnectorAction 
- AuthType    string             
- AuthURL     *string            
- Config      Object             
- Credentials Object    
ConnectionInput
- Name        string
- Description string  
- Tags        common.Tags 
- Config      Object   
- Credentials Object   
- AuthType    string   
- AuthURL     *string  
- Actions     []string    

Functions

  • New(url string) Client
  • GetConnectionMethod(name string) (*ConnectionMethod, error)
  • GetConnectors(connectorMethodID string) ([]*Connector, error)
  • GetConnections(tenantID string, connectionIDs []string, connectorIDs []string, connectorInterfaceIDs []string) ([]*Connection, error)
  • GetContext(tenantID string, connectionIDs []string, connectorIDs []string, connectorInterfaceIDs []string) (*Context, error)

Documentation

Index

Constants

View Source
const GlobalNamespace = "global"

Variables

Functions

func New

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

Types

type ActionLookup

type ActionLookup struct {
	ConnectorName                     string
	ImplementedConnectorInterfaceName string
	ConnectorInterfaceActionName      string
	Namespace                         string
}

type AuthType

type AuthType string

Enumeration of supported auth types

const (
	AuthTypeNone                    AuthType = "None"
	AuthTypePlatform                AuthType = "Platform"
	AuthTypeRaw                     AuthType = "Raw"
	AuthTypeBasic                   AuthType = "Basic"
	AuthTypeAPIKey                  AuthType = "APIKey"
	AuthTypeClientCerts             AuthType = "ClientCerts"
	AuthTypeOAuthClientCreds        AuthType = "OAuthClientCreds"
	AuthTypeOAuthOwnerPasswordCreds AuthType = "OAuthPassword"
	AuthTypeOAuthAuthCodeCreds      AuthType = "OAuthAuthCode"
)

func (AuthType) IsOAuthType

func (a AuthType) IsOAuthType() bool

func (AuthType) IsValid

func (a AuthType) IsValid() bool

func (AuthType) MarshalGQL

func (a AuthType) MarshalGQL(w io.Writer)

func (AuthType) MarshalJSON

func (a AuthType) MarshalJSON() ([]byte, error)

func (AuthType) String

func (a AuthType) String() string

func (*AuthType) UnmarshalGQL

func (a *AuthType) UnmarshalGQL(v interface{}) error

func (*AuthType) UnmarshalJSON

func (a *AuthType) UnmarshalJSON(v []byte) error

type Connection

type Connection struct {
	ID          string             `json:"id"`
	CreatedAt   time.Time          `json:"createdAt"`
	UpdatedAt   time.Time          `json:"updatedAt"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Tags        common.Tags        `json:"tags,omitempty"`
	Connector   *Connector         `json:"connector,omitempty"`
	Actions     []*ConnectorAction `json:"actions,omitempty"`
	AuthType    AuthType           `json:"authType"`
	AuthURL     *string            `json:"authUrl,omitempty"`
	Config      common.Object      `json:"config,omitempty"`
	Credentials common.Object      `json:"credentials,omitempty"`
	Sequence    *int64             `json:"sequence,omitempty"`
}

Connection is a per-tenant configuration of a connector

type ConnectionInput

type ConnectionInput struct {
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Tags        common.Tags   `json:"tags"`
	Config      common.Object `json:"config"`
	Credentials common.Object `json:"credentials"`
	AuthType    AuthType      `json:"authType"`
	AuthURL     *string       `json:"authUrl"`
	Actions     []string      `json:"actions"`
}

ConnectionInput defines the mutable fields of a connection

type ConnectionMethod

type ConnectionMethod struct {
	ID          string        `json:"id"`
	CreatedAt   time.Time     `json:"createdAt"`
	UpdatedAt   time.Time     `json:"updatedAt"`
	Name        string        `json:"name"`
	Description string        `json:"description"`
	Tags        common.Tags   `json:"tags,omitempty"`
	Parameters  common.Object `json:"parameters,omitempty"`
	GraphQLURL  string        `json:"graphqlUrl"`
	Connectors  []*Connector  `json:"connectors"`
}

ConnectionMethod references a service that implements connectors of a specific connection method (e.g. http, grpc, graphql)

type ConnectionMethodInput

type ConnectionMethodInput struct {
	common.ObjectMetaInput
	URL string
	// contains filtered or unexported fields
}

type Connector

type Connector struct {
	ID          string                       `json:"id"`
	CreatedAt   time.Time                    `json:"createdAt"`
	UpdatedAt   time.Time                    `json:"updatedAt"`
	Name        string                       `json:"name"`
	Description string                       `json:"description"`
	Tags        common.Tags                  `json:"tags,omitempty"`
	Docs        *string                      `json:"documentation,omitempty"`
	Method      *ConnectionMethod            `json:"method,omitempty"`
	Implements  []*ConnectorInterface        `json:"implements,omitempty"`
	Actions     []*ConnectorActionDefinition `json:"actions,omitempty"`
	Connections []*Connection                `json:"connections,omitempty"`
	Parameters  common.Object                `json:"parameters,omitempty"`
	AuthTypes   []AuthType                   `json:"authTypes"`
	Sequence    *int64                       `json:"sequence,omitempty"`
	Title       *string                      `json:"title"`
	TenantID    *string                      `json:"tenant,omitempty"`
}

Connector is an entry in catalog of available connectors (e.g. service now connector based on generic http connector)

func (*Connector) LookupAction

func (c *Connector) LookupAction(name string) *ConnectorAction

type ConnectorAction

type ConnectorAction struct {
	ID          string              `json:"id"`
	CreatedAt   time.Time           `json:"createdAt"`
	UpdatedAt   time.Time           `json:"updatedAt"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Tags        common.Tags         `json:"tags,omitempty"`
	Interface   *ConnectorInterface `json:"interface"`
	Inputs      common.Object       `json:"inputs,omitempty"`
	Outputs     common.Object       `json:"outputs,omitempty"`
}

ConnectorAction defines a method or activity that can be called on a connector and its corresponding input and output

type ConnectorActionDefinition

type ConnectorActionDefinition struct {
	ID        string           `json:"id"`
	Name      string           `json:"name"`
	CreatedAt time.Time        `json:"createdAt"`
	UpdatedAt time.Time        `json:"updatedAt"`
	Action    *ConnectorAction `json:"action"`
	Config    common.Object    `json:"config"`
}

ConnectorActionDefinition defines the configuration of a connector action implementation"

type ConnectorActionDefinitionInput

type ConnectorActionDefinitionInput struct {
	Action common.ID     `json:"action"`
	Config common.Object `json:"config"`
}

ConnectorActionInput defines the mutable fields of a connector action

type ConnectorActionInput

type ConnectorActionInput struct {
	common.ObjectMetaInput
	Inputs  common.Object `json:"inputs"`
	Outputs common.Object `json:"outputs"`
}

ConnectorActionInput defines the mutable fields of a connector action

type ConnectorCategory

type ConnectorCategory struct {
	ID          string      `json:"id"`
	CreatedAt   time.Time   `json:"createdAt"`
	UpdatedAt   time.Time   `json:"updatedAt"`
	Name        string      `json:"name"`
	Description string      `json:"description"`
	Tags        common.Tags `json:"tags,omitempty"`
}

ConnectorCategory is a grouping/categorization of available connectors (e.g. IP reputation services, DNS lookup, etc)

type ConnectorInput

type ConnectorInput struct {
	common.ObjectMetaInput
	Implements    common.IDs                        `json:"implements"`
	Parameters    common.Object                     `json:"parameters"`
	AuthTypes     []AuthType                        `json:"authTypes"`
	AllTenants    *bool                             `json:"allTenants"`
	Actions       []*ConnectorActionDefinitionInput `json:"actions"`
	Documentation *string                           `json:"documentation"`
	Categories    common.IDs                        `json:"categories"`
	Title         *string                           `json:"title"`
}

ConnectorInput defines the mutable fields of a connector

type ConnectorInterface

type ConnectorInterface struct {
	ID          string               `json:"id"`
	CreatedAt   time.Time            `json:"createdAt"`
	UpdatedAt   time.Time            `json:"updatedAt"`
	Name        string               `json:"name"`
	Description string               `json:"description"`
	Tags        common.Tags          `json:"tags,omitempty"`
	Categories  []*ConnectorCategory `json:"categories,omitempty"`
	Actions     []*ConnectorAction   `json:"actions,omitempty"`
	TenantID    *string              `json:"tenantId,omitempty"`
}

ConnectorInterface defines an abstract type (set of actions) that could be implemented by multiple connectors

func (*ConnectorInterface) LookupAction

func (c *ConnectorInterface) LookupAction(name string) *ConnectorAction

type ConnectorInterfaceInput

type ConnectorInterfaceInput struct {
	common.ObjectMetaInput
	Categories common.IDs              `json:"categories"`
	Actions    []*ConnectorActionInput `json:"actions"`
	AllTenants *bool                   `json:"all_tenants"`
}

type ConnectorUpdateInput

type ConnectorUpdateInput struct {
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Implements  common.IDs `json:"implements"`

	AuthTypes     []AuthType                       `json:"authTypes"`
	Documentation string                           `json:"documentation"`
	Actions       []ConnectorActionDefinitionInput `json:"actions"`
	Categories    common.IDs                       `json:"categories"`
	Tags          common.Tags                      `json:"tags"`
	Title         *string                          `json:"title"`
	// contains filtered or unexported fields
}

type Context

type Context struct {
	TenantID    string
	UserID      string
	Connections []*Connection
}

Context is the execution context for the current playbook

func (*Context) LookupAction

func (ctx *Context) LookupAction(actionLookup *ActionLookup) (*Connection, *ConnectorAction)

type GetConnectionsInput

type GetConnectionsInput struct {
	ConnectionIDs         []string
	ConnectorIDs          []string
	ConnectorInterfaceIDs []string
}

type GetConnectorsInput

type GetConnectorsInput struct {
	ConnectionMethodIDs   []string
	ConnectorInterfaceIDs []string
	ConnectorCategoryIDs  []string
	Tags                  []string
}

type Service

type Service interface {
	GetConnectionMethod(name string, opts ...graphql.RequestOption) (*ConnectionMethod, error)
	GetConnectors(input *GetConnectorsInput, opts ...graphql.RequestOption) ([]*Connector, error)
	GetConnections(input *GetConnectionsInput, opts ...graphql.RequestOption) ([]*Connection, error)
	GetContext(input *GetConnectionsInput, opts ...graphql.RequestOption) (*Context, error)
	DefineConnectionMethod(input *ConnectionMethodInput, opts ...graphql.RequestOption) (*ConnectionMethod, error)
	RemoveConnectionMethod(connectionID string, opts ...graphql.RequestOption) (*ConnectionMethod, error)
	CreateConnectorInterface(input *ConnectorInterfaceInput, opts ...graphql.RequestOption) (*ConnectorInterface, error)
	UpdateConnectorInterface(connectorID string, input *ConnectorInterfaceInput, opts ...graphql.RequestOption) (*ConnectorInterface, error)
	DeleteConnectorInterface(connectorID string, opts ...graphql.RequestOption) (*ConnectorInterface, error)
	CreateConnector(connectionMethodID string, input *ConnectorInput, opts ...graphql.RequestOption) (*Connector, error)
	UpdateConnector(connectorID string, input *ConnectorUpdateInput, opts ...graphql.RequestOption) (*Connector, error)
	DeleteConnector(connectorID string, opts ...graphql.RequestOption) (*Connector, error)
	CreateConnection(connectorID string, input *ConnectionInput, opts ...graphql.RequestOption) (*Connection, error)
	UpdateConnection(connectionID string, input *ConnectionInput, opts ...graphql.RequestOption) (*Connection, error)
	DeleteConnection(connectionID string, opts ...graphql.RequestOption) (*Connection, error)
	ExecuteConnectionAction(connectionID string, actionName string, inputs interface{}, opts ...graphql.RequestOption) (*interface{}, error)
	GetConnectorCategory(connectorCategoryID string, opts ...graphql.RequestOption) (*ConnectorCategory, error)
	GetConnectorInterface(connectorInterfaceID string, opts ...graphql.RequestOption) (*ConnectorInterface, error)
	GetConnector(connectorID string, opts ...graphql.RequestOption) (*Connector, error)
	GetConnection(connectionID string, opts ...graphql.RequestOption) (*Connection, error)
	ConnectorCreated(ctx context.Context, connectorMethods common.IDs, allTenants bool, options ...graphql.SubscriptionOption) (Subscription, error)
	ConnectorDeleted(ctx context.Context, connectorMethods common.IDs, allTenants bool, options ...graphql.SubscriptionOption) (Subscription, error)
	ConnectorUpdated(ctx context.Context, connectorMethods common.IDs, allTenants bool, options ...graphql.SubscriptionOption) (Subscription, error)
}

type Subscription

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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