Skip to content

Commit

Permalink
Add checksum gates for powervs (#372)
Browse files Browse the repository at this point in the history
  • Loading branch information
ismirlia authored Apr 5, 2024
1 parent cac5670 commit a992fec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions clients/instance/ibm-pi-image.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions clients/instance/ibm-pi-instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit a992fec

Please sign in to comment.