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

     1  package lifecycle
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  // UpdateOpts is a struct which represents the parameters of update function
     9  type UpdateOpts struct {
    10  	// DCS instance name.
    11  	// An instance name is a string of 4–64 characters
    12  	// that contain letters, digits, underscores (_), and hyphens (-).
    13  	// An instance name must start with letters.
    14  	Name string `json:"name,omitempty"`
    15  	// Brief description of the DCS instance.
    16  	// A brief description supports up to 1024 characters.
    17  	Description string `json:"description,omitempty"`
    18  	// Backup policy.
    19  	// This parameter is available for master/standby DCS instances.
    20  	InstanceBackupPolicy *InstanceBackupPolicy `json:"instance_backup_policy,omitempty"`
    21  	// Time at which the maintenance time window starts.
    22  	// Format: HH:mm:ss
    23  	MaintainBegin string `json:"maintain_begin,omitempty"`
    24  	// Time at which the maintenance time window ends.
    25  	// Format: HH:mm:ss
    26  	MaintainEnd string `json:"maintain_end,omitempty"`
    27  	// Security group ID.
    28  	SecurityGroupID string `json:"security_group_id,omitempty"`
    29  }
    30  
    31  // Update is a method which can be able to update the instance
    32  // via accessing to the service with Put method and parameters
    33  func Update(client *golangsdk.ServiceClient, id string, opts UpdateOpts) (err error) {
    34  	body, err := build.RequestBody(opts, "")
    35  	if err != nil {
    36  		return
    37  	}
    38  
    39  	_, err = client.Put(client.ServiceURL("instances", id), body, nil, &golangsdk.RequestOpts{
    40  		OkCodes: []int{204},
    41  	})
    42  	return
    43  }