Live Structure
This commit is contained in:
55
models/live/live.go
Normal file
55
models/live/live.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package live
|
||||
|
||||
import (
|
||||
"cloud.o-forge.io/core/oc-lib/models/resources"
|
||||
"cloud.o-forge.io/core/oc-lib/models/utils"
|
||||
"cloud.o-forge.io/core/oc-lib/tools"
|
||||
"github.com/biter777/countries"
|
||||
)
|
||||
|
||||
/*
|
||||
* LiveDatacenter is a struct that represents a compute units in your datacenters
|
||||
*/
|
||||
type Credentials struct {
|
||||
Login string `json:"login,omitempty" bson:"login,omitempty"`
|
||||
Pass string `json:"password,omitempty" bson:"password,omitempty"`
|
||||
Token string `json:"token,omitempty" bson:"token,omitempty"`
|
||||
}
|
||||
|
||||
type Certs struct {
|
||||
AuthorityCertificate string `json:"authority_certificate,omitempty" bson:"authority_certificate,omitempty"`
|
||||
ClientCertificate string `json:"client_certificate,omitempty" bson:"client_certificate,omitempty"`
|
||||
}
|
||||
|
||||
type LiveCerts struct {
|
||||
Host string `json:"host,omitempty" bson:"host,omitempty"`
|
||||
Port string `json:"port,omitempty" bson:"port,omitempty"`
|
||||
|
||||
Certificates *Certs `json:"certs,omitempty" bson:"certs,omitempty"`
|
||||
Credentials *Credentials `json:"creds,omitempty" bson:"creds,omitempty"`
|
||||
}
|
||||
|
||||
// TODO in the future multiple type of certs depending of infra type
|
||||
|
||||
type AbstractLive struct {
|
||||
utils.AbstractObject
|
||||
Certs LiveCerts `json:"certs,omitempty" bson:"certs,omitempty"`
|
||||
|
||||
MonitorPath string `json:"monitor_path,omitempty" bson:"monitor_path,omitempty"`
|
||||
Location resources.GeoPoint `json:"location,omitempty" bson:"location,omitempty"`
|
||||
Country countries.CountryCode `json:"country,omitempty" bson:"country,omitempty"`
|
||||
AccessProtocol string `json:"access_protocol,omitempty" bson:"access_protocol,omitempty"`
|
||||
ResourcesID []string `json:"resources_id" bson:"resources_id"`
|
||||
}
|
||||
|
||||
func (r *AbstractLive) GetResourceType() tools.DataType {
|
||||
return tools.INVALID
|
||||
}
|
||||
|
||||
func (r *AbstractLive) StoreDraftDefault() {
|
||||
r.IsDraft = true
|
||||
}
|
||||
|
||||
func (r *AbstractLive) CanDelete() bool {
|
||||
return r.IsDraft // only draft ComputeUnits can be deleted
|
||||
}
|
||||
Reference in New Issue
Block a user