types

package
v0.5.1-rc3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// AnnotationEnableManagedNamespace specify whether Walrus-managed namespace is enabled.
	// Defaults to true.
	AnnotationEnableManagedNamespace = "walrus.seal.io/enable-managed-namespace"
	// AnnotationManagedNamespace specify custom environment namespace name.
	AnnotationManagedNamespace = "walrus.seal.io/managed-namespace-name"
)
View Source
const (
	LabelWalrusProjectName     string = "walrus.seal.io/project-name"
	LabelWalrusEnvironmentName string = "walrus.seal.io/environment-name"
	LabelWalrusServiceName     string = "walrus.seal.io/service-name"

	// LabelWalrusEnvironmentPath indicate environment with project name, format: projectName/environmentName.
	LabelWalrusEnvironmentPath string = "walrus.seal.io/environment-path"
	// LabelWalrusServicePath indicate service with project name and environment name,
	// format: projectName/environmentName/serviceName
	LabelWalrusServicePath string = "walrus.seal.io/service-path"

	// LabelWalrusManaged indicates whether the resource is managed by Seal.
	LabelWalrusManaged string = "walrus.seal.io/managed"

	// LabelWalrusCategory indicates the category of the resource.
	LabelWalrusCategory string = "walrus.seal.io/category"

	// LabelWalrusConnectorType indicates the connector type of the resource.
	LabelWalrusConnectorType string = "walrus.seal.io/connector-type"

	// LabelWalrusResourceType indicates the type of the resource.
	LabelWalrusResourceType string = "walrus.seal.io/resource-type"

	// LabelWalrusResourceDefinition indicates if the template is for resource definition.
	LabelWalrusResourceDefinition string = "walrus.seal.io/resource-definition"

	// LabelResourceStoppable indicates if the resource is stoppable.
	LabelResourceStoppable string = "walrus.seal.io/stoppable"

	// LabelEmbeddedKubernetes indicates whether a connector is the embedded kubernetes.
	LabelEmbeddedKubernetes = "walrus.seal.io/embedded-kubernetes"
)

built-in labels.

View Source
const (
	WalrusSystemNamespace      = "walrus-system"
	DeployerServiceAccountName = "walrus-deployer"
	WorkflowServiceAccountName = "walrus-workflow"
)
View Source
const (
	ConnectorTypeDocker     string = "Docker"
	ConnectorTypeKubernetes string = "Kubernetes"
	ConnectorTypeAlibaba    string = "Alibaba"
	ConnectorTypeAWS        string = "AWS"
)
View Source
const (
	ConnectorCategoryDocker         string = "Docker"
	ConnectorCategoryKubernetes     string = "Kubernetes"
	ConnectorCategoryCustom         string = "Custom"
	ConnectorCategoryVersionControl string = "VersionControl"
	ConnectorCategoryCloudProvider  string = "CloudProvider"
)
View Source
const (
	// ManagementCostItemName indicates cost item name for cluster management.
	ManagementCostItemName = "__management__"

	// UnmountedCostItemName indicated cost item name for unmounted resource (PV or LB).
	UnmountedCostItemName = "__unmounted__"

	// IdleCostItemName indicated cost item name for idle.
	IdleCostItemName = "__idle__"

	// UnallocatedItemName indicate the cost for the resources unallocated.
	UnallocatedItemName = "__unallocated__"
)
View Source
const (
	EnvironmentDevelopment = "development"
	EnvironmentStaging     = "staging"
	EnvironmentProduction  = "production"
)
View Source
const (
	GitDriverGithub = "Github"
	GitDriverGitlab = "Gitlab"
	GitDriverGitee  = "Gitee"
)
View Source
const (
	// VertexKindResource indicates the vertex kind of resource, it contains resource groups.
	VertexKindResource = "Resource"
	// VertexKindResourceComponentGroup indicates the group resource that generates same type resources.
	VertexKindResourceComponentGroup = "ResourceComponentGroup"
	// VertexKindResourceComponent indicates the vertex kind of resource component.
	VertexKindResourceComponent = "ResourceComponent"

	// EdgeTypeComposition indicates vertex is composed of another vertex.
	EdgeTypeComposition = "Composition"
	// EdgeTypeRealization indicates vertex are realized by another vertex.
	EdgeTypeRealization = "Realization"
	// EdgeTypeDependency indicates vertex has dependency on another vertex.
	EdgeTypeDependency = "Dependency"
)
View Source
const (
	// ResourceRelationshipTypeImplicit indicates the resource dependency is auto created by resource reference.
	ResourceRelationshipTypeImplicit = "Implicit"
	// ResourceRelationshipTypeExplicit indicates the resource dependency is manually created by user.
	ResourceRelationshipTypeExplicit = "Explicit"
)
View Source
const (
	// ResourceComponentModeManaged indicates the resource created to target platform,
	// it is writable(update or delete).
	ResourceComponentModeManaged = "managed"

	// ResourceComponentModeData indicates the resource read from target platform,
	// it is read-only.
	ResourceComponentModeData = "data"

	// ResourceComponentModeDiscovered indicates the resource discovered from target platform,
	// it inherits its composition's characteristic to be writable or not.
	ResourceComponentModeDiscovered = "discovered"
)
View Source
const (
	// ResourceComponentShapeClass indicates the resource is a class.
	ResourceComponentShapeClass = "class"
	// ResourceComponentShapeInstance indicates the resource is an instance that implements a class.
	ResourceComponentShapeInstance = "instance"
)
View Source
const (
	RoleKindSystem  = "system"
	RoleKindProject = "project"
)
View Source
const (
	SystemRoleAnonymity = "system/anonymity"
	SystemRoleUser      = "system/user"
	SystemRoleManager   = "system/manager"
	SystemRoleAdmin     = "system/admin"

	ProjectRoleViewer = "project/viewer"
	ProjectRoleMember = "project/member"
	ProjectRoleOwner  = "project/owner"
)
View Source
const (
	VariableSchemaKey = "variables"
	OutputSchemaKey   = "outputs"
)
View Source
const (
	SubjectKindUser  = "user"
	SubjectKindGroup = "group"
)
View Source
const (
	TokenKindDeployment = "deployment"
	TokenKindAPI        = "api"
)
View Source
const (
	WorkflowTypeDefault = "default"
	WorkflowTypeCron    = "cron"
)
View Source
const (
	WorkflowStepTypeService  = "service"
	WorkflowStepTypeApproval = "approval"
)
View Source
const (
	ExecutionStatusRunning   = "Running"
	ExecutionStatusSucceeded = "Succeeded"
	ExecutionStatusFailed    = "Failed"
	ExecutionStatusError     = "Error"
)
View Source
const (
	// WorkflowStepApprovalTypeOr means step is approved
	// if any of the approval users approves it.
	WorkflowStepApprovalTypeOr = "or"
	// WorkflowStepApprovalTypeAnd means step is approved
	// only all of the approval users approve it.
	WorkflowStepApprovalTypeAnd = "and"

	// WorkflowStepApprovalType is the key of type in spec.
	WorkflowStepApprovalType = "approvalType"
	// WorkflowStepApprovalUsers is the key of approval users in spec.
	WorkflowStepApprovalUsers = "approvalUsers"
	// WorkflowStepApprovedUsers is the key of approved users in spec.
	WorkflowStepApprovedUsers = "approvedUsers"
	// WorkflowStepRejectedUsers is the key of reject users in spec.
	WorkflowStepRejectedUsers = "rejectedUsers"
)
View Source
const DeployerTypeTF string = "Terraform"
View Source
const (
	// LabelPrefix is used for generate label's field names.
	LabelPrefix = "label:"
)
View Source
const ResourceComponentRelationshipTypeDependency = "Dependency"

ResourceComponentRelationshipTypeDependency indicates the relationship between resource component and its dependencies.

View Source
const SubjectDomainBuiltin = "builtin"
View Source
const WalrusContextVariableName = openapi.WalrusContextVariableName
View Source
const (
	WalrusFileVersion = "v1"
)
View Source
const (
	WalrusOperationTokenName = "walrus-operation-token"
)
View Source
const (
	WorkflowExecutionTriggerTypeManual = "manual"
)

Variables

Functions

func EnvironmentTypes added in v0.4.0

func EnvironmentTypes() []string

func IsEnvironmentType added in v0.4.0

func IsEnvironmentType(s string) bool

func IsIdleCost

func IsIdleCost(name string) bool

func IsIdleOrManagementCost

func IsIdleOrManagementCost(name string) bool

func IsManagementCost

func IsManagementCost(name string) bool

func IsRoleKind

func IsRoleKind(s string) bool

func IsSubjectKind

func IsSubjectKind(s string) bool

func IsTokenKind

func IsTokenKind(s string) bool

func RoleKinds

func RoleKinds() []string

func RolePolicyFields

func RolePolicyFields(f ...string) []string

Types

type CatalogSync

type CatalogSync struct {
	Total     int       `json:"total"`
	Succeeded int       `json:"succeeded"`
	Failed    int       `json:"failed"`
	Time      time.Time `json:"time"`
}

CatalogSync is the sync information of a catalog.

type Context added in v0.5.0

type Context struct {
	// Project indicate the project metadata.
	Project struct {
		Name string    `json:"name,omitempty"`
		ID   object.ID `json:"id,omitempty"`
	} `json:"project,omitempty"`

	// Environment indicate the environment metadata.
	Environment struct {
		Name string    `json:"name,omitempty"`
		ID   object.ID `json:"id,omitempty"`
		// Namespace is the managed namespace name of an environment,
		// valid when Kubernetes connector is used in the environment.
		Namespace string `json:"namespace,omitempty"`
	} `json:"environment,omitempty"`

	// Resource indicate the resource metadata.
	Resource struct {
		Name string    `json:"name,omitempty"`
		ID   object.ID `json:"id,omitempty"`
	} `json:"resource,omitempty"`
}

Context indicate the walrus related metadata, will set to attribute context while user module include this attribute.

func NewContext added in v0.5.0

func NewContext() *Context

func (*Context) SetEnvironment added in v0.5.0

func (c *Context) SetEnvironment(id object.ID, name, namespace string) *Context

func (*Context) SetProject added in v0.5.0

func (c *Context) SetProject(id object.ID, name string) *Context

func (*Context) SetResource added in v0.5.0

func (c *Context) SetResource(id object.ID, name string) *Context

type CostFilters

type CostFilters [][]FilterRule

CostFilters indicate the filters for cost query.

type FilterField

type FilterField string

FilterField indicate type for filter field.

const (
	FilterFieldConnectorID    FilterField = "connector_id"
	FilterFieldNamespace      FilterField = "namespace"
	FilterFieldClusterName    FilterField = "cluster_name"
	FilterFieldNode           FilterField = "node"
	FilterFieldController     FilterField = "controller"
	FilterFieldControllerKind FilterField = "controller_kind"
	FilterFieldPod            FilterField = "pod"
	FilterFieldContainer      FilterField = "container"
	FilterFieldName           FilterField = "name"

	// FilterFieldProject is "label:seal.io/project-name".
	FilterFieldProject = FilterField("label:" + LabelWalrusProjectName)

	// FilterFieldEnvironmentPath is "label:seal.io/environment-name".
	FilterFieldEnvironmentPath = FilterField("label:" + LabelWalrusEnvironmentPath)

	// FilterFieldServicePath is "label:seal.io/service-name".
	FilterFieldServicePath = FilterField("label:" + LabelWalrusServicePath)
)

built-in filter fieldName.

func (*FilterField) IsLabel

func (f *FilterField) IsLabel() bool

type FilterRule

type FilterRule struct {
	FieldName  FilterField `json:"fieldName,omitempty"`
	Operator   Operator    `json:"operator,omitempty"`
	Values     []string    `json:"values,omitempty"`
	IncludeAll bool        `json:"includeAll,omitempty"`
}

FilterRule indicate the filter rule for cost query.

type FinOpsCustomPricing

type FinOpsCustomPricing struct {
	// CPU describing cost per core-month of CPU.
	CPU string `json:"cpu"`
	// CPU describing cost per core-month of CPU for spot nodes.
	SpotCPU string `json:"spotCPU"`
	// RAM describing cost per GiB-month of RAM/memory.
	RAM string `json:"ram"`
	// SpotRAM describing cost per GiB-month of RAM/memory for spot nodes.
	SpotRAM string `json:"spotRAM"`
	GPU     string `json:"gpu"`
	SpotGPU string `json:"spotGPU"`
	// Storage describing cost per GB-month of storage (e.g. PV, disk) resources.
	Storage string `json:"storage"`
}

FinOpsCustomPricing used to config opencost.

func DefaultFinOpsCustomPricing

func DefaultFinOpsCustomPricing() *FinOpsCustomPricing

func (*FinOpsCustomPricing) IsZero

func (c *FinOpsCustomPricing) IsZero() bool

type GraphEdge

type GraphEdge struct {
	// Type indicates the type of the edge, like: Dependency or Composition.
	Type string `json:"type"`
	// Start indicates the beginning of the edge.
	Start GraphVertexID `json:"start"`
	// End indicates the ending of the edge.
	End GraphVertexID `json:"end"`
}

GraphEdge defines the edge of graph.

type GraphVertex

type GraphVertex struct {
	GraphVertexID `json:",inline"`

	// Name indicates a human-readable string of the vertex.
	Name string `json:"name,omitempty"`
	// Description indicates the detail of the vertex.
	Description string `json:"description,omitempty"`
	// Icon indicates the icon of the vertex.
	Icon string `json:"icon,omitempty"`
	// Labels indicates the labels of the vertex.
	Labels map[string]string `json:"labels,omitempty"`
	// CreateTime indicates the time to create the vertex.
	CreateTime *time.Time `json:"createTime,omitempty"`
	// UpdateTime indicates the time to update the vertex.
	UpdateTime *time.Time `json:"updateTime,omitempty"`
	// Status observes the status of the vertex.
	Status status.Summary `json:"status,omitempty"`
	// Extensions records the other information of the vertex,
	// e.g. the physical type, logical category or the operational keys of the resource.
	Extensions map[string]any `json:"extensions,omitempty"`
}

GraphVertex defines the vertex of graph.

type GraphVertexID

type GraphVertexID struct {
	// Kind indicates the kind of the resource,
	// which should be the same as the API handler's Kind returning.
	Kind string `json:"kind"`
	// ID indicates the identifier of the resource.
	ID any `json:"id,omitempty"`
}

GraphVertexID defines the identifier of the vertex, which uniquely represents an API resource.

type GroupByField

type GroupByField string

GroupByField indicate type for groupBy field.

const (
	// Properties.
	GroupByFieldConnectorID    GroupByField = "connector_id"
	GroupByFieldNamespace      GroupByField = "namespace"
	GroupByFieldClusterName    GroupByField = "cluster_name"
	GroupByFieldNode           GroupByField = "node"
	GroupByFieldController     GroupByField = "controller"
	GroupByFieldControllerKind GroupByField = "controller_kind"
	GroupByFieldPod            GroupByField = "pod"
	GroupByFieldContainer      GroupByField = "container"
	GroupByFieldWorkload       GroupByField = "workload"

	// Time bucket.
	GroupByFieldDay   GroupByField = "day"
	GroupByFieldWeek  GroupByField = "week"
	GroupByFieldMonth GroupByField = "month"

	// Built-in labels.
	GroupByFieldProject     = GroupByField("label:" + LabelWalrusProjectName) // "label:walrus.seal.io/project-name".
	GroupByFieldEnvironment = GroupByField(
		"label:" + LabelWalrusEnvironmentName,
	) // "label:walrus.seal.io/environment-name".
	GroupByFieldService = GroupByField(
		"label:" + LabelWalrusServiceName,
	) // "label:walrus.seal.io/service-name".
	GroupByFieldEnvironmentPath = GroupByField(
		"label:" + LabelWalrusEnvironmentPath,
	) // "label:walrus.seal.io/environment-path".
	GroupByFieldServicePath = GroupByField("label:" + LabelWalrusServicePath) // "label:walrus.seal.io/service-path".
)

built-in groupBy fieldName.

func (*GroupByField) IsLabel

func (f *GroupByField) IsLabel() bool

type IdleShareOption

type IdleShareOption struct {
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

IdleShareOption indicate the shared cost option for idle cost.

type ItemSharedOption

type ItemSharedOption struct {
	Filters         CostFilters     `json:"filters,omitempty"`
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

ItemSharedOption indicate the shared cost option for custom item cost query.

type ItemSharedOptions

type ItemSharedOptions []ItemSharedOption

ItemSharedOptions indicate the shared cost options for custom item cost query.

type ManagementShareOption

type ManagementShareOption struct {
	SharingStrategy SharingStrategy `json:"sharingStrategy,omitempty"`
}

ManagementShareOption indicate the shared cost option for management cost.

type MatchResourceMetadata added in v0.5.0

type MatchResourceMetadata struct {
	ProjectName       string
	EnvironmentName   string
	EnvironmentType   string
	ProjectLabels     map[string]string
	EnvironmentLabels map[string]string
	ResourceLabels    map[string]string
}

type MetadataName added in v0.5.0

type MetadataName struct {
	Name string `json:"name,omitempty" yaml:"name,omitempty"`
}

MetadataName is the name of the resource.

type Operator

type Operator string

Operator for filter rule.

const (
	OperatorIn    Operator = "in"
	OperatorNotIn Operator = "notin"
)

type OutputValue

type OutputValue struct {
	Name      string          `json:"name,omitempty"`
	Value     property.Value  `json:"value,omitempty,cli-table-column"`
	Type      cty.Type        `json:"type,omitempty"`
	Sensitive bool            `json:"sensitive,omitempty"`
	Schema    openapi3.Schema `json:"schema,omitempty"`
}

type PVCost

type PVCost struct {
	Cost  float64 `json:"cost"`
	Bytes float64 `json:"bytes"`
}

type ProviderRequirement

type ProviderRequirement struct {
	*tfconfig.ProviderRequirement

	Name string `json:"name"`
}

ProviderRequirement include the required provider.

type QueryCondition

type QueryCondition struct {
	Filters       CostFilters        `json:"filters,omitempty"`
	GroupBy       GroupByField       `json:"groupBy,omitempty"`
	Step          Step               `json:"step,omitempty"`
	Paging        QueryPagination    `json:"paging,omitempty"`
	Query         string             `json:"query"`
	SharedOptions *SharedCostOptions `json:"sharedOptions,omitempty"`
}

QueryCondition indicated the filters, groupBys, step, and shared costs query params.

type QueryPagination

type QueryPagination struct {
	Page    int `json:"page,omitempty"`
	PerPage int `json:"perPage,omitempty"`
}

QueryPagination indicate the pagination query config.

type ResourceComponentOperationKey added in v0.4.0

type ResourceComponentOperationKey struct {
	// Keys indicates the subordinate keys,
	// usually, it should not be valued in leaves.
	Keys []ResourceComponentOperationKey `json:"keys,omitempty"`
	// Name indicates the name of the key.
	Name string `json:"name"`
	// Value indicates the value of the key,
	// usually, it should be valued in leaves.
	Value string `json:"value,omitempty"`
	// Loggable indicates whether to be able to get log.
	Loggable *bool `json:"loggable,omitempty"`
	// Executable indicates whether to be able to execute remote command.
	Executable *bool `json:"executable,omitempty"`
}

ResourceComponentOperationKey holds hierarchy query keys.

type ResourceComponentOperationKeys added in v0.4.0

type ResourceComponentOperationKeys struct {
	// Labels stores label of layer,
	// its length means each key contains levels with the same value as level.
	Labels []string `json:"labels,omitempty"`
	// Keys stores key in tree.
	Keys []ResourceComponentOperationKey `json:"keys,omitempty"`
}

type ResourceEndpoint added in v0.5.0

type ResourceEndpoint struct {
	// Name indicates the name of endpoint.
	Name string `json:"name"`
	// URL indicates the URL of endpoint, must be a valid URL.
	URL string `json:"url,cli-table-column"`
}

ResourceEndpoint holds the endpoint definition of resource.

type ResourceEndpoints added in v0.5.0

type ResourceEndpoints []ResourceEndpoint

ResourceEndpoints holds a list of the endpoints definitions of resource.

func ResourceEndpointsFromMap added in v0.5.0

func ResourceEndpointsFromMap(m map[string]string) ResourceEndpoints

ResourceEndpointsFromMap converts a map to ResourceEndpoints.

func (ResourceEndpoints) Len added in v0.5.0

func (in ResourceEndpoints) Len() int

func (ResourceEndpoints) Less added in v0.5.0

func (in ResourceEndpoints) Less(i, j int) bool

func (ResourceEndpoints) Sort added in v0.5.0

func (ResourceEndpoints) Swap added in v0.5.0

func (in ResourceEndpoints) Swap(i, j int)

type ResourceSpec added in v0.5.0

type ResourceSpec struct {
	Name        string `json:"name" yaml:"name,omitempty"`
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// Scope.
	Project     *MetadataName `json:"project,omitempty" yaml:"project,omitempty"`
	Environment *MetadataName `json:"environment,omitempty" yaml:"environment,omitempty"`

	// Template or resource definition type.
	Type     string        `json:"type,omitempty" yaml:"type,omitempty"`
	Template *TemplateSpec `json:"template,omitempty" yaml:"template,omitempty"`

	Labels     map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
	Attributes property.Values   `json:"attributes,omitempty" yaml:"attributes,omitempty"`
}

ResourceSpec include the fields walrus file related. The walrus file yaml preserves the order of the fields in this struct.

type RetryStrategy added in v0.4.0

type RetryStrategy struct {
	Limit       int              `json:"limit"`
	RetryPolicy wfv1.RetryPolicy `json:"retryPolicy"`
	Backoff     *wfv1.Backoff    `json:"backoff"`
}

RetryStrategy is the retry strategy of a workflow step. See https://raw.githubusercontent.com/argoproj/argo-workflows/master/examples/retry-conditional.yaml

type RolePolicies

type RolePolicies []RolePolicy

func DefaultRolePolicies

func DefaultRolePolicies() RolePolicies

func (RolePolicies) Clone

func (in RolePolicies) Clone() RolePolicies

func (RolePolicies) Deduplicate

func (in RolePolicies) Deduplicate() RolePolicies

func (RolePolicies) Delete

func (in RolePolicies) Delete(rs ...RolePolicy) RolePolicies

func (RolePolicies) Len

func (in RolePolicies) Len() int

func (RolePolicies) Less

func (in RolePolicies) Less(i, j int) bool

func (RolePolicies) Normalize

func (in RolePolicies) Normalize() RolePolicies

func (RolePolicies) Sort

func (in RolePolicies) Sort() RolePolicies

func (RolePolicies) Swap

func (in RolePolicies) Swap(i, j int)

type RolePolicy

type RolePolicy struct {
	// Actions specifies the including action list of this policy.
	Actions []string `json:"actions,omitempty"`

	// Resources specifies the including resource list of this policy.
	Resources []string `json:"resources,omitempty"`
	// ResourceRefers specifies the including object.Refer list of this policy,
	// only works if the Resources specified as ["<a kind of resource>"].
	ResourceRefers []string `json:"resourceRefers,omitempty"`

	// Paths specifies the route-registered path list of this policy,
	// i.e. /resources/:id, only works if the Resources has not been specified.
	Paths []string `json:"paths,omitempty"`
}

func (RolePolicy) IsZero

func (in RolePolicy) IsZero() bool

func (RolePolicy) Normalize

func (in RolePolicy) Normalize() RolePolicy

func (RolePolicy) String

func (in RolePolicy) String() string

type Schema added in v0.4.0

type Schema struct {
	OpenAPISchema *openapi3.T `json:"openAPISchema"`
}

Schema specifies the openAPI schema with variables and outputs.

func (*Schema) Expose added in v0.4.0

func (s *Schema) Expose(skipProps ...string) UISchema

Expose returns the UI schema of the schema.

func (*Schema) Intersect added in v0.4.0

func (s *Schema) Intersect(s2 *Schema)

Intersect sets variables & outputs schema of s to intersection of s and s2.

func (*Schema) IsEmpty added in v0.4.0

func (s *Schema) IsEmpty() bool

func (*Schema) OutputSchema added in v0.4.0

func (s *Schema) OutputSchema() *openapi3.Schema

OutputSchema returns the outputs' schema.

func (*Schema) RemoveVariableContext added in v0.5.0

func (s *Schema) RemoveVariableContext()

func (*Schema) SetOutputSchema added in v0.4.0

func (s *Schema) SetOutputSchema(v *openapi3.Schema)

func (*Schema) SetVariableSchema added in v0.4.0

func (s *Schema) SetVariableSchema(v *openapi3.Schema)

func (*Schema) Validate added in v0.4.0

func (s *Schema) Validate() error

Validate reports if the schema is valid.

func (*Schema) VariableSchema added in v0.4.0

func (s *Schema) VariableSchema() *openapi3.Schema

VariableSchema returns the variables' schema.

type Selector added in v0.4.0

type Selector struct {
	ProjectNames      []string          `json:"projectNames,omitempty"`
	ProjectLabels     map[string]string `json:"projectLabels,omitempty"`
	EnvironmentNames  []string          `json:"environmentNames,omitempty"`
	EnvironmentTypes  []string          `json:"environmentTypes,omitempty"`
	EnvironmentLabels map[string]string `json:"environmentLabels,omitempty"`
	ResourceLabels    map[string]string `json:"resourceLabels,omitempty"`
}

type SharedCostOptions

type SharedCostOptions struct {
	Item       ItemSharedOptions      `json:"item,omitempty"`
	Idle       *IdleShareOption       `json:"idle,omitempty"`
	Management *ManagementShareOption `json:"management,omitempty"`
}

SharedCostOptions indicate the shared cost options for shared cost query.

type SharingStrategy

type SharingStrategy string

SharingStrategy indicate the share cost strategy.

const (
	SharingStrategyEqually        SharingStrategy = "equally"
	SharingStrategyProportionally SharingStrategy = "proportionally"
)

type Step

type Step string

Step indicate the time step to aggregate cost.

const (
	StepDay   Step = "day"
	StepWeek  Step = "week"
	StepMonth Step = "month"
)

type TemplateSpec added in v0.5.0

type TemplateSpec struct {
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Version string `json:"version,omitempty" yaml:"version,omitempty"`
}

TemplateSpec include the field walrus file related.

type TemplateVersionSchema added in v0.4.0

type TemplateVersionSchema struct {
	Schema `json:",inline"`

	// TemplateVersionSchemaData include the data of this template version.
	TemplateVersionSchemaData `json:",inline"`
}

TemplateVersionSchema include the internal template variables schema and template data.

func (*TemplateVersionSchema) Validate added in v0.4.0

func (s *TemplateVersionSchema) Validate() error

Validate reports if the schema is valid.

type TemplateVersionSchemaData added in v0.4.0

type TemplateVersionSchemaData struct {
	// Readme specifies the readme of this template.
	Readme string `json:"readme"`
	// RequiredProviders specifies the required providers of this template.
	RequiredProviders []ProviderRequirement `json:"requiredProviders"`
}

TemplateVersionSchemaData include the data of this template version.

type UISchema added in v0.4.0

type UISchema Schema

UISchema include the UI schema that users can customize.

func (UISchema) IsEmpty added in v0.4.0

func (s UISchema) IsEmpty() bool

IsEmpty reports if the schema is empty.

func (*UISchema) SetVariableSchema added in v0.5.0

func (s *UISchema) SetVariableSchema(v *openapi3.Schema)

SetVariableSchema sets the variables' schema.

func (*UISchema) Validate added in v0.5.0

func (s *UISchema) Validate() error

Validate reports if the ui schema is valid.

func (*UISchema) VariableSchema added in v0.4.0

func (s *UISchema) VariableSchema() *openapi3.Schema

VariableSchema returns the variables' schema.

type WalrusFile added in v0.5.0

type WalrusFile struct {
	Version   string         `json:"version,omitempty" yaml:"version,omitempty"`
	Resources []ResourceSpec `json:"resources,omitempty" yaml:"resources,omitempty"`
}

WalrusFile is the spec for the WalrusFile.

func (*WalrusFile) Yaml added in v0.5.0

func (w *WalrusFile) Yaml() ([]byte, error)

Yaml returns the yaml bytes of the walrus file.

type WorkflowExecutionTrigger added in v0.4.0

type WorkflowExecutionTrigger struct {
	Type string `json:"type"`
	User string `json:"user"`
}

WorkflowExecutionTrigger is the trigger of a workflow execution.

type WorkflowStepApprovalSpec added in v0.4.0

type WorkflowStepApprovalSpec struct {
	ApprovalUsers []object.ID `json:"approvalUsers"`
	ApprovedUsers []object.ID `json:"approvedUsers"`
	RejectedUsers []object.ID `json:"rejectedUsers"`
	Type          string      `json:"approvalType"`
}

func NewWorkflowStepApprovalSpec added in v0.4.0

func NewWorkflowStepApprovalSpec(spec map[string]any) (*WorkflowStepApprovalSpec, error)

func (*WorkflowStepApprovalSpec) IsApprovalUser added in v0.4.0

func (s *WorkflowStepApprovalSpec) IsApprovalUser(user object.ID) bool

func (*WorkflowStepApprovalSpec) IsApproved added in v0.4.0

func (s *WorkflowStepApprovalSpec) IsApproved() bool

func (*WorkflowStepApprovalSpec) IsRejected added in v0.4.0

func (s *WorkflowStepApprovalSpec) IsRejected() bool

func (*WorkflowStepApprovalSpec) Reset added in v0.4.0

func (s *WorkflowStepApprovalSpec) Reset()

func (*WorkflowStepApprovalSpec) SetApprovedUser added in v0.4.0

func (s *WorkflowStepApprovalSpec) SetApprovedUser(user object.ID) error

func (*WorkflowStepApprovalSpec) SetRejectedUser added in v0.4.0

func (s *WorkflowStepApprovalSpec) SetRejectedUser(user object.ID) error

func (*WorkflowStepApprovalSpec) SetUserApproval added in v0.4.0

func (s *WorkflowStepApprovalSpec) SetUserApproval(user object.ID, approved bool) error

SetUserApproval sets the user approval status.

func (*WorkflowStepApprovalSpec) ToAttributes added in v0.4.0

func (s *WorkflowStepApprovalSpec) ToAttributes() map[string]any

type WorkflowVariable added in v0.4.0

type WorkflowVariable struct {
	// Name is the name of the parameter.
	Name        string `json:"name"`
	Value       string `json:"value"`
	Overwrite   bool   `json:"overwrite"`
	Description string `json:"description,omitempty"`
}

WorkflowVariable is the config of a workflow parameter. Parameters could be reconfigured in workflow execution.

func (*WorkflowVariable) Validate added in v0.4.0

func (c *WorkflowVariable) Validate() error

type WorkflowVariables added in v0.4.0

type WorkflowVariables []*WorkflowVariable

func (WorkflowVariables) Validate added in v0.4.0

func (c WorkflowVariables) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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