From a992fec8ad4c80110a885af8e179747b6f920334 Mon Sep 17 00:00:00 2001 From: ismirlia <90468712+ismirlia@users.noreply.github.com> Date: Fri, 5 Apr 2024 10:10:53 -0500 Subject: [PATCH] Add checksum gates for powervs (#372) --- clients/instance/ibm-pi-image.go | 8 ++++++++ clients/instance/ibm-pi-instance.go | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/clients/instance/ibm-pi-image.go b/clients/instance/ibm-pi-image.go index b93be950..9ac2796d 100644 --- a/clients/instance/ibm-pi-image.go +++ b/clients/instance/ibm-pi-image.go @@ -79,6 +79,10 @@ func (f *IBMPIImageClient) Create(body *models.CreateImage) (*models.Image, erro // Import an Image func (f *IBMPIImageClient) CreateCosImage(body *models.CreateCosImageImportJob) (imageJob *models.JobReference, err error) { + // Check for satellite differences in this endpoint + if !f.session.IsOnPrem() && body.Checksum { + return nil, fmt.Errorf("checksum parameter is not supported off-premise") + } params := p_cloud_images.NewPcloudV1CloudinstancesCosimagesPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithBody(body) @@ -94,6 +98,10 @@ func (f *IBMPIImageClient) CreateCosImage(body *models.CreateCosImageImportJob) // Export an Image func (f *IBMPIImageClient) ExportImage(id string, body *models.ExportImage) (*models.JobReference, error) { + // Check for satellite differences in this endpoint + if !f.session.IsOnPrem() && body.Checksum { + return nil, fmt.Errorf("checksum parameter is not supported off-premise") + } params := p_cloud_images.NewPcloudV2ImagesExportPostParams(). WithContext(f.ctx).WithTimeout(helpers.PICreateTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithImageID(id).WithBody(body) diff --git a/clients/instance/ibm-pi-instance.go b/clients/instance/ibm-pi-instance.go index 9eea9685..5c5ef5b5 100644 --- a/clients/instance/ibm-pi-instance.go +++ b/clients/instance/ibm-pi-instance.go @@ -176,6 +176,10 @@ func (f *IBMPIInstanceClient) UpdateConsoleLanguage(id string, body *models.Cons // Capture an Instance func (f *IBMPIInstanceClient) CaptureInstanceToImageCatalog(id string, body *models.PVMInstanceCapture) error { + // Check for satellite differences in this endpoint + if !f.session.IsOnPrem() && body.Checksum { + return fmt.Errorf("checksum parameter is not supported off-premise") + } params := p_cloud_p_vm_instances.NewPcloudPvminstancesCapturePostParams(). WithContext(f.ctx).WithTimeout(helpers.PIGetTimeOut). WithCloudInstanceID(f.cloudInstanceID).WithPvmInstanceID(id).