Skip to content

Commit

Permalink
chore: deprecate old core api pkg, use latest instead
Browse files Browse the repository at this point in the history
  • Loading branch information
adohe committed Apr 6, 2024
1 parent 40ad5b6 commit b4e5fea
Show file tree
Hide file tree
Showing 167 changed files with 881 additions and 3,792 deletions.
59 changes: 59 additions & 0 deletions pkg/apis/api.kusion.io/v1/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package v1

import (
"time"

"kusionstack.io/kusion/pkg/version"
)

// Project is a definition of Kusion project resource.
//
// A project is composed of one or more applications and is linked to a Git repository(monorepo or polyrepo),
Expand All @@ -13,6 +19,8 @@ type Project struct {
Labels map[string]string `json:"labels,omitempty" yaml:"labels,omitempty"`
// Path is a directory path within the Git repository.
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// The set of stacks that are known about this project.
Stacks []*Stack `json:"stacks,omitempty" yaml:"stacks,omitempty"`
}

// Stack is a definition of Kusion stack resource.
Expand All @@ -30,6 +38,11 @@ type Stack struct {
Path string `json:"path,omitempty" yaml:"path,omitempty"`
}

const (
DefaultBlock = "default"
ProjectSelectorField = "projectSelector"
)

// Workspace is a logical concept representing a target that stacks will be deployed to.
//
// Workspace is managed by platform engineers, which contains a set of configurations
Expand Down Expand Up @@ -289,3 +302,49 @@ type Resource struct {
// Extensions specifies arbitrary metadata of this resource
Extensions map[string]interface{} `json:"extensions,omitempty" yaml:"extensions,omitempty"`
}

// State is a record of an operation's result. It is a mapping between resources in KCL and the actual infra
// resource and often used as a datasource for 3-way merge/diff in operations like Apply or Preview.
type State struct {
// State ID
ID int64 `json:"id" yaml:"id"`

// Project name
Project string `json:"project" yaml:"project"`

// Stack name
Stack string `json:"stack" yaml:"stack"`

// Workspace name
Workspace string `json:"workspace" yaml:"workspace"`

// State version
Version int `json:"version" yaml:"version"`

// KusionVersion represents the Kusion's version when this State is created
KusionVersion string `json:"kusionVersion" yaml:"kusionVersion"`

// Serial is an auto-increase number that represents how many times this State is modified
Serial uint64 `json:"serial" yaml:"serial"`

// Operator represents the person who triggered this operation
Operator string `json:"operator,omitempty" yaml:"operator,omitempty"`

// Resources records all resources in this operation
Resources Resources `json:"resources" yaml:"resources"`

// CreateTime is the time State is created
CreateTime time.Time `json:"createTime" yaml:"createTime"`

// ModifiedTime is the time State is modified each time
ModifiedTime time.Time `json:"modifiedTime,omitempty" yaml:"modifiedTime,omitempty"`
}

func NewState() *State {
s := &State{
KusionVersion: version.ReleaseVersion(),
Version: 1,
Resources: []Resource{},
}
return s
}
6 changes: 0 additions & 6 deletions pkg/apis/core/group.go

This file was deleted.

66 changes: 0 additions & 66 deletions pkg/apis/core/v1/appconfiguration.go

This file was deleted.

200 changes: 0 additions & 200 deletions pkg/apis/core/v1/config.go

This file was deleted.

25 changes: 0 additions & 25 deletions pkg/apis/core/v1/intent.go

This file was deleted.

13 changes: 0 additions & 13 deletions pkg/apis/core/v1/patcher.go

This file was deleted.

Loading

0 comments on commit b4e5fea

Please sign in to comment.