claim

package
v0.7.1-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusSuccess  = "success"
	StatusFailure  = "failure"
	StatusUnderway = "underway"
	StatusUnknown  = "unknown"
)

Status constants define the CNAB status fields on a Result.

View Source
const (
	ActionInstall   = "install"
	ActionUpgrade   = "upgrade"
	ActionDowngrade = "downgrade"
	ActionUninstall = "uninstall"
	ActionStatus    = "status"
	ActionUnknown   = "unknown"
)

Action constants define the CNAB action to be taken

Variables

View Source
var ErrClaimNotFound = errors.New("Claim does not exist")

ErrClaimNotFound represents a claim not found in claim storage

View Source
var ValidName = regexp.MustCompile("^[a-zA-Z0-9._-]+$")

ValidName is a regular expression that indicates whether a name is a valid claim name.

Functions

func ULID

func ULID() string

ULID generates a string representation of a ULID.

Types

type Claim

type Claim struct {
	Name       string                 `json:"name"`
	Revision   string                 `json:"revision"`
	Created    time.Time              `json:"created"`
	Modified   time.Time              `json:"modified"`
	Bundle     *bundle.Bundle         `json:"bundle"`
	Result     Result                 `json:"result,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	// Outputs is a map from the names of outputs (defined in the bundle) to the contents of the files.
	Outputs map[string]interface{} `json:"outputs,omitempty"`
	Custom  interface{}            `json:"custom,omitempty"`
}

Claim is an installation claim receipt.

Claims reprsent information about a particular installation, and provide the necessary data to upgrade, uninstall, and downgrade a CNAB package.

func New

func New(name string) (*Claim, error)

New creates a new Claim initialized for an installation operation.

func (*Claim) Update

func (c *Claim) Update(action, status string)

Update is a convenience for modifying the necessary fields on a Claim.

Per spec, when a claim is updated, the action, status, revision, and modified fields all change. All but status and action can be computed.

type Result

type Result struct {
	Message string `json:"message"`
	Action  string `json:"action"`
	Status  string `json:"status"`
}

Result tracks the result of a Duffle operation on a CNAB installation

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store is a persistent store for claims.

func NewClaimStore

func NewClaimStore(backingStore crud.Store) Store

NewClaimStore creates a persistent store for claims using the specified backing key-blob store.

func (Store) Delete

func (s Store) Delete(name string) error

Delete deletes a claim from the store.

func (Store) List

func (s Store) List() ([]string, error)

List lists the names of the stored claims.

func (Store) Read

func (s Store) Read(name string) (Claim, error)

Read loads the claim with the given name from the store.

func (Store) ReadAll

func (s Store) ReadAll() ([]Claim, error)

ReadAll retrieves all the claims

func (Store) Store

func (s Store) Store(claim Claim) error

Store saves a claim. Any previous version of the claim (that is, with the same name) is overwritten.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL