Separate request data from actor in Event
To clarify the role of actor, the request data that initiates an event has been separated. The ActorRecord is pared down to just the username. This eliminates confusion about where event related data should be added. Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
0a29b59e14
commit
080e329cb1
4 changed files with 79 additions and 38 deletions
|
@ -67,6 +67,9 @@ type Event struct {
|
|||
URL string `json:"url,omitempty"`
|
||||
} `json:"target,omitempty"`
|
||||
|
||||
// Request covers the request that generated the event.
|
||||
Request RequestRecord `json:"request,omitempty"`
|
||||
|
||||
// Actor specifies the agent that initiated the event. For most
|
||||
// situations, this could be from the authorizaton context of the request.
|
||||
Actor ActorRecord `json:"actor,omitempty"`
|
||||
|
@ -86,18 +89,6 @@ type ActorRecord struct {
|
|||
// request context that generated the event.
|
||||
Name string `json:"name,omitempty"`
|
||||
|
||||
// Addr contains the ip or hostname and possibly port of the client
|
||||
// connection that initiated the event.
|
||||
Addr string `json:"addr,omitempty"`
|
||||
|
||||
// Host is the externally accessible host name of the registry instance,
|
||||
// as specified by the http host header on incoming requests.
|
||||
Host string `json:"host,omitempty"`
|
||||
|
||||
// RequestID uniquely identifies the registry request that generated the
|
||||
// event.
|
||||
RequestID string `json:"requestID,omitempty"`
|
||||
|
||||
// TODO(stevvooe): Look into setting a session cookie to get this
|
||||
// without docker daemon.
|
||||
// SessionID
|
||||
|
@ -107,6 +98,27 @@ type ActorRecord struct {
|
|||
// Command
|
||||
}
|
||||
|
||||
// RequestRecord covers the request that generated the event.
|
||||
type RequestRecord struct {
|
||||
// ID uniquely identifies the request that initiated the event.
|
||||
ID string `json:"id"`
|
||||
|
||||
// Addr contains the ip or hostname and possibly port of the client
|
||||
// connection that initiated the event. This is the RemoteAddr from
|
||||
// the standard http request.
|
||||
Addr string `json:"addr,omitempty"`
|
||||
|
||||
// Host is the externally accessible host name of the registry instance,
|
||||
// as specified by the http host header on incoming requests.
|
||||
Host string `json:"host,omitempty"`
|
||||
|
||||
// Method has the request method that generated the event.
|
||||
Method string `json:"method"`
|
||||
|
||||
// UserAgent contains the user agent header of the request.
|
||||
UserAgent string `json:"useragent"`
|
||||
}
|
||||
|
||||
// SourceRecord identifies the registry node that generated the event. Put
|
||||
// differently, while the actor "initiates" the event, the source "generates"
|
||||
// it.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue