Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e3594dfe
Commit
e3594dfe
authored
Mar 13, 2015
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5404 from derekwaynecarr/delete_events
Client support to delete events
parents
5326baed
703d2a87
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
0 deletions
+26
-0
events.go
pkg/client/events.go
+11
-0
events_test.go
pkg/client/events_test.go
+10
-0
fake_events.go
pkg/client/fake_events.go
+5
-0
No files found.
pkg/client/events.go
View file @
e3594dfe
...
@@ -40,6 +40,7 @@ type EventInterface interface {
...
@@ -40,6 +40,7 @@ type EventInterface interface {
Watch
(
label
,
field
labels
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
Watch
(
label
,
field
labels
.
Selector
,
resourceVersion
string
)
(
watch
.
Interface
,
error
)
// Search finds events about the specified object
// Search finds events about the specified object
Search
(
objOrRef
runtime
.
Object
)
(
*
api
.
EventList
,
error
)
Search
(
objOrRef
runtime
.
Object
)
(
*
api
.
EventList
,
error
)
Delete
(
name
string
)
error
}
}
// events implements Events interface
// events implements Events interface
...
@@ -161,3 +162,13 @@ func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
...
@@ -161,3 +162,13 @@ func (e *events) Search(objOrRef runtime.Object) (*api.EventList, error) {
}
}
return
e
.
List
(
labels
.
Everything
(),
fields
.
AsSelector
())
return
e
.
List
(
labels
.
Everything
(),
fields
.
AsSelector
())
}
}
// Delete deletes an existing event.
func
(
e
*
events
)
Delete
(
name
string
)
error
{
return
e
.
client
.
Delete
()
.
NamespaceIfScoped
(
e
.
namespace
,
len
(
e
.
namespace
)
>
0
)
.
Resource
(
"events"
)
.
Name
(
name
)
.
Do
()
.
Error
()
}
pkg/client/events_test.go
View file @
e3594dfe
...
@@ -175,3 +175,13 @@ func TestEventList(t *testing.T) {
...
@@ -175,3 +175,13 @@ func TestEventList(t *testing.T) {
t
.
Errorf
(
"%#v != %#v."
,
e
,
r
)
t
.
Errorf
(
"%#v != %#v."
,
e
,
r
)
}
}
}
}
func
TestEventDelete
(
t
*
testing
.
T
)
{
ns
:=
api
.
NamespaceDefault
c
:=
&
testClient
{
Request
:
testRequest
{
Method
:
"DELETE"
,
Path
:
"/events/foo"
},
Response
:
Response
{
StatusCode
:
200
},
}
err
:=
c
.
Setup
()
.
Events
(
ns
)
.
Delete
(
"foo"
)
c
.
Validate
(
t
,
nil
,
err
)
}
pkg/client/fake_events.go
View file @
e3594dfe
...
@@ -64,3 +64,8 @@ func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error) {
...
@@ -64,3 +64,8 @@ func (c *FakeEvents) Search(objOrRef runtime.Object) (*api.EventList, error) {
c
.
Fake
.
Actions
=
append
(
c
.
Fake
.
Actions
,
FakeAction
{
Action
:
"search-events"
})
c
.
Fake
.
Actions
=
append
(
c
.
Fake
.
Actions
,
FakeAction
{
Action
:
"search-events"
})
return
&
c
.
Fake
.
EventsList
,
nil
return
&
c
.
Fake
.
EventsList
,
nil
}
}
func
(
c
*
FakeEvents
)
Delete
(
name
string
)
error
{
c
.
Fake
.
Actions
=
append
(
c
.
Fake
.
Actions
,
FakeAction
{
Action
:
"delete-event"
,
Value
:
name
})
return
nil
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment