scaleway: update scaleway vendor
This commit is contained in:
parent
9181570bc3
commit
02878cc148
|
@ -458,6 +458,9 @@ type ScalewaySecurityGroups struct {
|
|||
Servers []ScalewaySecurityGroup `json:"servers"`
|
||||
EnableDefaultSecurity bool `json:"enable_default_security"`
|
||||
OrganizationDefault bool `json:"organization_default"`
|
||||
Stateful bool `json:"stateful"`
|
||||
InboundDefaultPolicy string `json:"inbound_default_policy"`
|
||||
OutboundDefaultPolicy string `json:"outbound_default_policy"`
|
||||
}
|
||||
|
||||
// ScalewayGetSecurityGroups represents the response of a GET /security_groups/
|
||||
|
@ -503,17 +506,23 @@ type ScalewaySecurityGroup struct {
|
|||
|
||||
// ScalewayNewSecurityGroup definition POST request /security_groups
|
||||
type ScalewayNewSecurityGroup struct {
|
||||
Organization string `json:"organization"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Organization string `json:"organization"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Stateful bool `json:"stateful"`
|
||||
InboundDefaultPolicy string `json:"inbound_default_policy"`
|
||||
OutboundDefaultPolicy string `json:"outbound_default_policy"`
|
||||
}
|
||||
|
||||
// ScalewayUpdateSecurityGroup definition PUT request /security_groups
|
||||
type ScalewayUpdateSecurityGroup struct {
|
||||
Organization string `json:"organization"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
OrganizationDefault bool `json:"organization_default"`
|
||||
Organization string `json:"organization"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
OrganizationDefault bool `json:"organization_default"`
|
||||
Stateful bool `json:"stateful"`
|
||||
InboundDefaultPolicy string `json:"inbound_default_policy"`
|
||||
OutboundDefaultPolicy string `json:"outbound_default_policy"`
|
||||
}
|
||||
|
||||
// ScalewayServer represents a Scaleway server
|
||||
|
@ -545,6 +554,9 @@ type ScalewayServer struct {
|
|||
// State is the current status of the server
|
||||
State string `json:"state,omitempty"`
|
||||
|
||||
// BootType is the boot method used, can be local or bootscript
|
||||
BootType string `json:"boot_type,omitempty"`
|
||||
|
||||
// StateDetail is the detailed status of the server
|
||||
StateDetail string `json:"state_detail,omitempty"`
|
||||
|
||||
|
@ -569,7 +581,7 @@ type ScalewayServer struct {
|
|||
// Organization is the owner of the server
|
||||
Organization string `json:"organization,omitempty"`
|
||||
|
||||
// CommercialType is the commercial type of the server (i.e: C1, C2[SML], VC1S)
|
||||
// CommercialType is the commercial type of the server (i.e: C1, C2[SML], START1-S)
|
||||
CommercialType string `json:"commercial_type,omitempty"`
|
||||
|
||||
// Location of the server
|
||||
|
@ -619,6 +631,7 @@ type ScalewayServerPatchDefinition struct {
|
|||
Tags *[]string `json:"tags,omitempty"`
|
||||
IPV6 *ScalewayIPV6Definition `json:"ipv6,omitempty"`
|
||||
EnableIPV6 *bool `json:"enable_ipv6,omitempty"`
|
||||
BootType *string `json:"boot_type,omitempty"`
|
||||
}
|
||||
|
||||
// ScalewayServerDefinition represents a Scaleway server with image definition
|
||||
|
@ -644,7 +657,7 @@ type ScalewayServerDefinition struct {
|
|||
// Organization is the owner of the server
|
||||
Organization string `json:"organization"`
|
||||
|
||||
// CommercialType is the commercial type of the server (i.e: C1, C2[SML], VC1S)
|
||||
// CommercialType is the commercial type of the server (i.e: C1, C2[SML], START1-S)
|
||||
CommercialType string `json:"commercial_type"`
|
||||
|
||||
PublicIP string `json:"public_ip,omitempty"`
|
||||
|
@ -652,6 +665,8 @@ type ScalewayServerDefinition struct {
|
|||
EnableIPV6 bool `json:"enable_ipv6,omitempty"`
|
||||
|
||||
SecurityGroup string `json:"security_group,omitempty"`
|
||||
|
||||
BootType string `json:"boot_type,omitempty"`
|
||||
}
|
||||
|
||||
// ScalewayOneServer represents the response of a GET /servers/UUID API call
|
||||
|
@ -1208,7 +1223,7 @@ func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error)
|
|||
}
|
||||
)
|
||||
|
||||
serverChan := make(chan ScalewayServers, 2)
|
||||
serverChan := make(chan ScalewayServers, len(apis))
|
||||
for _, api := range apis {
|
||||
g.Go(s.fetchServers(api, query, serverChan))
|
||||
}
|
||||
|
@ -1382,7 +1397,7 @@ func (s *ScalewayAPI) PostSnapshot(volumeID string, name string) (string, error)
|
|||
return "", err
|
||||
}
|
||||
// FIXME arch, owner, title
|
||||
s.Cache.InsertSnapshot(snapshot.Snapshot.Identifier, "", "", snapshot.Snapshot.Organization, snapshot.Snapshot.Name)
|
||||
s.Cache.InsertSnapshot(snapshot.Snapshot.Identifier, s.Region, "", snapshot.Snapshot.Organization, snapshot.Snapshot.Name)
|
||||
return snapshot.Snapshot.Identifier, nil
|
||||
}
|
||||
|
||||
|
@ -1414,7 +1429,7 @@ func (s *ScalewayAPI) PostImage(volumeID string, name string, bootscript string,
|
|||
return "", err
|
||||
}
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertImage(image.Image.Identifier, "", image.Image.Arch, image.Image.Organization, image.Image.Name, "")
|
||||
s.Cache.InsertImage(image.Image.Identifier, s.Region, image.Image.Arch, image.Image.Organization, image.Image.Name, "")
|
||||
return image.Image.Identifier, nil
|
||||
}
|
||||
|
||||
|
@ -1690,7 +1705,7 @@ func (s *ScalewayAPI) GetSnapshots() (*[]ScalewaySnapshot, error) {
|
|||
}
|
||||
for _, snapshot := range snapshots.Snapshots {
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertSnapshot(snapshot.Identifier, "", "", snapshot.Organization, snapshot.Name)
|
||||
s.Cache.InsertSnapshot(snapshot.Identifier, s.Region, "", snapshot.Organization, snapshot.Name)
|
||||
}
|
||||
return &snapshots.Snapshots, nil
|
||||
}
|
||||
|
@ -1713,7 +1728,7 @@ func (s *ScalewayAPI) GetSnapshot(snapshotID string) (*ScalewaySnapshot, error)
|
|||
return nil, err
|
||||
}
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertSnapshot(oneSnapshot.Snapshot.Identifier, "", "", oneSnapshot.Snapshot.Organization, oneSnapshot.Snapshot.Name)
|
||||
s.Cache.InsertSnapshot(oneSnapshot.Snapshot.Identifier, s.Region, "", oneSnapshot.Snapshot.Organization, oneSnapshot.Snapshot.Name)
|
||||
return &oneSnapshot.Snapshot, nil
|
||||
}
|
||||
|
||||
|
@ -1740,7 +1755,7 @@ func (s *ScalewayAPI) GetVolumes() (*[]ScalewayVolume, error) {
|
|||
}
|
||||
for _, volume := range volumes.Volumes {
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertVolume(volume.Identifier, "", "", volume.Organization, volume.Name)
|
||||
s.Cache.InsertVolume(volume.Identifier, s.Region, "", volume.Organization, volume.Name)
|
||||
}
|
||||
return &volumes.Volumes, nil
|
||||
}
|
||||
|
@ -1763,7 +1778,7 @@ func (s *ScalewayAPI) GetVolume(volumeID string) (*ScalewayVolume, error) {
|
|||
return nil, err
|
||||
}
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertVolume(oneVolume.Volume.Identifier, "", "", oneVolume.Volume.Organization, oneVolume.Volume.Name)
|
||||
s.Cache.InsertVolume(oneVolume.Volume.Identifier, s.Region, "", oneVolume.Volume.Organization, oneVolume.Volume.Name)
|
||||
return &oneVolume.Volume, nil
|
||||
}
|
||||
|
||||
|
@ -1789,7 +1804,7 @@ func (s *ScalewayAPI) GetBootscripts() (*[]ScalewayBootscript, error) {
|
|||
}
|
||||
for _, bootscript := range bootscripts.Bootscripts {
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertBootscript(bootscript.Identifier, "", bootscript.Arch, bootscript.Organization, bootscript.Title)
|
||||
s.Cache.InsertBootscript(bootscript.Identifier, s.Region, bootscript.Arch, bootscript.Organization, bootscript.Title)
|
||||
}
|
||||
return &bootscripts.Bootscripts, nil
|
||||
}
|
||||
|
@ -1812,7 +1827,7 @@ func (s *ScalewayAPI) GetBootscript(bootscriptID string) (*ScalewayBootscript, e
|
|||
return nil, err
|
||||
}
|
||||
// FIXME region, arch, owner, title
|
||||
s.Cache.InsertBootscript(oneBootscript.Bootscript.Identifier, "", oneBootscript.Bootscript.Arch, oneBootscript.Bootscript.Organization, oneBootscript.Bootscript.Title)
|
||||
s.Cache.InsertBootscript(oneBootscript.Bootscript.Identifier, s.Region, oneBootscript.Bootscript.Arch, oneBootscript.Bootscript.Organization, oneBootscript.Bootscript.Title)
|
||||
return &oneBootscript.Bootscript, nil
|
||||
}
|
||||
|
||||
|
@ -1973,21 +1988,10 @@ func (s *ScalewayAPI) CheckCredentials() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
found := false
|
||||
var tokens ScalewayGetTokens
|
||||
|
||||
if err = json.Unmarshal(body, &tokens); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, token := range tokens.Tokens {
|
||||
if token.ID == s.Token {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
return fmt.Errorf("Invalid token %v", s.Token)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,7 @@ type ConfigCreateServer struct {
|
|||
CommercialType string
|
||||
DynamicIPRequired bool
|
||||
EnableIPV6 bool
|
||||
BootType string
|
||||
}
|
||||
|
||||
// Return offer from any of the product name or alternate names
|
||||
|
@ -350,6 +351,10 @@ func CreateServer(api *ScalewayAPI, c *ConfigCreateServer) (string, error) {
|
|||
return "", errors.New("Invalid commercial type")
|
||||
}
|
||||
|
||||
if c.BootType != "local" && c.BootType != "bootscript" {
|
||||
return "", errors.New("Invalid boot type")
|
||||
}
|
||||
|
||||
if c.Name == "" {
|
||||
c.Name = strings.Replace(namesgenerator.GetRandomName(0), "_", "-", -1)
|
||||
}
|
||||
|
@ -360,6 +365,7 @@ func CreateServer(api *ScalewayAPI, c *ConfigCreateServer) (string, error) {
|
|||
server.Volumes = make(map[string]string)
|
||||
server.DynamicIPRequired = &c.DynamicIPRequired
|
||||
server.EnableIPV6 = c.EnableIPV6
|
||||
server.BootType = c.BootType
|
||||
if commercialType == "" {
|
||||
return "", errors.New("You need to specify a commercial-type")
|
||||
}
|
||||
|
|
|
@ -1443,10 +1443,10 @@
|
|||
"revisionTime": "2017-03-21T23:07:31Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "UvMjUbtTEF0wskLTpV8grtBUh7Q=",
|
||||
"checksumSHA1": "17M5pJv8Wr4lIxmINnba9vTozR8=",
|
||||
"path": "github.com/scaleway/scaleway-cli/pkg/api",
|
||||
"revision": "51d0290d9434dc6139dd89001236cfd989521a79",
|
||||
"revisionTime": "2018-03-05T22:44:21Z"
|
||||
"revision": "7b12c9699d70d4ca06140b7d829d09b6a1c8f6f5",
|
||||
"revisionTime": "2018-09-21T09:43:45Z"
|
||||
},
|
||||
{
|
||||
"checksumSHA1": "kveaAmNlnvmIIuEkFcMlB+N7TqY=",
|
||||
|
|
Loading…
Reference in New Issue