pyvcloud.vcd.acl module

class pyvcloud.vcd.acl.Acl(client, parent_resource, resource=None)

Bases: object

add_access_settings(access_settings_list=None)

Add access settings.

Append a new access control list to the existing ACL of the parent resource

Parameters:access_settings_list – (list of dict): list of access_setting in the dict format. Each dict contains: type: (str): type of the subject. One of ‘org’ or ‘user’. name: (str): name of the user or org. access_level: (str): access_level of the particular subject. One of ‘ReadOnly’, ‘Change’, ‘FullControl’
Returns:A lxml.objectify.StringElement object representing the updated access control setting of the resource.
convert_access_settings_list_to_params(access_settings_list)

Convert access_settings_list to object of type AccessSettingsType.

Parameters:access_settings_list – (list of dict): list of access_setting in the dict format. Each dict contains: type: (str): type of the subject. One of ‘org’ or ‘user’ name: (str): subject name access_level: (str): access_level of each subject. One of ‘ReadOnly’, ‘Change’, ‘FullControl’.
Returns:A lxml.objectify.StringElement object

representing xml of type AccessSettingsType

get_access_settings()

Get the access settings of the parent resource.

Returns:A lxml.objectify.StringElement object representing the access settings of the parent resource.
get_org_href()

Return the href of the org where the parent resource belongs to.

Returns:(str): org href of the parent resource.
get_resource()
remove_access_settings(access_settings_list=None, remove_all=False)

Remove access settings.

Remove a list of access settings from the existing ACL of the parent resource

Parameters:
  • access_settings_list – (list of dict): list of access_setting in the dict format. Each dict contains: type: (str): type of the subject. One of ‘org’ or ‘user’. name: (str): name of the user or org.
  • remove_all – (bool) : True if all the acl of the resource should be removed.
Returns:

A lxml.objectify.StringElement object representing the updated access control setting of the resource.

static search_for_access_setting_by_subject(subject_type, access_settings_params)

Search AccessSetting object based on the subject name and type.

Parameters:
  • subject_name – (str): name of the subject
  • subject_type – (str): type of the subject. One of ‘org’, ‘user’
  • access_settings_params – (lxml.objectify.StringElement): AccessSettings xml object which needs to searched by subject.
Returns:

A lxml.objectify.StringElement object representing a access setting matching the given subject.

share_with_org_members(everyone_access_level='ReadOnly')

Share the resource to all members of the organization.

Parameters:everyone_access_level – (str) : access level when sharing the resource with everyone. One of ‘ReadOnly’, ‘Change’, ‘FullControl’. ‘ReadOnly’ by default.
Returns:A lxml.objectify.StringElement object representing the updated access control setting of the resource.
unshare_from_org_members()

Unshare the resource from all members of current organization.

Returns:A lxml.objectify.StringElement object representing the updated access control setting of the resource.
update_resource(control_access_params)

Update the access settings of the parent resource.

Parameters:control_access_params – (lxml.objectify.StringElement) :

access settings to be updated. :return: A lxml.objectify.StringElement object representing

the updated access settings of the parent resource.