cli

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 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 ActionApprovePermissions added in v1.7.1

type ActionApprovePermissions struct {
	Users  []string        `json:"users"`
	Roles  []string        `json:"roles"`
	Teams  []string        `json:"teams"`
	Policy *map[string]any `json:"policy"`
}

type ActionExecutePermissions added in v1.7.1

type ActionExecutePermissions struct {
	Users       []string        `json:"users"`
	Roles       []string        `json:"roles"`
	Teams       []string        `json:"teams"`
	OwnedByTeam *bool           `json:"ownedByTeam"`
	Policy      *map[string]any `json:"policy"`
}

type ActionPermissions added in v1.7.1

type ActionPermissions struct {
	Execute ActionExecutePermissions `json:"execute"`
	Approve ActionApprovePermissions `json:"approve"`
}

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            any                 `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               any                 `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"`
	Encryption         *string             `json:"encryption,omitempty"`
	Visible            any                 `json:"visible,omitempty"`
}

type ActionUserInputs

type ActionUserInputs = struct {
	Properties map[string]ActionProperty `json:"properties"`
	Required   any                       `json:"required,omitempty"`
	Order      []string                  `json:"order,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"`
	AggregationProperties map[string]BlueprintAggregationProperty `json:"aggregationProperties,omitempty"`
	ChangelogDestination  *ChangelogDestination                   `json:"changelogDestination,omitempty"`
	TeamInheritance       *TeamInheritance                        `json:"teamInheritance,omitempty"`
	Relations             map[string]Relation                     `json:"relations"`
}

type BlueprintAggregationProperty added in v1.8.1

type BlueprintAggregationProperty struct {
	Title           *string           `json:"title,omitempty"`
	Description     *string           `json:"description,omitempty"`
	Icon            *string           `json:"icon,omitempty"`
	Target          string            `json:"target,omitempty"`
	CalculationSpec map[string]string `json:"calculationSpec,omitempty"`
	Query           any               `json:"query,omitempty"`
}

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     any               `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 BlueprintPermissions added in v1.11.1

type BlueprintPermissions struct {
	Entities BlueprintPermissionsEntities `json:"entities"`
}

type BlueprintPermissionsBlock added in v1.11.1

type BlueprintPermissionsBlock struct {
	Users       []string `json:"users"`
	Roles       []string `json:"roles"`
	Teams       []string `json:"teams"`
	OwnedByTeam *bool    `json:"ownedByTeam"`
}

type BlueprintPermissionsEntities added in v1.11.1

type BlueprintPermissionsEntities struct {
	Register         BlueprintPermissionsBlock                  `json:"register"`
	Unregister       BlueprintPermissionsBlock                  `json:"unregister"`
	Update           BlueprintPermissionsBlock                  `json:"update"`
	UpdateProperties BlueprintRolesOrPropertiesPermissionsBlock `json:"updateProperties,omitempty"`
	UpdateRelations  BlueprintRolesOrPropertiesPermissionsBlock `json:"updateRelations,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            any                 `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               []any               `json:"enum,omitempty"`
	Spec               *string             `json:"spec,omitempty"`
	SpecAuthentication *SpecAuthentication `json:"specAuthentication,omitempty"`
	EnumColors         map[string]string   `json:"enumColors,omitempty"`
}

type BlueprintRolesOrPropertiesPermissionsBlock added in v1.11.1

type BlueprintRolesOrPropertiesPermissionsBlock map[string]BlueprintPermissionsBlock

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]any `json:"properties"`
	Relations  map[string]any `json:"relations"`
}

type EntityProperty added in v1.3.0

type EntityProperty struct {
	Identifier string            `json:"identifier,omitempty"`
	Title      *string           `json:"title,omitempty"`
	Icon       *string           `json:"icon,omitempty"`
	Team       *string           `json:"team,omitempty"`
	Properties map[string]string `json:"properties,omitempty"`
	Relations  map[string]string `json:"relations,omitempty"`
}

type InvocationMethod

type InvocationMethod struct {
	Type                 string  `json:"type,omitempty"`
	Url                  *string `json:"url,omitempty"`
	Agent                *bool   `json:"agent,omitempty"`
	Synchronized         *bool   `json:"synchronized,omitempty"`
	Method               *string `json:"method,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 Mappings added in v1.3.0

type Mappings struct {
	Blueprint    string          `json:"blueprint,omitempty"`
	Filter       *string         `json:"filter,omitempty"`
	ItemsToParse *string         `json:"itemsToParse,omitempty"`
	Entity       *EntityProperty `json:"entity,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 Migration added in v1.10.1

type Migration struct {
	Meta
	Id              string `json:"id,omitempty"`
	Actor           string `json:"actor,omitempty"`
	SourceBlueprint string `json:"sourceBlueprint,omitempty"`
	Mapping         any    `json:"mapping,omitempty"`
	Status          string `json:"status,omitempty"`
	DeleteBlueprint bool   `json:"deleteBlueprint,omitempty"`
	DeleteEntities  bool   `json:"deleteEntities,omitempty"`
	FailureCount    int    `json:"failureCount,omitempty"`
	SuccessCount    int    `json:"successCount,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 Page added in v1.10.2

type Page struct {
	Meta
	Identifier string            `json:"identifier,omitempty"`
	Type       string            `json:"type,omitempty"`
	Icon       *string           `json:"icon,omitempty"`
	Parent     *string           `json:"parent,omitempty"`
	After      *string           `json:"after,omitempty"`
	Title      *string           `json:"title,omitempty"`
	Locked     *bool             `json:"locked,omitempty"`
	Blueprint  *string           `json:"blueprint,omitempty"`
	Widgets    *[]map[string]any `json:"widgets,omitempty"`
}

type PagePermissions added in v1.10.3

type PagePermissions struct {
	Read PageReadPermissions `json:"read"`
}

type PageReadPermissions added in v1.10.3

type PageReadPermissions struct {
	Users []string `json:"users"`
	Roles []string `json:"roles"`
	Teams []string `json:"teams"`
}

type PortBlueprintPermissionsBody added in v1.11.1

type PortBlueprintPermissionsBody struct {
	OK                   bool                 `json:"ok"`
	BlueprintPermissions BlueprintPermissions `json:"permissions"`
}

type PortBody

type PortBody struct {
	OK                   bool              `json:"ok"`
	Entity               Entity            `json:"entity"`
	Blueprint            Blueprint         `json:"blueprint"`
	BlueprintPermissions Blueprint         `json:"blueprint_permissions"`
	Action               Action            `json:"action"`
	ActionPermissions    ActionPermissions `json:"permissions"`
	Integration          Webhook           `json:"integration"`
	Scorecard            Scorecard         `json:"Scorecard"`
	Team                 Team              `json:"team"`
	Page                 Page              `json:"page"`
	MigrationId          string            `json:"migrationId"`
	Migration            Migration         `json:"migration"`
}

type PortBodyDelete added in v1.5.0

type PortBodyDelete struct {
	Ok bool `json:"ok"`
}

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) CreatePage added in v1.10.2

func (c *PortClient) CreatePage(ctx context.Context, page *Page) (*Page, error)

func (*PortClient) CreatePermissions

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

func (*PortClient) CreateScorecard added in v1.5.0

func (c *PortClient) CreateScorecard(ctx context.Context, blueprintID string, scorecard *Scorecard) (*Scorecard, error)

func (*PortClient) CreateTeam added in v1.6.0

func (c *PortClient) CreateTeam(ctx context.Context, team *Team) (*Team, error)

func (*PortClient) CreateWebhook added in v1.3.0

func (c *PortClient) CreateWebhook(ctx context.Context, webhook *Webhook) (*Webhook, error)

func (*PortClient) DeleteAction

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

func (*PortClient) DeleteBlueprint

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

func (*PortClient) DeleteBlueprintWithAllEntities added in v1.10.1

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

func (*PortClient) DeleteEntity

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

func (*PortClient) DeletePage added in v1.10.2

func (c *PortClient) DeletePage(ctx context.Context, pageId string) (int, error)

func (*PortClient) DeleteScorecard added in v1.5.0

func (c *PortClient) DeleteScorecard(ctx context.Context, blueprintID string, scorecardID string) error

func (*PortClient) DeleteTeam added in v1.6.0

func (c *PortClient) DeleteTeam(ctx context.Context, teamName string) error

func (*PortClient) DeleteWebhook added in v1.3.0

func (c *PortClient) DeleteWebhook(ctx context.Context, webhookID string) error

func (*PortClient) GetActionPermissions added in v1.7.1

func (c *PortClient) GetActionPermissions(ctx context.Context, blueprintID string, actionID string) (*ActionPermissions, int, error)

func (*PortClient) GetBlueprintPermissions added in v1.11.1

func (c *PortClient) GetBlueprintPermissions(ctx context.Context, blueprintID string) (*BlueprintPermissions, int, error)

func (*PortClient) GetMigration added in v1.10.1

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

func (*PortClient) GetPage added in v1.10.2

func (c *PortClient) GetPage(ctx context.Context, pageId string) (*Page, int, error)

func (*PortClient) GetPagePermissions added in v1.10.3

func (c *PortClient) GetPagePermissions(ctx context.Context, pageID string) (*PagePermissions, int, 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) ReadScorecard added in v1.5.0

func (c *PortClient) ReadScorecard(ctx context.Context, blueprintID string, scorecardID string) (*Scorecard, int, error)

func (*PortClient) ReadTeam added in v1.6.0

func (c *PortClient) ReadTeam(ctx context.Context, teamName string) (*Team, int, error)

func (*PortClient) ReadWebhook added in v1.3.0

func (c *PortClient) ReadWebhook(ctx context.Context, webhookID string) (*Webhook, int, error)

func (*PortClient) UpdateAction

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

func (*PortClient) UpdateActionPermissions added in v1.7.1

func (c *PortClient) UpdateActionPermissions(ctx context.Context, blueprintID string, actionID string, permissions *ActionPermissions) (*ActionPermissions, error)

func (*PortClient) UpdateBlueprint

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

func (*PortClient) UpdateBlueprintPermissions added in v1.11.1

func (c *PortClient) UpdateBlueprintPermissions(ctx context.Context, blueprintID string, permissions *BlueprintPermissions) (*BlueprintPermissions, error)

func (*PortClient) UpdateEntity added in v1.6.5

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

func (*PortClient) UpdatePage added in v1.10.2

func (c *PortClient) UpdatePage(ctx context.Context, pageId string, page *Page) (*Page, error)

func (*PortClient) UpdatePagePermissions added in v1.10.3

func (c *PortClient) UpdatePagePermissions(ctx context.Context, pageID string, permissions *PagePermissions) (*PagePermissions, error)

func (*PortClient) UpdateScorecard added in v1.5.0

func (c *PortClient) UpdateScorecard(ctx context.Context, blueprintID string, scorecardId string, scorecard *Scorecard) (*Scorecard, error)

func (*PortClient) UpdateTeam added in v1.6.0

func (c *PortClient) UpdateTeam(ctx context.Context, teamName string, team *Team) (*Team, error)

func (*PortClient) UpdateWebhook added in v1.3.0

func (c *PortClient) UpdateWebhook(ctx context.Context, webhookID string, webhook *Webhook) (*Webhook, error)

type PortPagePermissionsBody added in v1.10.3

type PortPagePermissionsBody struct {
	OK              bool            `json:"ok"`
	PagePermissions PagePermissions `json:"permissions"`
}

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 PortTeamBody added in v1.6.0

type PortTeamBody struct {
	OK   bool         `json:"ok"`
	Team TeamPortBody `json:"team"`
}

type Query added in v1.5.0

type Query struct {
	Combinator string `json:"combinator,omitempty"`
	Conditions []any  `json:"conditions,omitempty"`
}

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 Rule added in v1.5.0

type Rule struct {
	Identifier string `json:"identifier,omitempty"`
	Title      string `json:"title,omitempty"`
	Level      string `json:"level,omitempty"`
	Query      Query  `json:"query,omitempty"`
}

type Scorecard added in v1.5.0

type Scorecard struct {
	Meta
	Identifier string `json:"identifier,omitempty"`
	Title      string `json:"title,omitempty"`
	Blueprint  string `json:"blueprint,omitempty"`
	Rules      []Rule `json:"rules,omitempty"`
}

type Security added in v1.3.0

type Security struct {
	Secret                *string `json:"secret,omitempty"`
	SignatureHeaderName   *string `json:"signatureHeaderName,omitempty"`
	SignatureAlgorithm    *string `json:"signatureAlgorithm,omitempty"`
	SignaturePrefix       *string `json:"signaturePrefix,omitempty"`
	RequestIdentifierPath *string `json:"requestIdentifierPath,omitempty"`
}

type SpecAuthentication

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

type Team added in v1.6.0

type Team struct {
	CreatedAt   *time.Time `json:"createdAt,omitempty"`
	UpdatedAt   *time.Time `json:"updatedAt,omitempty"`
	Name        string     `json:"name,omitempty"`
	Description *string    `json:"description,omitempty"`
	Users       []string   `json:"users,omitempty"`
	Provider    string     `json:"provider,omitempty"`
}

type TeamInheritance

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

type TeamPortBody added in v1.6.0

type TeamPortBody struct {
	CreatedAt   *time.Time     `json:"createdAt,omitempty"`
	UpdatedAt   *time.Time     `json:"updatedAt,omitempty"`
	Name        string         `json:"name,omitempty"`
	Description *string        `json:"description,omitempty"`
	Users       []TeamUserBody `json:"users,omitempty"`
	Provider    string         `json:"provider,omitempty"`
}

type TeamUserBody added in v1.6.0

type TeamUserBody struct {
	Email string `json:"email"`
}

type Webhook added in v1.3.0

type Webhook struct {
	Meta
	Identifier  string     `json:"identifier,omitempty"`
	Title       *string    `json:"title,omitempty"`
	Icon        *string    `json:"icon,omitempty"`
	Description *string    `json:"description,omitempty"`
	Enabled     *bool      `json:"enabled,omitempty"`
	Security    *Security  `json:"security,omitempty"`
	Mappings    []Mappings `json:"mappings,omitempty"`
	WebhookKey  string     `json:"webhookKey,omitempty"`
	Url         string     `json:"url,omitempty"`
}

Jump to

Keyboard shortcuts

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