huaweicloud

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MPL-2.0 Imports: 140 Imported by: 1

Documentation

Overview

This set of code handles all functions required to configure networking on an huaweicloud_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 HuaweiCloud 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

View Source
const DisabledState = "3"
View Source
const EnabledState = "2"
View Source
const PendingDeletionState = "4"
View Source
const WaitingForEnableState = "1"

Variables

View Source
var BandWidthChargeMode = [1]string{"traffic"}
View Source
var BandWidthShareType = [1]string{"PER"}
View Source
var ContainerFormats = [1]string{"bare"}
View Source
var DiskFormats = [2]string{"vhd", "qcow2"}
View Source
var DiskTypes = [2]string{"DATA", "SYS"}
View Source
var HealthAuditMethods = [2]string{"ELB_AUDIT", "NOVA_AUDIT"}
View Source
var HealthAuditTime = [4]int{5, 15, 60, 180}
View Source
var IpTypes = [1]string{"5_bgp"}
View Source
var PolicyActions = [3]string{"ADD", "REMOVE", "SET"}
View Source
var PolicyTypes = [3]string{"ALARM", "SCHEDULED", "RECURRENCE"}
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

View Source
var RecurrenceTypes = [3]string{"Daily", "Weekly", "Monthly"}
View Source
var Specs = [4]string{"1", "2", "3", "4"}
View Source
var TerminatePolices = [4]string{"OLD_CONFIG_OLD_INSTANCE", "OLD_CONFIG_NEW_INSTANCE", "OLD_INSTANCE", "NEW_INSTANCE"}
View Source
var VolumeTypes = [2]string{"SATA", "SSD"}

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 BytesToString added in v1.1.0

func BytesToString(b []byte) string

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 ClusterStateRefreshFunc added in v1.3.0

func ClusterStateRefreshFunc(client *golangsdk.ServiceClient, clusterID string) resource.StateRefreshFunc

func DcsInstancesV1StateRefreshFunc added in v1.3.0

func DcsInstancesV1StateRefreshFunc(client *golangsdk.ServiceClient, instanceID string) resource.StateRefreshFunc

func DmsInstancesV1StateRefreshFunc added in v1.3.0

func DmsInstancesV1StateRefreshFunc(client *golangsdk.ServiceClient, instanceID string) resource.StateRefreshFunc

func FloatingIPV2StateRefreshFunc

func FloatingIPV2StateRefreshFunc(computeClient *golangsdk.ServiceClient, d *schema.ResourceData) resource.StateRefreshFunc

func FormatHeaders

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

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

func GetCredentials

func GetCredentials(c *Config) (*awsCredentials.Credentials, error)

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 InstanceStateFlavorUpdateRefreshFunc

func InstanceStateFlavorUpdateRefreshFunc(client *golangsdk.ServiceClient, instanceID string, flavorID string) resource.StateRefreshFunc

func InstanceStateRefreshFunc

func InstanceStateRefreshFunc(client *golangsdk.ServiceClient, instanceID string) resource.StateRefreshFunc

func InstanceStateUpdateRefreshFunc

func InstanceStateUpdateRefreshFunc(client *golangsdk.ServiceClient, instanceID string, size int) resource.StateRefreshFunc

func JobStateRefreshFunc added in v1.3.0

func JobStateRefreshFunc(client *golangsdk.ServiceClient, jobID string) resource.StateRefreshFunc

func KeyV1StateRefreshFunc

func KeyV1StateRefreshFunc(client *golangsdk.ServiceClient, keyID string) resource.StateRefreshFunc

func MapResourceProp

func MapResourceProp(d *schema.ResourceData, prop string) map[string]interface{}

MapResourceProp converts ResourceData property into a map

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 HuaweiCloud.

func RedactHeaders

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

RedactHeaders processes a headers object, returning a redacted list

func SecGroupV2StateRefreshFunc

func SecGroupV2StateRefreshFunc(computeClient *golangsdk.ServiceClient, d *schema.ResourceData) resource.StateRefreshFunc

func ServerV2StateRefreshFunc

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

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

func ValidateIntRange

func ValidateIntRange(v interface{}, k string, l int, h int) (ws []string, errors []error)

func ValidateStringList

func ValidateStringList(v interface{}, k string, l []string) (ws []string, errors []error)

func VolumeV2StateRefreshFunc

func VolumeV2StateRefreshFunc(client *golangsdk.ServiceClient, volumeID string) resource.StateRefreshFunc

VolumeV2StateRefreshFunc returns a resource.StateRefreshFunc that is used to watch an HuaweiCloud volume.

func WebsiteDomainUrl

func WebsiteDomainUrl(region string) string

Types

type Config

type Config struct {
	AccessKey        string
	SecretKey        string
	CACertFile       string
	ClientCertFile   string
	ClientKeyFile    string
	Cloud            string
	DomainID         string
	DomainName       string
	EndpointType     string
	IdentityEndpoint string
	Insecure         bool
	Password         string
	Region           string
	Swauth           bool
	TenantID         string
	TenantName       string
	Token            string
	Username         string
	UserID           string

	AgencyName       string
	AgencyDomainName string
	DelegatedProject string

	HwClient *golangsdk.ProviderClient

	DomainClient *golangsdk.ProviderClient
	// contains filtered or unexported fields
}

func (*Config) LoadAndValidate

func (c *Config) LoadAndValidate() error

func (*Config) MrsV1Client added in v1.3.0

func (c *Config) MrsV1Client(region string) (*golangsdk.ServiceClient, error)

func (*Config) RdsV1Client

func (c *Config) RdsV1Client(region string) (*golangsdk.ServiceClient, error)

func (*Config) SmnV2Client

func (c *Config) SmnV2Client(region string) (*golangsdk.ServiceClient, error)

type EIPCreateOpts added in v1.1.0

type EIPCreateOpts struct {
	eips.ApplyOpts
	ValueSpecs map[string]string `json:"value_specs,omitempty"`
}

EIPCreateOpts represents the attributes used when creating a new eip.

type FirewallGroup

FirewallGroup is an HuaweiCloud firewall group.

type FirewallGroupCreateOpts

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

FirewallGroupCreateOpts represents the attributes used when creating a new firewall.

func (FirewallGroupCreateOpts) ToFirewallCreateMap

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

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

type FirewallGroupUpdateOpts

type FirewallGroupUpdateOpts struct {
	firewall_groups.UpdateOptsBuilder
}

FirewallUpdateOpts

func (FirewallGroupUpdateOpts) ToFirewallUpdateMap

func (opts FirewallGroupUpdateOpts) 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 Group added in v1.2.0

type Group struct {
	ID string
}

type InstanceAddresses

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

type InstanceNIC struct {
	FixedIPv4 string
	FixedIPv6 string
	MAC       string
}

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

type InstanceNetwork

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 KeyPairCreateOpts

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

KeyPairCreateOpts represents the attributes used when creating a new keypair.

func (KeyPairCreateOpts) ToKeyPairCreateMap

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

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

type LogRoundTripper

type LogRoundTripper struct {
	Rt      http.RoundTripper
	OsDebug bool
}

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 Network added in v1.2.0

type Network struct {
	ID string
}

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 S3Website

type S3Website struct {
	Endpoint, Domain string
}

func WebsiteEndpoint

func WebsiteEndpoint(bucket string, region string) *S3Website

type ServerGroupCreateOpts

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

ServerGroupCreateOpts represents the attributes used when creating a new router.

func (ServerGroupCreateOpts) ToServerGroupCreateMap

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

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

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 ZoneCreateOpts

type ZoneCreateOpts struct {
	zones.CreateOpts
	ValueSpecs map[string]interface{} `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