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

     1  package gateway
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  )
     7  
     8  // ElbIngressAccessOpts is the structure that used to bind ingress EIP to instance when loadbalancer_provider is set to elb.
     9  type ElbIngressAccessOpts struct {
    10  	// The APIG dedicated instance ID.
    11  	InstanceId string `json:"-"`
    12  	// Public inbound access bandwidth.
    13  	IngressBandwithSize int `json:"bandwidth_size" required:"true"`
    14  	// Billing type of the public inbound access bandwidth.
    15  	// + bandwidth: billed by bandwidth.
    16  	// + traffic: billed by traffic.
    17  	IngressBandwithChargingMode string `json:"bandwidth_charging_mode" required:"true"`
    18  }
    19  
    20  // EnableElbIngressAccess is a method to bind the ingress eip associated with an existing APIG dedicated instance.
    21  // Supported only when loadbalancer_provider is set to elb.
    22  func EnableElbIngressAccess(client *golangsdk.ServiceClient, opts ElbIngressAccessOpts) (*GatewayResp, error) {
    23  	b, err := build.RequestBody(opts, "")
    24  	if err != nil {
    25  		return nil, err
    26  	}
    27  	var r GatewayResp
    28  	_, err = client.Post(client.ServiceURL("apigw", "instances", opts.InstanceId, "ingress-eip"), b, &r, &golangsdk.RequestOpts{})
    29  	return &r, err
    30  }