github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/configurations/Update.go (about)

     1  package configurations
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/openstack"
     7  )
     8  
     9  // UpdateOpts contains all the values needed to update a Configuration.
    10  type UpdateOpts struct {
    11  	// Specifies the parameter template ID.
    12  	ConfigId string
    13  	// Specifies the parameter template name. It contains a maximum of 64 characters and can contain only uppercase letters, lowercase letters, digits, hyphens (-), underscores (_), and periods (.).
    14  	Name string `json:"name,omitempty"`
    15  	// Specifies the parameter template description. It contains a maximum of 256 characters and does not support the following special characters: !<>='&" Its value is left blank by default.
    16  	Description string `json:"description,omitempty"`
    17  	// Specifies the parameter values defined by users based on the default parameter template. If this parameter is left blank, the parameter value cannot be changed.
    18  	Values map[string]string `json:"values,omitempty"`
    19  }
    20  
    21  // Update accepts a UpdateOpts struct and uses the values to update a Configuration.The response code from api is 200
    22  func Update(c *golangsdk.ServiceClient, opts UpdateOpts) (err error) {
    23  	b, err := build.RequestBody(opts, "")
    24  	if err != nil {
    25  		return
    26  	}
    27  
    28  	// PUT https://{Endpoint}/v3/{project_id}/configurations/{config_id}
    29  	_, err = c.Put(c.ServiceURL("configurations", opts.ConfigId), b, nil,
    30  		&golangsdk.RequestOpts{OkCodes: []int{200}, MoreHeaders: openstack.StdRequestOpts().MoreHeaders})
    31  
    32  	return
    33  }