-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathawscli.go
192 lines (155 loc) · 6.66 KB
/
awscli.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
package objects
// THIS FILE IS AUTO GENERATED BY bin/gen.go! DO NOT EDIT!
import (
"fmt"
"github.com/esurdam/go-sophos"
)
// Awscli is a generated struct representing the Sophos Awscli Endpoint
// GET /api/nodes/awscli
type Awscli struct {
Profiles []interface{} `json:"profiles"`
}
var _ sophos.Endpoint = &Awscli{}
var defsAwscli = map[string]sophos.RestObject{
"AwscliGroup": &AwscliGroup{},
"AwscliProfile": &AwscliProfile{},
}
// RestObjects implements the sophos.Node interface and returns a map of Awscli's Objects
func (Awscli) RestObjects() map[string]sophos.RestObject { return defsAwscli }
// GetPath implements sophos.RestGetter
func (*Awscli) GetPath() string { return "/api/nodes/awscli" }
// RefRequired implements sophos.RestGetter
func (*Awscli) RefRequired() (string, bool) { return "", false }
var defAwscli = &sophos.Definition{Description: "awscli", Name: "awscli", Link: "/api/definitions/awscli"}
// Definition returns the /api/definitions struct of Awscli
func (Awscli) Definition() sophos.Definition { return *defAwscli }
// ApiRoutes returns all known Awscli Paths
func (Awscli) ApiRoutes() []string {
return []string{
"/api/objects/awscli/group/",
"/api/objects/awscli/group/{ref}",
"/api/objects/awscli/group/{ref}/usedby",
"/api/objects/awscli/profile/",
"/api/objects/awscli/profile/{ref}",
"/api/objects/awscli/profile/{ref}/usedby",
}
}
// References returns the Awscli's references. These strings serve no purpose other than to demonstrate which
// Reference keys are used for this Endpoint
func (Awscli) References() []string {
return []string{
"REF_AwscliGroup",
"REF_AwscliProfile",
}
}
// AwscliGroups is an Sophos Endpoint subType and implements sophos.RestObject
type AwscliGroups []AwscliGroup
// AwscliGroup represents a UTM awscli->group
type AwscliGroup struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
Comment string `json:"comment"`
Name string `json:"name"`
}
var _ sophos.RestGetter = &AwscliGroup{}
// GetPath implements sophos.RestObject and returns the AwscliGroups GET path
// Returns all available awscli/group objects
func (*AwscliGroups) GetPath() string { return "/api/objects/awscli/group/" }
// RefRequired implements sophos.RestObject
func (*AwscliGroups) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AwscliGroups GET path
// Returns all available group types
func (a *AwscliGroup) GetPath() string {
return fmt.Sprintf("/api/objects/awscli/group/%s", a.Reference)
}
// RefRequired implements sophos.RestObject
func (a *AwscliGroup) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AwscliGroup DELETE path
// Creates or updates the complete object group
func (*AwscliGroup) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/group/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AwscliGroup PATCH path
// Changes to parts of the object group types
func (*AwscliGroup) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/group/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AwscliGroup POST path
// Create a new awscli/group object
func (*AwscliGroup) PostPath() string {
return "/api/objects/awscli/group/"
}
// PutPath implements sophos.RestObject and returns the AwscliGroup PUT path
// Creates or updates the complete object group
func (*AwscliGroup) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/group/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AwscliGroup) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/group/%s/usedby", ref)
}
// AwscliProfiles is an Sophos Endpoint subType and implements sophos.RestObject
type AwscliProfiles []AwscliProfile
// AwscliProfile represents a UTM AWS CLI Profile
type AwscliProfile struct {
Locked string `json:"_locked"`
ObjectType string `json:"_type"`
Reference string `json:"_ref"`
// AwsAccessKeyId description: (REGEX)
// AwsAccessKeyId default value is ""
AwsAccessKeyId string `json:"aws_access_key_id"`
// AwsSecretAccessKey default value is ""
AwsSecretAccessKey string `json:"aws_secret_access_key"`
// AwsSessionToken default value is ""
AwsSessionToken string `json:"aws_session_token"`
Comment string `json:"comment"`
Name string `json:"name"`
// Output can be one of: []string{"json", "text", "table"}
// Output default value is "json"
Output string `json:"output"`
// ProfileName description: (REGEX)
// ProfileName default value is "default"
ProfileName string `json:"profile_name"`
// Region description: REF(aws/region)
Region string `json:"region"`
}
var _ sophos.RestGetter = &AwscliProfile{}
// GetPath implements sophos.RestObject and returns the AwscliProfiles GET path
// Returns all available awscli/profile objects
func (*AwscliProfiles) GetPath() string { return "/api/objects/awscli/profile/" }
// RefRequired implements sophos.RestObject
func (*AwscliProfiles) RefRequired() (string, bool) { return "", false }
// GetPath implements sophos.RestObject and returns the AwscliProfiles GET path
// Returns all available profile types
func (a *AwscliProfile) GetPath() string {
return fmt.Sprintf("/api/objects/awscli/profile/%s", a.Reference)
}
// RefRequired implements sophos.RestObject
func (a *AwscliProfile) RefRequired() (string, bool) { return a.Reference, true }
// DeletePath implements sophos.RestObject and returns the AwscliProfile DELETE path
// Creates or updates the complete object profile
func (*AwscliProfile) DeletePath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/profile/%s", ref)
}
// PatchPath implements sophos.RestObject and returns the AwscliProfile PATCH path
// Changes to parts of the object profile types
func (*AwscliProfile) PatchPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/profile/%s", ref)
}
// PostPath implements sophos.RestObject and returns the AwscliProfile POST path
// Create a new awscli/profile object
func (*AwscliProfile) PostPath() string {
return "/api/objects/awscli/profile/"
}
// PutPath implements sophos.RestObject and returns the AwscliProfile PUT path
// Creates or updates the complete object profile
func (*AwscliProfile) PutPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/profile/%s", ref)
}
// UsedByPath implements sophos.RestObject
// Returns the objects and the nodes that use the object with the given ref
func (*AwscliProfile) UsedByPath(ref string) string {
return fmt.Sprintf("/api/objects/awscli/profile/%s/usedby", ref)
}