openstack

package
v1.15.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2019 License: MPL-2.0 Imports: 113 Imported by: 0

Documentation

Overview

This set of code handles all functions required to configure networking on an openstack_compute_instance_v2 resource.

This is a complicated task because it's not possible to obtain all information in a single API call. In fact, it even traverses multiple OpenStack services.

The end result, from the user's point of view, is a structured set of understandable network information within the instance resource.

Index

Constants

This section is empty.

Variables

View Source
var ContainerFormats = [9]string{"ami", "ari", "aki", "bare", "ovf", "ova"}
View Source
var DiskFormats = [9]string{"ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vdi", "iso"}
View Source
var REDACT_HEADERS = []string{"x-auth-token", "x-auth-key", "x-service-token",
	"x-storage-token", "x-account-meta-temp-url-key", "x-account-meta-temp-url-key-2",
	"x-container-meta-temp-url-key", "x-container-meta-temp-url-key-2", "set-cookie",
	"x-subject-token"}

List of headers that need to be redacted

Functions

func AddValueSpecs

func AddValueSpecs(body map[string]interface{}) map[string]interface{}

AddValueSpecs expands the 'value_specs' object and removes 'value_specs' from the reqeust body.

func BuildRequest

func BuildRequest(opts interface{}, parent string) (map[string]interface{}, error)

BuildRequest takes an opts struct and builds a request body for Gophercloud to execute

func CheckDeleted

func CheckDeleted(d *schema.ResourceData, err error, msg string) error

CheckDeleted checks the error to see if it's a 404 (Not Found) and, if so, sets the resource ID to the empty string instead of throwing an error.

func DatabaseConfigurationV1StateRefreshFunc added in v1.2.0

func DatabaseConfigurationV1StateRefreshFunc(client *gophercloud.ServiceClient, cgroupID string) resource.StateRefreshFunc

DatabaseConfigurationV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch an cloud database instance.

func DatabaseDatabaseV1State added in v1.2.0

func DatabaseDatabaseV1State(client *gophercloud.ServiceClient, instanceID string, dbName string) (exists bool, err error)

func DatabaseDatabaseV1StateRefreshFunc added in v1.2.0

func DatabaseDatabaseV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, dbName string) resource.StateRefreshFunc

DatabaseDatabaseV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch a database.

func DatabaseInstanceV1StateRefreshFunc added in v1.1.0

func DatabaseInstanceV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc

DatabaseInstanceV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch a database instance.

func DatabaseUserV1State added in v1.2.0

func DatabaseUserV1State(client *gophercloud.ServiceClient, instanceID string, userName string) (exists bool, userObj users.User, err error)

DatabaseUserV1State is used to check whether user exists on particular database instance

func DatabaseUserV1StateRefreshFunc added in v1.2.0

func DatabaseUserV1StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string, userName string) resource.StateRefreshFunc

DatabaseUserV1StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch db user.

func FormatHeaders

func FormatHeaders(headers http.Header, seperator string) string

FormatHeaders processes a headers object plus a deliminator, returning a string

func GetRegion

func GetRegion(d *schema.ResourceData, config *Config) string

GetRegion returns the region that was specified in the resource. If a region was not set, the provider-level region is checked. The provider-level region can either be set by the region argument or by OS_REGION_NAME.

func MapValueSpecs

func MapValueSpecs(d *schema.ResourceData) map[string]string

MapValueSpecs converts ResourceData into a map

func Provider

func Provider() terraform.ResourceProvider

Provider returns a schema.Provider for OpenStack.

func RedactHeaders

func RedactHeaders(headers http.Header) (processedHeaders []string)

RedactHeaders processes a headers object, returning a redacted list

func ServerV2StateRefreshFunc

func ServerV2StateRefreshFunc(client *gophercloud.ServiceClient, instanceID string) resource.StateRefreshFunc

ServerV2StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch an OpenStack instance.

Types

type ComputeKeyPairV2CreateOpts added in v1.12.0

type ComputeKeyPairV2CreateOpts struct {
	keypairs.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

ComputeKeyPairV2CreateOpts is a custom KeyPair struct to include the ValueSpecs field.

func (ComputeKeyPairV2CreateOpts) ToKeyPairCreateMap added in v1.12.0

func (opts ComputeKeyPairV2CreateOpts) ToKeyPairCreateMap() (map[string]interface{}, error)

ToKeyPairCreateMap casts a CreateOpts struct to a map. It overrides keypairs.ToKeyPairCreateMap to add the ValueSpecs field.

type ComputeServerGroupV2CreateOpts added in v1.13.0

type ComputeServerGroupV2CreateOpts struct {
	servergroups.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

ServerGroupCreateOpts is a custom ServerGroup struct to include the ValueSpecs field.

func (ComputeServerGroupV2CreateOpts) ToServerGroupCreateMap added in v1.13.0

func (opts ComputeServerGroupV2CreateOpts) ToServerGroupCreateMap() (map[string]interface{}, error)

ToServerGroupCreateMap casts a CreateOpts struct to a map. It overrides routers.ToServerGroupCreateMap to add the ValueSpecs field.

type Config

type Config struct {
	CACertFile                  string
	ClientCertFile              string
	ClientKeyFile               string
	Cloud                       string
	DefaultDomain               string
	DomainID                    string
	DomainName                  string
	EndpointOverrides           map[string]interface{}
	EndpointType                string
	IdentityEndpoint            string
	Insecure                    *bool
	Password                    string
	ProjectDomainName           string
	ProjectDomainID             string
	Region                      string
	Swauth                      bool
	TenantID                    string
	TenantName                  string
	Token                       string
	UserDomainName              string
	UserDomainID                string
	Username                    string
	UserID                      string
	ApplicationCredentialID     string
	ApplicationCredentialName   string
	ApplicationCredentialSecret string

	MaxRetries int

	OsClient *gophercloud.ProviderClient
	// contains filtered or unexported fields
}

func (*Config) LoadAndValidate

func (c *Config) LoadAndValidate() error

LoadAndValidate performs the authentication and initial configuration of an OpenStack Provider Client. This sets up the HTTP client and authenticates to an OpenStack cloud.

Individual Service Clients are created later in this file.

type EndpointGroupCreateOpts added in v1.5.0

type EndpointGroupCreateOpts struct {
	endpointgroups.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

EndpointGroupCreateOpts represents the attributes used when creating a new endpoint group.

type Firewall

type Firewall struct {
	firewalls.Firewall
	routerinsertion.FirewallExt
}

Firewall is an OpenStack firewall.

type FirewallCreateOpts

type FirewallCreateOpts struct {
	firewalls.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

FirewallCreateOpts represents the attributes used when creating a new firewall.

func (FirewallCreateOpts) ToFirewallCreateMap

func (opts FirewallCreateOpts) ToFirewallCreateMap() (map[string]interface{}, error)

ToFirewallCreateMap casts a CreateOptsExt struct to a map. It overrides firewalls.ToFirewallCreateMap to add the ValueSpecs field.

type FirewallUpdateOpts

type FirewallUpdateOpts struct {
	firewalls.UpdateOptsBuilder
}

FirewallUpdateOpts

func (FirewallUpdateOpts) ToFirewallUpdateMap

func (opts FirewallUpdateOpts) ToFirewallUpdateMap() (map[string]interface{}, error)

type FloatingIPCreateOpts

type FloatingIPCreateOpts struct {
	floatingips.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

FloatingIPCreateOpts represents the attributes used when creating a new floating ip.

func (FloatingIPCreateOpts) ToFloatingIPCreateMap

func (opts FloatingIPCreateOpts) ToFloatingIPCreateMap() (map[string]interface{}, error)

ToFloatingIPCreateMap casts a CreateOpts struct to a map. It overrides floatingips.ToFloatingIPCreateMap to add the ValueSpecs field.

type IKEPolicyCreateOpts added in v1.5.0

type IKEPolicyCreateOpts struct {
	ikepolicies.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

IKEPolicyCreateOpts represents the attributes used when creating a new IKE policy.

type IKEPolicyLifetimeCreateOpts added in v1.5.0

type IKEPolicyLifetimeCreateOpts struct {
	ikepolicies.LifetimeCreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

IKEPolicyLifetimeCreateOpts represents the attributes used when creating a new lifetime for an IKE policy.

type IPSecPolicyCreateOpts added in v1.5.0

type IPSecPolicyCreateOpts struct {
	ipsecpolicies.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

IPSecPolicyCreateOpts represents the attributes used when creating a new IPSec policy.

type InstanceAddresses added in v0.2.0

type InstanceAddresses struct {
	NetworkName  string
	InstanceNICs []InstanceNIC
}

InstanceAddresses is a collection of InstanceNICs, grouped by the network name. An instance/server could have multiple NICs on the same network.

type InstanceNIC added in v0.2.0

type InstanceNIC struct {
	FixedIPv4 string
	FixedIPv6 string
	MAC       string
}

InstanceNIC is a structured representation of a Gophercloud servers.Server virtual NIC.

type InstanceNetwork added in v0.2.0

type InstanceNetwork struct {
	UUID          string
	Name          string
	Port          string
	FixedIP       string
	AccessNetwork bool
}

InstanceNetwork represents a collection of network information that a Terraform instance needs to satisfy all network information requirements.

type LogRoundTripper

type LogRoundTripper struct {
	Rt         http.RoundTripper
	OsDebug    bool
	MaxRetries int
}

LogRoundTripper satisfies the http.RoundTripper interface and is used to customize the default http client RoundTripper to allow for logging.

func (*LogRoundTripper) RoundTrip

func (lrt *LogRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip performs a round-trip HTTP request and logs relevant information about it.

type NetworkCreateOpts

type NetworkCreateOpts struct {
	networks.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

NetworkCreateOpts represents the attributes used when creating a new network.

func (NetworkCreateOpts) ToNetworkCreateMap

func (opts NetworkCreateOpts) ToNetworkCreateMap() (map[string]interface{}, error)

ToNetworkCreateMap casts a CreateOpts struct to a map. It overrides networks.ToNetworkCreateMap to add the ValueSpecs field.

type PolicyCreateOpts

type PolicyCreateOpts struct {
	policies.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

PolicyCreateOpts represents the attributes used when creating a new firewall policy.

func (PolicyCreateOpts) ToFirewallPolicyCreateMap

func (opts PolicyCreateOpts) ToFirewallPolicyCreateMap() (map[string]interface{}, error)

ToPolicyCreateMap casts a CreateOpts struct to a map. It overrides policies.ToFirewallPolicyCreateMap to add the ValueSpecs field.

type PortCreateOpts

type PortCreateOpts struct {
	ports.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

PortCreateOpts represents the attributes used when creating a new port.

func (PortCreateOpts) ToPortCreateMap

func (opts PortCreateOpts) ToPortCreateMap() (map[string]interface{}, error)

ToPortCreateMap casts a CreateOpts struct to a map. It overrides ports.ToPortCreateMap to add the ValueSpecs field.

type RecordSetCreateOpts

type RecordSetCreateOpts struct {
	recordsets.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

RecordSetCreateOpts represents the attributes used when creating a new DNS record set.

func (RecordSetCreateOpts) ToRecordSetCreateMap

func (opts RecordSetCreateOpts) ToRecordSetCreateMap() (map[string]interface{}, error)

ToRecordSetCreateMap casts a CreateOpts struct to a map. It overrides recordsets.ToRecordSetCreateMap to add the ValueSpecs field.

type RouterCreateOpts

type RouterCreateOpts struct {
	routers.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

RouterCreateOpts represents the attributes used when creating a new router.

func (RouterCreateOpts) ToRouterCreateMap

func (opts RouterCreateOpts) ToRouterCreateMap() (map[string]interface{}, error)

ToRouterCreateMap casts a CreateOpts struct to a map. It overrides routers.ToRouterCreateMap to add the ValueSpecs field.

type RuleCreateOpts

type RuleCreateOpts struct {
	rules.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

RuleCreateOpts represents the attributes used when creating a new firewall rule.

func (RuleCreateOpts) ToRuleCreateMap

func (opts RuleCreateOpts) ToRuleCreateMap() (map[string]interface{}, error)

ToRuleCreateMap casts a CreateOpts struct to a map. It overrides rules.ToRuleCreateMap to add the ValueSpecs field.

type ServiceCreateOpts added in v1.5.0

type ServiceCreateOpts struct {
	services.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

ServiceCreateOpts represents the attributes used when creating a new VPN service.

type SiteConnectionCreateOpts added in v1.6.0

type SiteConnectionCreateOpts struct {
	siteconnections.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

SiteConnectionCreateOpts represents the attributes used when creating a new IPSec site connection.

type SubnetCreateOpts

type SubnetCreateOpts struct {
	subnets.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

SubnetCreateOpts represents the attributes used when creating a new subnet.

func (SubnetCreateOpts) ToSubnetCreateMap

func (opts SubnetCreateOpts) ToSubnetCreateMap() (map[string]interface{}, error)

ToSubnetCreateMap casts a CreateOpts struct to a map. It overrides subnets.ToSubnetCreateMap to add the ValueSpecs field.

type SubnetPoolCreateOpts added in v1.3.0

type SubnetPoolCreateOpts struct {
	subnetpools.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

SubnetPoolCreateOpts represents the attributes used when creating a new subnet pool.

type ZoneCreateOpts

type ZoneCreateOpts struct {
	zones.CreateOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

ZoneCreateOpts represents the attributes used when creating a new DNS zone.

func (ZoneCreateOpts) ToZoneCreateMap

func (opts ZoneCreateOpts) ToZoneCreateMap() (map[string]interface{}, error)

ToZoneCreateMap casts a CreateOpts struct to a map. It overrides zones.ToZoneCreateMap to add the ValueSpecs field.

Source Files

Jump to

Keyboard shortcuts

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