entity

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 8 Imported by: 11

Documentation

Index

Constants

View Source
const (
	SecretProviderTypeAliCloud   = "kam.v1.secretproviders.AlicloudProvider"
	SecretProviderTypeAWS        = "kam.v1.secretproviders.AWSProvider"
	SecretProviderTypeVault      = "kam.v1.secretproviders.VaultProvider"
	SecretProviderTypeAzureKV    = "kam.v1.secretproviders.AzureKVProvider"
	SecretProviderTypeOnPremises = "kam.v1.secretproviders.OnPremisesProvider"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// ID is the id of the backend.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the backend.
	Name string `yaml:"name" json:"name"`
	// // Type is the type of the backend.
	// Type string `yaml:"type" json:"type"`
	// Backend is the configuration of the backend.
	BackendConfig v1.BackendConfig `yaml:"backendConfig" json:"backendConfig"`
	// Description is a human-readable description of the backend.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// CreationTimestamp is the timestamp of the created for the backend.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the backend.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Backend represents the specific configuration backend

func (*Backend) Validate

func (w *Backend) Validate() error

Validate checks if the backend is valid. It returns an error if the backend is not valid.

type BackendFilter added in v0.14.0

type BackendFilter struct {
	Pagination *Pagination
}

type BackendListResult added in v0.14.0

type BackendListResult struct {
	Backends []*Backend
	Total    int
}

type GetConfig

type GetConfig struct {
	Paths []string
	Type  *constant.SourceProviderType
}

type GetOption

type GetOption func(opt *GetConfig)

func WithPaths

func WithPaths(paths ...string) GetOption

func WithType

type Module added in v0.14.0

type Module struct {
	// Name is the module name.
	Name string `yaml:"name" json:"name"`
	// URL is the module oci artifact registry URL.
	URL *url.URL `yaml:"url" json:"url"`
	// Description is a human-readable description of the module.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Owners is a list of owners for the module.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// Doc is the documentation URL of the module.
	Doc *url.URL `yaml:"doc,omitempty" json:"doc,omitempty"`
}

Module represents the specific configuration code module, which should be a specific instance of the Kusion Module provider.

func (*Module) Validate added in v0.14.0

func (m *Module) Validate() error

Validate checks if the module is valid. It returns an error if the module is not valid.

type ModuleFilter added in v0.14.0

type ModuleFilter struct {
	// ModuleName is the name of the module to filter by.
	ModuleName string
	Pagination *Pagination
}

ModuleFilter is the filter for the module.

type ModuleListResult added in v0.14.0

type ModuleListResult struct {
	Modules            []*Module
	ModulesWithVersion []*ModuleWithVersion
	Total              int
}

type ModuleWithVersion added in v0.14.0

type ModuleWithVersion struct {
	// Name is the module name.
	Name string `yaml:"name" json:"name"`
	// URL is the module oci artifact registry URL.
	URL *url.URL `yaml:"url" json:"url"`
	// Version is the module oci artifact version.
	Version string `yaml:"version" json:"version"`
	// Description is a human-readable description of the module.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Owners is a list of owners for the module.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// Doc is the documentation URL of the module.
	Doc *url.URL `yaml:"doc,omitempty" json:"doc,omitempty"`
}

ModuleWithVersion represents the specific configuration code module with version, which should be a specific instance of the Kusion Module provider.

type Organization

type Organization struct {
	// ID is the id of the organization.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the organization.
	Name string `yaml:"name" json:"name"`
	// DisplayName is the human-readable display name.
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
	// Description is a human-readable description of the organization.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Labels are custom labels associated with the organization.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the organization.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// CreationTimestamp is the timestamp of the created for the organization.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the organization.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Organization represents the specific configuration organization

func (*Organization) Validate

func (p *Organization) Validate() error

Validate checks if the organization is valid. It returns an error if the organization is not valid.

type OrganizationFilter added in v0.14.0

type OrganizationFilter struct {
	Pagination *Pagination
}

type OrganizationListResult added in v0.14.0

type OrganizationListResult struct {
	Organizations []*Organization
	Total         int
}

type Pagination added in v0.14.0

type Pagination struct {
	Page     int `json:"page"`
	PageSize int `json:"pageSize"`
}

type Project

type Project struct {
	// ID is the id of the project.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the project.
	Name string `yaml:"name" json:"name"`
	// DisplayName is the human-readable display name.
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
	// Source is the configuration source associated with the project.
	Source *Source `yaml:"source" json:"source"`
	// Organization is the configuration source associated with the project.
	Organization *Organization `yaml:"organization" json:"organization"`
	// Description is a human-readable description of the project.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Path is the relative path of the project within the sources.
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
	// Labels are custom labels associated with the project.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the project.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// CreationTimestamp is the timestamp of the created for the project.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the project.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Project represents the specific configuration project

func (*Project) ConvertToCore

func (p *Project) ConvertToCore() *v1.Project

Convert Project to core Project

func (*Project) Validate

func (p *Project) Validate() error

Validate checks if the project is valid. It returns an error if the project is not valid.

type ProjectFilter added in v0.13.0

type ProjectFilter struct {
	OrgID      uint
	Name       string
	FuzzyName  string
	Pagination *Pagination
}

type ProjectListResult added in v0.14.0

type ProjectListResult struct {
	Projects []*Project
	Total    int
}

type Resource added in v0.13.0

type Resource struct {
	// ID is the id of the resource.
	ID uint `yaml:"id" json:"id"`
	// Stack is the stack associated with the resource.
	Stack *Stack `yaml:"stack" json:"stack"`
	// ResourceType is the type of the resource.
	ResourceType string `yaml:"resourceType" json:"resourceType"`
	// ResourcePlane is the plane of the resource.
	ResourcePlane string `yaml:"resourcePlane" json:"resourcePlane"`
	// ResourceName is the name of the resource.
	ResourceName string `yaml:"resourceName" json:"resourceName"`
	// ResourceURN is the urn of the resource.
	ResourceURN string `yaml:"resourceURN" json:"resourceURN"`
	// KusionResourceID is the id of the resource in Kusion.
	KusionResourceID string `yaml:"kusionResourceID" json:"kusionResourceID"`
	// IAMResourceID is the id of the resource in IAM.
	IAMResourceID string `yaml:"iamResourceID" json:"iamResourceID"`
	// CloudResourceID is the id of the resource in the cloud.
	CloudResourceID string `yaml:"cloudResourceID" json:"cloudResourceID"`
	// LastAppliedRevision is the revision of the last sync.
	LastAppliedRevision string `yaml:"LastAppliedRevision" json:"LastAppliedRevision"`
	// LastAppliedTimestamp is the timestamp of the last sync.
	LastAppliedTimestamp time.Time `yaml:"LastAppliedTimestamp" json:"LastAppliedTimestamp"`
	// Status is the status of the resource.
	Status string `yaml:"status" json:"status"`
	// Attributes is the attributes of the resource.
	Attributes map[string]interface{} `yaml:"attributes,omitempty" json:"attributes,omitempty"`
	// Extensions is the extensions of the resource.
	Extensions map[string]interface{} `yaml:"extensions,omitempty" json:"extensions,omitempty"`
	// DependsOn is the depends on of the resource.
	DependsOn []string `yaml:"dependsOn,omitempty" json:"dependsOn,omitempty"`
	// Provider is the provider of the resource.
	Provider string `yaml:"provider" json:"provider"`
	// Labels are custom labels associated with the resource.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the resource.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// CreationTimestamp is the timestamp of the created for the resource.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the resource.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Resource represents the specific configuration code resource, which should be a specific instance of the resource provider.

func (*Resource) Validate added in v0.13.0

func (r *Resource) Validate() error

Validate checks if the resource is valid. It returns an error if the resource is not valid.

type ResourceFilter added in v0.13.0

type ResourceFilter struct {
	OrgID            uint
	ProjectID        uint
	StackID          uint
	ResourcePlane    string
	ResourceType     string
	KusionResourceID string
	Status           string
	Pagination       *Pagination
}

type ResourceGraph added in v0.14.0

type ResourceGraph struct {
	Resources map[string]ResourceInfo `yaml:"resources" json:"resources"`
	Relations []ResourceRelation      `yaml:"relations" json:"relations"`
	Workload  string                  `yaml:"workload" json:"workload"`
}

func NewResourceGraph added in v0.14.0

func NewResourceGraph() *ResourceGraph

func (*ResourceGraph) AddResourceRelation added in v0.14.0

func (rg *ResourceGraph) AddResourceRelation(dependentResource, dependencyResource string)

AddResourceRelation adds a directed edge from parent to child

func (*ResourceGraph) ConstructResourceGraph added in v0.14.0

func (rg *ResourceGraph) ConstructResourceGraph(resources []*Resource) error

ConstructResourceGraph constructs the resource graph from the resources.

func (*ResourceGraph) SetWorkload added in v0.14.0

func (rg *ResourceGraph) SetWorkload(workload string) error

type ResourceInfo added in v0.14.0

type ResourceInfo struct {
	// ResourceType is the type of the resource.
	ResourceType string `yaml:"resourceType" json:"resourceType"`
	// ResourcePlane is the plane of the resource.
	ResourcePlane string `yaml:"resourcePlane" json:"resourcePlane"`
	// ResourceName is the name of the resource.
	ResourceName string `yaml:"resourceName" json:"resourceName"`
	// IAMResourceID is the id of the resource in IAM.
	IAMResourceID string `yaml:"iamResourceID" json:"iamResourceID"`
	// CloudResourceID is the id of the resource in the cloud.
	CloudResourceID string `yaml:"cloudResourceID" json:"cloudResourceID"`
	// ResourceURN is the urn of the resource.
	ResourceURN string `yaml:"resourceURN" json:"resourceURN"`
	// Status is the status of the resource.
	Status string `yaml:"status" json:"status"`
}

type ResourceListResult added in v0.14.0

type ResourceListResult struct {
	Resources []*Resource
	Total     int
}

type ResourceRelation added in v0.14.0

type ResourceRelation struct {
	DependentResource  string
	DependencyResource string
}

type Run added in v0.14.0

type Run struct {
	// ID is the id of the run.
	ID uint `yaml:"id" json:"id"`
	// RunType is the type of the run provider.
	Type constant.RunType `yaml:"type" json:"type"`
	// Stack is the stack of the run.
	Stack *Stack `yaml:"stack" json:"stack"`
	// Workspace is the target workspace of the run.
	Workspace string `yaml:"workspace" json:"workspace"`
	// Status is the status of the run.
	Status constant.RunStatus `yaml:"status" json:"status"`
	// Result is the result of the run.
	Result string `yaml:"result" json:"result"`
	// Trace is the trace of the run.
	Trace string `yaml:"trace" json:"trace"`
	// Logs is the logs of the run.
	Logs string `yaml:"logs" json:"logs"`
	// CreationTimestamp is the timestamp of the created for the run.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the run.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Run represents the specific run, including type which should be a specific instance of the run provider.

func (*Run) Summary added in v0.14.0

func (r *Run) Summary() string

func (*Run) Validate added in v0.14.0

func (r *Run) Validate() error

Validate checks if the run is valid. It returns an error if the run is not valid.

type RunFilter added in v0.14.0

type RunFilter struct {
	ProjectID  uint
	StackID    uint
	Workspace  string
	Type       []string
	Status     []string
	StartTime  time.Time
	EndTime    time.Time
	Pagination *Pagination
}

type RunListResult added in v0.14.0

type RunListResult struct {
	Runs  []*Run
	Total int
}

type RunResult added in v0.14.0

type RunResult struct {
	// ExitCode is the exit code of the run.
	ExitCode int `yaml:"exitCode" json:"exitCode"`
	// Message is the message of the run.
	Message string `yaml:"message" json:"message"`
	// Old is the old state of the run.
	Old string `yaml:"old" json:"old"`
	// New is the new state of the run.
	New string `yaml:"new" json:"new"`
}

RunResult represents the result of the run.

type SecretStore added in v0.13.0

type SecretStore struct {
	ProviderType string         `json:"providerType"`
	Provider     map[string]any `json:"provider"`
}

func (*SecretStore) ConvertToKusionSecretStore added in v0.13.0

func (s *SecretStore) ConvertToKusionSecretStore() (*v1.SecretStore, error)

type SecretValue added in v0.13.0

type SecretValue struct {
	SecretStore *SecretStore `json:"secretStore"`
	// Value to store in the secret store.
	Value string `json:"value"`
	// Ref will only return with the update secret variable
	Ref string `json:"ref"`
}

type SortOptions added in v0.14.0

type SortOptions struct {
	Field     string
	Ascending bool
}

type Source

type Source struct {
	// ID is the id of the source.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the source.
	Name string `yaml:"name" json:"name"`
	// SourceProvider is the type of the source provider.
	SourceProvider constant.SourceProviderType `yaml:"sourceProvider" json:"sourceProvider"`
	// Remote is the source URL, including scheme.
	Remote *url.URL `yaml:"remote" json:"remote"`
	// Description is a human-readable description of the source.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Labels are custom labels associated with the source.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the source.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// CreationTimestamp is the timestamp of the created for the source.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the source.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Source represents the specific configuration code source, which should be a specific instance of the source provider.

func (*Source) Summary

func (s *Source) Summary() string

func (*Source) Validate

func (s *Source) Validate() error

Validate checks if the source is valid. It returns an error if the source is not valid.

type SourceFilter added in v0.14.0

type SourceFilter struct {
	SourceName string
	Pagination *Pagination
}

type SourceListResult added in v0.14.0

type SourceListResult struct {
	Sources []*Source
	Total   int
}

type SourceProvider

type SourceProvider interface {
	// Get the type of the source provider.
	Type() constant.SourceProviderType
	// Get source and return directory.
	Get(ctx context.Context, opts ...GetOption) (string, error)
	// Cleanup is invoked to cleanup temp resources for the source.
	Cleanup(ctx context.Context)
}

The SourceProvider represents the abstraction of the source provider(s) management framework.

type Stack

type Stack struct {
	// ID is the id of the stack.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the stack.
	Name string `yaml:"name" json:"name"`
	// Type is the type of the stack.
	Type string `yaml:"type" json:"type"`
	// DisplayName is the human-readable display nams.
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
	// Project is the project associated with the stack.
	Project *Project `yaml:"project" json:"project"`
	// Desired is the desired version of stack.
	DesiredVersion string `yaml:"desiredVersion" json:"desiredVersion"`
	// Description is a human-readable description of the stack.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Path is the relative path of the stack within the sourcs.
	Path string `yaml:"path,omitempty" json:"path,omitempty"`
	// Labels are custom labels associated with the stack.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the stack.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// SyncState is the current state of the stack.
	SyncState constant.StackState `yaml:"syncState" json:"syncState"`
	// LastGeneratedRevision is the spec ID of the last generate operation for the stack.
	LastGeneratedRevision string `yaml:"lastGeneratedRevision" json:"lastGeneratedRevision"`
	// LastPreviewedRevision is the spec ID of the last preview operation for the stack.
	LastPreviewedRevision string `yaml:"lastPreviewedRevision" json:"lastPreviewedRevision"`
	// LastAppliedRevision is the spec ID of the last apply operation for the stack.
	LastAppliedRevision string `yaml:"lastAppliedRevision" json:"lastAppliedRevision"`
	// LastAppliedTimestamp is the timestamp of the last apply operation for the stack.
	LastAppliedTimestamp time.Time `yaml:"lastAppliedTimestamp,omitempty" json:"lastAppliedTimestamp,omitempty"`
	// CreationTimestamp is the timestamp of the created for the stack.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the stack.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
}

Stack represents the specific configuration stack

func (*Stack) ConvertToCore

func (s *Stack) ConvertToCore() *v1.Stack

Convert stack to core stack

func (*Stack) StackInOperation added in v0.13.0

func (s *Stack) StackInOperation() bool

func (*Stack) Validate

func (s *Stack) Validate() error

Validate checks if the stack is valid. It returns an error if the stack is not valid.

type StackFilter added in v0.13.0

type StackFilter struct {
	OrgID      uint
	ProjectID  uint
	Path       string
	Pagination *Pagination
}

type StackListResult added in v0.14.0

type StackListResult struct {
	Stacks []*Stack
	Total  int
}

type Workspace

type Workspace struct {
	// ID is the id of the workspace.
	ID uint `yaml:"id" json:"id"`
	// Name is the name of the workspace.
	Name string `yaml:"name" json:"name"`
	// DisplayName is the human-readable display name.
	DisplayName string `yaml:"displayName,omitempty" json:"displayName,omitempty"`
	// Description is a human-readable description of the workspace.
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
	// Labels are custom labels associated with the workspace.
	Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"`
	// Owners is a list of owners for the workspace.
	Owners []string `yaml:"owners,omitempty" json:"owners,omitempty"`
	// CreationTimestamp is the timestamp of the created for the workspace.
	CreationTimestamp time.Time `yaml:"creationTimestamp,omitempty" json:"creationTimestamp,omitempty"`
	// UpdateTimestamp is the timestamp of the updated for the workspace.
	UpdateTimestamp time.Time `yaml:"updateTimestamp,omitempty" json:"updateTimestamp,omitempty"`
	// Backend is the corresponding backend for this workspace.
	Backend *Backend `yaml:"backend,omitempty" json:"backend,omitempty"`
}

Workspace represents the specific configuration workspace

func (*Workspace) Validate

func (w *Workspace) Validate() error

Validate checks if the workspace is valid. It returns an error if the workspace is not valid.

type WorkspaceFilter added in v0.13.0

type WorkspaceFilter struct {
	BackendID  uint
	Name       string
	Pagination *Pagination
}

type WorkspaceListResult added in v0.14.0

type WorkspaceListResult struct {
	Workspaces []*Workspace
	Total      int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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