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

     1  package gateway
     2  
     3  import (
     4  	"github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     7  )
     8  
     9  type UpdateOpts struct {
    10  	ID               string `json:"-"`
    11  	Description      string `json:"description,omitempty"`
    12  	MaintainBegin    string `json:"maintain_begin,omitempty"`
    13  	MaintainEnd      string `json:"maintain_end,omitempty"`
    14  	InstanceName     string `json:"instance_name,omitempty"`
    15  	SecGroupID       string `json:"security_group_id,omitempty"`
    16  	VpcepServiceName string `json:"vpcep_service_name,omitempty"`
    17  }
    18  
    19  func Update(client *golangsdk.ServiceClient, opts UpdateOpts) (*Gateway, error) {
    20  	b, err := build.RequestBody(opts, "")
    21  	if err != nil {
    22  		return nil, err
    23  	}
    24  
    25  	raw, err := client.Put(client.ServiceURL("apigw", "instances", opts.ID), b, nil, &golangsdk.RequestOpts{
    26  		OkCodes: []int{200},
    27  	})
    28  	if err != nil {
    29  		return nil, err
    30  	}
    31  
    32  	var res Gateway
    33  
    34  	err = extract.Into(raw.Body, &res)
    35  	return &res, err
    36  }