@@ -24,7 +24,7 @@ Create new event category.
2424The flags for new event action are:
2525
2626Mandatory:
27- --name
27+ --name
2828 specify name of the event.
2929Optional:
3030 --description
@@ -59,7 +59,7 @@ The flags for update event action are:
5959The name or id should be specified
6060 --id
6161 Unique identifier, if we want to update the name of the event, this become mandatory
62- --name
62+ --name
6363 specify the event name of the event.
6464 --description
6565 specify the description of the event.
@@ -109,6 +109,50 @@ The name or id should be specified
109109 cmd .PrintResult (cmd .Capi .UpdateEvent (eventObj ))
110110 },
111111 },
112+ {
113+ Name : "listdata" ,
114+ UsageLine : "event listdata (--name | --id) [--since --before]" ,
115+ Long : `
116+ List the data objects for a CoScale event.
117+
118+ The flags for listdata event action are:
119+ The name or id should be specified
120+ --id
121+ unique identifier of the event
122+ --name
123+ the event name of the event.
124+ --since
125+ list event data newer then the since UNIX timestamp.
126+ --before
127+ list event data older then the before UNIX timestamp.
128+ ` ,
129+ Run : func (cmd * Command , args []string ) {
130+ var name string
131+ var id , since , before int64
132+ cmd .Flag .Usage = func () { cmd .PrintUsage () }
133+ cmd .Flag .StringVar (& name , "name" , DEFAULT_STRING_FLAG_VALUE , "The name of the event." )
134+ cmd .Flag .Int64Var (& id , "id" , - 1 , "Unique identifier of the event" )
135+ cmd .Flag .Int64Var (& since , "since" , - 1 , "list event data newer then the since UNIX timestamp." )
136+ cmd .Flag .Int64Var (& before , "before" , - 1 , "list event data older then the before UNIX timestamp." )
137+ cmd .ParseArgs (args )
138+
139+ var eventObj = & api.Event {}
140+ var err error
141+ if id != - 1 {
142+ err = cmd .Capi .GetObjectRef ("event" , id , eventObj )
143+ } else if name != DEFAULT_STRING_FLAG_VALUE {
144+ err = cmd .Capi .GetObejctRefByName ("event" , name , eventObj )
145+ } else {
146+ cmd .PrintUsage ()
147+ os .Exit (EXIT_FLAG_ERROR )
148+ }
149+ if err != nil {
150+ cmd .PrintResult ("" , err )
151+ }
152+
153+ cmd .PrintResult (cmd .Capi .ListEventData (eventObj .ID , since , before ))
154+ },
155+ },
112156 {
113157 Name : "data" ,
114158 UsageLine : "event data (--name --id --message --subject) [--attribute --timestamp --stopTime]" ,
@@ -161,18 +205,18 @@ Insert event data.
161205
162206The flags for newdata event action are:
163207Mandatory:
164- --name
208+ --name
165209 specify the event name.
166210 --id
167211 specify the event id.
168212 Only one from id/name is necessary.
169-
213+
170214 --message
171- The message for the event data.
215+ The message for the event data.
172216 --subject
173217 The subject for the event data. The subject is structured as follows:
174218 s<serverId> for a server, g<servergroupId> for a server group, a for the application.
175- Optional:
219+ Optional:
176220 --attribute
177221 JSON String detailing the progress of the event.
178222 --timestamp
@@ -224,17 +268,17 @@ Update event data.
224268
225269The flags for updatedata event action are:
226270Mandatory:
227- --name
271+ --name
228272 specify the event name.
229273 --id
230274 specify the event id.
231275 Only one from id/name is necessary.
232-
276+
233277 --dataid
234278 specify the unique id of the event data.
235279Optional:
236280 --message
237- The message for the event data.
281+ The message for the event data.
238282 --subject
239283 The subject for the event data. The subject is structured as follows:
240284 s<serverId> for a server, g<servergroupId> for a server group, a for the application.
@@ -310,7 +354,7 @@ Delete a eventdata entry.
310354
311355The flags for event deletedata action are:
312356Mandatory:
313- --id
357+ --id
314358 specify the event id.
315359 --dataid
316360 specify the unique id of the event data.
0 commit comments