auth

Paddy 2015-03-07 Parent:d103a598548c Child:06fb735031bb

143:3aeadd2201e9 Go to Latest

auth/context.go

Add GetEndpoint method, add RemoveEndpoint handler. Add a method to our clientStore and Context types for retrieving an Endpoint from the clientStore. We need this to tell if someone is trying to delete an Endpoint that doesn't exist. Add a handler for removing Endpoints from a Client.

History
     1.1 --- a/context.go	Sat Mar 07 20:45:34 2015 -0500
     1.2 +++ b/context.go	Sat Mar 07 23:06:52 2015 -0500
     1.3 @@ -126,6 +126,15 @@
     1.4  	return c.clients.addEndpoints(client, endpoints)
     1.5  }
     1.6  
     1.7 +// GetEndpoint retrieves the Endpoint with the specified ID from the clientStore associated
     1.8 +// with the Context, if and only if it belongs to the Client with the specified ID.
     1.9 +func (c Context) GetEndpoint(client, endpoint uuid.ID) (Endpoint, error) {
    1.10 +	if c.clients == nil {
    1.11 +		return Endpoint{}, ErrNoClientStore
    1.12 +	}
    1.13 +	return c.clients.getEndpoint(client, endpoint)
    1.14 +}
    1.15 +
    1.16  // RemoveEndpoint deletes the Endpoint with the specified ID from the clientStore associated
    1.17  // with the Context, and disassociates the Endpoint from the specified Client.
    1.18  func (c Context) RemoveEndpoint(client, endpoint uuid.ID) error {