From d55e4b7fdfc28353926533066393ea4bfc319ee3 Mon Sep 17 00:00:00 2001 From: Julien Castets Date: Thu, 28 Jun 2018 12:28:13 +0200 Subject: [PATCH] Allow to inspect snapshots, fixes #510 --- README.md | 4 ++-- pkg/api/api.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 2d05a8e9d6..8a9bdbc09e 100644 --- a/README.md +++ b/README.md @@ -1214,8 +1214,8 @@ $ scw inspect myserver | jq '.[0].public_ip.address' ### v1.16+dev (unreleased) -This is the current development version. Update below with your changes. Remove -this line when releasing the package. +* Fix: it is now possible to `scw inspect` snapshots +* Fix: add region details in cache for snapshots, images, bootscripts and volumes. View full [commits list](https://github.com/scaleway/scaleway-cli/compare/v1.16...master) diff --git a/pkg/api/api.go b/pkg/api/api.go index 0caa124dd8..7cfde14945 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -1382,7 +1382,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 +1414,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 +1690,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 +1713,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 +1740,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 +1763,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 +1789,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 +1812,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 }