-
Notifications
You must be signed in to change notification settings - Fork 7
/
DeleteIpsFromList.go
36 lines (32 loc) · 1.11 KB
/
DeleteIpsFromList.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
34
35
36
package ipgroups
import (
"github.com/opentelekomcloud/gophertelekomcloud"
"github.com/opentelekomcloud/gophertelekomcloud/internal/build"
"github.com/opentelekomcloud/gophertelekomcloud/internal/extract"
)
// DeleteIpFromList is used to create or update the ip list of specific ip group.
func DeleteIpFromList(c *golangsdk.ServiceClient, id string, opts BatchDeleteOpts) (*IpGroup, error) {
b, err := build.RequestBody(opts, "ipgroup")
if err != nil {
return nil, err
}
url := c.ServiceURL("ipgroups", id, "iplist", "batch-delete")
raw, err := c.Post(url, b, nil, &golangsdk.RequestOpts{
OkCodes: []int{200},
})
if err != nil {
return nil, err
}
var res IpGroup
err = extract.IntoStructPtr(raw.Body, &res, "ipgroup")
return &res, err
}
// BatchDeleteOpts contains all the values needed to perform BatchDelete on the IP address group.
type BatchDeleteOpts struct {
// Specifies IP addresses that will be deleted from an IP address group in batches.
IpList []IpList `json:"ip_list,omitempty"`
}
type IpList struct {
// Specifies the IP addresses in the IP address group.
Ip string `json:"ip" required:"true"`
}