-
Notifications
You must be signed in to change notification settings - Fork 1
/
pool_srv.go
82 lines (70 loc) · 2.27 KB
/
pool_srv.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright e-Xpert Solutions SA. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gtm
import "github.com/hillmai/f5client/f5"
// PoolSRVEndpoint represents the REST resource for managing PoolSRV.
const PoolSRVEndpoint = "/pool/srv"
// PoolSRVResource provides an API to manage PoolSRV configurations.
type PoolSRVResource struct {
c *f5.Client
}
// ListAll lists all the PoolSRV configurations.
func (r *PoolSRVResource) ListAll() (*PoolList, error) {
var list PoolList
if err := r.c.ReadQuery(BasePath+PoolSRVEndpoint, &list); err != nil {
return nil, err
}
return &list, nil
}
// Get a single PoolSRV configuration identified by id.
func (r *PoolSRVResource) Get(id string) (*Pool, error) {
var item Pool
if err := r.c.ReadQuery(BasePath+PoolSRVEndpoint, &item); err != nil {
return nil, err
}
return &item, nil
}
// GetSRVMembers lists all the PoolMembers configurations.
func (r *PoolAResource) GetSRVMembers(id string) (*PoolMembersList, error) {
var list PoolMembersList
if err := r.c.ReadQuery(BasePath+PoolSRVEndpoint+"/"+id+"/members", &list); err != nil {
return nil, err
}
return &list, nil
}
// Create a new PoolSRV configuration.
func (r *PoolSRVResource) Create(item Pool) error {
if err := r.c.ModQuery("POST", BasePath+PoolSRVEndpoint, item); err != nil {
return err
}
return nil
}
// Edit a PoolSRV configuration identified by id.
func (r *PoolSRVResource) Edit(id string, item Pool) error {
if err := r.c.ModQuery("PUT", BasePath+PoolSRVEndpoint+"/"+id, item); err != nil {
return err
}
return nil
}
// Delete a single PoolSRV configuration identified by id.
func (r *PoolSRVResource) Delete(id string) error {
if err := r.c.ModQuery("DELETE", BasePath+PoolSRVEndpoint+"/"+id, nil); err != nil {
return err
}
return nil
}
func (pr *PoolSRVResource) ShowSRVStats(id string) (*PoolStatsList, error) {
var item PoolStatsList
if err := pr.c.ReadQuery(BasePath+PoolSRVEndpoint+"/"+id+"/stats", &item); err != nil {
return nil, err
}
return &item, nil
}
func (pr *PoolSRVResource) ShowAllSRVStats() (*PoolStatsList, error) {
var item PoolStatsList
if err := pr.c.ReadQuery(BasePath+PoolSRVEndpoint+"/stats", &item); err != nil {
return nil, err
}
return &item, nil
}