api

package
v0.1.4 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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	BaseModel
	Name                  string   `json:"name"`
	Handle                string   `json:"handle"`
	Location              *string  `json:"location"`
	Link                  *string  `json:"link"`
	ImageLocation         *string  `json:"image_location"`
	StripeCustomerID      *string  `json:"stripe_customer_id"`
	WorkOSDirectoryIDs    []string `json:"workos_directory_ids"`
	WorkOSOrganizationID  *string  `json:"workos_organization_id"`
	WorkOSConnectionIDs   []string `json:"workos_connection_ids"`
	AuthExpirationSeconds *int64   `json:"auth_expiration_seconds"`
	AllowPublicWorkspaces *bool    `json:"allow_public_workspaces"`
}

Account is a representation of an account.

type AccountMembership

type AccountMembership struct {
	ID              uuid.UUID  `json:"id"`
	ActorID         uuid.UUID  `json:"actor_id"`
	UserID          uuid.UUID  `json:"user_id"`
	FirstName       string     `json:"first_name"`
	LastName        string     `json:"last_name"`
	Handle          string     `json:"handle"`
	Email           string     `json:"email"`
	AccountRoleName string     `json:"account_role_name"`
	AccountRoleID   uuid.UUID  `json:"account_role_id"`
	LastLogin       *time.Time `json:"last_login"`
}

type AccountMembershipFilter

type AccountMembershipFilter struct {
	AccountMemberships struct {
		Email struct {
			Any []string `json:"any_"`
		} `json:"email,omitempty"`
	} `json:"account_memberships"`
}

AccountMembershipFilter defines the search filter payload when searching for workspace roles by name. example request payload: {"account_memberships": {"email": {"any_": ["test"]}}}.

type AccountMembershipsClient

type AccountMembershipsClient interface {
	List(ctx context.Context, emails []string) ([]*AccountMembership, error)
}

type AccountResponse

type AccountResponse struct {
	Account
	PlanType              string   `json:"plan_type"`
	SelfServe             bool     `json:"self_serve"`
	RunRetentionDays      int64    `json:"run_retention_days"`
	AuditLogRetentionDays int64    `json:"audit_log_retention_days"`
	AutomationsLimit      int64    `json:"automations_limit"`
	SCIMState             string   `json:"scim_state"`
	SSOState              string   `json:"sso_state"`
	BillingEmail          *string  `json:"billing_email"`
	Features              []string `json:"features"`
}

AccountResponse is the data about an account returned by the Accounts API.

type AccountRole

type AccountRole struct {
	BaseModel
	Name        string   `json:"name"`
	Permissions []string `json:"permissions"`

	AccountID    *uuid.UUID `json:"account_id"`
	IsSystemRole bool       `json:"is_system_role"`
}

AccountRole is a representation of an account role.

type AccountRoleFilter

type AccountRoleFilter struct {
	AccountRoles struct {
		Name struct {
			Any []string `json:"any_"`
		} `json:"name"`
	} `json:"account_roles"`
}

AccountRoleFilter defines the search filter payload when searching for workspace roles by name. example request payload: {"account_roles": {"name": {"any_": ["test"]}}}.

type AccountRolesClient

type AccountRolesClient interface {
	Get(ctx context.Context, roleID uuid.UUID) (*AccountRole, error)
	List(ctx context.Context, roleNames []string) ([]*AccountRole, error)
}

type AccountUpdate

type AccountUpdate struct {
	Name                  *string `json:"name"`
	Handle                *string `json:"handle"`
	Location              *string `json:"location"`
	Link                  *string `json:"link"`
	AuthExpirationSeconds *int64  `json:"auth_expiration_seconds"`
	AllowPublicWorkspaces *bool   `json:"allow_public_workspaces"`
	BillingEmail          *string `json:"billing_email"`
}

AccountUpdate is the data sent when updating an account.

type AccountsClient

type AccountsClient interface {
	Get(ctx context.Context) (*AccountResponse, error)
	Update(ctx context.Context, data AccountUpdate) error
	Delete(ctx context.Context) error
}

AccountsClient is a client for working with accounts.

type BaseModel

type BaseModel struct {
	ID      uuid.UUID  `json:"id"`
	Created *time.Time `json:"created"`
	Updated *time.Time `json:"updated"`
}

BaseModel is embedded in all other types and defines fields common to all Prefect data models.

type CollectionsClient

type CollectionsClient interface {
	GetWorkerMetadataViews(ctx context.Context) (WorkerTypeByPackage, error)
}

type MetadataByWorkerType

type MetadataByWorkerType map[string]WorkerMetadata

{ "ecs": {...} }.

type PrefectClient

type PrefectClient interface {
	Accounts(accountID uuid.UUID) (AccountsClient, error)
	AccountMemberships(accountID uuid.UUID) (AccountMembershipsClient, error)
	AccountRoles(accountID uuid.UUID) (AccountRolesClient, error)
	Collections() (CollectionsClient, error)
	Teams(accountID uuid.UUID) (TeamsClient, error)
	Workspaces(accountID uuid.UUID) (WorkspacesClient, error)
	WorkspaceAccess(accountID uuid.UUID, workspaceID uuid.UUID) (WorkspaceAccessClient, error)
	WorkspaceRoles(accountID uuid.UUID) (WorkspaceRolesClient, error)
	WorkPools(accountID uuid.UUID, workspaceID uuid.UUID) (WorkPoolsClient, error)
	Variables(accountID uuid.UUID, workspaceID uuid.UUID) (VariablesClient, error)
	ServiceAccounts(accountID uuid.UUID) (ServiceAccountsClient, error)
}

PrefectClient returns clients for different aspects of our API.

type ServiceAccount

type ServiceAccount struct {
	BaseModel
	AccountID       uuid.UUID            `json:"account_id"`
	Name            string               `json:"name"`
	AccountRoleName string               `json:"account_role_name"`
	APIKey          ServiceAccountAPIKey `json:"api_key"`
}

ServiceAccount is a representation of a created service account (from a Create response).

type ServiceAccountAPIKey

type ServiceAccountAPIKey struct {
	ID         string     `json:"id"`
	Created    *time.Time `json:"created"`
	Expiration *time.Time `json:"expiration"`
	Name       string     `json:"name"`
	Key        string     `json:"key"`
}

type ServiceAccountAPIKeyNoKey

type ServiceAccountAPIKeyNoKey struct {
	ID         string     `json:"id"`
	Created    *time.Time `json:"created"`
	Name       string     `json:"name"`
	Expiration *time.Time `json:"expiration"`
}

Represents an api_key block received from a List/Filter response, which excludes the actual key.

type ServiceAccountCreateRequest

type ServiceAccountCreateRequest struct {
	Name             string     `json:"name"`
	APIKeyExpiration string     `json:"api_key_expiration,omitempty"`
	AccountRoleID    *uuid.UUID `json:"account_role_id,omitempty"`
}

type ServiceAccountFilter

type ServiceAccountFilter struct {
	ServiceAccounts struct {
		Name struct {
			Any []string `json:"any_"`
		} `json:"name,omitempty"`
	} `json:"service_accounts"`
}

ServiceAccountFilter defines the search filter payload when searching for service accounts by name. example request payload: {"service_accounts": {"name": {"any_": ["test"]}}}.

type ServiceAccountNoKey

type ServiceAccountNoKey struct {
	BaseModel
	AccountID       uuid.UUID                 `json:"account_id"`
	Name            string                    `json:"name"`
	AccountRoleName string                    `json:"account_role_name"`
	APIKey          ServiceAccountAPIKeyNoKey `json:"api_key"`
}

ServiceAccountNoKey is a representation of Service Account details obtained from a List/Filter and excludes the actual key value for the api_key.

type ServiceAccountRotateKeyRequest

type ServiceAccountRotateKeyRequest struct {
	APIKeyExpiration *time.Time `json:"api_key_expiration"`
}

type ServiceAccountUpdateRequest

type ServiceAccountUpdateRequest struct {
	Name          string     `json:"name"`
	AccountRoleID *uuid.UUID `json:"account_role_id,omitempty"`
}

type ServiceAccountsClient

type ServiceAccountsClient interface {
	Create(ctx context.Context, request ServiceAccountCreateRequest) (*ServiceAccount, error)
	List(ctx context.Context, names []string) ([]*ServiceAccount, error)
	Get(ctx context.Context, id string) (*ServiceAccount, error)
	Update(ctx context.Context, id string, data ServiceAccountUpdateRequest) error
	Delete(ctx context.Context, id string) error
	RotateKey(ctx context.Context, id string, data ServiceAccountRotateKeyRequest) (*ServiceAccount, error)
}

type Team

type Team struct {
	BaseModel
	Name        string `json:"name"`
	Description string `json:"description"`
}

Team is a representation of an team.

type TeamFilter

type TeamFilter struct {
	Teams struct {
		Name struct {
			Any []string `json:"any_"`
		} `json:"name"`
	} `json:"teams"`
}

TeamFilter defines the search filter payload when searching for team by name. example request payload: {"teams": {"name": {"any_": ["test"]}}}.

type TeamsClient

type TeamsClient interface {
	List(ctx context.Context, names []string) ([]*Team, error)
}

TeamsClient is a client for working with teams.

type Variable

type Variable struct {
	BaseModel
	Name  string   `json:"name"`
	Value string   `json:"value"`
	Tags  []string `json:"tags"`
}

Variable is a representation of a variable.

type VariableCreate

type VariableCreate struct {
	Name  string   `json:"name"`
	Value string   `json:"value"`
	Tags  []string `json:"tags"`
}

VariableCreate is a subset of Variable used when creating variables.

type VariableFilter

type VariableFilter struct {
	ID    *VariableFilterID    `json:"id"`
	Name  *VariableFilterName  `json:"name"`
	Value *VariableFilterValue `json:"value"`
	Tags  *VariableFilterTags  `json:"tags"`
}

VariableFilter defines filters when searching for variables.

type VariableFilterID

type VariableFilterID struct {
	Any string `json:"any_"`
}

VariableFilterID defines filter criteria searching on variable IDs.

type VariableFilterName

type VariableFilterName struct {
	Any  string `json:"any_"`
	Like string `json:"like_"`
}

VariableFilterName defines filter criteria searching on variable names.

type VariableFilterSettings

type VariableFilterSettings struct {
	Limit     *int64          `json:"limit"`
	Offset    *int64          `json:"offset"`
	Variables *VariableFilter `json:"variables"`
	Sort      string          `json:"sort"`
}

VariableFilterSettings defines settings when searching for variables.

type VariableFilterTags

type VariableFilterTags struct {
	All  string `json:"all_"`
	Null bool   `json:"is_null_"`
}

VariableFilterTags defines filter criteria searching on variable IDs.

type VariableFilterValue

type VariableFilterValue struct {
	Any  string `json:"any_"`
	Like string `json:"like_"`
}

VariableFilterValue defines filter criteria searching on variable values.

type VariableUpdate

type VariableUpdate struct {
	Name  string   `json:"name"`
	Value string   `json:"value"`
	Tags  []string `json:"tags"`
}

VariableUpdate is a subset of Variable used when updating variables.

type VariablesClient

type VariablesClient interface {
	Create(ctx context.Context, variable VariableCreate) (*Variable, error)
	Get(ctx context.Context, variableID uuid.UUID) (*Variable, error)
	GetByName(ctx context.Context, name string) (*Variable, error)
	List(ctx context.Context, filter VariableFilter) ([]Variable, error)
	Update(ctx context.Context, variableID uuid.UUID, variable VariableUpdate) error
	Delete(ctx context.Context, variableID uuid.UUID) error
}

VariablesClient is a client for working with variables.

type WorkPool

type WorkPool struct {
	BaseModel
	Name             string                 `json:"name"`
	Description      *string                `json:"description"`
	Type             string                 `json:"type"`
	BaseJobTemplate  map[string]interface{} `json:"base_job_template"`
	IsPaused         bool                   `json:"is_paused"`
	ConcurrencyLimit *int64                 `json:"concurrency_limit"`
	DefaultQueueID   uuid.UUID              `json:"default_queue_id"`
}

WorkPool is a representation of a work pool.

type WorkPoolCreate

type WorkPoolCreate struct {
	Name             string                 `json:"name"`
	Description      *string                `json:"description"`
	Type             string                 `json:"type"`
	BaseJobTemplate  map[string]interface{} `json:"base_job_template"`
	IsPaused         bool                   `json:"is_paused"`
	ConcurrencyLimit *int64                 `json:"concurrency_limit"`
}

WorkPoolCreate is a subset of WorkPool used when creating pools.

type WorkPoolFilter

type WorkPoolFilter struct {
	Any []uuid.UUID `json:"any_"`
}

WorkPoolFilter defines filters when searching for work pools.

type WorkPoolUpdate

type WorkPoolUpdate struct {
	Description      *string                `json:"description"`
	IsPaused         *bool                  `json:"is_paused"`
	BaseJobTemplate  map[string]interface{} `json:"base_job_template"`
	ConcurrencyLimit *int64                 `json:"concurrency_limit"`
}

WorkPoolUpdate is a subset of WorkPool used when updating pools.

type WorkPoolsClient

type WorkPoolsClient interface {
	Create(ctx context.Context, data WorkPoolCreate) (*WorkPool, error)
	List(ctx context.Context, filter WorkPoolFilter) ([]*WorkPool, error)
	Get(ctx context.Context, name string) (*WorkPool, error)
	Update(ctx context.Context, name string, data WorkPoolUpdate) error
	Delete(ctx context.Context, name string) error
}

WorkPoolsClient is a client for working with work pools.

type WorkerMetadata

type WorkerMetadata struct {
	Type                        string          `json:"type"`
	DocumentationURL            string          `json:"documentation_url"`
	DisplayName                 string          `json:"display_name"`
	InstallCommand              string          `json:"install_command"`
	Description                 string          `json:"description"`
	DefaultBaseJobConfiguration json.RawMessage `json:"default_base_job_configuration"`
}

type WorkerTypeByPackage

type WorkerTypeByPackage map[string]MetadataByWorkerType

{ "prefect": {...}, "prefect-aws": {...} }.

type Workspace

type Workspace struct {
	BaseModel
	AccountID              uuid.UUID `json:"account_id"`
	Name                   string    `json:"name"`
	Description            *string   `json:"description"`
	Handle                 string    `json:"handle"`
	DefaultWorkspaceRoleID uuid.UUID `json:"default_workspace_role_id"`
	IsPublic               bool      `json:"is_public"`
}

Workspace is a representation of a workspace.

type WorkspaceAccess

type WorkspaceAccess struct {
	BaseModel
	WorkspaceID     uuid.UUID `json:"workspace_id"`
	WorkspaceRoleID uuid.UUID `json:"workspace_role_id"`

	ActorID *uuid.UUID `json:"actor_id"`
	BotID   *uuid.UUID `json:"bot_id"`
	TeamID  *uuid.UUID `json:"team_id"`
	UserID  *uuid.UUID `json:"user_id"`
}

WorkspaceAccess is a representation of a workspace access. This is used for multiple accessor types (user, service account, team), which dictates the presence of the specific accessor's ID.

type WorkspaceAccessClient

type WorkspaceAccessClient interface {
	Upsert(ctx context.Context, accessorType string, accessorID uuid.UUID, roleID uuid.UUID) (*WorkspaceAccess, error)
	Get(ctx context.Context, accessorType string, accessID uuid.UUID) (*WorkspaceAccess, error)
	Delete(ctx context.Context, accessorType string, accessID uuid.UUID, accessorID uuid.UUID) error
}

type WorkspaceAccessUpsert

type WorkspaceAccessUpsert struct {
	WorkspaceRoleID uuid.UUID `json:"workspace_role_id"`

	// Only one of the follow IDs should be set on each call
	// depending on the resource's AccessorType
	// NOTE: omitempty normally excludes any zero value,
	// for primitives, but complex types like structs
	// and uuid.UUID require a pointer type to be omitted.
	TeamID *uuid.UUID `json:"team_id,omitempty"`
	UserID *uuid.UUID `json:"user_id,omitempty"`
	BotID  *uuid.UUID `json:"bot_id,omitempty"`
}

WorkspaceAccessUpsert defines the payload when upserting a workspace access request.

type WorkspaceCreate

type WorkspaceCreate struct {
	Name        string  `json:"name"`
	Description *string `json:"description"`
	Handle      string  `json:"handle"`
}

WorkspaceCreate is a subset of Workspace used when creating workspaces.

type WorkspaceFilter

type WorkspaceFilter struct {
	Workspaces struct {
		Handle struct {
			Any []string `json:"any_"`
		} `json:"handle"`
	} `json:"workspaces"`
}

WorkspaceFilter defines the search filter payload when searching for workspaces by name. example request payload: {"workspaces": {"handle": {"any_": ["test"]}}}.

type WorkspaceRole

type WorkspaceRole struct {
	BaseModel
	Name            string     `json:"name"`
	Description     *string    `json:"description"`
	Scopes          []string   `json:"scopes"`
	AccountID       *uuid.UUID `json:"account_id"` // this is null for the default roles
	InheritedRoleID *uuid.UUID `json:"inherited_role_id"`
}

WorkspaceRole is a representation of a workspace role.

type WorkspaceRoleFilter

type WorkspaceRoleFilter struct {
	WorkspaceRoles struct {
		Name struct {
			Any []string `json:"any_"`
		} `json:"name"`
	} `json:"workspace_roles"`
}

WorkspaceRoleFilter defines the search filter payload when searching for workspace roles by name. example request payload: {"workspace_roles": {"name": {"any_": ["test"]}}}.

type WorkspaceRoleUpsert

type WorkspaceRoleUpsert struct {
	Name            string     `json:"name"`
	Description     string     `json:"description"`
	Scopes          []string   `json:"scopes"`
	InheritedRoleID *uuid.UUID `json:"inherited_role_id"`
}

WorkspaceRoleUpsert defines the request payload when creating or updating a workspace role.

type WorkspaceRolesClient

type WorkspaceRolesClient interface {
	Create(ctx context.Context, data WorkspaceRoleUpsert) (*WorkspaceRole, error)
	Update(ctx context.Context, id uuid.UUID, data WorkspaceRoleUpsert) error
	Delete(ctx context.Context, id uuid.UUID) error
	List(ctx context.Context, roleNames []string) ([]*WorkspaceRole, error)
	Get(ctx context.Context, id uuid.UUID) (*WorkspaceRole, error)
}

type WorkspaceUpdate

type WorkspaceUpdate struct {
	Name                   *string    `json:"name"`
	Description            *string    `json:"description"`
	Handle                 *string    `json:"handle"`
	DefaultWorkspaceRoleID *uuid.UUID `json:"default_workspace_role_id"`
}

WorkspaceUpdate is a subset of Workspace used when updating workspaces.

type WorkspacesClient

type WorkspacesClient interface {
	Create(ctx context.Context, data WorkspaceCreate) (*Workspace, error)
	Get(ctx context.Context, workspaceID uuid.UUID) (*Workspace, error)
	List(ctx context.Context, handleNames []string) ([]*Workspace, error)
	Update(ctx context.Context, workspaceID uuid.UUID, data WorkspaceUpdate) error
	Delete(ctx context.Context, workspaceID uuid.UUID) error
}

WorkspacesClient is a client for working with workspaces.

Jump to

Keyboard shortcuts

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