decort

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MODE_UNDEF  = iota // this is the invalid mode - it should never be seen
	MODE_LEGACY = iota
	MODE_OAUTH2 = iota
	MODE_JWT    = iota
)

enumerated constants that define authentication modes

View Source
const AccountsGetAPI = "/restmachine/cloudapi/account/get" // returns AccountRecord superset
View Source
const AccountsListAPI = "/restmachine/cloudapi/account/list" // returns list of abdridged info about accounts
View Source
const ComputeDeleteAPI = "/restmachine/cloudapi/compute/delete"

structures related to cloudapi/compute/delete API

View Source
const ComputeDiskAttachAPI = "/restmachine/cloudapi/compute/diskAttach"

structures related to /cloudapi/compute/disk Attach/Detach API

View Source
const ComputeDiskDetachAPI = "/restmachine/cloudapi/compute/diskDetach"
View Source
const ComputeGetAPI = "/restmachine/cloudapi/compute/get"
View Source
const ComputeListAPI = "/restmachine/cloudapi/compute/list"
View Source
const ComputeNetAttachAPI = "/restmachine/cloudapi/compute/netAttach"
View Source
const ComputeNetDetachAPI = "/restmachine/cloudapi/compute/netDetach"
View Source
const ComputePfwAddAPI = "/restmachine/cloudapi/compute/pfwAdd"
View Source
const ComputePfwDelAPI = "/restmachine/cloudapi/compute/pfwDel"
View Source
const ComputePfwListAPI = "/restmachine/cloudapi/compute/pfwList"
View Source
const ComputeResizeAPI = "/restmachine/cloudapi/compute/resize"
View Source
const ComputeStartAPI = "/restmachine/cloudapi/compute/start"

structures related to cloudapi/compute/start API

View Source
const ComputeStopAPI = "/restmachine/cloudapi/compute/stop"
View Source
const DisksCreateAPI = "/restmachine/cloudapi/disks/create"

structures related to /cloudapi/disks/create

View Source
const DisksDeleteAPI = "/restmachine/cloudapi/disks/delete"

structures related to /cloudapi/disks/delete

View Source
const DisksGetAPI = "/restmachine/cloudapi/disks/get" // Returns single DiskRecord on success

structures related to /cloudapi/disks/get

View Source
const DisksListAPI = "/restmachine/cloudapi/disks/list" // Returns list of DiskRecord on success
View Source
const DisksRenameAPI = "/restmachine/cloudapi/disks/rename"

structures related to /cloudapi/disks/resize

View Source
const DisksResizeAPI = "/restmachine/cloudapi/disks/resize2"

structures related to /cloudapi/disks/resize

View Source
const ExtNetListAPI = "/restmachine/cloudapi/extnet/list"
View Source
const ImagesListAPI = "/restmachine/cloudapi/image/list"
View Source
const KvmPPCCreateAPI = "/restmachine/cloudapi/kvmppc/create"
View Source
const KvmX86CreateAPI = "/restmachine/cloudapi/kvmx86/create"

structures related to /cloudapi/kvmXXX/create APIs

View Source
const LimitMaxVinsPerResgroup = 4

LimitMaxVinsPerResgroup set maximum number of VINs instances per Resource Group

View Source
const LocationsListAPI = "/restmachine/cloudapi/locations/list" // Returns list of GridRecord on success
View Source
const MaxCpusPerCompute = 128

MaxCpusPerCompute sets maximum number of vCPUs per compute

View Source
const MaxExtraDisksPerCompute = 12

MaxExtraDisksPerCompute sets maximum number of extra disks that can be added when creating new compute

View Source
const MaxNetworksPerCompute = 8

MaxNetworksPerCompute sets maximum number of vNICs per compute

View Source
const MaxSshKeysPerCompute = 12

MaxSshKeysPerCompute sets maximum number of user:ssh_key pairs to authorize when creating new compute

View Source
const MinRamPerCompute = 128

MinRamPerCompute sets minimum amount of RAM per compute in MB

View Source
const ResgroupCreateAPI = "/restmachine/cloudapi/rg/create"

structures related to /cloudapi/rg/create API call

View Source
const ResgroupDeleteAPI = "/restmachine/cloudapi/rg/delete"

structures related to /cloudapi/rg/delete API

View Source
const ResgroupGetAPI = "/restmachine/cloudapi/rg/get"
View Source
const ResgroupListAPI = "/restmachine/cloudapi/rg/list"
View Source
const ResgroupUpdateAPI = "/restmachine/cloudapi/rg/update"

structures related to /cloudapi/rg/update API call

View Source
const RgListComputesAPI = "/restmachine/cloudapi/rg/listComputes"
View Source
const VinsCreateInAccountAPI = "/restmachine/cloudapi/vins/createInAccount"
View Source
const VinsCreateInRgAPI = "/restmachine/cloudapi/vins/createInRG"
View Source
const VinsDeleteAPI = "/restmachine/cloudapi/vins/delete"
View Source
const VinsExtNetConnectAPI = "/restmachine/cloudapi/vins/extNetConnect"
View Source
const VinsExtNetDisconnectAPI = "/restmachine/cloudapi/vins/extNetDisconnect"
View Source
const VinsGetAPI = "/restmachine/cloudapi/vins/get"
View Source
const VinsSearchAPI = "/restmachine/cloudapi/vins/search"

Variables

View Source
var DefaultGridID int
View Source
var Timeout180s = time.Second * 180
View Source
var Timeout30s = time.Second * 30

timeouts for API calls from CRUD functions of Terraform plugin

View Source
var Timeout60s = time.Second * 60

Functions

func HashNetworkSubresource

func HashNetworkSubresource(resource *schema.Resource) schema.SchemaSetFunc

HashNetworkSubresource hashes network subresource of compute resource. It uses specially designed networkSubresourceSerialize (see above) to make sure hashing does not involve attributes that we deem irrelevant to the uniqueness of network subresource definitions. It is this function that should be specified as SchemaSetFunc when creating Set from network subresource (e.g. in flattenCompute)

This function is based on the original Terraform function HashResource from helper/schema/set.go

func Jo2JSON

func Jo2JSON(arg_str string) string

func Provider

func Provider() *schema.Provider

Types

type AccountAclRecord

type AccountAclRecord struct {
	IsExplicit bool   `json:"explicit"`
	Guid       string `json:"guid"`
	Rights     string `json:"right"`
	Status     string `json:"status"`
	Type       string `json:"type"`
	UgroupID   string `json:"userGroupId"`
}

type AccountRecord

type AccountRecord struct {
	// ACLs        []UserAclRecord `json:"acl"`
	// CreatedTime uint64          `json:"creationTime"`
	// DeletedTime uint64          `json:"deletionTime"`
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Status string `json:"status"`
}

structures related to /cloudapi/account/list API

type AccountsListResp

type AccountsListResp []AccountRecord

type ComputeBriefRecord

type ComputeBriefRecord struct {
	// we do not even include here all fields as returned by this API, but only the most important that
	// are really necessary to identify and distinguish computes
	AccountID   int    `json:"accountId"`
	AccountName string `json:"accountName"`
	Name        string `json:"name"`
	ID          uint   `json:"id"`
	RgID        int    `json:"rgId"`
	RgName      string `json:"rgName"`
	Status      string `json:"status"`
	TechStatus  string `json:"techStatus"`
}

structures related to /cloudapi/rg/listComputes API

type ComputeGetResp

type ComputeGetResp struct {
	// ACLs `json:"ACL"` - it is a dictionary, special parsing required
	AccountID          int               `json:"accountId"`
	AccountName        string            `json:"accountName"`
	Arch               string            `json:"arch"`
	BootDiskSize       int               `json:"bootdiskSize"`
	CloneReference     int               `json:"cloneReference"`
	Clones             []int             `json:"clones"`
	Cpu                int               `json:"cpus"`
	Desc               string            `json:"desc"`
	Disks              []DiskRecord      `json:"disks"`
	Driver             string            `json:"driver"`
	GridID             int               `json:"gid"`
	ID                 uint              `json:"id"`
	ImageID            int               `json:"imageId"`
	ImageName          string            `json:"imageName"`
	Interfaces         []InterfaceRecord `json:"interfaces"`
	LockStatus         string            `json:"lockStatus"`
	ManagerID          int               `json:"managerId"`
	ManagerType        string            `json:"manageType"`
	Name               string            `json:"name"`
	NatableVinsID      int               `json:"natableVinsId"`
	NatableVinsIP      string            `json:"natableVinsIp"`
	NatableVinsName    string            `json:"natableVinsName"`
	NatableVinsNet     string            `json:"natableVinsNetwork"`
	NatableVinsNetName string            `json:"natableVinsNetworkName"`
	OsUsers            []OsUserRecord    `json:"osUsers"`
	Ram                int               `json:"ram"`
	RgID               int               `json:"rgId"`
	RgName             string            `json:"rgName"`
	SnapSets           []SnapSetRecord   `json:"snapSets"`
	Status             string            `json:"status"`
	// Tags               []string          `json:"tags"` // Tags were reworked since DECORT 3.7.1
	TechStatus     string `json:"techStatus"`
	TotalDiskSize  int    `json:"totalDiskSize"`
	UpdatedBy      string `json:"updatedBy"`
	UpdateTime     uint64 `json:"updateTime"`
	UserManaged    bool   `json:"userManaged"`
	Vgpus          []int  `json:"vgpus"`
	VinsConnected  int    `json:"vinsConnected"`
	VirtualImageID int    `json:"virtualImageId"`
}

type ComputeListResp

type ComputeListResp []ComputeRecord

type ComputeNetMgmtRecord

type ComputeNetMgmtRecord struct {
	ID        int
	Type      string
	IPAddress string
	MAC       string
}

structures related to /cloudapi/compute/net Attach/Detach API

type ComputePfwListResp

type ComputePfwListResp []PfwRecord

type ComputeRecord

type ComputeRecord struct {
	AccountID      int               `json:"accountId"`
	AccountName    string            `json:"accountName"`
	ACLs           []UserAclRecord   `json:"acl"`
	Arch           string            `json:"arch"`
	BootDiskSize   int               `json:"bootdiskSize"`
	CloneReference int               `json:"cloneReference"`
	Clones         []int             `json:"clones"`
	Cpus           int               `json:"cpus"`
	CreatedBy      string            `json:"createdBy"`
	CreatedTime    uint64            `json:"createdTime"`
	DeletedBy      string            `json:"deletedBy"`
	DeletedTime    uint64            `json:"deletedTime"`
	Desc           string            `json:"desc"`
	Disks          []int             `json:"disks"`
	GridID         int               `json:"gid"`
	ID             uint              `json:"id"`
	ImageID        int               `json:"imageId"`
	Interfaces     []InterfaceRecord `json:"interfaces"`
	LockStatus     string            `json:"lockStatus"`
	ManagerID      int               `json:"managerId"`
	Name           string            `json:"name"`
	Ram            int               `json:"ram"`
	RgID           int               `json:"rgId"`
	RgName         string            `json:"rgName"`
	SnapSets       []SnapSetRecord   `json:"snapSets"`
	Status         string            `json:"status"`
	// Tags           []string          `json:"tags"` // Tags were reworked since DECORT 3.7.1
	TechStatus     string `json:"techStatus"`
	TotalDiskSize  int    `json:"totalDiskSize"`
	UpdatedBy      string `json:"updatedBy"`
	UpdateTime     uint64 `json:"updateTime"`
	UserManaged    bool   `json:"userManaged"`
	Vgpus          []int  `json:"vgpus"`
	VinsConnected  int    `json:"vinsConnected"`
	VirtualImageID int    `json:"virtualImageId"`
}

type ControllerCfg

type ControllerCfg struct {
	// contains filtered or unexported fields
}

func ControllerConfigure

func ControllerConfigure(d *schema.ResourceData) (*ControllerCfg, error)

type DiskRecord

type DiskRecord struct {
	// ACLs `json:"ACL"` - it is a dictionary, special parsing required
	// was - Acl map[string]string  `json:"acl"`
	AccountID       int    `json:"accountId"`
	AccountName     string `json:"accountName"` // NOTE: absent from compute/get output
	BootPartition   int    `json:"bootPartition"`
	CreatedTime     uint64 `json:"creationTime"`
	DeletedTime     uint64 `json:"deletionTime"`
	Desc            string `json:"desc"`
	DestructionTime uint64 `json:"destructionTime"`
	DiskPath        string `json:"diskPath"`
	GridID          int    `json:"gid"`
	ID              uint   `json:"id"`
	ImageID         int    `json:"imageId"`
	Images          []int  `json:"images"`
	// IOTune 'json:"iotune" - it is a dictionary
	Name string `json:"name"`
	// Order                   `json:"order"`
	ParentId int `json:"parentId"`
	PciSlot  int `json:"pciSlot"`
	// ResID string           `json:"resId"`
	// ResName string         `json:"resName"`
	// Params string          `json:"params"`
	Pool      string `json:"pool"`
	PurgeTime uint64 `json:"purgeTime"`
	// Role string            `json:"role"`
	SepType    string           `json:"sepType"`
	SepID      int              `json:"sepId"` // NOTE: absent from compute/get output
	SizeMax    int              `json:"sizeMax"`
	SizeUsed   int              `json:"sizeUsed"` // sum over all snapshots of this disk to report total consumed space
	Snapshots  []SnapshotRecord `json:"snapshots"`
	Status     string           `json:"status"`
	TechStatus string           `json:"techStatus"`
	Type       string           `json:"type"`
	ComputeID  int              `json:"vmid"`
}

type DisksListResp

type DisksListResp []DiskRecord

type ExtNetListResp

type ExtNetListResp []ExtNetRecord

type ExtNetRecord

type ExtNetRecord struct {
	Name   string `json:"name"`
	ID     uint   `json:"id"`
	IPCIDR string `json:"ipcidr"`
}

structures related to /cloudapi/extnet/list API

type ImageRecord

type ImageRecord struct {
	AccountID   uint   `json:"accountId"`
	Arch        string `json:"architecture"`
	BootType    string `json:"bootType"`
	IsBootable  bool   `json:"bootable"`
	IsCdrom     bool   `json:"cdrom"`
	Desc        string `json:"desc"`
	IsHotResize bool   `json:"hotResize"`
	ID          uint   `json:"id"`
	Name        string `json:"name"`
	Pool        string `json:"pool"`
	SepID       int    `json:"sepId"`
	Size        int    `json:"size"`
	Status      string `json:"status"`
	Type        string `json:"type"`
	Username    string `json:"username"`
	IsVirtual   bool   `json:"virtual"`
}

structures related to /restmachine/cloudapi/image/list API

type ImagesListResp

type ImagesListResp []ImageRecord

type InterfaceQosRecord

type InterfaceQosRecord struct {
	ERate   int    `json:"eRate"`
	Guid    string `json:"guid"`
	InBurst int    `json:"inBurst"`
	InRate  int    `json:"inRate"`
}

type InterfaceRecord

type InterfaceRecord struct {
	ConnID    int                `json:"connId"`   // This is VLAN ID or VxLAN ID, depending on ConnType
	ConnType  string             `json:"connType"` // Either "VLAN" or "VXLAN" tag
	DefaultGW string             `json:"defGw"`
	Guid      string             `json:"guid"`
	IPAddress string             `json:"ipAddress"` // without trailing network mask, i.e. "192.168.1.3"
	MAC       string             `json:"mac"`
	Name      string             `json:"name"`
	NetID     int                `json:"netId"` // This is either ExtNet ID or ViNS ID, depending on NetType
	NetMask   int                `json:"netMask"`
	NetType   string             `json:"netType"` // Either "EXTNET" or "VINS" tag
	PciSlot   int                `json:"pciSlot"`
	Target    string             `json:"target"`
	Type      string             `json:"type"`
	VNFs      []int              `json:"vnfs"`
	QOS       InterfaceQosRecord `json:"qos"`
}

type KvmVmCreateParam

type KvmVmCreateParam struct {
	RgID     uint   `json:"rgId"`
	Name     string `json:"name"`
	Cpu      int    `json:"cpu"`
	Ram      int    `json:"ram"`
	ImageID  int    `json:"imageId"`
	BootDisk int    `json:"bootDisk"`
	NetType  string `json:"netType"`
	NetId    int    `json:"netId"`
	IPAddr   string `json:"ipAddr"`
	UserData string `json:"userdata"`
	Desc     string `json:"desc"`
	Start    bool   `json:"start"`
}

type LocationRecord

type LocationRecord struct {
	GridID       int    `json:"gid"`
	Id           int    `json:"id"`
	LocationCode string `json:"locationCode"`
	Name         string `json:"name"`
	Flag         string `json:"flag"`
}

Grid ID structures

type LocationsListResp

type LocationsListResp []LocationRecord

type OsUserRecord

type OsUserRecord struct {
	Guid     string `json:"guid"`
	Login    string `json:"login"`
	Password string `json:"password"`
	PubKey   string `json:"pubkey"`
}

type PfwRecord

type PfwRecord struct {
	ID              int    `json:"id"`
	LocalIP         string `json:"localIp"`
	LocalPort       int    `json:"localPort"`
	Protocol        string `json:"protocol"`
	PublicPortEnd   int    `json:"publicPortEnd"`
	PublicPortStart int    `json:"publicPortStart"`
	ComputeID       int    `json:"vmId"`
}

structures related to /cloudapi/portforwarding/list API

type QuotaRecord

type QuotaRecord struct {
	Cpu        int     `json:"CU_C"`      // CPU count in pcs
	Ram        float64 `json:"CU_M"`      // RAM volume in MB, it is STILL reported as FLOAT
	Disk       int     `json:"CU_D"`      // Disk capacity in GB
	ExtIPs     int     `json:"CU_I"`      // Ext IPs count
	ExtTraffic int     `json:"CU_NP"`     // Ext network traffic
	GpuUnits   int     `json:"gpu_units"` // GPU count
}

structures related to /cloudapi/rg/get API call

type ResgroupGetResp

type ResgroupGetResp struct {
	ACLs           []UserAclRecord `json:"ACLs"`
	Usage          UsageRecord     `json:"Resources"`
	AccountID      int             `json:"accountId"`
	AccountName    string          `json:"accountName"`
	GridID         int             `json:"gid"`
	CreatedBy      string          `json:"createdBy"`
	CreatedTime    uint64          `json:"createdTime"`
	DefaultNetID   int             `json:"def_net_id"`
	DefaultNetType string          `json:"def_net_type"`
	DeletedBy      string          `json:"deletedBy"`
	DeletedTime    uint64          `json:"deletedTime"`
	Desc           string          `json:"desc"`
	ID             uint            `json:"id"`
	LockStatus     string          `json:"lockStatus"`
	Name           string          `json:"name"`
	Quota          QuotaRecord     `json:"resourceLimits"`
	Status         string          `json:"status"`
	UpdatedBy      string          `json:"updatedBy"`
	UpdatedTime    uint64          `json:"updatedTime"`
	Vins           []int           `json:"vins"`
	Computes       []int           `json:"vms"`

	Ignored map[string]interface{} `json:"-"`
}

type ResgroupListResp

type ResgroupListResp []ResgroupRecord

type ResgroupRecord

type ResgroupRecord struct {
	ACLs           []UserAclRecord  `json:"acl"`
	Owner          AccountAclRecord `json:"accountAcl"`
	AccountID      int              `json:"accountId"`
	AccountName    string           `json:"accountName"`
	CreatedBy      string           `json:"createdBy"`
	CreatedTime    uint64           `json:"createdTime"`
	DefaultNetID   int              `json:"def_net_id"`
	DefaultNetType string           `json:"def_net_type"`
	Decsription    string           `json:"desc"`
	GridID         int              `json:"gid"`
	ID             uint             `json:"id"`
	LockStatus     string           `json:"lockStatus"`
	Name           string           `json:"name"`
	Status         string           `json:"status"`
	UpdatedBy      string           `json:"updatedBy"`
	UpdatedTime    uint64           `json:"updatedTime"`
	Vins           []int            `json:"vins"`
	Computes       []int            `json:"vms"`
}

type ResgroupUpdateParam

type ResgroupUpdateParam struct {
	RgId       int    `json:"rgId"`
	Name       string `json:"name"`
	Desc       string `json:"decs"`
	Ram        int    `json:"maxMemoryCapacity"`
	Disk       int    `json:"maxVDiskCapacity"`
	Cpu        int    `json:"maxCPUCapacity"`
	NetTraffic int    `json:"maxNetworkPeerTransfer"`
	Reason     string `json:"reason"`
}

type ResourceRecord

type ResourceRecord struct {
	Cpu        int `json:"cpu"`
	Disk       int `json:"disksize"`
	ExtIPs     int `json:"extips"`
	ExtTraffic int `json:"exttraffic"`
	Gpu        int `json:"gpu"`
	Ram        int `json:"ram"`
}

type RgListComputesResp

type RgListComputesResp []ComputeBriefRecord

type SnapSetRecord

type SnapSetRecord struct {
	Disks     []int  `json:"disks"`
	Guid      string `json:"guid"`
	Label     string `json:"label"`
	TimeStamp uint64 `json:"timestamp"`
}

type SnapshotRecord

type SnapshotRecord struct {
	Guid        string `json:"guid"`
	Label       string `json:"label"`
	SnapSetGuid string `json:"snapSetGuid"`
	SnapSetTime uint64 `json:"snapSetTime"`
	TimeStamp   uint64 `json:"timestamp"`
}

structures related to /cloudapi/compute/get

type SshKeyConfig

type SshKeyConfig struct {
	User      string
	SshKey    string
	UserShell string
}

Auxiliary structures

type UsageRecord

type UsageRecord struct {
	Current  ResourceRecord `json:"Current"`
	Reserved ResourceRecord `json:"Reserved"`
}

type UserAclRecord

type UserAclRecord struct {
	IsExplicit bool   `json:"explicit"`
	Rights     string `json:"right"`
	Status     string `json:"status"`
	Type       string `json:"type"`
	UgroupID   string `json:"userGroupId"`
}

structures related to /cloudapi/rg/list API

type VinsRecord

type VinsRecord struct {
	ID          int                  `json:"id"`
	Name        string               `json:"name"`
	IPCidr      string               `json:"network"`
	VxLanID     int                  `json:"vxlanId"`
	ExternalIP  string               `json:"externalIP"`
	AccountID   int                  `json:"accountId"`
	AccountName string               `json:"accountName"`
	RgID        int                  `json:"rgid"`
	RgName      string               `json:"rgName"`
	VNFs        map[string]VnfRecord `json:"vnfs"`
	Desc        string               `json:"desc"`
}

type VinsSearchRecord

type VinsSearchRecord struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	IPCidr      string `json:"network"`
	VxLanID     int    `json:"vxlanId"`
	ExternalIP  string `json:"externalIP"`
	AccountID   int    `json:"accountId"`
	AccountName string `json:"accountName"`
	RgID        int    `json:"rgId"`
	RgName      string `json:"rgName"`
}

this is the structure of the element in the list returned by vins/search API

type VinsSearchResp

type VinsSearchResp []VinsSearchRecord

type VnfGwConfigRecord

type VnfGwConfigRecord struct {
	ExtNetID   int    `json:"ext_net_id"`
	ExtNetIP   string `json:"ext_net_ip"`
	ExtNetMask int    `json:"ext_net_mask"`
	DefaultGW  string `json:"default_gw"`
}

type VnfRecord

type VnfRecord struct {
	ID        int                    `json:"id"`
	AccountID int                    `json:"accountId"`
	Type      string                 `json:"type"`   // "DHCP", "NAT", "GW" etc
	Config    map[string]interface{} `json:"config"` // NOTE: VNF specs vary by VNF type
}

Jump to

Keyboard shortcuts

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