-
Notifications
You must be signed in to change notification settings - Fork 7
/
UpdateAlias.go
33 lines (28 loc) · 1.17 KB
/
UpdateAlias.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package alias
import (
golangsdk "github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
)
type UpdateAliasOpts struct {
FuncUrn string `json:"-"`
AliasName string `json:"-"`
Version string `json:"version" required:"true"`
Description string `json:"description,omitempty"`
AdditionalVersionWeights map[string]int `json:"additional_version_weights,omitempty"`
AdditionalVersionStrategy map[string]VectorStrategy `json:"additional_version_strategy,omitempty"`
}
func UpdateAlias(client *golangsdk.ServiceClient, opts UpdateAliasOpts) (*FuncAliasesResp, error) {
b, err := build.RequestBody(opts, "")
if err != nil {
return nil, err
}
raw, err := client.Put(client.ServiceURL("fgs", "functions", opts.FuncUrn, "aliases", opts.AliasName), b, nil, &golangsdk.RequestOpts{
OkCodes: []int{200},
})
if err != nil {
return nil, err
}
var res FuncAliasesResp
return &res, extract.Into(raw.Body, &res)
}