github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dds/v3/connection/KillSessions.go (about) 1 package connection 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type KillSessionsOpts struct { 9 // Specifies the node ID. The following nodes can be queried: mongos nodes in the cluster, and all nodes in the replica set and single node instances. 10 NodeId string `json:"-"` 11 // Specifies the IDs of sessions to be terminated. 12 Sessions []string `json:"sessions" required:"true"` 13 } 14 15 func KillSessions(client *golangsdk.ServiceClient, opts KillSessionsOpts) error { 16 b, err := build.RequestBody(opts, "") 17 if err != nil { 18 return err 19 } 20 21 // POST https://{Endpoint}/v3/{project_id}/nodes/{node_id}/session 22 _, err = client.Post(client.ServiceURL("nodes", opts.NodeId, "session"), b, nil, &golangsdk.RequestOpts{ 23 OkCodes: []int{200}, 24 }) 25 if err != nil { 26 return err 27 } 28 29 return nil 30 }