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

     1  package invoke
     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  func LaunchAsync(client *golangsdk.ServiceClient, funcUrn string, opts map[string]string) (*LaunchAsyncResp, error) {
    10  	b, err := build.RequestBody(opts, "body")
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	raw, err := client.Post(client.ServiceURL("fgs", "functions", funcUrn, "invocations-async"), b, nil, &golangsdk.RequestOpts{
    16  		OkCodes: []int{202},
    17  	})
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	var res LaunchAsyncResp
    23  	return &res, extract.Into(raw.Body, &res)
    24  }
    25  
    26  type LaunchAsyncResp struct {
    27  	RequestID string `json:"request_id"`
    28  }