github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dataarts/v1.1/cluster/Restart.go (about)

     1  package cluster
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type RestartOpts struct {
     9  	Id      string        `json:"-"`
    10  	Restart RestartStruct `json:"restart" required:"true"`
    11  }
    12  
    13  type RestartStruct struct {
    14  	StopMode     int    `json:"restartDelayTime,omitempty"`
    15  	RestartMode  string `json:"restartMode,omitempty"`
    16  	RestartLevel string `json:"restartLevel,omitempty"`
    17  	Type         string `json:"type,omitempty"`
    18  	Instance     string `json:"instance,omitempty"`
    19  	Group        string `json:"group,omitempty"`
    20  }
    21  
    22  func Restart(client *golangsdk.ServiceClient, opts RestartOpts) (*JobId, error) {
    23  	b, err := build.RequestBody(opts, "")
    24  	if err != nil {
    25  		return nil, err
    26  	}
    27  	// POST /v1.1/{project_id}/clusters/{cluster_id}/action
    28  	raw, err := client.Post(client.ServiceURL("clusters", opts.Id, "action"), b, nil, &golangsdk.RequestOpts{
    29  		MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en"},
    30  	})
    31  	return extraJob(err, raw)
    32  }