vcd

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: MPL-2.0 Imports: 32 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuildVersion = "unset"

BuildVersion holds version which is meant to be injected at build time using ldflags (e.g. 'go build -ldflags="-X 'github.com/vmware/terraform-provider-vcd/v3/vcd.BuildVersion=v1.0.0'"')

View Source
var DFWElements = []string{
	types.DFWElementIpv4,
	types.DFWElementNetwork,
	types.DFWElementEdge,
	types.DFWElementIpSet,
	types.DFWElementVirtualMachine,
	types.DFWElementVdc,
}
View Source
var (
	// IgnoreMetadataChangesConflictActions can hold values "error", "warn" or "none", and tells Terraform whether it should
	// give an error or just a warning if any Metadata Entry configured in HCL is affected by the 'ignore_metadata_changes'
	// configuration.
	IgnoreMetadataChangesConflictActions map[string]string
)
View Source
var (

	// ImportSeparator is the separation string used for import operations
	// Can be changed using either "import_separator" property in Provider
	// or environment variable "VCD_IMPORT_SEPARATOR"
	ImportSeparator = "."
)

Functions

func DataSources

func DataSources(nameRegexp string, includeDeprecated bool) (map[string]*schema.Resource, error)

DataSources is a public function which allows filtering and access all defined data sources When 'nameRegexp' is not empty - it will return only those matching the regexp When 'includeDeprecated' is false - it will skip out the resources which have a DeprecationMessage set

func GetVcenterHref

func GetVcenterHref(vcdClient *govcd.VCDClient, name string) (string, error)

func IsFloatAndBetween

func IsFloatAndBetween(min, max float64) schema.SchemaValidateFunc

IsFloatAndBetween returns a SchemaValidateFunc which tests if the provided value convertable to float64 and is between min and max (inclusive).

func IsIntAndAtLeast

func IsIntAndAtLeast(min int) schema.SchemaValidateFunc

IsIntAndAtLeast returns a SchemaValidateFunc which tests if the provided value string is convertable to int and is at least min (inclusive)

func ObjectMap added in v3.10.0

func ObjectMap[Input any, Output any](input []Input, f func(Input) Output) []Output

ObjectMap extracts an array of wanted elements from an array of complex objects. The Input type is the complex object The Output type could be a simple data type, such as a string or a number, but could also be a different object. The conversion is performed by the f function, which takes one complex input object and produces the wanted output. examples:

    ids := ObjectMap[*types.VimObjectRef, string](extendedProviderVdc.VMWProviderVdc.ResourcePoolRefs.VimObjectRef,
        vimObjectRefToMoref)

	ids := ObjectMap[*types.Reference, string](extendedProviderVdc.VMWProviderVdc.StorageProfiles.ProviderVdcStorageProfile,
		referenceToId)

	names := ObjectMap[*types.Reference, string](extendedProviderVdc.VMWProviderVdc.StorageProfiles.ProviderVdcStorageProfile,
		referenceToName)

func Provider

func Provider() *schema.Provider

Provider returns a terraform.ResourceProvider.

func ProviderAuthenticate

func ProviderAuthenticate(client *govcd.VCDClient, user, password, token, org, apiToken, apiTokenFile, saTokenFile string) error

TODO Look into refactoring this into a method of *Config

func Resources

func Resources(nameRegexp string, includeDeprecated bool) (map[string]*schema.Resource, error)

Resources is a public function which allows filtering and access all defined resources When 'nameRegexp' is not empty - it will return only those matching the regexp When 'includeDeprecated' is false - it will skip out the resources which have a DeprecationMessage set

Types

type Config

type Config struct {
	User                    string
	Password                string
	Token                   string // Token used instead of user and password
	ApiToken                string // User generated token used instead of user and password
	ApiTokenFile            string // File containing a user generated API token
	AllowApiTokenFile       bool   // Setting to suppress API Token File security warnings
	ServiceAccountTokenFile string // File containing the Service Account API token
	AllowSATokenFile        bool   // Setting to suppress Service Account Token File security warnings
	SysOrg                  string // Org used for authentication
	Org                     string // Default Org used for API operations
	Vdc                     string // Default (optional) VDC for API operations
	Href                    string
	MaxRetryTimeout         int
	InsecureFlag            bool

	// UseSamlAdfs specifies if SAML auth is used for authenticating VCD instead of local login.
	// The following conditions must be met so that authentication SAML authentication works:
	// * SAML IdP (Identity Provider) is Active Directory Federation Service (ADFS)
	// * Authentication endpoint "/adfs/services/trust/13/usernamemixed" must be enabled on ADFS
	// server
	UseSamlAdfs bool
	// CustomAdfsRptId allows to set custom Relaying Party Trust identifier. By default VCD Entity
	// ID is used as Relaying Party Trust identifier.
	CustomAdfsRptId string

	// IgnoredMetadata allows to configure a set of metadata entries that should be ignored by all the
	// API operations related to metadata.
	IgnoredMetadata []govcd.IgnoredMetadata
}

func (*Config) Client

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

type IgnoredMetadata added in v3.10.0

type IgnoredMetadata struct {
	IgnoredMetadata govcd.IgnoredMetadata
	ConflictAction  string
}

IgnoredMetadata extends the SDK IgnoredMetadata type to be able to add also the conflict behavior defined as an attribute in the schema.

type StringMap

type StringMap map[string]interface{}

StringMap type is used to simplify reading resource definitions

type TaskIdCollection added in v3.8.0

type TaskIdCollection struct {
	Running []string
	Failed  []string
	// contains filtered or unexported fields
}

type VCDClient

type VCDClient struct {
	*govcd.VCDClient
	SysOrg          string
	Org             string // name of default Org
	Vdc             string // name of default VDC
	MaxRetryTimeout int
	InsecureFlag    bool
}

func (*VCDClient) GetAdminOrg

func (cli *VCDClient) GetAdminOrg(orgName string) (org *govcd.AdminOrg, err error)

GetAdminOrg finds org using the names provided in the args. If the name is empty, it will use the default org name from the provider.

func (*VCDClient) GetAdminOrgFromResource

func (cli *VCDClient) GetAdminOrgFromResource(d *schema.ResourceData) (org *govcd.AdminOrg, err error)

GetAdminOrgFromResource is the same as GetOrgAndVdc, but using data from the resource, if available.

func (*VCDClient) GetEdgeGateway

func (cli *VCDClient) GetEdgeGateway(orgName, vdcName, edgeGwName string) (eg *govcd.EdgeGateway, err error)

GetEdgeGateway gets an NSX-V Edge Gateway when you don't need org or vdc for other purposes

func (*VCDClient) GetEdgeGatewayFromResource

func (cli *VCDClient) GetEdgeGatewayFromResource(d *schema.ResourceData, edgeGatewayFieldName string) (eg *govcd.EdgeGateway, err error)

GetEdgeGatewayFromResource is the same as GetEdgeGateway, but using data from the resource, if available edgeGatewayFieldName is the name used in the resource. It is usually "edge_gateway" for all resources that *use* an edge gateway, and when the resource is vcd_edgegateway, it is "name"

func (*VCDClient) GetNsxtEdgeGateway added in v3.3.0

func (cli *VCDClient) GetNsxtEdgeGateway(orgName, vdcName, edgeGwName string) (eg *govcd.NsxtEdgeGateway, err error)

GetNsxtEdgeGateway gets an NSX-T Edge Gateway when you don't need Org or VDC for other purposes

func (*VCDClient) GetNsxtEdgeGatewayById added in v3.3.0

func (cli *VCDClient) GetNsxtEdgeGatewayById(orgName, edgeGwId string) (eg *govcd.NsxtEdgeGateway, err error)

GetNsxtEdgeGatewayById gets an NSX-T Edge Gateway when you don't need Org or VDC for other purposes

func (*VCDClient) GetNsxtEdgeGatewayFromResourceById added in v3.3.0

func (cli *VCDClient) GetNsxtEdgeGatewayFromResourceById(d *schema.ResourceData, edgeGatewayFieldName string) (eg *govcd.NsxtEdgeGateway, err error)

GetNsxtEdgeGatewayFromResourceById helps to retrieve NSX-T Edge Gateway when Org org VDC are not needed. It performs a query By ID.

func (*VCDClient) GetOrg added in v3.3.0

func (cli *VCDClient) GetOrg(orgName string) (org *govcd.Org, err error)

GetOrg finds org using the names provided in the args. If the name is empty, it will use the default org name from the provider.

func (*VCDClient) GetOrgAndVdc

func (cli *VCDClient) GetOrgAndVdc(orgName, vdcName string) (org *govcd.Org, vdc *govcd.Vdc, err error)

GetOrgAndVdc finds a pair of org and vdc using the names provided in the args. If the names are empty, it will use the default org and vdc names from the provider.

func (*VCDClient) GetOrgAndVdcFromResource

func (cli *VCDClient) GetOrgAndVdcFromResource(d *schema.ResourceData) (org *govcd.Org, vdc *govcd.Vdc, err error)

GetOrgAndVdcFromResource is the same as GetOrgAndVdc, but using data from the resource, if available.

func (*VCDClient) GetOrgFromResource added in v3.3.0

func (cli *VCDClient) GetOrgFromResource(d *schema.ResourceData) (org *govcd.Org, err error)

GetOrgFromResource is the same as GetOrg, but using data from the resource, if available.

func (*VCDClient) GetOrgName added in v3.7.0

func (cli *VCDClient) GetOrgName(orgName string) (string, error)

GetOrgName returns the parameter orgName if provided. If not tried to get it from provider.

func (*VCDClient) GetOrgNameFromResource added in v3.7.0

func (cli *VCDClient) GetOrgNameFromResource(d *schema.ResourceData) (string, error)

GetOrgNameFromResource returns the Org name if set at resource level. If not, tries to get it from provider level. It errors if none is provided.

Source Files

Jump to

Keyboard shortcuts

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