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

     1  package security
     2  
     3  import (
     4  	"net/http"
     5  
     6  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     7  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     8  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     9  )
    10  
    11  type UpdatePortOpts struct {
    12  	InstanceId string `json:"-"`
    13  	// Specifies port information for all DB engines.
    14  	// The MySQL database port ranges from 1024 to 65535 (excluding 12017 and 33071, which are occupied by the RDS system and cannot be used).
    15  	// The PostgreSQL database port ranges from 2100 to 9500.
    16  	// The Microsoft SQL Server database port is 1433 or ranges from 2100 to 9500 (excluding 5355 and 5985).
    17  	// The default values is as follows:
    18  	// The default value of MySQL is 3306.
    19  	// The default value of PostgreSQL is 5432.
    20  	// The default value of Microsoft SQL Server is 1433.
    21  	Port int32 `json:"port"`
    22  }
    23  
    24  func UpdatePort(c *golangsdk.ServiceClient, opts UpdatePortOpts) (*string, error) {
    25  	b, err := build.RequestBody(opts, "")
    26  	if err != nil {
    27  		return nil, err
    28  	}
    29  
    30  	// PUT https://{Endpoint}/v3/{project_id}/instances/{instance_id}/port
    31  	raw, err := c.Put(c.ServiceURL("instances", opts.InstanceId, "port"), b, nil,
    32  		&golangsdk.RequestOpts{OkCodes: []int{200}})
    33  	return extra(err, raw)
    34  }
    35  
    36  func extra(err error, raw *http.Response) (*string, error) {
    37  	if err != nil {
    38  		return nil, err
    39  	}
    40  
    41  	var res WorkflowId
    42  	err = extract.Into(raw.Body, &res)
    43  	return &res.WorkflowId, err
    44  }
    45  
    46  type WorkflowId struct {
    47  	WorkflowId string `json:"workflowId"`
    48  }