deploymentcommon

package
v0.0.0-...-e28bd7b Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DeploymentNameMaxLength is max length for name
	DeploymentNameMaxLength = 100
	// DeploymentDescriptionMaxLength is max length for description
	DeploymentDescriptionMaxLength = 255
	// DeploymentStatusMsgMaxLength is max length for status msg
	DeploymentStatusMsgMaxLength = 255
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Creator

type Creator struct {
	User     string `bson:"creator"`
	Emulator string `bson:"creator_emulator"`
}

Creator is the creator of deployments

type CredentialID

type CredentialID string

CredentialID is the ID of credential

func (CredentialID) String

func (c CredentialID) String() string

String ...

type DeploymentParameter

type DeploymentParameter struct {
	Name  string      `bson:"name"`
	Type  string      `bson:"type"` // int,string,bool,float,uuid,url,secret, etc.
	Value interface{} `bson:"value"`
}

DeploymentParameter contain the type and value of a parameter to deployment

func (DeploymentParameter) ConvertToExternal

func (dp DeploymentParameter) ConvertToExternal() service.DeploymentParameter

ConvertToExternal converts to external representation

type DeploymentParameters

type DeploymentParameters []DeploymentParameter

DeploymentParameters ...

func (DeploymentParameters) ConvertToExternal

func (dp DeploymentParameters) ConvertToExternal() []service.DeploymentParameter

ConvertToExternal converts to external representation

func (DeploymentParameters) ToParameterValues

ToParameterValues convert parameters to parameter values

type DeploymentRunStatus

type DeploymentRunStatus string

DeploymentRunStatus is the status of a deployment run

const (
	// DeploymentRunPendingCreation is an internal status for run request that is pending. This will be used for placeholder record.
	DeploymentRunPendingCreation DeploymentRunStatus = "pending"
	// DeploymentRunPreflight ...
	DeploymentRunPreflight DeploymentRunStatus = "pre-flight"
	// DeploymentRunRunning ...
	DeploymentRunRunning DeploymentRunStatus = "running"
	// DeploymentRunActive ...
	DeploymentRunActive DeploymentRunStatus = "active"
	// DeploymentRunErrored ...
	DeploymentRunErrored DeploymentRunStatus = "errored"
)

func (DeploymentRunStatus) String

func (status DeploymentRunStatus) String() string

String ...

type DeploymentStateView

type DeploymentStateView service.DeploymentStateView

DeploymentStateView is a higher level view of raw state

func DeploymentStateViewFromExternal

func DeploymentStateViewFromExternal(state service.DeploymentStateView) DeploymentStateView

DeploymentStateViewFromExternal converts external representation of state view to internal one.

func (DeploymentStateView) ConvertToExternal

func (sv DeploymentStateView) ConvertToExternal() service.DeploymentStateView

ConvertToExternal converts to external representation

type GitUpstream

type GitUpstream struct {
	Branch string `bson:"branch"`
	Tag    string `bson:"tag"`
}

GitUpstream is a git upstream source

type OpenstackBlockStorageVolume

type OpenstackBlockStorageVolume struct {
	ID                 string                 `json:"id" mapstructure:"id"` // FIXME verify that volume has this field
	Region             string                 `json:"region" mapstructure:"region"`
	Size               int                    `json:"size" mapstructure:"size"`
	EnableOnlineResize *bool                  `json:"enable_online_resize" mapstructure:"enable_online_resize"`
	Name               string                 `json:"name" mapstructure:"name"`
	Description        string                 `json:"Description" mapstructure:"Description"`
	AvailabilityZone   string                 `json:"availability_zone" mapstructure:"availability_zone"`
	Metadata           map[string]interface{} `json:"metadata" mapstructure:"metadata"`
	SnapshotID         string                 `json:"snapshot_id" mapstructure:"snapshot_id"`
	SourceVolID        string                 `json:"source_vol_id" mapstructure:"source_vol_id"`
	ImageID            string                 `json:"image_id" mapstructure:"image_id"`
	VolumeType         string                 `json:"volume_type" mapstructure:"volume_type"`
	ConsistencyGroupID string                 `json:"consistency_group_id" mapstructure:"consistency_group_id"`
	SourceReplica      string                 `json:"source_replica" mapstructure:"source_replica"`
	Multiattach        *bool                  `json:"multiattach" mapstructure:"multiattach"`
	Attachment         []struct {
		ID         string `json:"id" mapstructure:"id"`
		InstanceID string `json:"instance_id" mapstructure:"instance_id"`
		Device     string `json:"device" mapstructure:"device"`
	} `json:"attachment" mapstructure:"attachment"`
	SchedulerHints []SchedulerHint `json:"scheduler_hints" mapstructure:"scheduler_hints"`
}

OpenstackBlockStorageVolume openstack_blockstorage_volume_v3

type OpenstackComputeFloatingIPAssociate

type OpenstackComputeFloatingIPAssociate struct {
	FixedIP             string      `json:"fixed_ip" mapstructure:"fixed_ip"`
	FloatingIP          string      `json:"floating_ip" mapstructure:"floating_ip"`
	ID                  string      `json:"id" mapstructure:"id"`                   // "111.111.111.111/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/"
	InstanceID          string      `json:"instance_id" mapstructure:"instance_id"` // uuid
	Region              string      `json:"region" mapstructure:"region"`
	Timeouts            interface{} `json:"timeouts" mapstructure:"timeouts"` // FIXME null
	WaitUntilAssociated *bool       `json:"wait_until_associated" mapstructure:"wait_until_associated"`
}

OpenstackComputeFloatingIPAssociate openstack_compute_floatingip_associate_v2

type OpenstackComputeInstance

type OpenstackComputeInstance struct {
	AccessIPV4  string `json:"access_ip_v4" mapstructure:"access_ip_v4"`
	AccessIPV6  string `json:"access_ip_v6" mapstructure:"access_ip_v6"`
	AdminPass   string `json:"admin_pass" mapstructure:"admin_pass"`
	BlockDevice []struct {
		SourceType          string `json:"source_type" mapstructure:"source_type"`
		UUID                string `json:"uuid" mapstructure:"uuid"`
		VolumeSize          int    `json:"volume_size" mapstructure:"volume_size"`
		DestinationType     string `json:"destination_type" mapstructure:"destination_type"`
		BootIndex           int    `json:"boot_index" mapstructure:"boot_index"`
		DeleteOnTermination *bool  `json:"delete_on_termination" mapstructure:"delete_on_termination"`
		GuestFormat         string `json:"guest_format" mapstructure:"guest_format"`
		VolumeType          string `json:"volume_type" mapstructure:"volume_type"`
		DeviceType          string `json:"device_type" mapstructure:"device_type"`
		DiskBus             string `json:"disk_bus" mapstructure:"disk_bus"`
	} `json:"block_device" mapstructure:"block_device"`
	ID        string `json:"id" mapstructure:"id"`
	ImageID   string `json:"image_id" mapstructure:"image_id"`
	ImageName string `json:"image_name" mapstructure:"image_name"`
	KeyPair   string `json:"key_pair" mapstructure:"key_pair"`
	Name      string `json:"name" mapstructure:"name"`
	Network   []struct {
		IPV4 string `json:"fixed_ip_v4" mapstructure:"fixed_ip_v4"`
		IPV6 string `json:"fixed_ip_v6" mapstructure:"fixed_ip_v6"`
		Mac  string `json:"mac" mapstructure:"mac"`
		Name string `json:"name" mapstructure:"name"`
		UUID string `json:"uuid" mapstructure:"uuid"`
		Port string `json:"port" mapstructure:"port"`
	} `json:"network" mapstructure:"network"`
	PowerState    string   `json:"power_state" mapstructure:"power_state"`
	Region        string   `json:"region" mapstructure:"region"`
	SecurityGroup []string `json:"security_groups" mapstructure:"security_groups"`
	UserData      string   `json:"user_data" mapstructure:"user_data"`
	Volume        []struct {
		ID       string `json:"id" mapstructure:"id"`
		VolumeID string `json:"volume_id" mapstructure:"volume_id"`
		Device   string `json:"device" mapstructure:"device"`
	} `json:"volume" mapstructure:"volume"`
	SchedulerHints []SchedulerHint `json:"scheduler_hints" mapstructure:"scheduler_hints"`
}

OpenstackComputeInstance openstack_compute_instance_v2

type OpenstackNetworkFloatingIPAssociate

type OpenstackNetworkFloatingIPAssociate struct {
	FixedIP    string `json:"fixed_ip" mapstructure:"fixed_ip"`
	FloatingIP string `json:"floating_ip" mapstructure:"floating_ip"`
	ID         string `json:"id" mapstructure:"id"` // "111.111.111.111/aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa/"
	PortID     string `json:"port_id" mapstructure:"port_id"`
	Region     string `json:"region" mapstructure:"region"`
}

OpenstackNetworkFloatingIPAssociate openstack_networking_floatingip_associate_v2

type OpenstackNetworkingFloatingIP

type OpenstackNetworkingFloatingIP struct {
	Address     string      `json:"address" mapstructure:"address"`
	AllTags     []string    `json:"all_tags" mapstructure:"all_tags"`
	Description string      `json:"description" mapstructure:"description"`
	DNSDomain   string      `json:"dns_domain" mapstructure:"dns_domain"`
	DNSName     string      `json:"dns_name" mapstructure:"dns_name"`
	FixedIP     string      `json:"fixed_ip" mapstructure:"fixed_ip"`
	ID          string      `json:"id" mapstructure:"id"`     // uuid
	Pool        string      `json:"pool" mapstructure:"pool"` // "ext-net"
	PortID      string      `json:"port_id" mapstructure:"port_id"`
	Region      string      `json:"region" mapstructure:"region"`       // "RegionOne"
	SubnetID    string      `json:"subnet_id" mapstructure:"subnet_id"` // uuid
	Tags        []string    `json:"tags" mapstructure:"tags"`
	TenantID    string      `json:"tenant_id" mapstructure:"tenant_id"` // uuid
	Timeouts    interface{} `json:"timeouts" mapstructure:"timeouts"`   // FIXME null
	ValueSpecs  []string    `json:"value_specs" mapstructure:"value_specs"`
}

OpenstackNetworkingFloatingIP openstack_networking_floatingip_v2

type ProviderCredentialMappings

type ProviderCredentialMappings []ProviderCredentialPair

ProviderCredentialMappings is a list of mappings between cloud providers and cloud credentials.

func (ProviderCredentialMappings) ConvertToExternal

func (mapping ProviderCredentialMappings) ConvertToExternal() map[string]common.ID

ConvertToExternal converts to map[credID]providerID

type ProviderCredentialPair

type ProviderCredentialPair struct {
	Credential CredentialID `bson:"credential"`
	Provider   common.ID    `bson:"provider"`
}

ProviderCredentialPair is a mapping between a cloud provider and a cloud credential.

type RawDeploymentState

type RawDeploymentState struct {
	Type    RawStateType    `bson:"type"`
	TFState *TerraformState `bson:"terraform"`
}

RawDeploymentState is the raw state of a deployment (run)

type RawStateType

type RawStateType string

RawStateType is type of raw state

const (
	// TerraformRawState ...
	TerraformRawState RawStateType = "terraform"
)

type SchedulerHint

type SchedulerHint struct {
	DifferentHost        []string               `json:"different_host" mapstructure:"different_host"`
	SameHost             []string               `json:"same_host" mapstructure:"same_host"`
	Query                string                 `json:"query" mapstructure:"query"`
	LocalToInstance      string                 `json:"local_to_instance" mapstructure:"local_to_instance"`
	AdditionalProperties map[string]interface{} `json:"additional_properties" mapstructure:"additional_properties"`
}

SchedulerHint is the scheduler_hints field shared by many openstack resource

type TemplateSnapshot

type TemplateSnapshot struct {
	TemplateID        common.ID   `bson:"template_id"`
	TemplateVersionID common.ID   `bson:"template_version_id"`
	UpstreamTracked   GitUpstream `bson:",inline"`
	GitURL            string      `bson:"git_url"`
	CommitHash        string      `bson:"git_commit"`
	// Path within the git repo, empty means root dir of repo
	SubPath string `bson:"sub_path"`
}

TemplateSnapshot is a snapshot in time of a template. It contains info that can be used to identify a specific instance template.

func GetTemplateSnapshot

func GetTemplateSnapshot(templateVersion service.TemplateVersion) (TemplateSnapshot, error)

GetTemplateSnapshot get a snapshot of a template

type TerraformResource

type TerraformResource struct {
	Module     string                      `json:"module" bson:"module" mapstructure:"module"`
	Mode       string                      `json:"mode" bson:"mode" mapstructure:"mode"`
	Type       string                      `json:"type" bson:"type" mapstructure:"type"`
	Name       string                      `json:"name" bson:"name" mapstructure:"name"`
	TFProvider string                      `json:"provider" bson:"provider" mapstructure:"provider"` // "provider[\"terraform.cyverse.org/cyverse/openstack\"]"
	Instances  []TerraformResourceInstance `json:"instances" bson:"instances" mapstructure:"instances"`
}

TerraformResource is the resource in Terraform raw state

type TerraformResourceInstance

type TerraformResourceInstance struct {
	IndexKey            interface{}            `json:"index_key" bson:"index_key" mapstructure:"index_key"` // could be int or string
	SchemaVersion       int                    `json:"schema_version" bson:"schema_version" mapstructure:"schema_version"`
	Attributes          map[string]interface{} `json:"attributes" bson:"attributes" mapstructure:"attributes"`
	SensitiveAttributes []interface{}          `json:"sensitive_attributes" bson:"sensitive_attributes" mapstructure:"sensitive_attributes"`
	Private             string                 `json:"private" bson:"private" mapstructure:"private"` // base64 encoded
	Dependencies        []string               `json:"dependencies" bson:"dependencies" mapstructure:"dependencies"`
}

TerraformResourceInstance is instance of resource in Terraform raw state

type TerraformState

type TerraformState struct {
	Version          int                    `json:"version" bson:"version" mapstructure:"version"`
	TerraformVersion string                 `json:"terraform_version" bson:"terraform_version" mapstructure:"terraform_version"`
	Serial           int                    `json:"serial" bson:"serial" mapstructure:"serial"`
	Lineage          string                 `json:"lineage" bson:"lineage" mapstructure:"lineage"` // uuid
	Outputs          map[string]interface{} `json:"outputs" bson:"outputs" mapstructure:"outputs"`
	Resources        []TerraformResource    `json:"resources" bson:"resources" mapstructure:"resources"`
}

TerraformState is top level struct for Terraform raw state

func (TerraformState) String

func (state TerraformState) String() string

String marshals the state into string, this method will log.Fatal() if marshal failed

func (TerraformState) Type

func (state TerraformState) Type() RawStateType

Type ...

type TerraformStateParser

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

TerraformStateParser is parser for Terraform raw state

func (TerraformStateParser) FromJSONString

func (parser TerraformStateParser) FromJSONString(jsonStateStr string) (*TerraformState, error)

FromJSONString parse Terraform state from JSON string

func (*TerraformStateParser) ToStateView

func (parser *TerraformStateParser) ToStateView(state TerraformState, primaryProvider common.ID) (service.DeploymentStateView, error)

ToStateView converts TerraformState to a state view

Jump to

Keyboard shortcuts

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