github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/rds/v3/security/SetSecurityGroup.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 SetSecurityGroupOpts struct {
     9  	InstanceId string `json:"-"`
    10  	// Specifies the security group ID.
    11  	SecurityGroupId string `json:"security_group_id" required:"true"`
    12  }
    13  
    14  func SetSecurityGroup(c *golangsdk.ServiceClient, opts SetSecurityGroupOpts) (*string, error) {
    15  	b, err := build.RequestBody(opts, "")
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	// PUT /v3/{project_id}/instances/{instance_id}/security-group
    21  	raw, err := c.Put(c.ServiceURL("instances", opts.InstanceId, "security-group"), b, nil,
    22  		&golangsdk.RequestOpts{OkCodes: []int{200}})
    23  	return extra(err, raw)
    24  }