commons

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FailureFieldReadPattern   = "failed reading field %v - %#v"
	FailureFieldCreatePattern = "failed creating field %v - %#v"
	FailureFieldUpdatePattern = "failed updating field %v - %#v"

	FieldUpdateNotAllowedPattern = "field [%v] is immutable, cannot be changed post group creation"
	FieldCreateNotAllowedPattern = "field [%v] can only be changed after the group is created"

	ProviderToken   FieldName = "token"
	ProviderAccount FieldName = "account"

	Subscription            ResourceAffinity = "Subscription"
	ElastigroupAWSBeanstalk ResourceAffinity = "ElastigroupAWSBeanstalk"

	OceanAWS                    ResourceAffinity = "Ocean_AWS"
	OceanAWSInstanceTypes       ResourceAffinity = "Ocean_AWS_Instance_Types"
	OceanAWSAutoScaling         ResourceAffinity = "Ocean_AWS_Auto_Scaling"
	OceanAWSStrategy            ResourceAffinity = "Ocean_AWS_Strategy"
	OceanAWSLaunchConfiguration ResourceAffinity = "Ocean_AWS_Launch_Configuration"

	ElastigroupAWS                 ResourceAffinity = "Elastigroup_AWS"
	ElastigroupInstanceType        ResourceAffinity = "Elastigroup_Instance_Type"
	ElastigroupStrategy            ResourceAffinity = "Elastigroup_Strategy"
	ElastigroupStateful            ResourceAffinity = "Elastigroup_Stateful"
	ElastigroupLaunchConfiguration ResourceAffinity = "Elastigroup_Launch_Configuration"
	ElastigroupNetworkInterface    ResourceAffinity = "Elastigroup_Network_Interface"
	ElastigroupScheduledTask       ResourceAffinity = "Elastigroup_Scheduled_Task"
	ElastigroupBlockDevices        ResourceAffinity = "Elastigroup_Block_Device"
	ElastigroupScalingPolicies     ResourceAffinity = "Elastigroup_Scaling_Policies"
	ElastigroupIntegrations        ResourceAffinity = "Elastigroup_Integrations"

	ElastigroupGCP                    ResourceAffinity = "Elastigroup_GCP"
	ElastigroupGCPDisk                ResourceAffinity = "Elastigroup_GCP_Disk"
	ElastigroupGCPGPU                 ResourceAffinity = "Elastigroup_GPC_GPU"
	ElastigroupGCPInstanceType        ResourceAffinity = "Elastigroup_GCP_Instance_Type"
	ElastigroupGCPLaunchConfiguration ResourceAffinity = "Elastigroup_GCP_Launch_Configuration"
	ElastigroupGCPNetworkInterface    ResourceAffinity = "Elastigroup_GCP_Network_Interface"
	ElastigroupGCPScalingPolicies     ResourceAffinity = "Elastigroup_GCP_Scaling_Policies"
	ElastigroupGCPStrategy            ResourceAffinity = "Elastigroup_GCP_Strategy"

	ElastigroupGKE             ResourceAffinity = "Elastigroup_GKE"
	ElastigroupGKEInstanceType ResourceAffinity = "Elastigroup_GKE_Instance_Type"

	ElastigroupAzure                    ResourceAffinity = "Elastigroup_Azure"
	ElastigroupAzureStrategy            ResourceAffinity = "Elastigroup_Azure_Strategy"
	ElastigroupAzureLogin               ResourceAffinity = "Elastigroup_Azure_Login"
	ElastigroupAzureNetwork             ResourceAffinity = "Elastigroup_Azure_Network"
	ElastigroupAzureLoadBalancers       ResourceAffinity = "Elastigroup_Azure_Load_Balancers"
	ElastigroupAzureVMSizes             ResourceAffinity = "Elastigroup_Azure_VM_Sizes"
	ElastigroupAzureImage               ResourceAffinity = "Elastigroup_Azure_Image"
	ElastigroupAzureLaunchConfiguration ResourceAffinity = "Elastigroup_Azure_Launch_Configuration"
	ElastigroupAzureHealthCheck         ResourceAffinity = "Elastigroup_Azure_Health_Check"

	ResourceFieldOnRead   LogFormat = "onRead() -> %s -> %s"
	ResourceFieldOnCreate LogFormat = "onCreate() -> %s -> %s"
	ResourceFieldOnUpdate LogFormat = "onUpdate() -> %s -> %s"

	ResourceOnDelete LogFormat = "onDelete() -> %s -> started for %s..."
	ResourceOnUpdate LogFormat = "onUpdate() -> %s -> started for %s..."
	ResourceOnRead   LogFormat = "onRead() -> %s -> started for %s..."
	ResourceOnCreate LogFormat = "onCreate() -> %s -> started..."
)

Variables

This section is empty.

Functions

func NewSubscription added in v1.1.0

func NewSubscription() *subscription.Subscription

func ToJson

func ToJson(object interface{}) (string, error)

Types

type ClusterWrapper added in v1.6.0

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

func NewClusterWrapper added in v1.6.0

func NewClusterWrapper() *ClusterWrapper

func (*ClusterWrapper) GetCluster added in v1.6.0

func (clusterWrapper *ClusterWrapper) GetCluster() *aws.Cluster

func (*ClusterWrapper) SetCluster added in v1.6.0

func (clusterWrapper *ClusterWrapper) SetCluster(cluster *aws.Cluster)

type ElastigroupAWSBeanstalkTerraformResource added in v1.5.0

type ElastigroupAWSBeanstalkTerraformResource struct {
	GenericResource // embedding
}
var ElastigroupAWSBeanstalkResource *ElastigroupAWSBeanstalkTerraformResource

func NewElastigroupAWSBeanstalkResource added in v1.5.0

func NewElastigroupAWSBeanstalkResource(fieldsMap map[FieldName]*GenericField) *ElastigroupAWSBeanstalkTerraformResource

func (*ElastigroupAWSBeanstalkTerraformResource) MaintenanceState added in v1.5.0

func (res *ElastigroupAWSBeanstalkTerraformResource) MaintenanceState(
	resourceData *schema.ResourceData,
	meta interface{}) (string, error)

func (*ElastigroupAWSBeanstalkTerraformResource) OnCreate added in v1.5.0

func (res *ElastigroupAWSBeanstalkTerraformResource) OnCreate(
	importedGroup *aws.Group,
	resourceData *schema.ResourceData,
	meta interface{}) (*aws.Group, error)

func (*ElastigroupAWSBeanstalkTerraformResource) OnRead added in v1.5.0

func (res *ElastigroupAWSBeanstalkTerraformResource) OnRead(
	elastigroup *aws.Group,
	resourceData *schema.ResourceData,
	meta interface{}) error

func (*ElastigroupAWSBeanstalkTerraformResource) OnUpdate added in v1.5.0

func (res *ElastigroupAWSBeanstalkTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *aws.Group, error)

type ElastigroupAWSBeanstalkWrapper added in v1.5.0

type ElastigroupAWSBeanstalkWrapper struct {
	BeanstalkEnvironmentName string

	// Load balancer states
	StatusElbUpdated bool
	StatusTgUpdated  bool
	StatusMlbUpdated bool

	// Block devices states
	StatusEphemeralBlockDeviceUpdated bool
	StatusEbsBlockDeviceUpdated       bool
	// contains filtered or unexported fields
}

func NewElastigroupAWSBeanstalkWrapper added in v1.5.0

func NewElastigroupAWSBeanstalkWrapper() *ElastigroupAWSBeanstalkWrapper

Spotinst elastigroup must have a wrapper struct. Reason is that there are multiple fields who share the same elastigroup API object e.g. LoadBalancersConfig fields and BlockDeviceMapping fields Wrapper struct intended to help reflecting these fields state properly into the elastigroup object.

func (*ElastigroupAWSBeanstalkWrapper) GetElastigroupAWSBeanstalk added in v1.5.0

func (egWrapper *ElastigroupAWSBeanstalkWrapper) GetElastigroupAWSBeanstalk() *aws.Group

func (*ElastigroupAWSBeanstalkWrapper) SetElastigroupAWSBeanstalk added in v1.5.0

func (egWrapper *ElastigroupAWSBeanstalkWrapper) SetElastigroupAWSBeanstalk(elastigroup *aws.Group)

type ElastigroupAzureTerraformResource added in v1.6.0

type ElastigroupAzureTerraformResource struct {
	GenericResource // embedding
}
var ElastigroupAzureResource *ElastigroupAzureTerraformResource

func NewElastigroupAzureResource added in v1.6.0

func NewElastigroupAzureResource(fieldsMap map[FieldName]*GenericField) *ElastigroupAzureTerraformResource

func (*ElastigroupAzureTerraformResource) OnCreate added in v1.6.0

func (res *ElastigroupAzureTerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*azure.Group, error)

func (*ElastigroupAzureTerraformResource) OnRead added in v1.6.0

func (res *ElastigroupAzureTerraformResource) OnRead(
	elastigroup *azure.Group,
	resourceData *schema.ResourceData,
	meta interface{}) error

func (*ElastigroupAzureTerraformResource) OnUpdate added in v1.6.0

func (res *ElastigroupAzureTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *azure.Group, error)

type ElastigroupAzureWrapper added in v1.6.0

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

func NewElastigroupAzureWrapper added in v1.6.0

func NewElastigroupAzureWrapper() *ElastigroupAzureWrapper

Spotinst elastigroup must have a wrapper struct. Reason is that there are multiple fields who share the same elastigroup API object e.g. LoadBalancersConfig fields and BlockDeviceMapping fields Wrapper struct intended to help reflecting these fields state properly into the elastigroup object.

func (*ElastigroupAzureWrapper) GetElastigroup added in v1.6.0

func (egWrapper *ElastigroupAzureWrapper) GetElastigroup() *azure.Group

func (*ElastigroupAzureWrapper) SetElastigroup added in v1.6.0

func (egWrapper *ElastigroupAzureWrapper) SetElastigroup(elastigroup *azure.Group)

type ElastigroupGCPTerraformResource added in v1.6.0

type ElastigroupGCPTerraformResource struct {
	GenericResource // embedding
}
var ElastigroupGCPResource *ElastigroupGCPTerraformResource

func NewElastigroupGCPResource added in v1.6.0

func NewElastigroupGCPResource(fieldMap map[FieldName]*GenericField) *ElastigroupGCPTerraformResource

NewElastigroupGCPResource creates a new GCP resource

func (*ElastigroupGCPTerraformResource) OnCreate added in v1.6.0

func (res *ElastigroupGCPTerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*gcp.Group, error)

OnCreate is called when creating a new resource block and returns a new elastigroup or an error.

func (*ElastigroupGCPTerraformResource) OnRead added in v1.6.0

func (res *ElastigroupGCPTerraformResource) OnRead(
	elastigroup *gcp.Group,
	resourceData *schema.ResourceData,
	meta interface{}) error

OnRead is called when reading an existing resource and throws an error if it is unable to do so.

func (*ElastigroupGCPTerraformResource) OnUpdate added in v1.6.0

func (res *ElastigroupGCPTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *gcp.Group, error)

OnUpdate is called when updating an existing resource and returns an elastigroup with a bool indicating if had been updated, or an error.

type ElastigroupGCPWrapper added in v1.6.0

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

func NewElastigroupGCPWrapper added in v1.6.0

func NewElastigroupGCPWrapper() *ElastigroupGCPWrapper

NewElastigroupGCPWrapper avoids parameter collisions and returns a GCP Elastigroup. Spotinst elastigroup must have a wrapper struct. The reason is that there are multiple fields that share the same elastigroup API object. the wrapper struct is intended to help reflect the field states into the elastigroup object properly.

func (*ElastigroupGCPWrapper) GetElastigroup added in v1.6.0

func (egWrapper *ElastigroupGCPWrapper) GetElastigroup() *gcp.Group

GetElastigroup returns a wrapped elastigroup

func (*ElastigroupGCPWrapper) SetElastigroup added in v1.6.0

func (egWrapper *ElastigroupGCPWrapper) SetElastigroup(elastigroup *gcp.Group)

SetElastigroup applies elastigroup fields to the elastigroup wrapper.

type ElastigroupGKETerraformResource added in v1.6.0

type ElastigroupGKETerraformResource struct {
	GenericResource // embedding
}
var ElastigroupGKEResource *ElastigroupGKETerraformResource

func NewElastigroupGKEResource added in v1.6.0

func NewElastigroupGKEResource(fieldMap map[FieldName]*GenericField) *ElastigroupGKETerraformResource

NewElastigroupGKEResource creates a new GKE resource

func (*ElastigroupGKETerraformResource) OnCreate added in v1.6.0

func (res *ElastigroupGKETerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*gcp.ImportGKEGroup, error)

OnCreate is called when creating a new resource block and returns a new elastigroup or an error.

func (*ElastigroupGKETerraformResource) OnRead added in v1.6.0

func (res *ElastigroupGKETerraformResource) OnRead(
	elastigroup *gcp.Group,
	resourceData *schema.ResourceData,
	meta interface{}) error

OnRead is called when reading an existing resource and throws an error if it is unable to do so.

func (*ElastigroupGKETerraformResource) OnUpdate added in v1.6.0

func (res *ElastigroupGKETerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *gcp.Group, error)

OnUpdate is called when updating an existing resource and returns an elastigroup with a bool indicating if had been updated, or an error.

type ElastigroupGKEWrapper added in v1.6.0

type ElastigroupGKEWrapper struct {
	ClusterID       string
	ClusterZoneName string
	// contains filtered or unexported fields
}

func NewElastigroupGKEWrapper added in v1.6.0

func NewElastigroupGKEWrapper() *ElastigroupGKEWrapper

NewElastigroupGKEWrapper avoids parameter collisions and returns a GKE Elastigroup. Spotinst elastigroup must have a wrapper struct. The reason is that there are multiple fields that share the same elastigroup API object. the wrapper struct is intended to help reflect the field states into the elastigroup object properly.

func (*ElastigroupGKEWrapper) GetElastigroup added in v1.6.0

func (egWrapper *ElastigroupGKEWrapper) GetElastigroup() *gcp.Group

GetElastigroup returns a wrapped elastigroup

func (*ElastigroupGKEWrapper) SetElastigroup added in v1.6.0

func (egWrapper *ElastigroupGKEWrapper) SetElastigroup(elastigroup *gcp.Group)

SetElastigroup applies elastigroup fields to the elastigroup wrapper.

type ElastigroupTerraformResource added in v1.1.0

type ElastigroupTerraformResource struct {
	GenericResource // embedding
}
var ElastigroupResource *ElastigroupTerraformResource

func NewElastigroupResource

func NewElastigroupResource(fieldsMap map[FieldName]*GenericField) *ElastigroupTerraformResource

func (*ElastigroupTerraformResource) OnCreate added in v1.1.0

func (res *ElastigroupTerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*aws.Group, error)

func (*ElastigroupTerraformResource) OnRead added in v1.1.0

func (res *ElastigroupTerraformResource) OnRead(
	elastigroup *aws.Group,
	resourceData *schema.ResourceData,
	meta interface{}) error

func (*ElastigroupTerraformResource) OnUpdate added in v1.1.0

func (res *ElastigroupTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *aws.Group, error)

type ElastigroupWrapper added in v1.1.0

type ElastigroupWrapper struct {

	// Load balancer states
	StatusElbUpdated bool
	StatusTgUpdated  bool
	StatusMlbUpdated bool

	// Block devices states
	StatusEphemeralBlockDeviceUpdated bool
	StatusEbsBlockDeviceUpdated       bool
	// contains filtered or unexported fields
}

func NewElastigroupWrapper added in v1.1.0

func NewElastigroupWrapper() *ElastigroupWrapper

Spotinst elastigroup must have a wrapper struct. Reason is that there are multiple fields who share the same elastigroup API object e.g. LoadBalancersConfig fields and BlockDeviceMapping fields Wrapper struct intended to help reflecting these fields state properly into the elastigroup object.

func (*ElastigroupWrapper) GetElastigroup added in v1.1.0

func (egWrapper *ElastigroupWrapper) GetElastigroup() *aws.Group

func (*ElastigroupWrapper) SetElastigroup added in v1.1.0

func (egWrapper *ElastigroupWrapper) SetElastigroup(elastigroup *aws.Group)

type FieldName

type FieldName string

type GenericField

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

func NewGenericField

func NewGenericField(
	resourceAffinity ResourceAffinity,
	fieldName FieldName,
	schema *schema.Schema,
	onRead onFieldRead,
	onCreate onFieldCreate,
	onUpdate onFieldUpdate,
	hasChangeCustom hasFieldChange) *GenericField

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Constructors

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

func (*GenericField) GetSchema

func (field *GenericField) GetSchema() *schema.Schema

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Methods: GenericField

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

type GenericFields

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

func NewGenericFields

func NewGenericFields(fieldsMap map[FieldName]*GenericField) *GenericFields

type GenericResource

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

func (*GenericResource) GetField

func (res *GenericResource) GetField(fieldName FieldName) *GenericField

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Methods: GenericResource

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

func (*GenericResource) GetName

func (res *GenericResource) GetName() string

func (*GenericResource) GetSchemaMap

func (res *GenericResource) GetSchemaMap() map[string]*schema.Schema

type ImportGKEWrapper added in v1.6.0

type ImportGKEWrapper struct {
	ClusterID       string
	ClusterZoneName string
	// contains filtered or unexported fields
}

func NewImportGKEWrapper added in v1.6.0

func NewImportGKEWrapper() *ImportGKEWrapper

func (*ImportGKEWrapper) GetImport added in v1.6.0

func (egWrapper *ImportGKEWrapper) GetImport() *gcp.ImportGKEGroup

func (*ImportGKEWrapper) SetImport added in v1.6.0

func (egWrapper *ImportGKEWrapper) SetImport(elastigroup *gcp.ImportGKEGroup)

type LogFormat

type LogFormat string

type OceanAWSTerraformResource added in v1.6.0

type OceanAWSTerraformResource struct {
	GenericResource // embedding
}
var OceanResource *OceanAWSTerraformResource

func NewOceanAWSResource added in v1.6.0

func NewOceanAWSResource(fieldsMap map[FieldName]*GenericField) *OceanAWSTerraformResource

func (*OceanAWSTerraformResource) OnCreate added in v1.6.0

func (res *OceanAWSTerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*aws.Cluster, error)

func (*OceanAWSTerraformResource) OnRead added in v1.6.0

func (res *OceanAWSTerraformResource) OnRead(
	cluster *aws.Cluster,
	resourceData *schema.ResourceData,
	meta interface{}) error

func (*OceanAWSTerraformResource) OnUpdate added in v1.6.0

func (res *OceanAWSTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *aws.Cluster, error)

type ResourceAffinity

type ResourceAffinity string

type ResourceName

type ResourceName string
const (
	ElastigroupAWSBeanstalkResourceName ResourceName = "spotinst_elastigroup_aws_beanstalk"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	ElastigroupAwsResourceName ResourceName = "spotinst_elastigroup_aws"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	ElastigroupAzureResourceName ResourceName = "spotinst_elastigroup_azure"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	ElastigroupGCPResourceName ResourceName = "spotinst_elastigroup_gcp"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	ElastigroupGKEResourceName ResourceName = "spotinst_elastigroup_gke"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	OceanAWSResourceName ResourceName = "spotinst_ocean_aws"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

const (
	SubscriptionResourceName ResourceName = "spotinst_subscription"
)

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Variables

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

type SubscriptionTerraformResource added in v1.1.0

type SubscriptionTerraformResource struct {
	GenericResource // embedding
}
var SubscriptionResource *SubscriptionTerraformResource

func NewSubscriptionResource

func NewSubscriptionResource(
	fieldsMap map[FieldName]*GenericField) *SubscriptionTerraformResource

func (*SubscriptionTerraformResource) OnCreate added in v1.1.0

func (res *SubscriptionTerraformResource) OnCreate(
	resourceData *schema.ResourceData,
	meta interface{}) (*subscription.Subscription, error)

func (*SubscriptionTerraformResource) OnRead added in v1.1.0

func (res *SubscriptionTerraformResource) OnRead(
	subscription *subscription.Subscription,
	resourceData *schema.ResourceData,
	meta interface{}) error

func (*SubscriptionTerraformResource) OnUpdate added in v1.1.0

func (res *SubscriptionTerraformResource) OnUpdate(
	resourceData *schema.ResourceData,
	meta interface{}) (bool, *subscription.Subscription, error)

Jump to

Keyboard shortcuts

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