github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/dcs/v1/configs/Update.go (about)

     1  package configs
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type UpdateOpts struct {
     9  	// Array of configuration items of the DCS instance.
    10  	RedisConfigs []RedisConfig `json:"redis_config" required:"true"`
    11  }
    12  
    13  type RedisConfig struct {
    14  	// Configuration item ID.
    15  	ParamID string `json:"param_id" required:"true"`
    16  	// Configuration item name.
    17  	ParamName string `json:"param_name" required:"true"`
    18  	// Value of the configuration item.
    19  	ParamValue string `json:"param_value" required:"true"`
    20  }
    21  
    22  func Update(client *golangsdk.ServiceClient, instanceID string, opts UpdateOpts) (err error) {
    23  	b, err := build.RequestBody(opts, "")
    24  	if err != nil {
    25  		return
    26  	}
    27  
    28  	_, err = client.Put(client.ServiceURL("instances", instanceID, "configs"), b, nil, &golangsdk.RequestOpts{
    29  		OkCodes: []int{204},
    30  	})
    31  	return
    32  }