Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: split types in the v1/types.go to separate files to maintain consistency with the coding style of the rest of the code #808

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions pkg/apis/core/v1/types.go → pkg/apis/core/v1/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,6 @@ const (
AppConfigurationBuilder BuilderType = "AppConfiguration"
)

// Project is a definition of Kusion Project resource.
//
// A project is composed of one or more applications and is linked to a Git repository,
// which contains the project's desired manifests.
type Project struct {
// Name is a required fully qualified name.
Name string `json:"name" yaml:"name"`

// Description is an optional informational description.
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
// Labels is the list of labels that are assigned to this project.
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"`

// Generator controls how to generate the Intent.
Generator *GeneratorConfig `json:"generator,omitempty" yaml:"generator,omitempty"`

// The set of stacks that are known about this project.
Stacks []*Stack `json:"stacks,omitempty" yaml:"stacks,omitempty"`
}

// GeneratorConfig holds the intent generation configurations defined in Project resource.
type GeneratorConfig struct {
// Type specifies the type of Generator. can be either "KCL" or "AppConfiguration".
Expand All @@ -40,20 +17,19 @@ type GeneratorConfig struct {
Configs map[string]interface{} `json:"configs,omitempty" yaml:"configs,omitempty"`
}

// Stack is a definition of Kusion Stack resource.
//
// Stack provides a mechanism to isolate multiple deploys of same application,
// it's the target workspace that an application will be deployed to, also the
// smallest operation unit that can be configured and deployed independently.
type Stack struct {
// Project is a definition of Kusion Project resource.
// A project is composed of one or more applications and is linked to a Git repository, which contains the project's desired manifests.
type Project struct {
// Name is a required fully qualified name.
Name string `json:"name" yaml:"name"`

// Description is an optional informational description.
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
// Labels is the list of labels that are assigned to this stack.
// Labels is the list of labels that are assigned to this project.
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"`
// Generator controls how to generate the Intent.
Generator *GeneratorConfig `json:"generator,omitempty" yaml:"generator,omitempty"`
// The set of stacks that are known about this project.
Stacks []*Stack `json:"stacks,omitempty" yaml:"stacks,omitempty"`
}
17 changes: 17 additions & 0 deletions pkg/apis/core/v1/stack.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package v1

// Stack is a definition of Kusion Stack resource.
//
// Stack provides a mechanism to isolate multiple deploys of same application,
// it's the target workspace that an application will be deployed to, also the
// smallest operation unit that can be configured and deployed independently.
type Stack struct {
// Name is a required fully qualified name.
Name string `json:"name" yaml:"name"`
// Description is an optional informational description.
Description *string `json:"description,omitempty" yaml:"description,omitempty"`
// Labels is the list of labels that are assigned to this stack.
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"`
}
Loading