edgecenter

package
v0.18.6 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MPL-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOptPermanentToken        = "permanent_api_token"
	ProviderOptSkipCredsAuthErr      = "ignore_creds_auth_error" // nolint: gosec
	ProviderOptSingleAPIEndpoint     = "api_endpoint"
	RegionIDField                    = "region_id"
	RegionNameField                  = "region_name"
	ProjectIDField                   = "project_id"
	ProjectNameField                 = "project_name"
	CreatedAtField                   = "created_at"
	UpdatedAtField                   = "updated_at"
	LastUpdatedField                 = "last_updated"
	IDField                          = "id"
	InstanceIDField                  = "instance_id"
	ClientIDField                    = "client_id"
	NameField                        = "name"
	TagsField                        = "tags"
	DescriptionField                 = "description"
	StateField                       = "state"
	IsDefaultField                   = "is_default"
	DisabledField                    = "disabled"
	TypeField                        = "type"
	TypeNameField                    = "type_name"
	OrderField                       = "order"
	KeyField                         = meta.KeyField
	NetworkField                     = "network"
	NetworkIDField                   = "network_id"
	NetworkNameField                 = "network_name"
	SubnetIDField                    = "subnet_id"
	SubnetNameField                  = "subnet_name"
	PortIDField                      = "port_id"
	IsParentField                    = "is_parent"
	PasswordField                    = "password"
	UsernameField                    = "username"
	MetadataMapField                 = "metadata_map"
	IPAddressField                   = "ip_address"
	SecurityGroupField               = "security_group"
	SecurityGroupsField              = "security_groups"
	SecurityGroupIDsField            = "security_group_ids"
	AllSecurityGroupIDsField         = "all_security_group_ids"
	OverwriteExistingField           = "overwrite_existing"
	MetadataField                    = "metadata"
	ValueField                       = meta.ValueField
	FlavorField                      = "flavor"
	FlavorsField                     = "flavors"
	FlavorNameField                  = "flavor_name"
	FlavorIDField                    = "flavor_id"
	RAMField                         = "ram"
	CPUField                         = "cpu"
	GPUField                         = "gpu"
	VCPUsField                       = "vcpus"
	DiskField                        = "disk"
	IPUField                         = "ipu"
	StatusField                      = "status"
	OperatingStatusField             = "operating_status"
	ProvisioningStatusField          = "provisioning_status"
	ConnectionStringField            = "connection_string"
	ReceiveChildClientEventsField    = "receive_child_client_events"
	RoutingKeyField                  = "routing_key"
	ExchangeAMQPField                = "exchange"
	SendUserActionLogsURLField       = "url"
	AuthHeaderValueField             = "auth_header_value"
	AuthHeaderNameField              = "auth_header_name"
	ResellerIDField                  = "reseller_id"
	ImageIDsField                    = "image_ids"
	AllPublicImagesAreAvailableField = "all_public_images_are_available"
	ResellerImagesOptionsField       = "options"
	NetworkTypeField                 = "network_type"
	OrderByField                     = "order_by"
	SharedField                      = "shared"
	MetadataKVField                  = "metadata_kv"
	MetadataKField                   = "metadata_k"
	NetworksField                    = "networks"
	DefaultField                     = "default"
	ExternalField                    = "external"
	MTUField                         = "mtu"
	CreatorTaskIDField               = "creator_task_id"
	SubnetsField                     = "subnets"
	TaskIDField                      = "task_id"
	SegmentationIDField              = "segmentation_id"
	ReadOnlyField                    = meta.ReadOnlyField
	AvailableIPsField                = "available_ips"
	TotalIPsField                    = "total_ips"
	EnableDHCPField                  = "enable_dhcp"
	HasRouterField                   = "has_router"
	CIDRField                        = "cidr"
	DNSNameserversField              = "dns_nameservers"
	HostRoutesField                  = "host_routes"
	GatewayIPField                   = "gateway_ip"
	DestinationField                 = "destination"
	NexthopField                     = "nexthop"
	AllocationPoolsField             = "allocation_pools"
	StartField                       = "start"
	EndField                         = "end"
	ConnectToNetworkRouterField      = "connect_to_network_router"
	MetadataReadOnlyField            = "metadata_read_only"
	EntityIDField                    = "entity_id"
	EntityTypeField                  = "entity_type"
	LoadbalancerIDField              = "loadbalancer_id"
	ListenerIDField                  = "listener_id"
	VolumeIDField                    = "volume_id"
	SnapshotIDField                  = "snapshot_id"
	PoplarCountField                 = "poplar_count"
	HardwareDescriptionField         = "hardware_description"
	SgxEPCSizeField                  = "sgx_epc_size"
	ResourceClassField               = "resource_class"
	PricePerHourField                = "price_per_hour"
	PricePerMonthField               = "price_per_month"
	CurrencyCodeField                = "currency_code"
	IncludeDisabledField             = "include_disabled"
	ExcludeWindowsField              = "exclude_windows"
	IncludePricesField               = "include_prices"

	MKaaSClusterPodSubnetField          = "pod_subnet"
	MKaaSClusterServiceSubnetField      = "service_subnet"
	MKaaSClusterAutohealingEnabledField = "autohealing_enabled"
)
View Source
const (
	MKaaSClusterKeypairNameField = "ssh_keypair_name"

	MKaaSClusterControlPlaneField        = "control_plane"
	MKaaSClusterPublishKubeAPIToInternet = "publish_kube_api_to_internet"
	MKaaSClusterLabelsField              = "labels"
	MKaaSNodeCountField                  = "node_count"
	MKaaSVolumeSizeField                 = "volume_size"
	MKaaSVolumeTypeField                 = "volume_type"
	MKaaSClusterVersionField             = "version"

	MKaaSClusterInternalIPField = "internal_ip"
	MKaaSClusterExternalIPField = "external_ip"
	MKaaSClusterCreatedField    = "created"
	MKaaSClusterProcessingField = "processing"
	MKaaSClusterStageField      = "stage"
	MKaaSClusterIDField         = "cluster_id"

	MKaaSPoolIDField = "pool_id"

	MKaaSPoolScalePolicyField      = "scale_policy"
	MKaaSPoolAutoScaleField        = "auto_scale"
	MKaaSPoolMinNodeCountField     = "min_node_count"
	MKaaSPoolMaxNodeCountField     = "max_node_count"
	MKaaSPoolCurrentNodeCountField = "current_node_count"
	MKaaSPoolPublicIPEnabledField  = "public_ip_enabled"

	MKaaSPoolLabelsField = "labels"
	MKaaSPoolTaintsField = "taints"

	MKaaSPoolStateField            = "state"
	MKaaSPoolStatusField           = "status"
	MKaaSPoolSecurityGroupIDsField = "security_group_ids"

	DBaaSClusterIDField   = "cluster_id"
	DBaaSClusterNameField = "name"

	DBaaSDbmsTypeField    = "type"
	DBaaSDbmsVersionField = "version"

	DBaaSClusterHighAvailabilityField = "high_availability"
	DBaaSClusterTaskIDField           = "task_id"
	DBaaSClusterFromBackupIDField     = "from_backup_id"

	DBaaSVolumeSizeField = "volume_size"
	DBaaSVolumeTypeField = "volume_type"

	DBaaSClusterAllowedCIDRsField = "allowed_cidrs"
	DBaaSClusterIsPublicField     = "is_public"

	DBaaSClusterHostField = "host"
	DBaaSClusterPortField = "port"

	DBaaSClusterConnectionField = "connection_info"
	DBaaSClusterAccessField     = "access"

	DBaaSDatabaseEncodingField = "encoding"
	DBaaSDatabaseLocaleField   = "locale"

	DBaaSUserDatabasesField = "databases"

	DBaaSBackupTypeField          = "backup_type"
	DBaaSBackupParentIDField      = "parent_id"
	DBaaSBackupSizeField          = "size"
	DBaaSBackupIsServiceField     = "is_service"
	DBaaSBackupHasChildField      = "has_child"
	DBaaSBackupFinishedAtField    = "finished_at"
	DBaaSBackupCreatorTaskIDField = "creator_task_id"
)
View Source
const (
	VersionPointV1 = "v1"
	VersionPointV2 = "v2"

	ProjectPoint = "projects"
	RegionPoint  = "regions"
)

Variables

This section is empty.

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 DiagnosticsToString added in v0.8.0

func DiagnosticsToString(diags diag.Diagnostics) string

DiagnosticsToString converts a diag.Diagnostics object into a formatted string representation.

func ExtractHostAndPath

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

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

func Filter added in v0.7.4

func Filter[T any](arr []T, predicate func(T) bool) []T

Filter iterates over elements of the collection, returning a slice of all elements for which the predicate returns true. - arr []T is a slice of elements of type T. - predicate func(T) bool is a function that takes an element of type T and returns bool.

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 GetProjectByIDV2 added in v0.6.0

func GetProjectByIDV2(
	ctx context.Context,
	client *edgecloudV2.Client,
	projectID int,
) (*edgecloudV2.Project, error)

GetProjectByIDV2 returns a project by its ID. Use new version Edgecenterclient-go V2. Returns an error if the project is not found or there is an issue with the client.

func GetProjectByNameV2 added in v0.6.0

func GetProjectByNameV2(
	ctx context.Context,
	client *edgecloudV2.Client,
	projectName string,
) (*edgecloudV2.Project, error)

GetProjectByNameV2 returns a valid project 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. Returns an error if the project is not found or there is an issue with the client.

func GetProjectID added in v0.6.0

func GetProjectID(
	ctx context.Context,
	client *edgecloudV2.Client,
	d *schema.ResourceData,
) (int, error)

func GetProjectV2 added in v0.2.0

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

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 GetRegionID added in v0.6.0

func GetRegionID(
	ctx context.Context,
	client *edgecloudV2.Client,
	d *schema.ResourceData,
) (int, error)

func GetRegionIDandProjectID added in v0.2.0

func GetRegionIDandProjectID(
	ctx context.Context,
	client *edgecloudV2.Client,
	d *schema.ResourceData,
) (regionID int, 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) (int, int, string, error)

func ImportStringParserSimple added in v0.9.0

func ImportStringParserSimple(infoStr string) (string, string, error)

func InitCloudClient added in v0.4.0

func InitCloudClient(
	ctx context.Context,
	d *schema.ResourceData,
	m interface{},
	clientConf *CloudClientConf,
) (*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

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 ProviderSchema added in v0.13.3

func ProviderSchema() map[string]*schema.Schema

func Reduce added in v0.7.4

func Reduce[T any, U any](arr []T, reduceFunc func(U, T) U, acc U) U

Reduce accumulates a value based on a reduction function and initial accumulator value. - arr []T is a slice of elements of type T. - reduceFunc func(U, T) U is a function that takes an accumulator of type U and an element of type T, and returns a new accumulator of type U. - acc U is the initial value of the accumulator of type U.

func RejectScopeChange added in v0.17.0

func RejectScopeChange(ctx context.Context, d *schema.ResourceDiff, m interface{}) error

func RequireSameScope added in v0.17.0

func RequireSameScope(update schema.UpdateContextFunc) schema.UpdateContextFunc

Types

type CloudClientConf added in v0.7.0

type CloudClientConf struct {
	DoNotUseRegionID  bool
	DoNotUseProjectID bool
}

type Config

type Config struct {
	PermanentToken     string
	CloudBaseURL       string
	UserAgent          string
	Provider           *edgecloud.ProviderClient
	CDNClient          cdn.ClientService
	StorageClient      StorageClientService
	DNSClient          DNSClientService
	ProtectionClient   *protection.Client
	WebsecClient       websecsdk.ClientService
	RmonClient         rmon.ClientService
	CloudClientFactory func() (*edgecloudV2.Client, error)
}

func NewConfig added in v0.7.0

func NewConfig(
	provider *edgecloud.ProviderClient,
	cdnClient cdn.ClientService,
	storageClient StorageClientService,
	dnsClient DNSClientService,
	protectionClient *protection.Client,
	rmonClient rmon.ClientService,
	permanentToken,
	cloudBaseURL,
	userAgent string,
) Config

func ProviderConfigure added in v0.13.3

func ProviderConfigure(
	ctx context.Context,
	d *schema.ResourceData,
	terraformVersion string,
	providerVersion string,
) (*Config, diag.Diagnostics)

func (*Config) NewCloudClient added in v0.7.21

func (c *Config) NewCloudClient() (*edgecloudV2.Client, error)

type DNSClientService added in v0.14.4

type DNSClientService interface {
	DNSZoneService
	DNSRecordService
	DNSSecondaryZoneService
}

DNSClientService is the seam over the DNS SDK client. The SDK exports a concrete *dnsSDK.Client and no interface, so it is declared here, at the consumer, to keep the DNS resources mockable.

type DNSRecordService added in v0.14.4

type DNSRecordService interface {
	RRSet(ctx context.Context, zone, name, recordType string) (dnsSDK.RRSet, error)
	CreateRRSet(ctx context.Context, zone, name, recordType string, record dnsSDK.RRSet) error
	UpdateRRSet(ctx context.Context, zone, name, recordType string, record dnsSDK.RRSet) error
	DeleteRRSet(ctx context.Context, zone, name, recordType string) error
}

type DNSSecondaryZoneService added in v0.14.4

type DNSSecondaryZoneService interface {
	CreateSecondaryZone(ctx context.Context, req dnsSDK.CreateSecondaryZoneRequest) (dnsSDK.SecondaryZone, error)
	GetSecondaryZone(ctx context.Context, name string) (dnsSDK.SecondaryZone, error)
	UpdateSecondaryZone(ctx context.Context, name string, req dnsSDK.UpdateSecondaryZoneRequest) (dnsSDK.SecondaryZone, error)
	DeleteSecondaryZone(ctx context.Context, name string) error
	SecondaryZones(ctx context.Context) ([]dnsSDK.SecondaryZone, error)
}

type DNSZoneService added in v0.14.4

type DNSZoneService interface {
	CreateZone(ctx context.Context, name string) (uint64, error)
	Zone(ctx context.Context, name string) (dnsSDK.Zone, error)
	DeleteZone(ctx context.Context, name string) error
}

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 LegacyService added in v0.13.3

type LegacyService struct{}

func (LegacyService) DataSources added in v0.13.3

func (LegacyService) DataSources() map[string]*schema.Resource

func (LegacyService) Name added in v0.13.3

func (LegacyService) Name() string

func (LegacyService) Resources added in v0.13.3

func (LegacyService) Resources() map[string]*schema.Resource

type StorageBucketService added in v0.14.5

type StorageBucketService interface {
	BucketsList(opts ...func(params *buckets.StorageListBucketsHTTPParams)) ([]models.BucketDto, error)
	CreateBucket(opts ...func(params *buckets.StorageBucketCreateHTTPParams)) error
	DeleteBucket(opts ...func(params *buckets.StorageBucketRemoveHTTPParams)) error
}

type StorageClientService added in v0.14.5

type StorageClientService interface {
	StorageLocationService
	StorageS3Service
	StorageBucketService
}

type StorageLocationService added in v0.14.5

type StorageLocationService interface {
	LocationsList(opts ...func(params *locations.LocationListHTTPParams)) ([]models.ClientLocationRes, error)
}

type StorageS3Service added in v0.14.5

type StorageS3Service interface {
	StoragesList(opts ...func(params *storages.StorageListHTTPV2Params)) ([]models.Storage, error)
	CreateStorage(opts ...func(params *storages.StorageCreateHTTPParams)) (*models.Storage, error)
	DeleteStorage(opts ...func(params *storages.StorageDeleteHTTPParams)) error
}

Directories

Path Synopsis
integrationtest
Package provider is the entry point of the EdgeCenter Terraform provider.
Package provider is the entry point of the EdgeCenter Terraform provider.
Package services is the root of the EdgeCenter provider service packages.
Package services is the root of the EdgeCenter provider service packages.
cdn
Package cdn implements Terraform resources for the EdgeCenter CDN API.
Package cdn implements Terraform resources for the EdgeCenter CDN API.
cloud/compute
Package compute implements Terraform resources for the EdgeCenter Cloud compute API.
Package compute implements Terraform resources for the EdgeCenter Cloud compute API.
cloud/lb
Package lb implements Terraform resources for the EdgeCenter Cloud load balancer API.
Package lb implements Terraform resources for the EdgeCenter Cloud load balancer API.
cloud/network
Package network implements Terraform resources for the EdgeCenter Cloud network API.
Package network implements Terraform resources for the EdgeCenter Cloud network API.
cloud/platform
Package platform implements Terraform resources for the EdgeCenter Cloud platform API.
Package platform implements Terraform resources for the EdgeCenter Cloud platform API.
cloud/security
Package security implements Terraform resources for the EdgeCenter Cloud security API.
Package security implements Terraform resources for the EdgeCenter Cloud security API.
cloud/useractions
Package useractions implements Terraform resources for the EdgeCenter user actions API.
Package useractions implements Terraform resources for the EdgeCenter user actions API.
dbaas
Package dbaas implements Terraform resources for the EdgeCenter DBaaS API.
Package dbaas implements Terraform resources for the EdgeCenter DBaaS API.
dns
Package dns implements Terraform resources for the EdgeCenter DNS API.
Package dns implements Terraform resources for the EdgeCenter DNS API.
edgemon
Package edgemon implements Terraform resources for the EdgeCenter EdgeMon (RMON) monitoring API.
Package edgemon implements Terraform resources for the EdgeCenter EdgeMon (RMON) monitoring API.
mkaas
Package mkaas implements Terraform resources for the EdgeCenter MKaaS API.
Package mkaas implements Terraform resources for the EdgeCenter MKaaS API.
protection
Package protection implements Terraform resources for the EdgeCenter DDoS Protection API.
Package protection implements Terraform resources for the EdgeCenter DDoS Protection API.
reseller
Package reseller implements Terraform resources for the EdgeCenter reseller API.
Package reseller implements Terraform resources for the EdgeCenter reseller API.
storage
Package storage implements Terraform resources for the EdgeCenter Storage API.
Package storage implements Terraform resources for the EdgeCenter Storage API.
Package shared holds infrastructure code shared by several services.
Package shared holds infrastructure code shared by several services.
meta
Package meta holds helpers for the metadata fields of EdgeCenter resources.
Package meta holds helpers for the metadata fields of EdgeCenter resources.
testacc
Package testacc holds shared helpers for service-package acceptance tests.
Package testacc holds shared helpers for service-package acceptance tests.
tfutil
Package tfutil holds utilities shared by terraform resources.
Package tfutil holds utilities shared by terraform resources.

Jump to

Keyboard shortcuts

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