common

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2016 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APITokenCredential

type APITokenCredential string

APITokenCredential defines an API token.

type BasicAuthCredential

type BasicAuthCredential struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

BasicAuthCredential holds a username and password.

type Configuration

type Configuration struct {
	Resources []*Resource `json:"resources"`
}

Configuration describes a set of resources in a form that can be instantiated.

type CredentialProvider

type CredentialProvider interface {
	// Set the credential for a registry.
	// May not be supported by some registry services.
	SetCredential(name string, credential *RegistryCredential) error

	// GetCredential returns the specified credential or nil if there's no credential.
	// Error is non-nil if fetching the credential failed.
	GetCredential(name string) (*RegistryCredential, error)
}

CredentialProvider provides credentials for registries.

type Deployment

type Deployment struct {
	Name           string           `json:"name"`
	CreatedAt      time.Time        `json:"createdAt,omitempty"`
	DeployedAt     time.Time        `json:"deployedAt,omitempty"`
	ModifiedAt     time.Time        `json:"modifiedAt,omitempty"`
	DeletedAt      time.Time        `json:"deletedAt,omitempty"`
	State          *DeploymentState `json:"state,omitempty"`
	LatestManifest string           `json:"latestManifest,omitEmpty"`
}

Deployment defines a deployment that describes the creation, modification and/or deletion of a set of resources.

func NewDeployment

func NewDeployment(name string) *Deployment

NewDeployment creates a new deployment.

type DeploymentState

type DeploymentState struct {
	Status DeploymentStatus `json:"status,omitempty"`
	Errors []string         `json:"errors,omitempty"`
}

DeploymentState describes the state of a resource. It is set to the terminal state depending on the outcome of an operation on the deployment.

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus is an enumeration type for the status of a deployment.

const (
	CreatedStatus  DeploymentStatus = "Created"
	DeletedStatus  DeploymentStatus = "Deleted"
	DeployedStatus DeploymentStatus = "Deployed"
	FailedStatus   DeploymentStatus = "Failed"
	ModifiedStatus DeploymentStatus = "Modified"
)

These constants implement the DeploymentStatus enumeration type.

func (DeploymentStatus) String

func (s DeploymentStatus) String() string

type ImportFile

type ImportFile struct {
	Name    string `json:"name,omitempty"`
	Path    string `json:"path,omitempty"` // Actual URL for the file
	Content string `json:"content"`
}

ImportFile describes a base64 encoded file imported by a Template.

type JWTTokenCredential

type JWTTokenCredential string

JWTTokenCredential defines a JWT token.

type KubernetesObject

type KubernetesObject struct {
	Kind       string                 `json:"kind"`
	APIVersion string                 `json:"apiVersion"`
	Metadata   map[string]interface{} `json:"metadata"`
	Spec       map[string]interface{} `json:"spec"`
}

KubernetesObject represents a native 'bare' Kubernetes object.

type KubernetesSecret

type KubernetesSecret struct {
	Kind       string            `json:"kind"`
	APIVersion string            `json:"apiVersion"`
	Metadata   map[string]string `json:"metadata"`
	Data       map[string]string `json:"data,omitempty"`
}

KubernetesSecret represents a Kubernetes secret

type Layout

type Layout struct {
	Resources []*LayoutResource `json:"resources,omitempty"`
}

Layout defines the structure of a layout as returned from expansion.

type LayoutResource

type LayoutResource struct {
	Resource
	Layout
}

LayoutResource defines the structure of resources in the manifest layout.

type Manifest

type Manifest struct {
	Deployment     string         `json:"deployment,omitempty"`
	Name           string         `json:"name,omitempty"`
	InputConfig    *Template      `json:"inputConfig,omitempty"`
	ExpandedConfig *Configuration `json:"expandedConfig,omitempty"`
	Layout         *Layout        `json:"layout,omitempty"`
}

Manifest contains the input configuration for a deployment, the fully expanded configuration, and the layout structure of the manifest.

type Registry

type Registry struct {
	Name           string         `json:"name,omitempty"`           // Friendly name for the registry
	Type           RegistryType   `json:"type,omitempty"`           // Technology implementing the registry
	URL            string         `json:"url,omitempty"`            // URL to the root of the registry
	Format         RegistryFormat `json:"format,omitempty"`         // Format of the registry
	CredentialName string         `json:"credentialname,omitempty"` // Name of the credential to use
}

Registry describes a template registry TODO(jackr): Fix ambiguity re: whether or not URL has a scheme.

type RegistryCredential

type RegistryCredential struct {
	APIToken       APITokenCredential  `json:"apitoken,omitempty"`
	BasicAuth      BasicAuthCredential `json:"basicauth,omitempty"`
	ServiceAccount JWTTokenCredential  `json:"serviceaccount,omitempty"`
}

RegistryCredential holds a credential used to access a registry.

type RegistryFormat

type RegistryFormat string

RegistryFormat is a semi-colon delimited string that describes the format of a registry.

const (

	// VersionedRegistry identifies a versioned registry, where types appear under versions.
	VersionedRegistry RegistryFormat = "versioned"
	// UnversionedRegistry identifies an unversioned registry, where types appear under their names.
	UnversionedRegistry RegistryFormat = "unversioned"

	// CollectionRegistry identfies a collection registry, where types are grouped into collections.
	CollectionRegistry RegistryFormat = "collection"
	// OneLevelRegistry identifies a one level registry, where all types appear at the top level.
	OneLevelRegistry RegistryFormat = "onelevel"
)

type RegistryService

type RegistryService interface {
	// List all the registries
	List() ([]*Registry, error)
	// Create a new registry
	Create(registry *Registry) error
	// Get a registry
	Get(name string) (*Registry, error)
	// Get a registry with credential.
	GetRegistry(name string) (*Registry, error)
	// Delete a registry
	Delete(name string) error
	// Find a registry that backs the given URL
	GetByURL(URL string) (*Registry, error)
	// GetRegistryByURL returns a registry that handles the types for a given URL.
	GetRegistryByURL(URL string) (*Registry, error)
}

RegistryService maintains a set of registries that defines the scope of all registry based operations, such as search and type resolution.

type RegistryType

type RegistryType string

RegistryType defines the technology that implements the registry

const (
	GithubRegistryType RegistryType = "github"
	GCSRegistryType    RegistryType = "gcs"
)

Constants that identify the supported registry layouts.

type Resource

type Resource struct {
	Name       string                 `json:"name"`
	Type       string                 `json:"type"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	State      *ResourceState         `json:"state,omitempty"`
}

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 to identify the resource in Kubernetes. The properties are passed to Kubernetes as the resource configuration.

type ResourceState

type ResourceState struct {
	Status   ResourceStatus `json:"status,omitempty"`
	SelfLink string         `json:"selflink,omitempty"`
	Errors   []string       `json:"errors,omitempty"`
}

ResourceState describes the state of a resource. Status is set during resource creation and is a terminal state.

type ResourceStatus

type ResourceStatus string

ResourceStatus is an enumeration type for the status of a resource.

const (
	Created ResourceStatus = "Created"
	Failed  ResourceStatus = "Failed"
	Aborted ResourceStatus = "Aborted"
)

These constants implement the resourceStatus enumeration type.

type Schema

type Schema struct {
	Imports []SchemaImport `json:"imports"`
}

Schema is a partial DM schema. We only need access to the imports object at this level.

type SchemaImport

type SchemaImport struct {
	Path string `json:"path"`
	Name string `json:"name"`
}

SchemaImport represents an import as declared in a schema file.

type Template

type Template struct {
	Name    string        `json:"name"`
	Content string        `json:"content"`
	Imports []*ImportFile `json:"imports"`
}

Template describes a set of resources to be deployed. Manager expands a Template into a Configuration, which describes the set in a form that can be instantiated.

type TypeInstance

type TypeInstance struct {
	Name       string `json:"name"`       // instance name
	Type       string `json:"type"`       // instance type
	Deployment string `json:"deployment"` // deployment name
	Manifest   string `json:"manifest"`   // manifest name
	Path       string `json:"path"`       // JSON path within manifest
}

TypeInstance defines the metadata for an instantiation of a template type in a deployment.

Jump to

Keyboard shortcuts

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