forked from scaleway/scaleway-cli
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaudit_trail_cli.go
177 lines (164 loc) · 5.54 KB
/
audit_trail_cli.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
// This file was automatically generated. DO NOT EDIT.
// If you have any remark or suggestion do not hesitate to open an issue.
package audit_trail
import (
"context"
"reflect"
"github.com/scaleway/scaleway-cli/v2/core"
"github.com/scaleway/scaleway-sdk-go/api/audit_trail/v1alpha1"
"github.com/scaleway/scaleway-sdk-go/scw"
)
// always import dependencies
var (
_ = scw.RegionFrPar
)
func GetGeneratedCommands() *core.Commands {
return core.NewCommands(
auditTrailRoot(),
auditTrailEvent(),
auditTrailProduct(),
auditTrailEventList(),
auditTrailProductList(),
)
}
func auditTrailRoot() *core.Command {
return &core.Command{
Short: `This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.`,
Long: `This API allows you to ensure accountability and security by recording events and changes performed within your Scaleway Organization.`,
Namespace: "audit-trail",
}
}
func auditTrailEvent() *core.Command {
return &core.Command{
Short: `Represent an entry in the Audit Trail`,
Long: `Represent an entry in the Audit Trail.`,
Namespace: "audit-trail",
Resource: "event",
}
}
func auditTrailProduct() *core.Command {
return &core.Command{
Short: `Product integrated with Audit Trail`,
Long: `Product integrated with Audit Trail.`,
Namespace: "audit-trail",
Resource: "product",
}
}
func auditTrailEventList() *core.Command {
return &core.Command{
Short: `List events`,
Long: `Retrieve the list of Audit Trail events for a Scaleway Organization and/or Project. You must specify the ` + "`" + `organization_id` + "`" + ` and optionally, the ` + "`" + `project_id` + "`" + `.`,
Namespace: "audit-trail",
Resource: "event",
Verb: "list",
// Deprecated: false,
ArgsType: reflect.TypeOf(audit_trail.ListEventsRequest{}),
ArgSpecs: core.ArgSpecs{
{
Name: "project-id",
Short: `(Optional) ID of the Project containing the Audit Trail events`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "resource-type",
Short: `(Optional) Returns a paginated list of Scaleway resources' features`,
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"unknown_type", "secm_secret", "secm_secret_version", "kube_cluster", "kube_pool", "kube_node", "kube_acl", "keym_key", "iam_user", "iam_application", "iam_group", "iam_policy", "iam_api_key", "iam_ssh_key", "secret_manager_secret", "secret_manager_version", "key_manager_key"},
},
{
Name: "method-name",
Short: `(Optional) Name of the method of the API call performed`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "status",
Short: `(Optional) HTTP status code of the request. Returns either ` + "`" + `200` + "`" + ` if the request was successful or ` + "`" + `403` + "`" + ` if the permission was denied`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "recorded-after",
Short: `(Optional) The ` + "`" + `recorded_after` + "`" + ` parameter defines the earliest timestamp from which Audit Trail events are retrieved. Returns ` + "`" + `one hour ago` + "`" + ` by default`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "recorded-before",
Short: `(Optional) The ` + "`" + `recorded_before` + "`" + ` parameter defines the latest timestamp up to which Audit Trail events are retrieved. Returns ` + "`" + `now` + "`" + ` by default`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "order-by",
Required: false,
Deprecated: false,
Positional: false,
EnumValues: []string{"recorded_at_desc", "recorded_at_asc"},
},
{
Name: "page-size",
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "page-token",
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "product-name",
Short: `(Optional) Name of the Scaleway resource in a hyphenated format`,
Required: false,
Deprecated: false,
Positional: false,
},
{
Name: "service-name",
Short: `(Optional) Name of the service of the API call performed`,
Required: false,
Deprecated: false,
Positional: false,
},
core.OrganizationIDArgSpec(),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*audit_trail.ListEventsRequest)
client := core.ExtractClient(ctx)
api := audit_trail.NewAPI(client)
return api.ListEvents(request)
},
}
}
func auditTrailProductList() *core.Command {
return &core.Command{
Short: `Retrieve the list of Scaleway resources for which you have Audit Trail events`,
Long: `Retrieve the list of Scaleway resources for which you have Audit Trail events.`,
Namespace: "audit-trail",
Resource: "product",
Verb: "list",
// Deprecated: false,
ArgsType: reflect.TypeOf(audit_trail.ListProductsRequest{}),
ArgSpecs: core.ArgSpecs{
core.OrganizationIDArgSpec(),
core.RegionArgSpec(scw.RegionFrPar, scw.RegionNlAms),
},
Run: func(ctx context.Context, args interface{}) (i interface{}, e error) {
request := args.(*audit_trail.ListProductsRequest)
client := core.ExtractClient(ctx)
api := audit_trail.NewAPI(client)
return api.ListProducts(request)
},
}
}