-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(#189) Split api into meta and core groups
Previously in v1alpha1, all Holos structs are located in the same package. This makes it difficult to focus on only the structs necessary to transfer configuration data from CUE to the `holos` cli. This patch splits the structs into `meta` and `core` where the core package holds the structs end users should refer to and focus on. Only the Platform resource is in core now, but other BuildPlan types will be added shortly.
- Loading branch information
1 parent
62f96a2
commit 6d2daac
Showing
8 changed files
with
89 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package v1alpha2 | ||
|
||
// TypeMeta describes an individual object in an API response or request with | ||
// strings representing the type of the object and its API schema version. | ||
// Structures that are versioned or persisted should inline TypeMeta. | ||
type TypeMeta struct { | ||
// Kind is a string value representing the resource this object represents. | ||
Kind string `json:"kind" yaml:"kind"` | ||
// APIVersion defines the versioned schema of this representation of an object. | ||
APIVersion string `json:"apiVersion" yaml:"apiVersion" cue:"string | *\"v1alpha2\""` | ||
} | ||
|
||
func (tm *TypeMeta) GetKind() string { | ||
return tm.Kind | ||
} | ||
|
||
func (tm *TypeMeta) GetAPIVersion() string { | ||
return tm.APIVersion | ||
} | ||
|
||
// Discriminator discriminates the kind of an api object. | ||
type Discriminator interface { | ||
// GetKind returns Kind. | ||
GetKind() string | ||
// GetAPIVersion returns APIVersion. | ||
GetAPIVersion() string | ||
} | ||
|
||
// ObjectMeta represents metadata of a holos component object. The fields are a | ||
// copy of upstream kubernetes api machinery but are holos objects distinct from | ||
// kubernetes api objects. | ||
type ObjectMeta struct { | ||
// Name uniquely identifies the holos component instance and must be suitable as a file name. | ||
Name string `json:"name,omitempty" yaml:"name,omitempty"` | ||
// Namespace confines a holos component to a single namespace via kustomize if set. | ||
Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 5 additions & 28 deletions
33
...un/holos/api/v1alpha2/v1alpha2_go_gen.cue → ...n/holos/api/core/v1alpha2/core_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...nerate/platforms/cue.mod/gen/github.com/holos-run/holos/api/meta/v1alpha2/meta_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/holos-run/holos/api/meta/v1alpha2 | ||
|
||
package v1alpha2 | ||
|
||
// TypeMeta describes an individual object in an API response or request with | ||
// strings representing the type of the object and its API schema version. | ||
// Structures that are versioned or persisted should inline TypeMeta. | ||
#TypeMeta: { | ||
// Kind is a string value representing the resource this object represents. | ||
kind: string @go(Kind) | ||
|
||
// APIVersion defines the versioned schema of this representation of an object. | ||
apiVersion: string & (string | *"v1alpha2") @go(APIVersion) | ||
} | ||
|
||
// Discriminator discriminates the kind of an api object. | ||
#Discriminator: _ | ||
|
||
// ObjectMeta represents metadata of a holos component object. The fields are a | ||
// copy of upstream kubernetes api machinery but are holos objects distinct from | ||
// kubernetes api objects. | ||
#ObjectMeta: { | ||
// Name uniquely identifies the holos component instance and must be suitable as a file name. | ||
name?: string @go(Name) | ||
|
||
// Namespace confines a holos component to a single namespace via kustomize if set. | ||
namespace?: string @go(Namespace) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters