vcd

package
v0.12.0-31 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeRef

func DeRef(v interface{}) interface{}

DeRef returns the value pointed to by the interface if the interface is a pointer and is not nil, otherwise returns nil, or the direct value if it's not a pointer.

func IsIPv4

func IsIPv4(str string) bool

func NormalizeValue

func NormalizeValue(v interface{}) interface{}

NormalizeValue converts a value to something that is suitable to be set in a ResourceData and can be useful in situations where there is not access to normal helper/schema functionality, but you still need saved fields to behave in the same way.

Specifically, this will run the value through DeRef to dereference any pointers first, and then convert numeric primitives, if necessary.

func Provider

func Provider() terraform.ResourceProvider

Provider returns a terraform.ResourceProvider.

func VAppNetworkSubresourceSchema

func VAppNetworkSubresourceSchema() map[string]*schema.Schema

func ValidateDiskSize

func ValidateDiskSize() schema.SchemaValidateFunc

func ValidateIPv4

func ValidateIPv4() schema.SchemaValidateFunc

func VirtualMachineNetworkSubresourceSchema

func VirtualMachineNetworkSubresourceSchema() map[string]*schema.Schema

Types

type Config

type Config struct {
	User            string
	Password        string
	Org             string
	Href            string
	VDC             string
	MaxRetryTimeout int
	InsecureFlag    bool
}

func (*Config) Client

func (c *Config) Client() (*VCDClient, error)

type Subresource

type Subresource struct {
	// The index of this subresource - should either be an index or hash. It's up
	// to the upstream object to set this to something useful.
	Index int
	// contains filtered or unexported fields
}

Subresource defines a common interface for device sub-resources in the vsphere_virtual_machine resource.

This object is designed to be used by parts of the resource with workflows that are so complex in their own right that probably the only way to handle their management is to treat them like resources themselves.

This structure of this resource loosely follows schema.Resource with having CRUD and maintaining a set of resource data to work off of. However, since we are using schema.Resource, we take some liberties that we normally would not be able to take, or need to take considering the context of the data we are working with.

Inparticular functions implement this structure by creating an instance into it, much like how a resource creates itself by creating an instance of schema.Resource.

func (*Subresource) Data

func (r *Subresource) Data() map[string]interface{}

Data returns the underlying data map.

func (*Subresource) Get

func (r *Subresource) Get(key string) interface{}

Get hands off to r.data.Get, with an address relative to this subresource.

func (*Subresource) GetChange

func (r *Subresource) GetChange(key string) (interface{}, interface{})

GetChange gets the old and new values for the value specified by key.

func (*Subresource) GetWithVeto

func (r *Subresource) GetWithVeto(key string) (interface{}, error)

GetWithVeto returns the value specified by key, but returns an error if it has changed. The intention here is to block changes to the resource in a fashion that would otherwise result in forcing a new resource.

func (*Subresource) HasChange

func (r *Subresource) HasChange(key string) bool

HasChange checks to see if there has been a change in the resource data since the last update.

Note that this operation may only be useful during update operations, depending on subresource-specific workflow.

func (*Subresource) Hash

func (r *Subresource) Hash() int

Hash calculates a set hash for the current data. If you want a hash for error reporting a device address, it's probably a good idea to run this at the beginning of a run as any set calls will change the value this ultimately calculates.

func (*Subresource) Set

func (r *Subresource) Set(key string, value interface{})

Set sets the specified key/value pair in the subresource.

type SubresourceInstance

type SubresourceInstance interface {
	Set(string, interface{}) error
	Schema() map[string]*schema.Schema
	State() map[string]interface{}
}

SubresourceInstance is an interface for derivative objects of Subresource. It's used on the general apply and read operation methods, and contains both exported methods of the base Subresource type and the CRUD methods that should be supplied by derivative objects.

Note that this interface should be used sparingly - as such, only the methods that are needed by inparticular functions external to most virtual device workflows are exported into this interface.

type VAppNetworkSubresource

type VAppNetworkSubresource struct {
	*Subresource
}

func NewVAppNetworkSubresource

func NewVAppNetworkSubresource(d, old map[string]interface{}) *VAppNetworkSubresource

type VCDClient

type VCDClient struct {
	*govcd.VCDClient

	Org    govcd.Org
	OrgVdc govcd.Vdc

	Mutex           sync.Mutex
	MaxRetryTimeout int
	InsecureFlag    bool
}

type VirtualMachineNetworkSubresource

type VirtualMachineNetworkSubresource struct {
	*Subresource
}

func NewVirtualMachineNetworkSubresource

func NewVirtualMachineNetworkSubresource(d, old map[string]interface{}) *VirtualMachineNetworkSubresource

Jump to

Keyboard shortcuts

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