Package ganeti :: Package server :: Module rapi :: Class RemoteApiHttpServer
[hide private]
[frames] | no frames]

Class RemoteApiHttpServer

source code


REST Request Handler Class.

Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
Initializes the HTTP server
source code
 
LoadUsers(self, filename)
Loads a file containing users and passwords.
source code
 
_GetRequestContext(self, req)
Returns the context for a request.
source code
 
AuthenticationRequired(self, req)
Determine whether authentication is required.
source code
 
Authenticate(self, req, username, password)
Checks whether a user can access a resource.
source code
 
HandleRequest(self, req)
Handles a request.
source code

Inherited from http.auth.HttpServerRequestAuthentication: GetAuthRealm, PreHandleRequest, VerifyBasicAuthPassword

Inherited from http.server.HttpServer: OnSignal, Start, Stop, handle_accept

Inherited from http.HttpBase: GetSslCiphers

Inherited from http.HttpBase (private): _CreateSocket, _SSLVerifyCallback

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Inherited from asyncore.dispatcher: __getattr__, accept, add_channel, bind, close, connect, create_socket, del_channel, handle_close, handle_connect, handle_connect_event, handle_error, handle_expt, handle_expt_event, handle_read, handle_read_event, handle_write, handle_write_event, listen, log, log_info, readable, recv, send, set_reuse_addr, set_socket, writable

Class Variables [hide private]
  AUTH_REALM = "Ganeti Remote API"

Inherited from http.server.HttpServer: MAX_CHILDREN

Inherited from asyncore.dispatcher: accepting, addr, closing, connected, debug, ignore_log_types

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

Initializes the HTTP server

Parameters:
  • mainloop - Mainloop used to poll for I/O events
  • local_address - Local IP address to bind to
  • port - TCP port to listen on
  • ssl_params - SSL key and certificate
  • ssl_verify_peer - Whether to require client certificate and compare it with our certificate
  • request_executor_class - an class derived from the HttpServerRequestExecutor class
Overrides: asyncore.dispatcher.__init__

LoadUsers(self, filename)

source code 

Loads a file containing users and passwords.

Parameters:
  • filename (string) - Path to file

_GetRequestContext(self, req)

source code 

Returns the context for a request.

The context is cached in the req.private variable.

AuthenticationRequired(self, req)

source code 

Determine whether authentication is required.

Parameters:
  • req - HTTP request context
Overrides: http.auth.HttpServerRequestAuthentication.AuthenticationRequired

Authenticate(self, req, username, password)

source code 

Checks whether a user can access a resource.

Overrides: http.auth.HttpServerRequestAuthentication.Authenticate

HandleRequest(self, req)

source code 

Handles a request.

Overrides: http.server.HttpServer.HandleRequest