flexibleengine

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MPL-2.0 Imports: 250 Imported by: 1

Documentation

Overview

This set of code handles all functions required to configure addresses on a flexibleengine_compute_bms_server_v2 datasource.

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 flexibleengine services.

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

This set of code handles all functions required to configure networking on a flexibleengine_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 FlexibleEngine 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 (
	WaitingForEnableState = "1"
	EnabledState          = "2"
	DisabledState         = "3"
	PendingDeletionState  = "4"
)
View Source
const (
	// JobFlink is a type of the MRS job, which specifies the use of Flink componment.
	// The Flink is a unified computing framework that supports both batch processing and stream processing.
	JobFlink = "Flink"
	// JobHiveSQL is a type of the MRS job, which specifies the use of Hive componment by a sql command.
	// The Hive is a data warehouse infrastructure built on Hadoop.
	JobHiveSQL = "HiveSql"
	// JobHiveScript is a type of the MRS job, which specifies the use of Hive componment by a sql file.
	JobHiveScript = "HiveScript"
	// JobMapReduce is a type of the MRS job, which specifies the use of MapReduce componment.
	// MapReduce is the core of Hadoop.
	JobMapReduce = "MapReduce"
	// JobSparkSubmit is a type of the MRS job, which specifies the use of Spark componment to submit a job to MRS
	// executor.
	JobSparkSubmit = "SparkSubmit"
	// JobSparkSQL is a type of the MRS job, which specifies the use of Spark componment by a sql command.
	JobSparkSQL = "SparkSql"
	// JobSparkScript is a type of the MRS job, which specifies the use of Spark componment by a sql file.
	JobSparkScript = "SparkScript"
)
View Source
const (
	PoolID   = "0a2228f2-7f8a-45f1-8e09-9039e1d09975"
	PoolName = "admin_external_net"
)
View Source
const (
	PROTECTION_MODE_LOG   = "log"
	PROTECTION_MODE_BLOCK = "block"
)
View Source
const CU_16 = 16
View Source
const MappingIDPrefix = "mapping_"

PublicType indicates that an endpoint is "public" in service catalog

View Source
const QUEUE_TYPE_SQL, QUEUE_TYPE_GENERAL = "sql", "general"
View Source
const RESOURCE_MODE_SHARED, RESOURCE_MODE_EXCLUSIVE = 0, 1
View Source
const RFC3339ZNoTNoZ = "2006-01-02 15:04:05"

RFC3339ZNoTNoZ is a time format

Variables

View Source
var BandWidthChargeMode = [1]string{"traffic"}
View Source
var BandWidthShareType = [1]string{"PER"}
View Source
var ContainerFormats = [9]string{"ami", "ari", "aki", "bare", "ovf"}
View Source
var DiskFormats = [9]string{"ami", "ari", "aki", "vhd", "vmdk", "raw", "qcow2", "vdi", "iso"}
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 ProtocolFormats = [5]string{"HTTP", "TCP", "HTTPS", "SSL", "UDP"}
View Source
var RecurrenceTypes = [3]string{"Daily", "Weekly", "Monthly"}
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 golangsdk to execute

func BytesToString added in v1.2.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 CheckDeletedDiag added in v1.28.0

func CheckDeletedDiag(d *schema.ResourceData, err error, msg string) diag.Diagnostics

CheckDeletedDiag 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.2.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 DdsInstanceStateRefreshFunc added in v1.28.0

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

func ExtractAttachId added in v1.28.0

func ExtractAttachId(s string) (string, string)

func ExtractValFromNid

func ExtractValFromNid(s string) (bool, string)

func ExtractValSFromNid

func ExtractValSFromNid(s string) (string, string)

func FloatingIPV2StateRefreshFunc

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

func FormatAttachId added in v1.28.0

func FormatAttachId(insId string, id string) string

func FormatNidFromValS

func FormatNidFromValS(asu string, id string) string

func GetCredentials

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

GetCredentials is responsible for reading credentials from the environment in the case that they're not explicitly specified in the Terraform configuration.

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 HashStrings added in v1.28.0

func HashStrings(strings []string) string

HashStrings hashes a list of strings to a unique hashcode.

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 IsRFC3339Time added in v1.28.0

func IsRFC3339Time(i interface{}, k string) (warnings []string, errors []error)

IsRFC3339Time is a SchemaValidateFunc which tests if the provided value is of type string and a valid RFC33349Time

func IsUUIDFormat added in v1.36.0

func IsUUIDFormat(str string) bool

func JobStateRefreshFunc added in v1.2.0

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

func LoadAndValidate added in v1.28.0

func LoadAndValidate(c *Config) error

LoadAndValidate overwrites the the c.LoadAndValidate

func MapResourceProp added in v1.3.0

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

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

func Provider

func Provider() *schema.Provider

Provider returns a schema.Provider for FlexibleEngine.

func ResourceDliQueueV1 added in v1.28.0

func ResourceDliQueueV1() *schema.Resource

func ResourceWafDedicatedCertificateV1 added in v1.35.0

func ResourceWafDedicatedCertificateV1() *schema.Resource

func ResourceWafDedicatedDomainV1 added in v1.37.0

func ResourceWafDedicatedDomainV1() *schema.Resource

func ResourceWafDedicatedInstance added in v1.35.0

func ResourceWafDedicatedInstance() *schema.Resource

ResourceWafDedicatedInstance the resource of managing a dedicated mode instance within Flexibleengine.

func ResourceWafDedicatedPolicyV1 added in v1.35.0

func ResourceWafDedicatedPolicyV1() *schema.Resource

func UpdateResourceTags added in v1.28.0

func UpdateResourceTags(conn *golangsdk.ServiceClient, d *schema.ResourceData, resourceType, id string) error

UpdateResourceTags is a helper to update the tags for a resource. It expects the tags field to be named "tags"

func ValidateInsensitiveStringList

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

Not currently used.

func ValidateIntRange

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

func ValidateProtocolFormat

func ValidateProtocolFormat(v interface{}, k string) (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 a FlexibleEngine volume.

func WebsiteDomainUrl

func WebsiteDomainUrl(region string) string

Types

type Condition added in v1.28.0

type Condition struct {
	KeyPrefixEquals             string `json:"KeyPrefixEquals,omitempty"`
	HttpErrorCodeReturnedEquals string `json:"HttpErrorCodeReturnedEquals,omitempty"`
}

type Config

type Config = huaweiconfig.Config

Config is the alias of huaweicloud Config

type ErrorResp added in v1.36.0

type ErrorResp struct {
	ErrorCode string `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

ErrorResp is the response when API failed

func ParseErrorMsg added in v1.36.0

func ParseErrorMsg(body []byte) (ErrorResp, error)

ParseErrorMsg is used to unmarshal the error body to ErrorResp usage: resp, pErr := ParseErrorMsg(err.Body)

type FirewallGroup

FirewallGroup is a FlexibleEngine 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 FirewallGroupCreateOpts struct to a map. It overrides firewalls.ToFirewallCreateMap to add the ValueSpecs field.

type FirewallGroupUpdateOpts

type FirewallGroupUpdateOpts struct {
	firewall_groups.UpdateOptsBuilder
}

FirewallGroupUpdateOpts represents the attributes used when updating a firewall

func (FirewallGroupUpdateOpts) ToFirewallUpdateMap

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

ToFirewallUpdateMap casts a FirewallGroupUpdateOpts struct to a map.

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

type Group struct {
	ID string
}

type InstanceNIC

type InstanceNIC struct {
	NetworkID string
	PortID    string
	FixedIPv4 string
	FixedIPv6 string
	MAC       string
	Fetched   bool
}

InstanceNIC is a structured representation of a 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 Network

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)

ToFirewallPolicyCreateMap casts a PolicyCreateOpts 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 Redirect added in v1.28.0

type Redirect struct {
	Protocol             string `json:"Protocol,omitempty"`
	HostName             string `json:"HostName,omitempty"`
	ReplaceKeyPrefixWith string `json:"ReplaceKeyPrefixWith,omitempty"`
	ReplaceKeyWith       string `json:"ReplaceKeyWith,omitempty"`
	HttpRedirectCode     string `json:"HttpRedirectCode,omitempty"`
}

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

type ServerAddress struct {
	NetworkName string
	ServerNICS  []ServerNICS
}

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

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

type ServerNICS struct {
	IP      string
	IPv6    string
	MAC     string
	Type    string
	Version float64
}

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

type ServerNetwork added in v1.2.0

type ServerNetwork struct {
	UUID          string
	Name          string
	Port          string
	FixedIP       string
	FixedIPv6     string
	AccessNetwork bool
}

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

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 WebsiteRoutingRule added in v1.28.0

type WebsiteRoutingRule struct {
	Condition Condition `json:"Condition,omitempty"`
	Redirect  Redirect  `json:"Redirect"`
}

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

Directories

Path Synopsis
Package acceptance includes all test cases of resources and data sources that imported directly from huaweicloud.
Package acceptance includes all test cases of resources and data sources that imported directly from huaweicloud.
Package deprecated includes files of resources and data sources that imported directly from huaweicloud, so we should deprecate them.
Package deprecated includes files of resources and data sources that imported directly from huaweicloud, so we should deprecate them.

Jump to

Keyboard shortcuts

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