commons

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2018 License: MPL-2.0 Imports: 8 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"

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

	Subscription ResourceAffinity = "Subscription"

	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"

	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 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 LogFormat

type LogFormat string

type ResourceAffinity

type ResourceAffinity string

type ResourceName

type ResourceName string
const (
	ElastigroupAwsResourceName ResourceName = "spotinst_elastigroup_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