API documentation¶
Client¶
-
class
pylxd.client.Client(endpoint=None, version='1.0', cert=None, verify=True, timeout=None)¶ Client class for LXD REST API.
This client wraps all the functionality required to interact with LXD, and is meant to be the sole entry point.
-
containers¶ Instance of
Client.Containers:
-
images¶ Instance of
Client.Images.
-
operations¶ Instance of
Client.Operations.
-
profiles¶ Instance of
Client.Profiles.
-
api¶ This attribute provides tree traversal syntax to LXD’s REST API for lower-level interaction.
Use the name of the url part as attribute or item of an api object to create another api object appended with the new url part name, ie:
>>> api = Client().api # / >>> response = api.get() # Check status code and response >>> print response.status_code, response.json() # /containers/test/ >>> print api.containers['test'].get().json()
-
events(websocket_client=None)¶ Get a websocket client for getting events.
/events is a websocket url, and so must be handled differently than most other LXD API endpoints. This method returns a client that can be interacted with like any regular python socket.
An optional websocket_client parameter can be specified for implementation-specific handling of events as they occur.
-