github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/apigw/v2/gateway/EnableEIP.go (about)

     1  package gateway
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  type EipOpts struct {
     9  	ID                    string `json:"-"`
    10  	BandwidthSize         string `json:"bandwidth_size,omitempty"`
    11  	BandwidthChargingMode string `json:"bandwidth_charging_mode,omitempty"`
    12  }
    13  
    14  func EnableEIP(client *golangsdk.ServiceClient, opts EipOpts) error {
    15  	b, err := build.RequestBody(opts, "")
    16  	if err != nil {
    17  		return err
    18  	}
    19  
    20  	_, err = client.Post(client.ServiceURL("apigw", "instances", opts.ID, "nat-eip"), b, nil, &golangsdk.RequestOpts{
    21  		OkCodes: []int{200},
    22  	})
    23  	if err != nil {
    24  		return err
    25  	}
    26  
    27  	return nil
    28  }