github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/fgs/v2/alias/PublishVersion.go (about) 1 package alias 2 3 import ( 4 golangsdk "github.com/opentelekomcloud/gophertelekomcloud" 5 "github.com/opentelekomcloud/gophertelekomcloud/internal/build" 6 "github.com/opentelekomcloud/gophertelekomcloud/internal/extract" 7 "github.com/opentelekomcloud/gophertelekomcloud/openstack/fgs/v2/function" 8 ) 9 10 type PublishOpts struct { 11 FuncUrn string `json:"-"` 12 Digest string `json:"digest,omitempty"` 13 Version string `json:"version,omitempty"` 14 Description string `json:"description,omitempty"` 15 } 16 17 func PublishVersion(client *golangsdk.ServiceClient, opts PublishOpts) (*function.FuncGraph, error) { 18 b, err := build.RequestBody(opts, "") 19 if err != nil { 20 return nil, err 21 } 22 23 raw, err := client.Post(client.ServiceURL("fgs", "functions", opts.FuncUrn, "versions"), b, nil, &golangsdk.RequestOpts{ 24 OkCodes: []int{200}, 25 }) 26 if err != nil { 27 return nil, err 28 } 29 30 var res function.FuncGraph 31 return &res, extract.Into(raw.Body, &res) 32 }