github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/fgs/v2/function/UpdateMaxInstances.go (about)

     1  package function
     2  
     3  import (
     4  	golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
     5  	"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
     6  	"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
     7  )
     8  
     9  type UpdateFuncInstancesOpts struct {
    10  	FuncUrn        string `json:"-"`
    11  	MaxInstanceNum int    `json:"max_instance_num,omitempty"`
    12  }
    13  
    14  func UpdateMaxInstances(client *golangsdk.ServiceClient, opts UpdateFuncInstancesOpts) (*FuncGraph, error) {
    15  	b, err := build.RequestBody(opts, "")
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	raw, err := client.Put(client.ServiceURL("fgs", "functions", opts.FuncUrn, "config-max-instance"), b, nil, &golangsdk.RequestOpts{
    21  		OkCodes: []int{200},
    22  	})
    23  	if err != nil {
    24  		return nil, err
    25  	}
    26  
    27  	var res FuncGraph
    28  	return &res, extract.Into(raw.Body, &res)
    29  }