Documentation ¶
Index ¶
- type Credential
- type DB
- func (db *DB) DeleteCredential(id manifold.ID) bool
- func (db *DB) DeleteResource(id manifold.ID) bool
- func (db *DB) GetCredential(id manifold.ID) *Credential
- func (db *DB) GetCredentialsByResource(id manifold.ID) []Credential
- func (db *DB) GetMeasuresByResource(id manifold.ID) []Measure
- func (db *DB) GetResource(id manifold.ID) *Resource
- func (db *DB) PutCredential(c Credential)
- func (db *DB) PutMeasure(m Measure)
- func (db *DB) PutResource(r Resource)
- type Measure
- type Resource
- type ResourceState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credential ¶
type Credential struct { ID manifold.ID `json:"id"` Keys map[string]string `json:"keys"` CustomNames map[string]string `json:"custom_names"` CreatedOn time.Time `json:"created_on"` // Internal Fields ResourceID manifold.ID `json:"-"` }
Credential represents a credential set for a resource
type DB ¶
type DB struct { ResourcesByID map[manifold.ID]Resource CredentialsByResource map[manifold.ID][]Credential CredentialsByID map[manifold.ID]Credential MeasuresByResource map[manifold.ID][]Measure }
DB functions as an in-memory database of marketplace entities
func (*DB) DeleteCredential ¶
DeleteCredential removes a credential and returns true, false if there was no credential
func (*DB) DeleteResource ¶
DeleteResource removes a resource and returns true, false if there was no resource
func (*DB) GetCredential ¶
func (db *DB) GetCredential(id manifold.ID) *Credential
GetCredential returns a credential based on it's id or nil, if it can't be found
func (*DB) GetCredentialsByResource ¶
func (db *DB) GetCredentialsByResource(id manifold.ID) []Credential
GetCredentialsByResource returns a list of credentials or nil, for a ResourceID
func (*DB) GetMeasuresByResource ¶
GetMeasuresByResource returns a list of measures or nil, for a ResourceID
func (*DB) GetResource ¶
GetResource returns a resource based on it's id or nil, if it can't be found
func (*DB) PutCredential ¶
func (db *DB) PutCredential(c Credential)
PutCredential stores the provided credential, it must have a ResourceID set!
func (*DB) PutMeasure ¶
PutMeasure stores the provided measure, it must have a ResourceID set!
func (*DB) PutResource ¶
PutResource stores the provided resource in the database
type Measure ¶
type Measure struct { ResourceID manifold.ID `json:"resource_id"` PeriodStart time.Time `json:"period_start"` PeriodEnd time.Time `json:"period_end"` Measures map[string]int64 `json:"measures"` // Internal Fields UpdatedAt time.Time `json:"-"` }
Measure represents a measures set for a resource
type Resource ¶
type Resource struct { ID manifold.ID `json:"id"` Name manifold.Name `json:"name"` Label manifold.Label `json:"label"` Plan manifold.Label `json:"plan"` Product manifold.Label `json:"product"` Region string `json:"region"` Features manifold.FeatureMap `json:"features,omitempty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // Internal Fields State ResourceState `json:"-"` }
Resource represents a resource provisioned through Grafton
type ResourceState ¶
type ResourceState string
ResourceState defines the current state of the resource
const ( // ResourceStateProvisioning defines the state for the resource when its "provisioning" ResourceStateProvisioning ResourceState = "provisioning" // ResourceStateProvisioned defines the state for the resource when its "provisioned" ResourceStateProvisioned ResourceState = "provisioned" // ResourceStateProvisionFailed defines the state for the resource when it has failed provisioning ResourceStateProvisionFailed ResourceState = "provision-failed" // ResourceStateDerovisioning defines the state for the resource when its "deprovisioning" ResourceStateDerovisioning ResourceState = "deprovisioning" // ResourceStateDeprovisioned defines the state for the resource when its "deprovisioned" ResourceStateDeprovisioned ResourceState = "deprovisioned" )