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 new / Overwrite old access setting(s) to the existing Access Control List of the parent resource.

Parameters:access_settings_list (list) –

list of dictionaries, where each dictionary represents a single access setting. The dictionary structure is as follows,

  • 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.
    Allowed values are ‘ReadOnly’, ‘Change’ or ‘FullControl’.
Returns:an object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the updated Access Control List of the resource.
Return type:lxml.objectify.ObjectifiedElement
convert_access_settings_list_to_params(access_settings_list)

Convert access settings from one format to other.

Convert dictionary representation of access settings to AccessSettings XML element. Please refer to schema definition of EntityType.CONTROL_ACCESS_PARAMS for more details.

Parameters:access_settings_list (list) –

list of dictionaries, where each dictionary represents a single access setting. The dictionary structure is as follows,

  • 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.
    Allowed values are ‘ReadOnly’, ‘Change’ or ‘FullControl’.
Returns:an object containing AccessSettings XML data.
Return type:lxml.objectify.ObjectifiedElement
get_access_settings()

Get the Access Control List of the parent resource.

Returns:an object containing EntityType.CONTROL_ACCESS_PARAMS XML data that represents the Access Control List of the parent resource.
Return type:lxml.objectify.ObjectifiedElement
get_org_href()

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

Returns:href of the org to which the parent resource belongs.
Return type:str
get_resource()

Fetches the XML representation of the Access Control List from vCD.

Will serve cached response if possible.

Returns:object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the concerned Access Control List.
Return type:lxml.objectify.ObjectifiedElement
remove_access_settings(access_settings_list=None, remove_all=False)

Remove access settings.

Remove a list of access settings from the existing Access Control List of the parent resource.

Parameters:
  • access_settings_list (list) –

    list of dictionaries, where each dictionary represents a single access setting. The dictionary structure is as follows,

    • type: (str): type of the subject. One of ‘org’ or ‘user’.
    • name: (str): name of the user or org.
  • remove_all (bool) – True, if the entire Access Control List of the parent resource should be removed, else False.
Returns:

an object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the updated access control setting of the resource.

Return type:

lxml.objectify.ObjectifiedElement`

static search_for_access_setting_by_subject(subject_name, subject_type, access_settings_params)

Search an AccessSettings object for a particular AccessSetting.

The search is based on the subject name and type.

Parameters:
  • subject_name (str) – name of the subject.
  • subject_type (str) – type of the subject. Value must be either ‘org’ or ‘user’.
  • access_settings_params (lxml.objectify.ObjectifiedElement) – an object containing AccessSettings XML data.
Returns:

an object containing AccessSetting XML data representing the matched access setting. Please refer to schema definition of EntityType.CONTROL_ACCESS_PARAMS for more details.

Return type:

lxml.objectify.ObjectifiedElement

share_with_org_members(everyone_access_level='ReadOnly')

Share the resource to all members of the organization.

Parameters:everyone_access_level (str) – level of access granted while sharing the resource with everyone. Allowed values are ‘ReadOnly’, ‘Change’, or ‘FullControl’. Default value is ‘ReadOnly’.
Returns:an object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the updated access control setting of the resource.
Return type:lxml.objectify.ObjectifiedElement
unshare_from_org_members()

Unshare the resource from all members of current organization.

Returns:an object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the updated access control setting of the resource.
Return type:lxml.objectify.ObjectifiedElement
update_resource(control_access_params)

Update the access control settings of the parent resource.

Parameters:control_access_params (lxml.objectify.ObjectifiedElement) – object containing EntityType.CONTROL_ACCESS_PARAMS XML data representing the updated Access Control List.
Returns:an object containing EntityType.CONTROL_ACCESS_PARAMS XML data that represents the updated Access Control List of the parent resource.
Return type:lxml.objectify.ObjectifiedElement