command line tool for the public ProfitBricks API
Bases: exceptions.Exception
Raised when the ProfitBricks client is too new in general or for a specified API version.
Bases: exceptions.Exception
Raised when the ProfitBricks client is too old in general or for a specified API version.
Bases: exceptions.Exception
Raised when an unknown API version was requested.
Bases: exceptions.Exception
Raised when an API calls fails due to a wrong username and password.
Delete all information regarding the client and WSDL by removing the cache directory.
Delete username and password from configuration file and from the keyring.
Return a user configuration object.
Return the endpoint for the WSDL service.
Parameters: |
|
---|
If no API version or endpoint is specified, the previously stored endpoint will be returned. If no endpoint was stored (e.g. first script execution), the endpoint for given default API version will be returned.
If api_version is specified, the endpoint for this API version will be retrieved. If endpoint is specified, this endpoint will be returned. If both api_version and endpoint is specified, the endpoint for the given API version must match the given endpoint. Otherwise an exception will be raised.
When store_selection is set to True, the returned endpoint will be stored in the configuration file and can be used for the following calls of this function.
Return the password for the given username.
This function tries to get the password from the user’s keyring. The user is asked for the password if the password is not available.
Connect to the API and return a ProfitBricks client object.
If username is not specified, get_username() is used to retrieve the username. If password is not specified, get_password() is used for determining the password. api_version, endpoint, and store_endpoint are passed to a get_endpoint() call to calculate the endpoint.
A connection to the ProfitBricks public API is made and ProfitBricks client object is created. All available API calls will become methods of the returned client object.
An urllib2.URLError will be raised when the connection to the API failed. No error will be raised when the credentials are wrong, but method calls will raise a WrongCredentialsException.
Return the username.
The username is read from the configuration file. The user is asked for the username if the username is not available. The username is then stored in the configuration file.
Main function for the command line client.
The command line arguments are parsed and the corresponding actions are triggered. The function returns 0 on success and a positive, non-zero value on error.