[clc] pull latest sdk
This commit is contained in:
parent
eb4963a853
commit
c93bc5ccb5
|
@ -153,48 +153,48 @@
|
|||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/aa",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/alert",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/api",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/dc",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/group",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/lb",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/server",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/CenturyLinkCloud/clc-sdk/status",
|
||||
"Comment": "0.0.2-20-gd546567",
|
||||
"Rev": "d546567abc945ad52d1906fc6c7caa8f903e7445"
|
||||
"Comment": "0.0.2-27-gedd0930",
|
||||
"Rev": "edd0930276e7f1a5f2cf3e7835b5dc42a3217669"
|
||||
},
|
||||
{
|
||||
"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("Api-Client", c.config.UserAgent)
|
||||
req.Header.Add("Accept", "application/json")
|
||||
if req.Body != nil {
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
|
|
|
@ -61,5 +61,5 @@ type CapabilitiesResponse struct {
|
|||
NetworkId string `json:"networkId"`
|
||||
Type string `json:"type"`
|
||||
AccountID string `json:"accountID"`
|
||||
} `json:deployableNetworks`
|
||||
} `json:"deployableNetworks"`
|
||||
}
|
||||
|
|
|
@ -169,9 +169,9 @@ type GroupDefaults struct {
|
|||
CPU string `json:"cpu,omitempty"`
|
||||
MemoryGB string `json:"memoryGB,omitempty"`
|
||||
NetworkID string `json:"networkId,omitempty"`
|
||||
primaryDns string `json:"primaryDns,omitempty"`
|
||||
secondaryDns string `json:"secondaryDns,omitempty"`
|
||||
templateName string `json:"templateName,omitempty"`
|
||||
PrimaryDns string `json:"primaryDns,omitempty"`
|
||||
SecondaryDns string `json:"secondaryDns,omitempty"`
|
||||
TemplateName string `json:"templateName,omitempty"`
|
||||
}
|
||||
|
||||
// request body for /v2/groups/ALIAS/ID/horizontalAutoscalePolicy
|
||||
|
|
|
@ -3,6 +3,7 @@ package server
|
|||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/CenturyLinkCloud/clc-sdk/api"
|
||||
"github.com/CenturyLinkCloud/clc-sdk/status"
|
||||
|
@ -313,26 +314,34 @@ func UpdateCustomfields(fields []api.Customfields) api.Update {
|
|||
}
|
||||
|
||||
type Server struct {
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
GroupID string `json:"groupId"`
|
||||
SourceServerID string `json:"sourceServerId"`
|
||||
IsManagedOS bool `json:"isManagedOS,omitempty"`
|
||||
PrimaryDNS string `json:"primaryDns,omitempty"`
|
||||
SecondaryDNS string `json:"secondaryDns,omitempty"`
|
||||
NetworkID string `json:"networkId,omitempty"`
|
||||
IPaddress string `json:"ipAddress,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
CPU int `json:"cpu"`
|
||||
MemoryGB int `json:"memoryGB"`
|
||||
Type string `json:"type"`
|
||||
Storagetype string `json:"storageType,omitempty"`
|
||||
Customfields []api.Customfields `json:"customFields,omitempty"`
|
||||
Additionaldisks []Disk `json:"additionalDisks,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description,omitempty"`
|
||||
GroupID string `json:"groupId"`
|
||||
SourceServerID string `json:"sourceServerId"`
|
||||
IsManagedOS bool `json:"isManagedOS,omitempty"`
|
||||
IsManagedBackup bool `json:"isManagedBackup,omitempty"`
|
||||
PrimaryDNS string `json:"primaryDns,omitempty"`
|
||||
SecondaryDNS string `json:"secondaryDns,omitempty"`
|
||||
NetworkID string `json:"networkId,omitempty"`
|
||||
IPaddress string `json:"ipAddress,omitempty"`
|
||||
Password string `json:"password,omitempty"`
|
||||
SourceServerPassword string `json:"sourceServerPassword,omitempty"`
|
||||
CPU int `json:"cpu"`
|
||||
CPUAutoscalePolicyID string `json:"cpuAutoscalePolicyId,omitempty"`
|
||||
MemoryGB int `json:"memoryGB"`
|
||||
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 {
|
||||
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 {
|
||||
|
|
|
@ -30,6 +30,13 @@ func (s *Service) Get(id string) (*Response, error) {
|
|||
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 {
|
||||
for {
|
||||
status, err := s.Get(id)
|
||||
|
@ -128,3 +135,35 @@ func (q *QueuedOperation) Status() *Status {
|
|||
}
|
||||
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