github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/configurations/UpdateInstanceConfiguration.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/internal/extract"
     7  )
     8  
     9  type UpdateInstanceConfigurationOpts struct {
    10  	// Specifies the DB instance ID.
    11  	InstanceId string `json:"-"`
    12  	// Specifies the parameter values defined by users based on the default parameter templates.
    13  	// For example, "max_connections": "10"
    14  	Values map[string]interface{} `json:"values"`
    15  }
    16  
    17  func UpdateInstanceConfiguration(client *golangsdk.ServiceClient, opts UpdateInstanceConfigurationOpts) (*UpdateInstanceConfigurationResponse, error) {
    18  	b, err := build.RequestBody(opts, "")
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  
    23  	// PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/configurations
    24  	raw, err := client.Put(client.ServiceURL("instances", opts.InstanceId, "configurations"), b, nil, &golangsdk.RequestOpts{
    25  		OkCodes: []int{200},
    26  	})
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	var res UpdateInstanceConfigurationResponse
    32  	err = extract.Into(raw.Body, &res)
    33  	return &res, err
    34  }
    35  
    36  type UpdateInstanceConfigurationResponse struct {
    37  	// Indicates whether a reboot is required.
    38  	RestartRequired bool   `json:"restart_required"`
    39  	JobId           string `json:"job_id"`
    40  	// List of ignored parameters.
    41  	// If a parameter does not exist or is read-only, the parameter cannot be modified and the names of all ignored parameters are returned by ignored_params.
    42  	IgnoredParams []string `json:"ignored_params"`
    43  }