Commit 8f995f3b authored by vaikas-google's avatar vaikas-google

introduce state of a resource to Resource in types. In prep for issues: 79, 80

parent c51edede
...@@ -84,7 +84,7 @@ func NewDeployment(name string, id int) *Deployment { ...@@ -84,7 +84,7 @@ func NewDeployment(name string, id int) *Deployment {
// DeploymentStatus is an enumeration type for the status of a deployment. // DeploymentStatus is an enumeration type for the status of a deployment.
type DeploymentStatus string type DeploymentStatus string
// These constants implement the deploymentStatus enumeration type. // These constants implement the DeploymentStatus enumeration type.
const ( const (
CreatedStatus DeploymentStatus = "Created" CreatedStatus DeploymentStatus = "Created"
DeletedStatus DeploymentStatus = "Deleted" DeletedStatus DeploymentStatus = "Deleted"
...@@ -140,6 +140,23 @@ type Configuration struct { ...@@ -140,6 +140,23 @@ type Configuration struct {
Resources []*Resource `json:"resources"` Resources []*Resource `json:"resources"`
} }
// ResourceStatus is an enumeration type for the status of a resource.
type ResourceStatus string
// These constants implement the resourceStatus enumeration type.
const (
Created ResourceStatus = "Created"
Failed ResourceStatus = "Failed"
Aborted ResourceStatus = "Aborted"
)
// ResourceState describes the state of a resource.
type ResourceState struct {
Status ResourceStatus `json:"status"`
SelfLink string `json:"selflink,omitempty"`
Errors []string `json:"errors,omitempty"`
}
// Resource describes a resource in a configuration. A resource has // Resource describes a resource in a configuration. A resource has
// a name, a type and a set of properties. The name and type are used // a name, a type and a set of properties. The name and type are used
// to identify the resource in Kubernetes. The properties are passed // to identify the resource in Kubernetes. The properties are passed
...@@ -148,6 +165,7 @@ type Resource struct { ...@@ -148,6 +165,7 @@ type Resource struct {
Name string `json:"name"` Name string `json:"name"`
Type string `json:"type"` Type string `json:"type"`
Properties map[string]interface{} `json:"properties,omitempty"` Properties map[string]interface{} `json:"properties,omitempty"`
State ResourceState `json:"state"`
} }
// TypeInstance defines the metadata for an instantiation of a template type // TypeInstance defines the metadata for an instantiation of a template type
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment