github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/instances/Restart.go (about)

     1  package instances
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type RestartOpts struct {
     9  	// Specifies the instance ID, which can be obtained by calling the API for querying instances.
    10  	InstanceId string `json:"-"`
    11  	// Specifies the type of the object to restart.
    12  	//
    13  	// This parameter is mandatory when you restart one or more nodes of a cluster instance.
    14  	// Set the value to mongos if mongos nodes are restarted.
    15  	// Set the value to shard if shard nodes are restarted.
    16  	// Set the value to config if config nodes are restarted.
    17  	// This parameter is not transferred when the DB instance is restarted.
    18  	TargetType string `json:"target_type,omitempty"`
    19  	// Specifies the ID of the object to be restarted, which can be obtained by calling the API for querying instances. If you do not have an instance, you can call the API used for creating an instance.
    20  	//
    21  	// In a cluster instance, the value is the ID of the node to restart.
    22  	// When you restart the entire DB instance, the value is the DB instance ID.
    23  	TargetId string `json:"target_id" required:"true"`
    24  }
    25  
    26  func Restart(client *golangsdk.ServiceClient, opts RestartOpts) (*string, error) {
    27  	b, err := build.RequestBody(opts, "")
    28  	if err != nil {
    29  		return nil, err
    30  	}
    31  
    32  	// POST https://{Endpoint}/v3/{project_id}/instances/{instance_id}/restart
    33  	raw, err := client.Post(client.ServiceURL("instances", opts.InstanceId, "restart"), b, nil, nil)
    34  	return extractJob(err, raw)
    35  }