libsolace.items.SolaceUser module

class libsolace.items.SolaceUser.SolaceUser[source]

Manage a Solace Client User

This plugin manages Client Users within Solace. Typically you should invoke this plugin via L{SolaceAPI.SolaceAPI}.

Please see L{plugin.Plugin} for how plugins are instantiated and used.

api = 'None'
check_acl_profile_exists(**kwargs)[source]

Checks if a acl_profiles exists on the appliance.

Example:

>>> api = SolaceAPI("dev")
>>> client = api.manage("SolaceUser")
>>> client.check_acl_profile_exists(acl_profile="myacl")
False
Parameters:acl_profile (str) – the client profile to check
Return type:bool
Returns:true or false
check_client_profile_exists(**kwargs)[source]

Checks if a client_profile exists on the appliance.

Example:

>>> api = SolaceAPI("dev")
>>> client = api.manage("SolaceUser")
>>> client.check_client_profile_exists(client_profile="default")
True
Parameters:client_profile (str) – the client profile to check
Return type:bool
Returns:true or false
commands = None
create_user(*args, **kwargs)[source]

Create client-user

Example

>>> api = SolaceAPI("dev")
>>> xml = api.manage("SolaceUser").create_user(client_username="foo", vpn_name="bar")
<rpc semp-version="soltr/6_0"><create><client-username><username>foo</username><vpn-name>bar</vpn-name>
</client-username></create></rpc>
Parameters:
  • client_username (str) – the username
  • vpn_name – the vpn name

:type vpn_name:str :rtype: plugin.PluginResponse :returns: SEMP request

delete(*args, **kwargs)[source]

Delete a client user

Example

>>> connection = SolaceAPI("dev")
>>> connection.manage("SolaceUser").delete(client_username="foo", vpn_name="bar")
<rpc semp-version="soltr/6_0"><create><client-username><username>foo</username><vpn-name>bar</vpn-name>
</client-username></create></rpc>
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
Return type:

plugin.PluginResponse

Returns:

SEMP request

get(**kwargs)[source]

Get a username from the appliance, return a dict

Example

>>> connection = SolaceAPI("dev")
>>> reply = connection.manage("SolaceUser").get(client_username="default", vpn_name="default")
>>> reply[0]['rpc-reply']['rpc']['show']['client-username']['client-usernames']['client-username']['client-username']
u'default'
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
Return type:

list

Returns:

the user as a dict from the appliance

no_guarenteed_endpoint(**kwargs)[source]

No guaranteed endpoint permission override

Example:

>>> api = SolaceAPI("dev", version="soltr/7_1_1")
>>> request = api.manage("SolaceUser").no_guarenteed_endpoint(client_username="foo", vpn_name="bar")
>>> request.xml
'<rpc semp-version="soltr/7_1_1"><client-username><username>foo</username><vpn-name>bar</vpn-name><no><guaranteed-endpoint-permission-override/></no></client-username></rpc>'
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
Return type:

plugin.PluginResponse

Returns:

SEMP request

no_shutdown(**kwargs)[source]

Enable the client-user

Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
Return type:

plugin.PluginResponse

Returns:

SEMP request

no_subscription_manager(**kwargs)[source]

No subscription manager

Example:

>>> api = SolaceAPI("dev", version="soltr/7_1_1")
>>> request = api.manage("SolaceUser").no_subscription_manager(client_username="foo", vpn_name="bar")
>>> request.xml
'<rpc semp-version="soltr/7_1_1"><client-username><username>foo</username><vpn-name>bar</vpn-name><no><subscription-manager/></no></client-username></rpc>'
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
Return type:

plugin.PluginResponse

Returns:

SEMP request

plugin_name = 'SolaceUser'
requirements(**kwargs)[source]

Call the tests before create is attempted, checks for profiles in this case

Return type:None
Returns:nothing
set_acl_profile(*args, **kwargs)[source]

Set the acl profile

>>> connection = SolaceAPI("dev")
>>> requests = []
>>> requests.append(connection.manage("SolaceUser").shutdown(client_username="default", vpn_name="default", shutdown_on_apply=True))
>>> requests.append(connection.manage("SolaceUser").set_acl_profile(client_username="default", vpn_name="default", acl_profile="default"))
>>> requests.append(connection.manage("SolaceUser").no_shutdown(client_username="default", vpn_name="default", shutdown_on_apply=True))
>>> # [api.rpc(r) for r in requests]
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
  • client_profile (str) – the client profile to check
  • shutdown_on_apply (bool / char) – bool / char
Return type:

plugin.PluginResponse

Returns:

SEMP request

set_client_profile(*args, **kwargs)[source]

Set the ClientProfile

Example

>>> connection = SolaceAPI("dev")
>>> requests = []
>>> requests.append(connection.manage("SolaceUser").shutdown(client_username="default", vpn_name="default", shutdown_on_apply=True))
>>> requests.append(connection.manage("SolaceUser").set_client_profile(client_username="default", vpn_name="default", client_profile="default"))
>>> requests.append(connection.manage("SolaceUser").no_shutdown(client_username="default", vpn_name="default", shutdown_on_apply=True))
>>> # [api.rpc(r) for r in requests]
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
  • client_profile (str) – the client profile to check
  • shutdown_on_apply (bool / char) – bool / char
Return type:

plugin.PluginResponse

Returns:

SEMP request

set_password(**kwargs)[source]

Sets the client-user’s password

Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
  • password (str) – the vpn name
Return type:

plugin.PluginResponse

Returns:

SEMP request

shutdown(**kwargs)[source]

Shutdown the user, this method will be called by anything decorated with the @shutdown decorator. The kwarg shutdown_on_apply needs to be either True or ‘u’ or ‘b’ for this method to fire.

Example

>>> connection.manage("SolaceUser").shutdown(client_username="foo", vpn_name="bar", shutdown_on_apply=True)
<rpc semp-version="soltr/6_0"><client-username><username>foo</username><vpn-name>bar</vpn-name><shutdown/>
</client-username></rpc>
Parameters:
  • client_username (str) – the username
  • vpn_name (str) – the vpn name
  • shutdown_on_apply (bool / char) – bool / char
Return type:

plugin.PluginResponse

Returns:

SEMP request