You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decort-golang-sdk/pkg/cloudbroker/image/computeci_unset.go

42 lines
726 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package image
import (
"context"
"errors"
"net/http"
"strconv"
)
type ComputeCIUnsetRequest struct {
ImageID uint64 `url:"imageId"`
}
func (irq ComputeCIUnsetRequest) Validate() error {
if irq.ImageID == 0 {
return errors.New("validation-error: field ImageID must be set")
}
return nil
}
func (i Image) ComputeCIUnset(ctx context.Context, req ComputeCIUnsetRequest) (bool, error) {
err := req.Validate()
if err != nil {
return false, err
}
url := "/cloudbroker/image/сomputeciUnset"
res, err := i.client.DecortApiCall(ctx, http.MethodPost, url, req)
if err != nil {
return false, err
}
result, err := strconv.ParseBool(string(res))
if err != nil {
return false, err
}
return result, nil
}