cli

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	Ok          bool   `json:"ok"`
	AccessToken string `json:"accessToken"`
	ExpiresIn   int64  `json:"expiresIn"`
	TokenType   string `json:"tokenType"`
}

type Action

type Action struct {
	ID                   string                `json:"id,omitempty"`
	Identifier           string                `json:"identifier,omitempty"`
	Description          *string               `json:"description,omitempty"`
	Title                string                `json:"title,omitempty"`
	Icon                 *string               `json:"icon,omitempty"`
	UserInputs           ActionUserInputs      `json:"userInputs"`
	Trigger              string                `json:"trigger"`
	RequiredApproval     *bool                 `json:"requiredApproval,omitempty"`
	InvocationMethod     *InvocationMethod     `json:"invocationMethod,omitempty"`
	ApprovalNotification *ApprovalNotification `json:"approvalNotification,omitempty"`
}

type ActionProperty added in v1.1.0

type ActionProperty struct {
	Type               string              `json:"type,omitempty"`
	Title              *string             `json:"title,omitempty"`
	Identifier         string              `json:"identifier,omitempty"`
	Items              map[string]any      `json:"items,omitempty"`
	Default            interface{}         `json:"default,omitempty"`
	Icon               *string             `json:"icon,omitempty"`
	Format             *string             `json:"format,omitempty"`
	MaxLength          *int                `json:"maxLength,omitempty"`
	MinLength          *int                `json:"minLength,omitempty"`
	MaxItems           *int                `json:"maxItems,omitempty"`
	MinItems           *int                `json:"minItems,omitempty"`
	Maximum            *float64            `json:"maximum,omitempty"`
	Minimum            *float64            `json:"minimum,omitempty"`
	Description        *string             `json:"description,omitempty"`
	Blueprint          *string             `json:"blueprint,omitempty"`
	Pattern            *string             `json:"pattern,omitempty"`
	Enum               interface{}         `json:"enum,omitempty"`
	Spec               *string             `json:"spec,omitempty"`
	SpecAuthentication *SpecAuthentication `json:"specAuthentication,omitempty"`
	EnumColors         map[string]string   `json:"enumColors,omitempty"`
	DependsOn          []string            `json:"dependsOn,omitempty"`
	Dataset            *Dataset            `json:"dataset,omitempty"`
}

type ActionUserInputs

type ActionUserInputs = struct {
	Properties map[string]ActionProperty `json:"properties"`
	Required   []string                  `json:"required,omitempty"`
}

type ApprovalNotification

type ApprovalNotification struct {
	Type   string  `json:"type,omitempty"`
	Url    string  `json:"url,omitempty"`
	Format *string `json:"format,omitempty"`
}

type Blueprint

type Blueprint struct {
	Meta
	Identifier            string                                  `json:"identifier,omitempty"`
	Title                 string                                  `json:"title,omitempty"`
	Icon                  *string                                 `json:"icon,omitempty"`
	Description           *string                                 `json:"description,omitempty"`
	Schema                BlueprintSchema                         `json:"schema"`
	MirrorProperties      map[string]BlueprintMirrorProperty      `json:"mirrorProperties"`
	CalculationProperties map[string]BlueprintCalculationProperty `json:"calculationProperties"`
	ChangelogDestination  *ChangelogDestination                   `json:"changelogDestination,omitempty"`
	TeamInheritance       *TeamInheritance                        `json:"teamInheritance,omitempty"`
	Relations             map[string]Relation                     `json:"relations"`
}

type BlueprintCalculationProperty

type BlueprintCalculationProperty struct {
	Type        string            `json:"type,omitempty"`
	Title       *string           `json:"title,omitempty"`
	Identifier  string            `json:"identifier,omitempty"`
	Calculation string            `json:"calculation,omitempty"`
	Default     interface{}       `json:"default,omitempty"`
	Icon        *string           `json:"icon,omitempty"`
	Format      *string           `json:"format,omitempty"`
	Description *string           `json:"description,omitempty"`
	Colorized   *bool             `json:"colorized,omitempty"`
	Colors      map[string]string `json:"colors,omitempty"`
}

type BlueprintMirrorProperty

type BlueprintMirrorProperty struct {
	Identifier string  `json:"identifier,omitempty"`
	Title      *string `json:"title,omitempty"`
	Path       string  `json:"path,omitempty"`
}

type BlueprintProperty

type BlueprintProperty struct {
	Type               string              `json:"type,omitempty"`
	Title              *string             `json:"title,omitempty"`
	Identifier         string              `json:"identifier,omitempty"`
	Items              map[string]any      `json:"items,omitempty"`
	Default            interface{}         `json:"default,omitempty"`
	Icon               *string             `json:"icon,omitempty"`
	Format             *string             `json:"format,omitempty"`
	MaxLength          *int                `json:"maxLength,omitempty"`
	MinLength          *int                `json:"minLength,omitempty"`
	MaxItems           *int                `json:"maxItems,omitempty"`
	MinItems           *int                `json:"minItems,omitempty"`
	Maximum            *float64            `json:"maximum,omitempty"`
	Minimum            *float64            `json:"minimum,omitempty"`
	Description        *string             `json:"description,omitempty"`
	Blueprint          *string             `json:"blueprint,omitempty"`
	Pattern            *string             `json:"pattern,omitempty"`
	Enum               []interface{}       `json:"enum,omitempty"`
	Spec               *string             `json:"spec,omitempty"`
	SpecAuthentication *SpecAuthentication `json:"specAuthentication,omitempty"`
	EnumColors         map[string]string   `json:"enumColors,omitempty"`
}

type BlueprintSchema

type BlueprintSchema struct {
	Properties map[string]BlueprintProperty `json:"properties"`
	Required   []string                     `json:"required,omitempty"`
}

type ChangelogDestination

type ChangelogDestination struct {
	Type  string `json:"type,omitempty"`
	Url   string `json:"url,omitempty"`
	Agent *bool  `json:"agent,omitempty"`
}

type Dataset added in v1.1.0

type Dataset struct {
	Combinator string        `json:"combinator,omitempty"`
	Rules      []DatasetRule `json:"rules,omitempty"`
}

type DatasetRule added in v1.1.0

type DatasetRule struct {
	Blueprint *string       `json:"blueprint,omitempty"`
	Property  *string       `json:"property,omitempty"`
	Operator  string        `json:"operator,omitempty"`
	Value     *DatasetValue `json:"value,omitempty"`
}

type DatasetValue added in v1.1.0

type DatasetValue struct {
	JqQuery string `json:"jqQuery,omitempty"`
}

type Entity

type Entity struct {
	Meta
	Identifier string                 `json:"identifier,omitempty"`
	Title      string                 `json:"title"`
	Blueprint  string                 `json:"blueprint"`
	Team       []string               `json:"team,omitempty"`
	Properties map[string]interface{} `json:"properties"`
	Relations  map[string]interface{} `json:"relations"`
}

type InvocationMethod

type InvocationMethod struct {
	Type                 string  `json:"type,omitempty"`
	Url                  *string `json:"url,omitempty"`
	Agent                *bool   `json:"agent,omitempty"`
	Org                  *string `json:"org,omitempty"`
	Repo                 *string `json:"repo,omitempty"`
	Webhook              *string `json:"webhook,omitempty"`
	Workflow             *string `json:"workflow,omitempty"`
	OmitPayload          *bool   `json:"omitPayload,omitempty"`
	OmitUserInputs       *bool   `json:"omitUserInputs,omitempty"`
	ReportWorkflowStatus *bool   `json:"reportWorkflowStatus,omitempty"`
	Branch               *string `json:"branch,omitempty"`
	ProjectName          *string `json:"projectName,omitempty"`
	GroupName            *string `json:"groupName,omitempty"`
	DefaultRef           *string `json:"defaultRef,omitempty"`
}

type Meta

type Meta struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	CreatedBy string     `json:"createdBy,omitempty"`
	UpdatedBy string     `json:"updatedBy,omitempty"`
}

type Option

type Option func(*PortClient)

func WithClientID

func WithClientID(clientID string) Option

func WithHeader

func WithHeader(key, val string) Option

func WithToken

func WithToken(token string) Option

type PortBody

type PortBody struct {
	OK        bool      `json:"ok"`
	Entity    Entity    `json:"entity"`
	Blueprint Blueprint `json:"blueprint"`
	Action    Action    `json:"action"`
}

type PortClient

type PortClient struct {
	Client   *resty.Client
	ClientID string
	Token    string
}

func New

func New(baseURL string, opts ...Option) (*PortClient, error)

func (*PortClient) Authenticate

func (c *PortClient) Authenticate(ctx context.Context, clientID, clientSecret string) (string, error)

func (*PortClient) CreateAction

func (c *PortClient) CreateAction(ctx context.Context, blueprintID string, action *Action) (*Action, error)

func (*PortClient) CreateBlueprint

func (c *PortClient) CreateBlueprint(ctx context.Context, b *Blueprint) (*Blueprint, error)

func (*PortClient) CreateEntity

func (c *PortClient) CreateEntity(ctx context.Context, e *Entity, runID string) (*Entity, error)

func (*PortClient) CreatePermissions

func (c *PortClient) CreatePermissions(ctx context.Context, clientID string, scopes ...string) error

func (*PortClient) DeleteAction

func (c *PortClient) DeleteAction(ctx context.Context, blueprintID, actionID string) error

func (*PortClient) DeleteBlueprint

func (c *PortClient) DeleteBlueprint(ctx context.Context, id string) error

func (*PortClient) DeleteEntity

func (c *PortClient) DeleteEntity(ctx context.Context, id string, blueprint string) error

func (*PortClient) ReadAction

func (c *PortClient) ReadAction(ctx context.Context, blueprintID, id string) (*Action, int, error)

func (*PortClient) ReadBlueprint

func (c *PortClient) ReadBlueprint(ctx context.Context, id string) (*Blueprint, int, error)

func (*PortClient) ReadEntity

func (c *PortClient) ReadEntity(ctx context.Context, id string, blueprint string) (*Entity, int, error)

func (*PortClient) UpdateAction

func (c *PortClient) UpdateAction(ctx context.Context, blueprintID, actionID string, action *Action) (*Action, error)

func (*PortClient) UpdateBlueprint

func (c *PortClient) UpdateBlueprint(ctx context.Context, b *Blueprint, id string) (*Blueprint, error)

type PortProviderModel

type PortProviderModel struct {
	ClientId types.String `tfsdk:"client_id"`
	Secret   types.String `tfsdk:"secret"`
	Token    types.String `tfsdk:"token"`
	BaseUrl  types.String `tfsdk:"base_url"`
}

type Relation

type Relation struct {
	Identifier *string `json:"identifier,omitempty"`
	Title      *string `json:"title,omitempty"`
	Target     *string `json:"target,omitempty"`
	Required   *bool   `json:"required,omitempty"`
	Many       *bool   `json:"many,omitempty"`
}

type SpecAuthentication

type SpecAuthentication struct {
	ClientId         string `json:"clientId,omitempty"`
	AuthorizationUrl string `json:"authorizationUrl,omitempty"`
	TokenUrl         string `json:"tokenUrl,omitempty"`
}

type TeamInheritance

type TeamInheritance struct {
	Path string `json:"path,omitempty"`
}

Jump to

Keyboard shortcuts

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