crud

package
v2.1.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2018 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FAILED = "FAILED"
)

Variables

View Source
var (
	FiveMinutes time.Duration = 5 * time.Minute
	TwoHours    time.Duration = 120 * time.Minute
	ZeroTime    time.Duration = 0

	DefaultTimeout = &schema.ResourceTimeout{
		Create: &FiveMinutes,
		Update: &FiveMinutes,
		Delete: &FiveMinutes,
	}
)

Functions

func CreateDBSystemResource added in v1.0.15

func CreateDBSystemResource(d *schema.ResourceData, sync ResourceCreator) (e error)

func CreateResource

func CreateResource(d *schema.ResourceData, sync ResourceCreator) (e error)

func DeleteResource

func DeleteResource(d *schema.ResourceData, sync ResourceDeleter) (e error)

DeleteResource requests a Delete(). If the resource deletes statefully (not immediately), poll State to ensure: () -> Pending -> Deleted. Finally, sets the ResourceData state to empty.

func EqualIgnoreCaseSuppressDiff

func EqualIgnoreCaseSuppressDiff(key string, old string, new string, d *schema.ResourceData) bool

func FieldDeprecated

func FieldDeprecated(deprecatedFieldName string) string

func FieldDeprecatedForAnother

func FieldDeprecatedForAnother(deprecatedFieldName string, newFieldName string) string

func FilterMissingResourceError added in v1.0.8

func FilterMissingResourceError(sync ResourceVoider, err *error)

func GenerateDataSourceID

func GenerateDataSourceID() string

GenerateDataSourceID generates an ID for the data source based on the current time stamp.

func LoadBalancerResourceGet added in v1.0.11

func LoadBalancerResourceGet(client *oci_load_balancer.LoadBalancerClient, d *schema.ResourceData, wr *oci_load_balancer.WorkRequest, retryOptions ...oci_common.RetryPolicyOption) (id string, stillWorking bool, err error)

func LoadBalancerResourceID added in v1.0.11

func LoadBalancerResourceID(res interface{}, workReq *oci_load_balancer.WorkRequest) (id *string, workReqSucceeded bool)

func LoadBalancerWaitForWorkRequest added in v1.0.13

func LoadBalancerWaitForWorkRequest(client *oci_load_balancer.LoadBalancerClient, d *schema.ResourceData, wr *oci_load_balancer.WorkRequest, retryOptions ...oci_common.RetryPolicyOption) error

func ReadResource

func ReadResource(sync ResourceReader) (e error)

func StringsToSet

func StringsToSet(ss []string) *schema.Set

stringsToSet encodes an []string into a *schema.Set in the appropriate structure for the schema

func UpdateResource

func UpdateResource(d *schema.ResourceData, sync ResourceUpdater) (e error)

Types

type BaseCrud

type BaseCrud struct {
	D *schema.ResourceData
}

func (*BaseCrud) State added in v1.0.3

func (s *BaseCrud) State() string

Default implementation pulls state off of the schema

func (*BaseCrud) VoidState

func (s *BaseCrud) VoidState()

type ExtraWaitPostCreateDelete added in v1.0.11

type ExtraWaitPostCreateDelete interface {
	ExtraWaitPostCreateDelete() time.Duration
}

Some resources in the oracle API are removed asynchronously, so even after they claim to be gone, other dependencies haven't been notified of that fact. This facility allows us to add an artificial delay for resources that need a little time to let the oracle API backend catch up with reality.

type ResourceCreator

type ResourceCreator interface {
	ResourceDataWriter
	// ID identifies the resource, or a work request to create the resource.
	ID() string
	Create() error
}

ResourceCreator may create a BareMetal resource and populate into ResourceData state by using CreateResource()

type ResourceDataWriter

type ResourceDataWriter interface {
	ResourceVoider
	// SetData populates ResourceData state from current
	// BareMetal resource
	SetData()
}

ResourceDataWriter populates ResourceData state from the current BareMetal resource

type ResourceDeleter

type ResourceDeleter interface {
	ResourceVoider
	// ID identifies the resource, or a work request to create the resource.
	ID() string
	Delete() error
}

Deletes a BareMetal entity

type ResourceFetcher

type ResourceFetcher interface {
	// Get should update the s.Resource, and is used by crud.ReadResource() to populate s.D
	// Get() may expect s.D.Id() to be set, but not s.Resource, or anything else in s.D
	Get() error
}

Gets the current BareMetal Resource

type ResourceReader

type ResourceReader interface {
	ResourceFetcher
	ResourceDataWriter
}

ResourceReader get BareMetal Resource and updated ResourceData

type ResourceUpdater

type ResourceUpdater interface {
	ResourceDataWriter
	Update() error
}

Updates a BareMetal entity to match ResourceData

type ResourceVoider

type ResourceVoider interface {
	// VoidState sets ResourceData ID to "". To be called when
	// the resource is gone.
	VoidState()
}

ResourceVoider may set its ResourceData state to empty.

type StatefulResource

type StatefulResource interface {
	ResourceReader
	State() string
	// contains filtered or unexported methods
}

type StatefullyCreatedResource

type StatefullyCreatedResource interface {
	StatefulResource
	CreatedPending() []string
	CreatedTarget() []string
}

type StatefullyDeletedResource

type StatefullyDeletedResource interface {
	StatefulResource
	DeletedPending() []string
	DeletedTarget() []string
}

type StatefullyUpdatedResource added in v1.0.13

type StatefullyUpdatedResource interface {
	StatefulResource
	UpdatedPending() []string
	UpdatedTarget() []string
}

Jump to

Keyboard shortcuts

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