vmware.vapi package¶
Submodules¶
vmware.vapi.core module¶
vmware.vapi.exception module¶
vAPI CoreException Class
-
exception
vmware.vapi.exception.
CoreException
(message, cause=None)¶ Bases:
Exception
This exception is raised by various components of the vAPI runtime infrastructure to indicate failures in that infrastructure.
Server-side the exception is caught by specific components and an internal_server_error is reported to the client that invoked the request. Client-side the exception may be raised for certain failures before a request was sent to the server or after the response was received from the server. Similarly, server-side the exception may be raised for failures that occur when a provider implementation invokes the vAPI runtime.
This exception is not part of the vAPI message protocol, and it must never be raised by provider implementations.
- Variables
messages – Generator of error messages describing why the Exception was raised
Initialize CoreException
- Parameters
message (
vmware.vapi.message.Message
) – Description regarding why the Exception was raised
-
property
messages
¶ - Return type
generator of
vmware.vapi.message.Message
- Returns
Generator of error messages describing why the Exception was raised
vmware.vapi.message module¶
vAPI Message class
-
class
vmware.vapi.message.
Message
(id_, def_msg, *args)¶ Bases:
object
This class encapsulates the concept of a localizable message.
- Variables
id – The unique message identifier
def_msg – An english language default
args – The arguments to be used for the messsage
Initializes the message object
- Parameters
id (
string
) – The unique message identifierdef_msg (
string
) – An english language defaultargs (
list
ofstring
) – The arguments to be used for the messsage
-
class
vmware.vapi.message.
MessageBundle
(messages)¶ Bases:
object
Base class for all message bundle classes.
Initialize MessageBundle.
- Parameters
messages (
dict
ofstr
,str
) – Dictionary with message identifiers as keys and message templates as values.
-
get
(msg_id)¶ Returns the message template for the given message identifier
- Parameters
msg_id (
str
) – Message identifier- Return type
str
- Returns
Message template
- Raises
KeyError – If the message identifier is not found
-
class
vmware.vapi.message.
MessageFactory
(msg_bundle, formatter)¶ Bases:
object
A factory class to generate localizable messages
Initializes the message object
- Parameters
messages – The message dictionary for the message factory
formatter (
vmware.vapi.formatter.MessageFormatter
) – Formatter for the message
-
get_message
(id_, *args)¶ Return a message object for the given id with the given args. If the message is not found, a default unknown message is returned.
- Parameters
id (string) – The unique message identifier
args (
list
ofobject
) – The arguments to be used for constructing this message
- Return type
- Returns
The message object constructed using the given arguments
-
class
vmware.vapi.message.
MessageFormatter
¶ Bases:
object
Base class for all message formatter classes
-
classmethod
format_msg
(msg, args)¶ Format the message using the specified arguments
- Parameters
msg (
str
) – Message templateargs (
list
ofobject
) – Arguments for the message
- Return type
str
- Returns
Localized message
-
classmethod