/
dos_profile_protocol_sip.go
68 lines (57 loc) · 2.42 KB
/
dos_profile_protocol_sip.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
// 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 security
import "github.com/e-XpertSolutions/f5-rest-client/f5"
// DOSProfileProtocolSIPConfigList holds a list of DOSProfileProtocolSIP configuration.
type DOSProfileProtocolSIPConfigList struct {
Items []DOSProfileProtocolSIPConfig `json:"items"`
Kind string `json:"kind"`
SelfLink string `json:"selflink"`
}
// DOSProfileProtocolSIPConfig holds the configuration of a single DOSProfileProtocolSIP.
type DOSProfileProtocolSIPConfig struct {
}
// DOSProfileProtocolSIPEndpoint represents the REST resource for managing DOSProfileProtocolSIP.
const DOSProfileProtocolSIPEndpoint = "/dos/profile_protocol-sip"
// DOSProfileProtocolSIPResource provides an API to manage DOSProfileProtocolSIP configurations.
type DOSProfileProtocolSIPResource struct {
c *f5.Client
}
// ListAll lists all the DOSProfileProtocolSIP configurations.
func (r *DOSProfileProtocolSIPResource) ListAll() (*DOSProfileProtocolSIPConfigList, error) {
var list DOSProfileProtocolSIPConfigList
if err := r.c.ReadQuery(BasePath+DOSProfileProtocolSIPEndpoint, &list); err != nil {
return nil, err
}
return &list, nil
}
// Get a single DOSProfileProtocolSIP configuration identified by id.
func (r *DOSProfileProtocolSIPResource) Get(id string) (*DOSProfileProtocolSIPConfig, error) {
var item DOSProfileProtocolSIPConfig
if err := r.c.ReadQuery(BasePath+DOSProfileProtocolSIPEndpoint, &item); err != nil {
return nil, err
}
return &item, nil
}
// Create a new DOSProfileProtocolSIP configuration.
func (r *DOSProfileProtocolSIPResource) Create(item DOSProfileProtocolSIPConfig) error {
if err := r.c.ModQuery("POST", BasePath+DOSProfileProtocolSIPEndpoint, item); err != nil {
return err
}
return nil
}
// Edit a DOSProfileProtocolSIP configuration identified by id.
func (r *DOSProfileProtocolSIPResource) Edit(id string, item DOSProfileProtocolSIPConfig) error {
if err := r.c.ModQuery("PUT", BasePath+DOSProfileProtocolSIPEndpoint+"/"+id, item); err != nil {
return err
}
return nil
}
// Delete a single DOSProfileProtocolSIP configuration identified by id.
func (r *DOSProfileProtocolSIPResource) Delete(id string) error {
if err := r.c.ModQuery("DELETE", BasePath+DOSProfileProtocolSIPEndpoint+"/"+id, nil); err != nil {
return err
}
return nil
}