-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from KusionStack/dayuan
engine: upgrade manifest to spec
- Loading branch information
Showing
37 changed files
with
299 additions
and
313 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
This file was deleted.
Oops, something went wrong.
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,45 @@ | ||
package models | ||
|
||
type Type string | ||
|
||
type Resources []Resource | ||
|
||
type Resource struct { | ||
// ID is the unique key of this resource in the whole State. ApiVersion:Kind:Namespace:Name is an idiomatic way of Kubernetes resources. | ||
ID string `json:"id"` | ||
|
||
// Type represents all Runtimes we supported | ||
Type Type `json:"type"` | ||
|
||
// Attributes represents all specified attributes of this resource | ||
Attributes map[string]interface{} `json:"attributes"` | ||
|
||
// DependsOn contains all resources this resource depends on | ||
DependsOn []string `json:"dependsOn,omitempty" yaml:"dependsOn,omitempty"` | ||
|
||
// Extensions specifies arbitrary metadata of this resource | ||
Extensions map[string]interface{} `json:"extensions"` | ||
} | ||
|
||
func (r *Resource) ResourceKey() string { | ||
return r.ID | ||
} | ||
|
||
func (rs Resources) Index() map[string]*Resource { | ||
m := make(map[string]*Resource) | ||
for i := range rs { | ||
m[rs[i].ResourceKey()] = &rs[i] | ||
} | ||
return m | ||
} | ||
|
||
func (rs Resources) Len() int { return len(rs) } | ||
func (rs Resources) Swap(i, j int) { rs[i], rs[j] = rs[j], rs[i] } | ||
func (rs Resources) Less(i, j int) bool { | ||
switch { | ||
case rs[i].ID != rs[j].ID: | ||
return rs[i].ID < rs[j].ID | ||
default: | ||
return false | ||
} | ||
} |
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,6 @@ | ||
package models | ||
|
||
// Spec represent the KCL compile result | ||
type Spec struct { | ||
Resources Resources `json:"resources"` | ||
} |
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
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
Oops, something went wrong.