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

     1  package security
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type SwitchSslOpts struct {
     9  	// Specifies the DB instance ID.
    10  	InstanceId string `json:"-"`
    11  	// Specifies whether to enable SSL.
    12  	// true: SSL is enabled.
    13  	// false: SSL is disabled.
    14  	SslOption bool `json:"ssl_option"`
    15  }
    16  
    17  // SwitchSsl This API is supported for MySQL only.
    18  func SwitchSsl(c *golangsdk.ServiceClient, opts SwitchSslOpts) (err error) {
    19  	b, err := build.RequestBody(opts, "")
    20  	if err != nil {
    21  		return
    22  	}
    23  
    24  	// PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/ssl
    25  	_, err = c.Put(c.ServiceURL("instances", opts.InstanceId, "ssl"), b, nil,
    26  		&golangsdk.RequestOpts{OkCodes: []int{200}})
    27  	return
    28  }