package bservice import ( "context" "net/http" "strconv" "repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators" ) // Request struct for stop service type StopRequest struct { // ID of the service to stop // Required: true ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"` } // Stop stops service. // Stopping a service technically means stopping computes from // all service groups func (b BService) Stop(ctx context.Context, req StopRequest) (bool, error) { err := validators.ValidateRequest(req) if err != nil { for _, validationError := range validators.GetErrors(err) { return false, validators.ValidationError(validationError) } } url := "/cloudapi/bservice/stop" res, err := b.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 }