common

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StrSPIDER_REST_URL            string = "SPIDER_REST_URL"
	StrDRAGONFLY_REST_URL         string = "DRAGONFLY_REST_URL"
	StrDB_URL                     string = "DB_URL"
	StrDB_DATABASE                string = "DB_DATABASE"
	StrDB_USER                    string = "DB_USER"
	StrDB_PASSWORD                string = "DB_PASSWORD"
	StrAUTOCONTROL_DURATION_MS    string = "AUTOCONTROL_DURATION_MS"
	CbStoreKeyNotFoundErrorString string = "key not found"
	StrAdd                        string = "add"
	StrDelete                     string = "delete"
	StrSSHKey                     string = "sshKey"
	StrImage                      string = "image"
	StrSecurityGroup              string = "securityGroup"
	StrSpec                       string = "spec"
	StrVNet                       string = "vNet"
)

Variables

View Source
var AUTOCONTROL_DURATION_MS string

CB-Store

View Source
var CBStore icbs.Store
View Source
var DB_DATABASE string
View Source
var DB_PASSWORD string
View Source
var DB_URL string
View Source
var DB_USER string
View Source
var DRAGONFLY_REST_URL string
View Source
var MYDB *sql.DB
View Source
var SPIDER_REST_URL string
View Source
var StartTime string

Functions

func CheckConfig added in v0.3.1

func CheckConfig(id string) (bool, error)

func CheckNs added in v0.3.1

func CheckNs(id string) (bool, error)

func CheckString added in v0.3.7

func CheckString(name string) error

func ConvGrpcStatusErr

func ConvGrpcStatusErr(err error, tag string, method string) error

ConvGrpcStatusErr - GRPC 상태 코드 에러로 변환

func ConvertToMessage

func ConvertToMessage(inType string, inData string, obj interface{}) error

ConvertToMessage - 입력 데이터를 grpc 메시지로 변환

func ConvertToOutput

func ConvertToOutput(outType string, obj interface{}) (string, error)

ConvertToOutput - grpc 메시지를 출력포맷으로 변환

func CopySrcToDest

func CopySrcToDest(src interface{}, dest interface{}) error

CopySrcToDest - 소스에서 타켓으로 데이터 복사

func CreateImageTable

func CreateImageTable() error

func CreateSpecTable

func CreateSpecTable() error

func DelAllConfig

func DelAllConfig() error

func DelAllNs

func DelAllNs() error

func DelNs

func DelNs(id string) error

func DeleteObject added in v0.3.3

func DeleteObject(key string) error

func DeleteObject delete the object.

func DeleteObjects added in v0.3.3

func DeleteObjects(key string) error

func DeleteObjects delete objects.

func GenMcisKey

func GenMcisKey(nsId string, mcisId string, vmId string) string

func GenMcisPolicyKey added in v0.2.8

func GenMcisPolicyKey(nsId string, mcisId string, vmId string) string

Generate Mcis policy key

func GenMcisVmGroupKey added in v0.3.3

func GenMcisVmGroupKey(nsId string, mcisId string, groupId string) string

func GenResourceKey

func GenResourceKey(nsId string, resourceType string, resourceId string) string

func GenUuid

func GenUuid() string

func GetChildIdList

func GetChildIdList(key string) []string

func GetCspResourceId

func GetCspResourceId(nsId string, resourceType string, resourceId string) (string, error)

func GetObjectList added in v0.3.3

func GetObjectList(key string) []string

func GetObjectList returns IDs of each child objects that has the same key.

func GetObjectValue added in v0.3.3

func GetObjectValue(key string) (string, error)

func GetObjectValue returns the object value.

func ListConfigId

func ListConfigId() []string

func ListNsId

func ListNsId() []string

func LookupKeyValueList

func LookupKeyValueList(kvl []KeyValue, key string) string

func NVL

func NVL(str string, def string) string

NVL is null value logic

func NewGrpcStatusErr

func NewGrpcStatusErr(msg string, tag string, method string) error

NewGrpcStatusErr - GRPC 상태 코드 에러 생성

func NsValidation

func NsValidation() echo.MiddlewareFunc

func OpenSQL

func OpenSQL(path string) error

func PrintJsonPretty

func PrintJsonPretty(v interface{})

func SelectDatabase

func SelectDatabase(database string) error

func ToLower added in v0.3.1

func ToLower(name string) string

To be deprecated

func UpdateEnv

func UpdateEnv(id string) error

Types

type ConfigInfo

type ConfigInfo struct {
	Id    string `json:"id" example:"SPIDER_REST_URL"`
	Name  string `json:"name" example:"SPIDER_REST_URL"`
	Value string `json:"value" example:"http://localhost:1024/spider"`
}

swagger:response ConfigInfo

func GetConfig

func GetConfig(id string) (ConfigInfo, error)

func ListConfig

func ListConfig() ([]ConfigInfo, error)

func UpdateConfig

func UpdateConfig(u *ConfigReq) (ConfigInfo, error)

type ConfigReq

type ConfigReq struct {
	Name  string `json:"name" example:"SPIDER_REST_URL"`
	Value string `json:"value" example:"http://localhost:1024/spider"`
}

swagger:request ConfigReq

type ConnConfig

type ConnConfig struct {
	ConfigName     string
	ProviderName   string
	DriverName     string
	CredentialName string
	RegionName     string
}

func GetConnConfig

func GetConnConfig(ConnConfigName string) (ConnConfig, error)

type ConnConfigList

type ConnConfigList struct {
	Connectionconfig []ConnConfig `json:"connectionconfig"`
}

func GetConnConfigList

func GetConnConfigList() (ConnConfigList, error)

type IID

type IID struct {
	NameId   string // NameID by user
	SystemId string // SystemID by CloudOS
}

Spider 2020-03-30 https://github.com/cloud-barista/cb-spider/blob/master/cloud-control-manager/cloud-driver/interfaces/resources/IId.go

type KeyValue

type KeyValue struct {
	Key   string
	Value string
}

type NsInfo

type NsInfo struct {
	Id          string `json:"id" example:"namespaceid01"`
	Name        string `json:"name" example:"namespacename01"`
	Description string `json:"description" example:"Description for this namespace"`
}

swagger:response NsInfo

func CreateNs

func CreateNs(u *NsReq) (NsInfo, error)

func GetNs

func GetNs(id string) (NsInfo, error)

func ListNs

func ListNs() ([]NsInfo, error)

type NsReq

type NsReq struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

type Region

type Region struct {
	RegionName       string
	ProviderName     string
	KeyValueInfoList []KeyValue
}

func GetRegion

func GetRegion(RegionName string) (Region, error)

type RegionInfo added in v0.3.5

type RegionInfo struct {
	RegionName       string     // ex) "region01"
	ProviderName     string     // ex) "GCP"
	KeyValueInfoList []KeyValue // ex) { {region, us-east1},

}

func GetRegionInfo added in v0.3.5

func GetRegionInfo(RegionName string) (RegionInfo, error)

type RegionList

type RegionList struct {
	Region []Region `json:"region"`
}

RegionList is array struct for Region

func GetRegionList

func GetRegionList() (RegionList, error)

GetRegionList retrieves region list

type SimpleMsg

type SimpleMsg struct {
	Message string `json:"message" example:"Any message"`
}

JSON Simple message struct

type SpiderConnectionName added in v0.3.7

type SpiderConnectionName struct {
	ConnectionName string `json:"ConnectionName"`
}

Jump to

Keyboard shortcuts

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