github.com/leowmjw/otto@v0.2.1-0.20160126165905-6400716cf085/directory/infra.go (about)

     1  package directory
     2  
     3  import (
     4  	"github.com/hashicorp/otto/helper/uuid"
     5  )
     6  
     7  // Infra represents the data stored in the directory service about
     8  // Infrastructures.
     9  type Infra struct {
    10  	// Lookup information for the Infra. The only required field for
    11  	// this is Infra. Optionally you may also specify Foundation to
    12  	// get the infrastructure data for a foundation.
    13  	Lookup
    14  
    15  	// State is the state of this infrastructure. This is important since
    16  	// it is possible for there to be a partial state. If we're in a
    17  	// partial state then deploys and such can't go through yet.
    18  	State InfraState
    19  
    20  	// Outputs are the output data from the infrastructure step.
    21  	// This is an opaque blob that is dependent on each infrastructure
    22  	// type. Please refer to docs of a specific infra to learn more about
    23  	// what values are here.
    24  	Outputs map[string]string `json:"outputs"`
    25  
    26  	// Private fields. These are usually set on Get or Put.
    27  	//
    28  	// DO NOT MODIFY THESE.
    29  	ID string
    30  }
    31  
    32  func (i *Infra) IsPartial() bool {
    33  	return i != nil && i.State == InfraStatePartial
    34  }
    35  
    36  func (i *Infra) IsReady() bool {
    37  	return i != nil && i.State == InfraStateReady
    38  }
    39  
    40  func (i *Infra) setId() {
    41  	i.ID = uuid.GenerateUUID()
    42  }