mantle/platform: gcloud: use API endpoint for replacement in DeprecateImage
For the replacement in the images.deprecate API call we need the
string representation of the replacement to be the full API endpoint
for the image. Let's use the new getImageAPIEndpoint function to
calculate the image API endpoint given a short name representation.
@@ -159,6 +159,15 @@ func (a *API) GetPendingForImage(image *compute.Image) (*Pending, error) {
}
func (a *API) DeprecateImage(name string, state DeprecationState, replacement string) (*Pending, error) {
+ var err error
+
+ if replacement != "" {
+ replacement, err = getImageAPIEndpoint(replacement, a.options.Project)
+ if err != nil {
+ return nil, err
+ }
+ }
+
req := a.compute.Images.Deprecate(a.options.Project, name, &compute.DeprecationStatus{
State: string(state),
Replacement: replacement,
