github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/instances/UpdateInstanceName.go (about) 1 package instances 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 ) 7 8 type UpdateInstanceNameOpts struct { 9 InstanceId string `json:"-"` 10 // Specifies the DB instance name. 11 // DB instances of the same type can have same names under the same tenant. 12 // The parameter must be 4 to 64 characters long, start with a letter, and contain only letters (case-sensitive), digits, hyphens (-), and underscores (_). 13 Name string `json:"name"` 14 } 15 16 func UpdateInstanceName(client *golangsdk.ServiceClient, opts UpdateInstanceNameOpts) (err error) { 17 b, err := build.RequestBody(opts, "") 18 if err != nil { 19 return 20 } 21 22 // PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/name 23 _, err = client.Put(client.ServiceURL("instances", opts.InstanceId, "name"), b, nil, &golangsdk.RequestOpts{ 24 OkCodes: []int{200}, 25 }) 26 return 27 }