Merge pull request #96 from vaikas-google/master

introduce state of a resource to Resource in types.
pull/100/head
Jack Greenfield 9 years ago
commit e3f5414790

@ -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,24 @@ 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.
// Status is set during resource creation and is a terminal state.
type ResourceState struct {
Status ResourceStatus `json:"status,omitempty"`
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 +166,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

Loading…
Cancel
Save