edgecenter

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MPL-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOptPermanentToken    = "permanent_api_token"
	ProviderOptSkipCredsAuthErr  = "ignore_creds_auth_error" // nolint: gosec
	ProviderOptSingleAPIEndpoint = "api_endpoint"

	LifecyclePolicyResource = "edgecenter_lifecyclepolicy"
)
View Source
const (
	BmInstanceDeletingTimeout int = 1200
	BmInstanceCreatingTimeout int = 3600
	BmInstancePoint               = "bminstances"
)
View Source
const (
	DNSZoneResource   = "edgecenter_dns_zone"
	DNSZoneSchemaName = "name"
)
View Source
const (
	DNSZoneRecordResource = "edgecenter_dns_zone_record"

	DNSZoneRecordSchemaZone      = "zone"
	DNSZoneRecordSchemaDomain    = "domain"
	DNSZoneRecordSchemaType      = "type"
	DNSZoneRecordSchemaTTL       = "ttl"
	DNSZoneRecordSchemaRRSetMeta = "meta"
	DNSZoneRecordSchemaFailover  = "failover"
	DNSZoneRecordSchemaFilter    = "filter"

	DNSZoneRecordSchemaFailoverProtocol       = "protocol"
	DNSZoneRecordSchemaFailoverFrequency      = "frequency"
	DNSZoneRecordSchemaFailoverHost           = "host"
	DNSZoneRecordSchemaFailoverHTTPStatusCode = "http_status_code"
	DNSZoneRecordSchemaFailoverMethod         = "method"
	DNSZoneRecordSchemaFailoverPort           = "port"
	DNSZoneRecordSchemaFailoverRegexp         = "regexp"
	DNSZoneRecordSchemaFailoverTimeout        = "timeout"
	DNSZoneRecordSchemaFailoverTLS            = "tls"
	DNSZoneRecordSchemaFailoverURL            = "url"
	DNSZoneRecordSchemaFailoverVerify         = "verify"

	DNSZoneRecordSchemaFilterLimit  = "limit"
	DNSZoneRecordSchemaFilterType   = "type"
	DNSZoneRecordSchemaFilterStrict = "strict"

	DNSZoneRecordSchemaResourceRecord = "resource_record"
	DNSZoneRecordSchemaContent        = "content"
	DNSZoneRecordSchemaEnabled        = "enabled"
	DNSZoneRecordSchemaMeta           = "meta"

	DNSZoneRecordSchemaMetaAsn        = "asn"
	DNSZoneRecordSchemaMetaIP         = "ip"
	DNSZoneRecordSchemaMetaCountries  = "countries"
	DNSZoneRecordSchemaMetaContinents = "continents"
	DNSZoneRecordSchemaMetaLatLong    = "latlong"
	DNSZoneRecordSchemaMetaNotes      = "notes"
	DNSZoneRecordSchemaMetaDefault    = "default"
)
View Source
const (
	FloatingIPsPoint        = "floatingips"
	FloatingIPCreateTimeout = 1200 * time.Second
	FloatingIPDeleteTimeout = 1200 * time.Second
)
View Source
const (
	InstanceCreateTimeout = 1200 * time.Second
	InstanceDeleteTimeout = 1200 * time.Second
	InstanceUpdateTimeout = 1200 * time.Second
	InstancePoint         = "instances"

	InstanceVMStateActive  = "active"
	InstanceVMStateStopped = "stopped"
)
View Source
const (
	K8sPoint         = "k8s/clusters"
	K8sCreateTimeout = 3600
)
View Source
const (
	LBListenersPoint        = "lblisteners"
	LBListenerCreateTimeout = 2400 * time.Second
	LBListenerUpdateTimeout = 2400 * time.Second
	LBListenerDeleteTimeout = 2400 * time.Second
)
View Source
const (
	LBMemberCreateTimeout = 2400 * time.Second
	LBMemberUpdateTimeout = 2400 * time.Second
	LBMemberDeleteTimeout = 2400 * time.Second
)
View Source
const (
	LBPoolsPoint         = "lbpools"
	LBPoolsCreateTimeout = 2400 * time.Second
	LBPoolsUpdateTimeout = 2400 * time.Second
	LBPoolsDeleteTimeout = 2400 * time.Second
)
View Source
const (
	LoadBalancersPoint        = "loadbalancers"
	LoadBalancerCreateTimeout = 2400 * time.Second
	LoadBalancerDeleteTimeout = 2400 * time.Second
	LoadBalancerUpdateTimeout = 2400 * time.Second
)
View Source
const (
	NetworkDeletingTimeout = 1200 * time.Second
	NetworkCreatingTimeout = 1200 * time.Second
	NetworksPoint          = "networks"
	SharedNetworksPoint    = "availablenetworks"
)
View Source
const (
	ReservedFixedIPsPoint        = "reserved_fixed_ips"
	ReservedFixedIPCreateTimeout = 1200 * time.Second
	ReservedFixedIPDeleteTimeout = 1200 * time.Second
)
View Source
const (
	RouterPoint           = "routers"
	RouterDeletingTimeout = 1200 * time.Second
	RouterCreatingTimeout = 1200 * time.Second
)
View Source
const (
	SecretDeletingTimeout = 1200 * time.Second
	SecretCreatingTimeout = 1200 * time.Second
	SecretPoint           = "secrets"
	// RFC3339NoZ is the time format used in Heat (Orchestration).
	RFC3339NoZ          = "2006-01-02T15:04:05"
	RFC3339WithTimeZone = "2006-01-02T15:04:05+00:00"
)
View Source
const (
	StorageS3SchemaGenerateAccessKey  = "generated_access_key"
	StorageS3SchemaGenerateSecretKey  = "generated_secret_key"
	StorageSchemaGenerateHTTPEndpoint = "generated_http_endpoint"
	StorageSchemaGenerateS3Endpoint   = "generated_s3_endpoint"
	StorageSchemaGenerateEndpoint     = "generated_endpoint"

	StorageSchemaLocation = "location"
	StorageSchemaName     = "name"
	StorageSchemaID       = "storage_id"
	StorageSchemaClientID = "client_id"
)
View Source
const (
	StorageS3BucketSchemaName      = "name"
	StorageS3BucketSchemaStorageID = "storage_id"
)
View Source
const (
	SubnetCreatingTimeout = 1200 * time.Second
	SubnetPoint           = "subnets"
)
View Source
const (
	VolumeCreatingTimeout = 1200 * time.Second

	VolumesPoint = "volumes"
)
View Source
const (
	VersionPointV1 = "v1"
	VersionPointV2 = "v2"

	ProjectPoint = "projects"
	RegionPoint  = "regions"
)
View Source
const KeypairsPoint = "keypairs"
View Source
const (
	LifecyclePolicyPoint = "lifecycle_policies"
)
View Source
const ReservedFixedIPVIPDisabledPortSecurityErrMsg = "Port Security must be enabled in order to have allowed address pairs on a port"
View Source
const (
	SecurityGroupPoint = "securitygroups"
)
View Source
const (
	ServerGroupsPoint = "servergroups"
)
View Source
const (
	SnapshotsPoint = "snapshots"
)

Variables

View Source
var ErrCannotDeleteSGRule = errors.New("error when deleting security group rule")

Functions

func CreateClient

func CreateClient(provider *edgecloud.ProviderClient, d *schema.ResourceData, endpoint string, version string) (*edgecloud.ServiceClient, error)

CreateClient creates a new edgecloud.ServiceClient.

func ExtractHostAndPath

func ExtractHostAndPath(uri string) (string, string, error)

ExtractHostAndPath splits a given URI into the host and path components.

func GetProject

func GetProject(provider *edgecloud.ProviderClient, projectID int, projectName string) (int, error)

GetProject returns a valid project ID for a resource. If the projectID is provided, it will be returned directly. If projectName is provided instead, the function will search for the project by name and return its ID. Returns an error if the project is not found or there is an issue with the client. ToDo Remove after migrate to Edgecenterclient-go V2.

func GetProjectV2 added in v0.2.0

func GetProjectV2(ctx context.Context, client *edgecloudV2.Client, projectID int, projectName string) (int, error)

GetProjectV2 returns a valid project ID for a resource. Use new version Edgecenterclient-go V2. If the projectID is provided, it will be returned directly. If projectName is provided instead, the function will search for the project by name and return its ID. Returns an error if the project is not found or there is an issue with the client.

func GetRegion

func GetRegion(provider *edgecloud.ProviderClient, regionID int, regionName string) (int, error)

GetRegion returns a valid region ID for a resource. If the regionID is provided, it will be returned directly. If regionName is provided instead, the function will search for the region by name and return its ID. Returns an error if the region is not found or there is an issue with the client. ToDo Remove after migrate to Edgecenterclient-go V2.

func GetRegionIDandProjectID added in v0.2.0

func GetRegionIDandProjectID(ctx context.Context, client *edgecloudV2.Client, d *schema.ResourceData) (regionID, projectID int, err error)

GetRegionIDandProjectID search for project ID and region ID by name or return project ID and region ID if they exist in the terraform configuration. Use new version Edgecenterclient-go V2. nolint: nonamedreturns

func GetRegionLegacy added in v0.2.0

func GetRegionLegacy(provider *edgecloud.ProviderClient, regionID int, regionName string) (int, error)

GetRegionLegacy to support backwards compatibility.

func GetRegionV2 added in v0.2.0

func GetRegionV2(ctx context.Context, client *edgecloudV2.Client, regionID int, regionName string) (int, error)

GetRegionV2 returns a valid region ID for a resource. Use new version Edgecenterclient-go V2. If the regionID is provided, it will be returned directly. If regionName is provided instead, the function will search for the region by name and return its ID. Returns an error if the region is not found or there is an issue with the client.

func ImportStringParser

func ImportStringParser(infoStr string) (projectID int, regionID int, id3 string, err error)

ImportStringParser parses a string containing project ID, region ID, and another field, and returns them as separate values along with any error encountered.

func ImportStringParserExtended

func ImportStringParserExtended(infoStr string) (projectID int, regionID int, id3 string, id4 string, err error)

ImportStringParserExtended parses a string containing project ID, region ID, and two other fields, and returns them as separate values along with any error encountered.

func InitCloudClient added in v0.4.0

func InitCloudClient(ctx context.Context, d *schema.ResourceData, m interface{}) (*edgecloudV2.Client, error)

func MapInterfaceToMapString added in v0.2.0

func MapInterfaceToMapString(mapInterface interface{}) (*map[string]string, error)

func MapStructureDecoder

func MapStructureDecoder(strct interface{}, v *map[string]interface{}, config *mapstructure.DecoderConfig) error

MapStructureDecoder decodes the given map into the provided structure using the specified decoder configuration.

func PrepareMetadata added in v0.1.11

func PrepareMetadata(apiMetadataRaw interface{}) (map[string]string, []map[string]interface{})

func PrepareMetadataReadonly added in v0.1.11

func PrepareMetadataReadonly(apiMetadataRaw interface{}) []map[string]interface{}

func Provider

func Provider() *schema.Provider

func ServerV2StateRefreshFuncV2 added in v0.2.0

func ServerV2StateRefreshFuncV2(ctx context.Context, client *edgecloudV2.Client, instanceID string) retry.StateRefreshFunc

ServerV2StateRefreshFuncV2 returns a StateRefreshFunc to track the state of an instance using its instanceID.

func StringToNetHookFunc

func StringToNetHookFunc() mapstructure.DecodeHookFuncType

StringToNetHookFunc returns a DecodeHookFunc for the mapstructure package to handle the custom conversion of string values to net.IP and edgecloud.CIDR types.

func StringToNetHookFuncV2 added in v0.2.0

func StringToNetHookFuncV2() mapstructure.DecodeHookFuncType

StringToNetHookFuncV2 returns a DecodeHookFunc for the mapstructure package to handle the custom conversion of string values to net.IP and edgecloudV2.CIDR types.

func StructToMap

func StructToMap(obj interface{}) (map[string]interface{}, error)

StructToMap converts the struct to map[string]interface{}. Returns an error if the conversion fails.

Types

type Config

type Config struct {
	Provider      *edgecloud.ProviderClient
	CloudClient   *edgecloudV2.Client
	CDNClient     cdn.ClientService
	StorageClient *storageSDK.SDK
	DNSClient     *dnsSDK.Client
}

type InstanceInterfaceWithIPAddress added in v0.2.0

type InstanceInterfaceWithIPAddress struct {
	InstanceInterface edgecloudV2.InstanceInterface
	IPAddress         string
}

type InstancePortSecurityOpts added in v0.1.31

type InstancePortSecurityOpts struct {
	PortID               string
	PortSecurityDisabled bool
	SubnetID             string
	IPAddress            string
}

type K8sConfig added in v0.1.17

type K8sConfig struct {
	APIVersion     string   `yaml:"apiVersion"`
	Kind           string   `yaml:"kind"`
	CurrentContext string   `yaml:"current-context"` // nolint: tagliatelle
	Preferences    struct{} `yaml:"preferences"`

	Clusters []struct {
		Name    string `yaml:"name"`
		Cluster struct {
			CertificateAuthorityData string `yaml:"certificate-authority-data"` // nolint: tagliatelle
			Server                   string `yaml:"server"`
		} `yaml:"cluster"`
	} `yaml:"clusters"`

	Contexts []struct {
		Name    string `yaml:"name"`
		Context struct {
			Cluster string `yaml:"cluster"`
			User    string `yaml:"user"`
		} `yaml:"context"`
	} `yaml:"contexts"`

	Users []struct {
		Name string `yaml:"name"`
		User struct {
			ClientCertificateData string `yaml:"client-certificate-data"` // nolint: tagliatelle
			ClientKeyData         string `yaml:"client-key-data"`         // nolint: tagliatelle
		} `yaml:"user"`
	} `yaml:"users"`
}

type OrderedInterfaceOpts

type OrderedInterfaceOpts struct {
	InstanceInterfaceWithIPAddress
	Order int
}

Source Files

Jump to

Keyboard shortcuts

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