github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/instances/ChangeOpsWindow.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 ChangeOpsWindowOpts struct {
     9  	InstanceId string `json:"-"`
    10  	// Specifies the start time.
    11  	// The value must be a valid value in the "HH:MM" format. The current time is in the UTC format.
    12  	StartTime string `json:"start_time"`
    13  	// Specifies the end time.
    14  	// The value must be a valid value in the "HH:MM" format. The current time is in the UTC format.
    15  	// NOTE
    16  	// The interval between the start time and end time must be four hours.
    17  	EndTime string `json:"end_time"`
    18  }
    19  
    20  func ChangeOpsWindow(client *golangsdk.ServiceClient, opts ChangeOpsWindowOpts) (err error) {
    21  	b, err := build.RequestBody(opts, "")
    22  	if err != nil {
    23  		return
    24  	}
    25  
    26  	// PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/ops-window
    27  	_, err = client.Put(client.ServiceURL("instances", opts.InstanceId, "ops-window"), b, nil, &golangsdk.RequestOpts{
    28  		OkCodes: []int{200},
    29  	})
    30  	return
    31  }