[clc] pull latest sdk
This commit is contained in:
parent
eb4963a853
commit
c93bc5ccb5
|
@ -153,48 +153,48 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
|
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
|
||||||
"Comment": "0.0.2-20-gd546567",
|
"Comment": "0.0.2-27-gedd0930",
|
||||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/DreamItGetIT/statuscake",
|
"ImportPath": "github.com/DreamItGetIT/statuscake",
|
||||||
|
|
|
@ -92,6 +92,7 @@ func (c *Client) Do(req *http.Request, ret interface{}) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Add("User-Agent", c.config.UserAgent)
|
req.Header.Add("User-Agent", c.config.UserAgent)
|
||||||
|
req.Header.Add("Api-Client", c.config.UserAgent)
|
||||||
req.Header.Add("Accept", "application/json")
|
req.Header.Add("Accept", "application/json")
|
||||||
if req.Body != nil {
|
if req.Body != nil {
|
||||||
req.Header.Add("Content-Type", "application/json")
|
req.Header.Add("Content-Type", "application/json")
|
||||||
|
|
|
@ -61,5 +61,5 @@ type CapabilitiesResponse struct {
|
||||||
NetworkId string `json:"networkId"`
|
NetworkId string `json:"networkId"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
AccountID string `json:"accountID"`
|
AccountID string `json:"accountID"`
|
||||||
} `json:deployableNetworks`
|
} `json:"deployableNetworks"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,9 +169,9 @@ type GroupDefaults struct {
|
||||||
CPU string `json:"cpu,omitempty"`
|
CPU string `json:"cpu,omitempty"`
|
||||||
MemoryGB string `json:"memoryGB,omitempty"`
|
MemoryGB string `json:"memoryGB,omitempty"`
|
||||||
NetworkID string `json:"networkId,omitempty"`
|
NetworkID string `json:"networkId,omitempty"`
|
||||||
primaryDns string `json:"primaryDns,omitempty"`
|
PrimaryDns string `json:"primaryDns,omitempty"`
|
||||||
secondaryDns string `json:"secondaryDns,omitempty"`
|
SecondaryDns string `json:"secondaryDns,omitempty"`
|
||||||
templateName string `json:"templateName,omitempty"`
|
TemplateName string `json:"templateName,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// request body for /v2/groups/ALIAS/ID/horizontalAutoscalePolicy
|
// request body for /v2/groups/ALIAS/ID/horizontalAutoscalePolicy
|
||||||
|
|
|
@ -3,6 +3,7 @@ package server
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/CenturyLinkCloud/clc-sdk/api"
|
"github.com/CenturyLinkCloud/clc-sdk/api"
|
||||||
"github.com/CenturyLinkCloud/clc-sdk/status"
|
"github.com/CenturyLinkCloud/clc-sdk/status"
|
||||||
|
@ -313,26 +314,34 @@ func UpdateCustomfields(fields []api.Customfields) api.Update {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Server struct {
|
type Server struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Description string `json:"description,omitempty"`
|
Description string `json:"description,omitempty"`
|
||||||
GroupID string `json:"groupId"`
|
GroupID string `json:"groupId"`
|
||||||
SourceServerID string `json:"sourceServerId"`
|
SourceServerID string `json:"sourceServerId"`
|
||||||
IsManagedOS bool `json:"isManagedOS,omitempty"`
|
IsManagedOS bool `json:"isManagedOS,omitempty"`
|
||||||
PrimaryDNS string `json:"primaryDns,omitempty"`
|
IsManagedBackup bool `json:"isManagedBackup,omitempty"`
|
||||||
SecondaryDNS string `json:"secondaryDns,omitempty"`
|
PrimaryDNS string `json:"primaryDns,omitempty"`
|
||||||
NetworkID string `json:"networkId,omitempty"`
|
SecondaryDNS string `json:"secondaryDns,omitempty"`
|
||||||
IPaddress string `json:"ipAddress,omitempty"`
|
NetworkID string `json:"networkId,omitempty"`
|
||||||
Password string `json:"password,omitempty"`
|
IPaddress string `json:"ipAddress,omitempty"`
|
||||||
CPU int `json:"cpu"`
|
Password string `json:"password,omitempty"`
|
||||||
MemoryGB int `json:"memoryGB"`
|
SourceServerPassword string `json:"sourceServerPassword,omitempty"`
|
||||||
Type string `json:"type"`
|
CPU int `json:"cpu"`
|
||||||
Storagetype string `json:"storageType,omitempty"`
|
CPUAutoscalePolicyID string `json:"cpuAutoscalePolicyId,omitempty"`
|
||||||
Customfields []api.Customfields `json:"customFields,omitempty"`
|
MemoryGB int `json:"memoryGB"`
|
||||||
Additionaldisks []Disk `json:"additionalDisks,omitempty"`
|
Type string `json:"type"`
|
||||||
|
Storagetype string `json:"storageType,omitempty"`
|
||||||
|
AntiAffinityPolicyID string `json:"antiAffinityPolicyId,omitempty"`
|
||||||
|
Customfields []api.Customfields `json:"customFields,omitempty"`
|
||||||
|
Additionaldisks []Disk `json:"additionalDisks,omitempty"`
|
||||||
|
TTL *time.Time `json:"ttl,omitempty"`
|
||||||
|
Packages []Package `json:"packages,omitempty"`
|
||||||
|
ConfigurationID string `json:"configurationId,omitempty"`
|
||||||
|
OSType string `json:"osType,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) Valid() bool {
|
func (s *Server) Valid() bool {
|
||||||
return s.Name != "" && s.CPU != 0 && s.MemoryGB != 0 && s.GroupID != "" && s.SourceServerID != ""
|
return s.Name != "" && s.CPU != 0 && s.MemoryGB != 0 && s.GroupID != "" && s.SourceServerID != "" && s.Type != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
|
|
|
@ -30,6 +30,13 @@ func (s *Service) Get(id string) (*Response, error) {
|
||||||
return status, err
|
return status, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) GetBlueprint(id string) (*BlueprintOperation, error) {
|
||||||
|
url := fmt.Sprintf("%s/operations/%s/status/%s", s.config.BaseURL, s.config.Alias, id)
|
||||||
|
status := &BlueprintOperation{}
|
||||||
|
err := s.client.Get(url, status)
|
||||||
|
return status, err
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) Poll(id string, poll chan *Response) error {
|
func (s *Service) Poll(id string, poll chan *Response) error {
|
||||||
for {
|
for {
|
||||||
status, err := s.Get(id)
|
status, err := s.Get(id)
|
||||||
|
@ -128,3 +135,35 @@ func (q *QueuedOperation) Status() *Status {
|
||||||
}
|
}
|
||||||
return st
|
return st
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* BlueprintOperation is a status object representing a running blueprint job
|
||||||
|
{
|
||||||
|
"requestType":"blueprintOperation",
|
||||||
|
"status":"succeeded",
|
||||||
|
"summary":{
|
||||||
|
"blueprintId":51229,
|
||||||
|
"locationId":"CA1",
|
||||||
|
"links":[
|
||||||
|
{
|
||||||
|
"rel":"network",
|
||||||
|
"href":"/v2-experimental/networks/ZZBB/CA1/6955e7c39b5648df91bfb32e5d0aa24b",
|
||||||
|
"id":"6955e7c39b5648df91bfb32e5d0aa24b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"source":{"userName":"ack","requestedAt":"2016-03-24T16:47:04Z"}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
type BlueprintOperation struct {
|
||||||
|
RequestType string `json:"requestType,omitempty"`
|
||||||
|
Status string `json:"status,omitempty"`
|
||||||
|
Summary struct {
|
||||||
|
BlueprintID int `json:"blueprintId,omitempty"`
|
||||||
|
LocationID string `json:"locationId,omitempty"`
|
||||||
|
Links api.Links `json:"links,omitempty"`
|
||||||
|
} `json:"summary,omitempty"`
|
||||||
|
Source struct {
|
||||||
|
UserName string `json:"userName"`
|
||||||
|
RequestedAt time.Time `json:"requestedAt,omitempty"`
|
||||||
|
} `json:"source,omitempty"`
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue