provider/scaleway: update sdk for ams1 region (#9687)
* provider/scalway: update sdk for ams1 region * provider/scaleway typecast volume size as of 472a493
This commit is contained in:
parent
6491190211
commit
082ef04b9e
|
@ -88,7 +88,9 @@ func resourceScalewayVolumeRead(d *schema.ResourceData, m interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
d.Set("name", volume.Name)
|
d.Set("name", volume.Name)
|
||||||
d.Set("size_in_gb", volume.Size/gb)
|
if size, ok := volume.Size.(uint64); ok {
|
||||||
|
d.Set("size_in_gb", size/gb)
|
||||||
|
}
|
||||||
d.Set("type", volume.VolumeType)
|
d.Set("type", volume.VolumeType)
|
||||||
d.Set("server", "")
|
d.Set("server", "")
|
||||||
if volume.Server != nil {
|
if volume.Server != nil {
|
||||||
|
|
|
@ -35,8 +35,11 @@ var (
|
||||||
AccountAPI = "https://account.scaleway.com/"
|
AccountAPI = "https://account.scaleway.com/"
|
||||||
MetadataAPI = "http://169.254.42.42/"
|
MetadataAPI = "http://169.254.42.42/"
|
||||||
MarketplaceAPI = "https://api-marketplace.scaleway.com"
|
MarketplaceAPI = "https://api-marketplace.scaleway.com"
|
||||||
URLPublicDNS = ".pub.cloud.scaleway.com"
|
ComputeAPIPar1 = "https://cp-par1.scaleway.com/"
|
||||||
URLPrivateDNS = ".priv.cloud.scaleway.com"
|
ComputeAPIAms1 = "https://cp-ams1.scaleway.com"
|
||||||
|
|
||||||
|
URLPublicDNS = ".pub.cloud.scaleway.com"
|
||||||
|
URLPrivateDNS = ".priv.cloud.scaleway.com"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -74,6 +77,8 @@ type ScalewayAPI struct {
|
||||||
client *http.Client
|
client *http.Client
|
||||||
verbose bool
|
verbose bool
|
||||||
computeAPI string
|
computeAPI string
|
||||||
|
|
||||||
|
Region string
|
||||||
//
|
//
|
||||||
Logger
|
Logger
|
||||||
}
|
}
|
||||||
|
@ -142,7 +147,7 @@ type ScalewayVolume struct {
|
||||||
Identifier string `json:"id,omitempty"`
|
Identifier string `json:"id,omitempty"`
|
||||||
|
|
||||||
// Size is the allocated size of the volume
|
// Size is the allocated size of the volume
|
||||||
Size uint64 `json:"size,omitempty"`
|
Size interface{} `json:"size,omitempty"`
|
||||||
|
|
||||||
// CreationDate is the creation date of the volume
|
// CreationDate is the creation date of the volume
|
||||||
CreationDate string `json:"creation_date,omitempty"`
|
CreationDate string `json:"creation_date,omitempty"`
|
||||||
|
@ -533,6 +538,7 @@ type ScalewayServer struct {
|
||||||
Hypervisor string `json:"hypervisor_id,omitempty"`
|
Hypervisor string `json:"hypervisor_id,omitempty"`
|
||||||
Blade string `json:"blade_id,omitempty"`
|
Blade string `json:"blade_id,omitempty"`
|
||||||
Node string `json:"node_id,omitempty"`
|
Node string `json:"node_id,omitempty"`
|
||||||
|
ZoneID string `json:"zone_id,omitempty"`
|
||||||
} `json:"location,omitempty"`
|
} `json:"location,omitempty"`
|
||||||
|
|
||||||
IPV6 *ScalewayIPV6Definition `json:"ipv6,omitempty"`
|
IPV6 *ScalewayIPV6Definition `json:"ipv6,omitempty"`
|
||||||
|
@ -660,6 +666,11 @@ type ScalewayTokensDefinition struct {
|
||||||
Token ScalewayTokenDefinition `json:"token"`
|
Token ScalewayTokenDefinition `json:"token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScalewayGetTokens represents a list of Scaleway Tokens
|
||||||
|
type ScalewayGetTokens struct {
|
||||||
|
Tokens []ScalewayTokenDefinition `json:"tokens"`
|
||||||
|
}
|
||||||
|
|
||||||
// ScalewayContainerData represents a Scaleway container data (S3)
|
// ScalewayContainerData represents a Scaleway container data (S3)
|
||||||
type ScalewayContainerData struct {
|
type ScalewayContainerData struct {
|
||||||
LastModified string `json:"last_modified"`
|
LastModified string `json:"last_modified"`
|
||||||
|
@ -879,10 +890,13 @@ func NewScalewayAPI(organization, token, userAgent, region string, options ...fu
|
||||||
}
|
}
|
||||||
switch region {
|
switch region {
|
||||||
case "par1", "":
|
case "par1", "":
|
||||||
s.computeAPI = "https://api.scaleway.com/"
|
s.computeAPI = ComputeAPIPar1
|
||||||
|
case "ams1":
|
||||||
|
s.computeAPI = ComputeAPIAms1
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("%s isn't a valid region", region)
|
return nil, fmt.Errorf("%s isn't a valid region", region)
|
||||||
}
|
}
|
||||||
|
s.Region = region
|
||||||
if url := os.Getenv("SCW_COMPUTE_API"); url != "" {
|
if url := os.Getenv("SCW_COMPUTE_API"); url != "" {
|
||||||
s.computeAPI = url
|
s.computeAPI = url
|
||||||
}
|
}
|
||||||
|
@ -1092,6 +1106,30 @@ func (s *ScalewayAPI) handleHTTPError(goodStatusCode []int, resp *http.Response)
|
||||||
return body, nil
|
return body, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *ScalewayAPI) fetchServers(api string, query url.Values, out chan<- ScalewayServers) func() error {
|
||||||
|
return func() error {
|
||||||
|
resp, err := s.GetResponsePaginate(api, "servers", query)
|
||||||
|
if resp != nil {
|
||||||
|
defer resp.Body.Close()
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
body, err := s.handleHTTPError([]int{http.StatusOK}, resp)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var servers ScalewayServers
|
||||||
|
|
||||||
|
if err = json.Unmarshal(body, &servers); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
out <- servers
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// GetServers gets the list of servers from the ScalewayAPI
|
// GetServers gets the list of servers from the ScalewayAPI
|
||||||
func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error) {
|
func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error) {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
|
@ -1106,31 +1144,33 @@ func (s *ScalewayAPI) GetServers(all bool, limit int) (*[]ScalewayServer, error)
|
||||||
if all && limit == 0 {
|
if all && limit == 0 {
|
||||||
s.Cache.ClearServers()
|
s.Cache.ClearServers()
|
||||||
}
|
}
|
||||||
resp, err := s.GetResponsePaginate(s.computeAPI, "servers", query)
|
var (
|
||||||
if resp != nil {
|
g errgroup.Group
|
||||||
defer resp.Body.Close()
|
apis = []string{
|
||||||
}
|
ComputeAPIPar1,
|
||||||
if err != nil {
|
ComputeAPIAms1,
|
||||||
return nil, err
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
serverChan := make(chan ScalewayServers, 2)
|
||||||
|
for _, api := range apis {
|
||||||
|
g.Go(s.fetchServers(api, query, serverChan))
|
||||||
}
|
}
|
||||||
|
|
||||||
body, err := s.handleHTTPError([]int{http.StatusOK}, resp)
|
if err := g.Wait(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
close(serverChan)
|
||||||
var servers ScalewayServers
|
var servers ScalewayServers
|
||||||
if err = json.Unmarshal(body, &servers); err != nil {
|
|
||||||
return nil, err
|
for server := range serverChan {
|
||||||
|
servers.Servers = append(servers.Servers, server.Servers...)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, server := range servers.Servers {
|
for i, server := range servers.Servers {
|
||||||
// FIXME region, arch, owner, title
|
|
||||||
servers.Servers[i].DNSPublic = server.Identifier + URLPublicDNS
|
servers.Servers[i].DNSPublic = server.Identifier + URLPublicDNS
|
||||||
servers.Servers[i].DNSPrivate = server.Identifier + URLPrivateDNS
|
servers.Servers[i].DNSPrivate = server.Identifier + URLPrivateDNS
|
||||||
s.Cache.InsertServer(server.Identifier, "fr-1", server.Arch, server.Organization, server.Name)
|
s.Cache.InsertServer(server.Identifier, server.Location.ZoneID, server.Arch, server.Organization, server.Name)
|
||||||
}
|
|
||||||
// FIXME: when API limit is ready, remove the following code
|
|
||||||
if limit > 0 && limit < len(servers.Servers) {
|
|
||||||
servers.Servers = servers.Servers[0:limit]
|
|
||||||
}
|
}
|
||||||
return &servers.Servers, nil
|
return &servers.Servers, nil
|
||||||
}
|
}
|
||||||
|
@ -1172,10 +1212,10 @@ func (s *ScalewayAPI) GetServer(serverID string) (*ScalewayServer, error) {
|
||||||
if err = json.Unmarshal(body, &oneServer); err != nil {
|
if err = json.Unmarshal(body, &oneServer); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME arch, owner, title
|
||||||
oneServer.Server.DNSPublic = oneServer.Server.Identifier + URLPublicDNS
|
oneServer.Server.DNSPublic = oneServer.Server.Identifier + URLPublicDNS
|
||||||
oneServer.Server.DNSPrivate = oneServer.Server.Identifier + URLPrivateDNS
|
oneServer.Server.DNSPrivate = oneServer.Server.Identifier + URLPrivateDNS
|
||||||
s.Cache.InsertServer(oneServer.Server.Identifier, "fr-1", oneServer.Server.Arch, oneServer.Server.Organization, oneServer.Server.Name)
|
s.Cache.InsertServer(oneServer.Server.Identifier, oneServer.Server.Location.ZoneID, oneServer.Server.Arch, oneServer.Server.Organization, oneServer.Server.Name)
|
||||||
return &oneServer.Server, nil
|
return &oneServer.Server, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1234,8 +1274,8 @@ func (s *ScalewayAPI) PostServer(definition ScalewayServerDefinition) (string, e
|
||||||
if err = json.Unmarshal(body, &server); err != nil {
|
if err = json.Unmarshal(body, &server); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME arch, owner, title
|
||||||
s.Cache.InsertServer(server.Server.Identifier, "fr-1", server.Server.Arch, server.Server.Organization, server.Server.Name)
|
s.Cache.InsertServer(server.Server.Identifier, server.Server.Location.ZoneID, server.Server.Arch, server.Server.Organization, server.Server.Name)
|
||||||
return server.Server.Identifier, nil
|
return server.Server.Identifier, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1294,8 +1334,8 @@ func (s *ScalewayAPI) PostSnapshot(volumeID string, name string) (string, error)
|
||||||
if err = json.Unmarshal(body, &snapshot); err != nil {
|
if err = json.Unmarshal(body, &snapshot); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME arch, owner, title
|
||||||
s.Cache.InsertSnapshot(snapshot.Snapshot.Identifier, "fr-1", "", snapshot.Snapshot.Organization, snapshot.Snapshot.Name)
|
s.Cache.InsertSnapshot(snapshot.Snapshot.Identifier, "", "", snapshot.Snapshot.Organization, snapshot.Snapshot.Name)
|
||||||
return snapshot.Snapshot.Identifier, nil
|
return snapshot.Snapshot.Identifier, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1369,7 @@ func (s *ScalewayAPI) PostImage(volumeID string, name string, bootscript string,
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertImage(image.Image.Identifier, "fr-1", image.Image.Arch, image.Image.Organization, image.Image.Name, "")
|
s.Cache.InsertImage(image.Image.Identifier, "", image.Image.Arch, image.Image.Organization, image.Image.Name, "")
|
||||||
return image.Image.Identifier, nil
|
return image.Image.Identifier, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1486,7 +1526,7 @@ func (s *ScalewayAPI) GetImages() (*[]MarketImage, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
for _, orgaImage := range OrgaImages.Images {
|
for _, orgaImage := range OrgaImages.Images {
|
||||||
s.Cache.InsertImage(orgaImage.Identifier, "fr-1", orgaImage.Arch, orgaImage.Organization, orgaImage.Name, "")
|
s.Cache.InsertImage(orgaImage.Identifier, "", orgaImage.Arch, orgaImage.Organization, orgaImage.Name, "")
|
||||||
images.Images = append(images.Images, MarketImage{
|
images.Images = append(images.Images, MarketImage{
|
||||||
Categories: []string{"MyImages"},
|
Categories: []string{"MyImages"},
|
||||||
CreationDate: orgaImage.CreationDate,
|
CreationDate: orgaImage.CreationDate,
|
||||||
|
@ -1505,7 +1545,7 @@ func (s *ScalewayAPI) GetImages() (*[]MarketImage, error) {
|
||||||
{
|
{
|
||||||
Arch: orgaImage.Arch,
|
Arch: orgaImage.Arch,
|
||||||
ID: orgaImage.Identifier,
|
ID: orgaImage.Identifier,
|
||||||
Zone: "fr-1",
|
Zone: "",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1536,8 +1576,8 @@ func (s *ScalewayAPI) GetImage(imageID string) (*ScalewayImage, error) {
|
||||||
if err = json.Unmarshal(body, &oneImage); err != nil {
|
if err = json.Unmarshal(body, &oneImage); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME owner, title
|
||||||
s.Cache.InsertImage(oneImage.Image.Identifier, "fr-1", oneImage.Image.Arch, oneImage.Image.Organization, oneImage.Image.Name, "")
|
s.Cache.InsertImage(oneImage.Image.Identifier, s.Region, oneImage.Image.Arch, oneImage.Image.Organization, oneImage.Image.Name, "")
|
||||||
return &oneImage.Image, nil
|
return &oneImage.Image, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,7 +1656,7 @@ func (s *ScalewayAPI) GetSnapshots() (*[]ScalewaySnapshot, error) {
|
||||||
}
|
}
|
||||||
for _, snapshot := range snapshots.Snapshots {
|
for _, snapshot := range snapshots.Snapshots {
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertSnapshot(snapshot.Identifier, "fr-1", "", snapshot.Organization, snapshot.Name)
|
s.Cache.InsertSnapshot(snapshot.Identifier, "", "", snapshot.Organization, snapshot.Name)
|
||||||
}
|
}
|
||||||
return &snapshots.Snapshots, nil
|
return &snapshots.Snapshots, nil
|
||||||
}
|
}
|
||||||
|
@ -1641,7 +1681,7 @@ func (s *ScalewayAPI) GetSnapshot(snapshotID string) (*ScalewaySnapshot, error)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertSnapshot(oneSnapshot.Snapshot.Identifier, "fr-1", "", oneSnapshot.Snapshot.Organization, oneSnapshot.Snapshot.Name)
|
s.Cache.InsertSnapshot(oneSnapshot.Snapshot.Identifier, "", "", oneSnapshot.Snapshot.Organization, oneSnapshot.Snapshot.Name)
|
||||||
return &oneSnapshot.Snapshot, nil
|
return &oneSnapshot.Snapshot, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1662,6 +1702,7 @@ func (s *ScalewayAPI) GetVolumes() (*[]ScalewayVolume, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var volumes ScalewayVolumes
|
var volumes ScalewayVolumes
|
||||||
|
|
||||||
if err = json.Unmarshal(body, &volumes); err != nil {
|
if err = json.Unmarshal(body, &volumes); err != nil {
|
||||||
|
@ -1669,7 +1710,7 @@ func (s *ScalewayAPI) GetVolumes() (*[]ScalewayVolume, error) {
|
||||||
}
|
}
|
||||||
for _, volume := range volumes.Volumes {
|
for _, volume := range volumes.Volumes {
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertVolume(volume.Identifier, "fr-1", "", volume.Organization, volume.Name)
|
s.Cache.InsertVolume(volume.Identifier, "", "", volume.Organization, volume.Name)
|
||||||
}
|
}
|
||||||
return &volumes.Volumes, nil
|
return &volumes.Volumes, nil
|
||||||
}
|
}
|
||||||
|
@ -1694,7 +1735,7 @@ func (s *ScalewayAPI) GetVolume(volumeID string) (*ScalewayVolume, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertVolume(oneVolume.Volume.Identifier, "fr-1", "", oneVolume.Volume.Organization, oneVolume.Volume.Name)
|
s.Cache.InsertVolume(oneVolume.Volume.Identifier, "", "", oneVolume.Volume.Organization, oneVolume.Volume.Name)
|
||||||
return &oneVolume.Volume, nil
|
return &oneVolume.Volume, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1722,7 +1763,7 @@ func (s *ScalewayAPI) GetBootscripts() (*[]ScalewayBootscript, error) {
|
||||||
}
|
}
|
||||||
for _, bootscript := range bootscripts.Bootscripts {
|
for _, bootscript := range bootscripts.Bootscripts {
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertBootscript(bootscript.Identifier, "fr-1", bootscript.Arch, bootscript.Organization, bootscript.Title)
|
s.Cache.InsertBootscript(bootscript.Identifier, "", bootscript.Arch, bootscript.Organization, bootscript.Title)
|
||||||
}
|
}
|
||||||
return &bootscripts.Bootscripts, nil
|
return &bootscripts.Bootscripts, nil
|
||||||
}
|
}
|
||||||
|
@ -1747,7 +1788,7 @@ func (s *ScalewayAPI) GetBootscript(bootscriptID string) (*ScalewayBootscript, e
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
// FIXME region, arch, owner, title
|
// FIXME region, arch, owner, title
|
||||||
s.Cache.InsertBootscript(oneBootscript.Bootscript.Identifier, "fr-1", oneBootscript.Bootscript.Arch, oneBootscript.Bootscript.Organization, oneBootscript.Bootscript.Title)
|
s.Cache.InsertBootscript(oneBootscript.Bootscript.Identifier, "", oneBootscript.Bootscript.Arch, oneBootscript.Bootscript.Organization, oneBootscript.Bootscript.Title)
|
||||||
return &oneBootscript.Bootscript, nil
|
return &oneBootscript.Bootscript, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1908,7 +1949,6 @@ func (s *ScalewayAPI) GetTasks() (*[]ScalewayTask, error) {
|
||||||
// CheckCredentials performs a dummy check to ensure we can contact the API
|
// CheckCredentials performs a dummy check to ensure we can contact the API
|
||||||
func (s *ScalewayAPI) CheckCredentials() error {
|
func (s *ScalewayAPI) CheckCredentials() error {
|
||||||
query := url.Values{}
|
query := url.Values{}
|
||||||
query.Set("token_id", s.Token)
|
|
||||||
|
|
||||||
resp, err := s.GetResponsePaginate(AccountAPI, "tokens", query)
|
resp, err := s.GetResponsePaginate(AccountAPI, "tokens", query)
|
||||||
if resp != nil {
|
if resp != nil {
|
||||||
|
@ -1917,10 +1957,25 @@ func (s *ScalewayAPI) CheckCredentials() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
body, err := s.handleHTTPError([]int{http.StatusOK}, resp)
|
||||||
if _, err := s.handleHTTPError([]int{http.StatusOK}, resp); err != nil {
|
if err != nil {
|
||||||
return err
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2060,11 +2115,12 @@ func showResolverResults(needle string, results ScalewayResolverResults) error {
|
||||||
w := tabwriter.NewWriter(os.Stderr, 20, 1, 3, ' ', 0)
|
w := tabwriter.NewWriter(os.Stderr, 20, 1, 3, ' ', 0)
|
||||||
defer w.Flush()
|
defer w.Flush()
|
||||||
sort.Sort(results)
|
sort.Sort(results)
|
||||||
|
fmt.Fprintf(w, " IMAGEID\tFROM\tNAME\tZONE\tARCH\n")
|
||||||
for _, result := range results {
|
for _, result := range results {
|
||||||
if result.Arch == "" {
|
if result.Arch == "" {
|
||||||
result.Arch = "n/a"
|
result.Arch = "n/a"
|
||||||
}
|
}
|
||||||
fmt.Fprintf(w, "- %s\t%s\t%s\t%s\n", result.TruncIdentifier(), result.CodeName(), result.Name, result.Arch)
|
fmt.Fprintf(w, "- %s\t%s\t%s\t%s\t%s\n", result.TruncIdentifier(), result.CodeName(), result.Name, result.Region, result.Arch)
|
||||||
}
|
}
|
||||||
return fmt.Errorf("Too many candidates for %s (%d)", needle, len(results))
|
return fmt.Errorf("Too many candidates for %s (%d)", needle, len(results))
|
||||||
}
|
}
|
||||||
|
@ -2118,6 +2174,19 @@ func FilterImagesByArch(res ScalewayResolverResults, arch string) (ret ScalewayR
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FilterImagesByRegion removes entry that doesn't match with region
|
||||||
|
func FilterImagesByRegion(res ScalewayResolverResults, region string) (ret ScalewayResolverResults) {
|
||||||
|
if region == "*" {
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
for _, result := range res {
|
||||||
|
if result.Region == region {
|
||||||
|
ret = append(ret, result)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// GetImageID returns exactly one image matching
|
// GetImageID returns exactly one image matching
|
||||||
func (s *ScalewayAPI) GetImageID(needle, arch string) (*ScalewayImageIdentifier, error) {
|
func (s *ScalewayAPI) GetImageID(needle, arch string) (*ScalewayImageIdentifier, error) {
|
||||||
// Parses optional type prefix, i.e: "image:name" -> "name"
|
// Parses optional type prefix, i.e: "image:name" -> "name"
|
||||||
|
@ -2128,17 +2197,18 @@ func (s *ScalewayAPI) GetImageID(needle, arch string) (*ScalewayImageIdentifier,
|
||||||
return nil, fmt.Errorf("Unable to resolve image %s: %s", needle, err)
|
return nil, fmt.Errorf("Unable to resolve image %s: %s", needle, err)
|
||||||
}
|
}
|
||||||
images = FilterImagesByArch(images, arch)
|
images = FilterImagesByArch(images, arch)
|
||||||
|
images = FilterImagesByRegion(images, s.Region)
|
||||||
if len(images) == 1 {
|
if len(images) == 1 {
|
||||||
return &ScalewayImageIdentifier{
|
return &ScalewayImageIdentifier{
|
||||||
Identifier: images[0].Identifier,
|
Identifier: images[0].Identifier,
|
||||||
Arch: images[0].Arch,
|
Arch: images[0].Arch,
|
||||||
// FIXME region, owner hardcoded
|
// FIXME region, owner hardcoded
|
||||||
Region: "fr-1",
|
Region: images[0].Region,
|
||||||
Owner: "",
|
Owner: "",
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
if len(images) == 0 {
|
if len(images) == 0 {
|
||||||
return nil, fmt.Errorf("No such image: %s", needle)
|
return nil, fmt.Errorf("No such image (zone %s, arch %s) : %s", s.Region, arch, needle)
|
||||||
}
|
}
|
||||||
return nil, showResolverResults(needle, images)
|
return nil, showResolverResults(needle, images)
|
||||||
}
|
}
|
||||||
|
@ -2796,3 +2866,14 @@ func (s *ScalewayAPI) DeleteMarketPlaceLocalImage(uuidImage, uuidVersion, uuidLo
|
||||||
_, err = s.handleHTTPError([]int{http.StatusNoContent}, resp)
|
_, err = s.handleHTTPError([]int{http.StatusNoContent}, resp)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResolveTTYUrl return an URL to get a tty
|
||||||
|
func (s *ScalewayAPI) ResolveTTYUrl() string {
|
||||||
|
switch s.Region {
|
||||||
|
case "par1", "":
|
||||||
|
return "https://tty-par1.scaleway.com/v2/"
|
||||||
|
case "ams1":
|
||||||
|
return "https://tty-ams1.scaleway.com"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
|
@ -29,7 +29,6 @@ const (
|
||||||
CacheTitle
|
CacheTitle
|
||||||
// CacheMarketPlaceUUID is used to determine the UUID of local images
|
// CacheMarketPlaceUUID is used to determine the UUID of local images
|
||||||
CacheMarketPlaceUUID
|
CacheMarketPlaceUUID
|
||||||
|
|
||||||
// CacheMaxfield is used to determine the size of array
|
// CacheMaxfield is used to determine the size of array
|
||||||
CacheMaxfield
|
CacheMaxfield
|
||||||
)
|
)
|
||||||
|
@ -87,13 +86,14 @@ type ScalewayResolverResult struct {
|
||||||
Arch string
|
Arch string
|
||||||
Needle string
|
Needle string
|
||||||
RankMatch int
|
RankMatch int
|
||||||
|
Region string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScalewayResolverResults is a list of `ScalewayResolverResult`
|
// ScalewayResolverResults is a list of `ScalewayResolverResult`
|
||||||
type ScalewayResolverResults []ScalewayResolverResult
|
type ScalewayResolverResults []ScalewayResolverResult
|
||||||
|
|
||||||
// NewScalewayResolverResult returns a new ScalewayResolverResult
|
// NewScalewayResolverResult returns a new ScalewayResolverResult
|
||||||
func NewScalewayResolverResult(Identifier, Name, Arch string, Type int) (ScalewayResolverResult, error) {
|
func NewScalewayResolverResult(Identifier, Name, Arch, Region string, Type int) (ScalewayResolverResult, error) {
|
||||||
if err := anonuuid.IsUUID(Identifier); err != nil {
|
if err := anonuuid.IsUUID(Identifier); err != nil {
|
||||||
return ScalewayResolverResult{}, err
|
return ScalewayResolverResult{}, err
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,7 @@ func NewScalewayResolverResult(Identifier, Name, Arch string, Type int) (Scalewa
|
||||||
Type: Type,
|
Type: Type,
|
||||||
Name: Name,
|
Name: Name,
|
||||||
Arch: Arch,
|
Arch: Arch,
|
||||||
|
Region: Region,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +269,7 @@ func (c *ScalewayCache) LookUpImages(needle string, acceptUUID bool) (ScalewayRe
|
||||||
|
|
||||||
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
||||||
if fields, ok := c.Images[needle]; ok {
|
if fields, ok := c.Images[needle]; ok {
|
||||||
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], IdentifierImage)
|
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -282,7 +283,7 @@ func (c *ScalewayCache) LookUpImages(needle string, acceptUUID bool) (ScalewayRe
|
||||||
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
||||||
for identifier, fields := range c.Images {
|
for identifier, fields := range c.Images {
|
||||||
if fields[CacheTitle] == needle {
|
if fields[CacheTitle] == needle {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierImage)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -290,14 +291,14 @@ func (c *ScalewayCache) LookUpImages(needle string, acceptUUID bool) (ScalewayRe
|
||||||
exactMatches = append(exactMatches, entry)
|
exactMatches = append(exactMatches, entry)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierImage)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
entry.ComputeRankMatch(needle)
|
entry.ComputeRankMatch(needle)
|
||||||
res = append(res, entry)
|
res = append(res, entry)
|
||||||
} else if strings.HasPrefix(fields[CacheMarketPlaceUUID], needle) || nameRegex.MatchString(fields[CacheMarketPlaceUUID]) {
|
} else if strings.HasPrefix(fields[CacheMarketPlaceUUID], needle) || nameRegex.MatchString(fields[CacheMarketPlaceUUID]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierImage)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -323,7 +324,7 @@ func (c *ScalewayCache) LookUpSnapshots(needle string, acceptUUID bool) (Scalewa
|
||||||
|
|
||||||
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
||||||
if fields, ok := c.Snapshots[needle]; ok {
|
if fields, ok := c.Snapshots[needle]; ok {
|
||||||
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], IdentifierSnapshot)
|
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -336,7 +337,7 @@ func (c *ScalewayCache) LookUpSnapshots(needle string, acceptUUID bool) (Scalewa
|
||||||
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
||||||
for identifier, fields := range c.Snapshots {
|
for identifier, fields := range c.Snapshots {
|
||||||
if fields[CacheTitle] == needle {
|
if fields[CacheTitle] == needle {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierSnapshot)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -344,7 +345,7 @@ func (c *ScalewayCache) LookUpSnapshots(needle string, acceptUUID bool) (Scalewa
|
||||||
exactMatches = append(exactMatches, entry)
|
exactMatches = append(exactMatches, entry)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierSnapshot)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -370,7 +371,7 @@ func (c *ScalewayCache) LookUpVolumes(needle string, acceptUUID bool) (ScalewayR
|
||||||
|
|
||||||
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
||||||
if fields, ok := c.Volumes[needle]; ok {
|
if fields, ok := c.Volumes[needle]; ok {
|
||||||
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], IdentifierVolume)
|
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierVolume)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -382,7 +383,7 @@ func (c *ScalewayCache) LookUpVolumes(needle string, acceptUUID bool) (ScalewayR
|
||||||
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
||||||
for identifier, fields := range c.Volumes {
|
for identifier, fields := range c.Volumes {
|
||||||
if fields[CacheTitle] == needle {
|
if fields[CacheTitle] == needle {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierVolume)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierVolume)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -390,7 +391,7 @@ func (c *ScalewayCache) LookUpVolumes(needle string, acceptUUID bool) (ScalewayR
|
||||||
exactMatches = append(exactMatches, entry)
|
exactMatches = append(exactMatches, entry)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierVolume)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierVolume)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -416,7 +417,7 @@ func (c *ScalewayCache) LookUpBootscripts(needle string, acceptUUID bool) (Scale
|
||||||
|
|
||||||
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
||||||
if fields, ok := c.Bootscripts[needle]; ok {
|
if fields, ok := c.Bootscripts[needle]; ok {
|
||||||
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], IdentifierBootscript)
|
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierBootscript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -428,7 +429,7 @@ func (c *ScalewayCache) LookUpBootscripts(needle string, acceptUUID bool) (Scale
|
||||||
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
||||||
for identifier, fields := range c.Bootscripts {
|
for identifier, fields := range c.Bootscripts {
|
||||||
if fields[CacheTitle] == needle {
|
if fields[CacheTitle] == needle {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierBootscript)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierBootscript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -436,7 +437,7 @@ func (c *ScalewayCache) LookUpBootscripts(needle string, acceptUUID bool) (Scale
|
||||||
exactMatches = append(exactMatches, entry)
|
exactMatches = append(exactMatches, entry)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierBootscript)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierBootscript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -462,7 +463,7 @@ func (c *ScalewayCache) LookUpServers(needle string, acceptUUID bool) (ScalewayR
|
||||||
|
|
||||||
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
if acceptUUID && anonuuid.IsUUID(needle) == nil {
|
||||||
if fields, ok := c.Servers[needle]; ok {
|
if fields, ok := c.Servers[needle]; ok {
|
||||||
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], IdentifierServer)
|
entry, err := NewScalewayResolverResult(needle, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -474,7 +475,7 @@ func (c *ScalewayCache) LookUpServers(needle string, acceptUUID bool) (ScalewayR
|
||||||
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
nameRegex := regexp.MustCompile(`(?i)` + regexp.MustCompile(`[_-]`).ReplaceAllString(needle, ".*"))
|
||||||
for identifier, fields := range c.Servers {
|
for identifier, fields := range c.Servers {
|
||||||
if fields[CacheTitle] == needle {
|
if fields[CacheTitle] == needle {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierServer)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -482,7 +483,7 @@ func (c *ScalewayCache) LookUpServers(needle string, acceptUUID bool) (ScalewayR
|
||||||
exactMatches = append(exactMatches, entry)
|
exactMatches = append(exactMatches, entry)
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
if strings.HasPrefix(identifier, needle) || nameRegex.MatchString(fields[CacheTitle]) {
|
||||||
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], IdentifierServer)
|
entry, err := NewScalewayResolverResult(identifier, fields[CacheTitle], fields[CacheArch], fields[CacheRegion], IdentifierServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -551,7 +552,7 @@ func (c *ScalewayCache) LookUpIdentifiers(needle string) (ScalewayResolverResult
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
for _, result := range servers {
|
for _, result := range servers {
|
||||||
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, IdentifierServer)
|
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, result.Region, IdentifierServer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -566,7 +567,7 @@ func (c *ScalewayCache) LookUpIdentifiers(needle string) (ScalewayResolverResult
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
for _, result := range images {
|
for _, result := range images {
|
||||||
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, IdentifierImage)
|
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, result.Region, IdentifierImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -581,7 +582,7 @@ func (c *ScalewayCache) LookUpIdentifiers(needle string) (ScalewayResolverResult
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
for _, result := range snapshots {
|
for _, result := range snapshots {
|
||||||
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, IdentifierSnapshot)
|
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, result.Region, IdentifierSnapshot)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -596,7 +597,7 @@ func (c *ScalewayCache) LookUpIdentifiers(needle string) (ScalewayResolverResult
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
for _, result := range volumes {
|
for _, result := range volumes {
|
||||||
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, IdentifierVolume)
|
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, result.Region, IdentifierVolume)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
@ -611,7 +612,7 @@ func (c *ScalewayCache) LookUpIdentifiers(needle string) (ScalewayResolverResult
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
for _, result := range bootscripts {
|
for _, result := range bootscripts {
|
||||||
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, IdentifierBootscript)
|
entry, err := NewScalewayResolverResult(result.Identifier, result.Name, result.Arch, result.Region, IdentifierBootscript)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ScalewayResolverResults{}, err
|
return ScalewayResolverResults{}, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ import "fmt"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// VERSION represents the semver version of the package
|
// VERSION represents the semver version of the package
|
||||||
VERSION = "v1.9.0+dev"
|
VERSION = "v1.11+dev"
|
||||||
|
|
||||||
// GITCOMMIT represents the git commit hash of the package, it is configured at build time
|
// GITCOMMIT represents the git commit hash of the package, it is configured at build time
|
||||||
GITCOMMIT string
|
GITCOMMIT string
|
||||||
|
|
Loading…
Reference in New Issue