rubrik_polaris.gps package

Submodules

rubrik_polaris.gps.cluster module

Constants

rubrik_polaris.gps.cluster.ERROR_MESSAGES = {'INVALID_FIELD_TYPE': "'{}' is an invalid value for '{}'. Value must be in {}.", 'INVALID_FILTER': "'{}' is an invalid filter type."}

Collection of methods for GPS clusters.

rubrik_polaris.gps.cluster.list_clusters(self, first: Optional[int] = None, after: Optional[str] = None, filters: Optional[dict] = None, sort_by: Optional[enumerate] = None, sort_order: Optional[enumerate] = None)

Retrieves a list of available clusters. :param after: The next page cursor to retrieve the next set of results. :param first: Number of results to retrieve in the response. :param filters: Filters the cluster result. Supported fields of class ClusterFilterInput. :param sort_by: Sorts the result using ClusterSortByEnum. :param sort_order: Sorting orders ASC or DESC.

Returns

List of clusters.

Return type

iterator

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error.

rubrik_polaris.gps.files module

Collection of methods for gps files.

rubrik_polaris.gps.files.get_snapshot_files(self, snapshot_id: str, first: Optional[int] = None, path: Optional[str] = None, after: Optional[str] = None, search_prefix: Optional[str] = None)

Retrieve the list of the available files that can be downloaded.

Parameters
  • first (int) – Number of results to retrieve in the response.

  • after (str) – The next page cursor to retrieve the next set of results.

  • path (str) – The path of the folder to list the sub-files. If not provided the root directory files will be returned.

  • search_prefix (str) – Provide a keyword to search in the file names.

  • snapshot_id (str) – The Snapshot ID of the file that needs to be downloaded.

Returns

Dictionary containing list of files

Return type

dict

Raises

RequestException – If the query to Polaris returned an error

rubrik_polaris.gps.files.request_download_snapshot_files(self, snapshot_id: str, paths: list, delta_type_filter: Optional[enumerate] = None, next_snapshot_fid: Optional[str] = None)
Parameters
  • snapshot_id (str) – The Snapshot ID of the file that needs to be downloaded.

  • paths (array) – List of paths to download.

  • delta_type_filter (enumerate) – DeltaTypeEnum filter

  • next_snapshot_fid (str) – The next Snapshot FID.

Returns

Dictionary containing list of files

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error

rubrik_polaris.gps.sla module

Constants

rubrik_polaris.gps.sla.ERROR_MESSAGES = {'INVALID_FIELD_TYPE': "'{}' is an invalid value for '{}'. Value must be in {}."}

Collection of methods for GPS SLAs.

rubrik_polaris.gps.sla.list_sla_domains(self, after: Optional[str] = None, first: Optional[int] = None, filters: Optional[list] = None, sort_by: Optional[enumerate] = None, sort_order: Optional[enumerate] = None, show_protected_object_count: Optional[bool] = None)
Parameters
  • after – The next page cursor to retrieve the next set of results.

  • first – Number of results to retrieve in the response.

  • filters – Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField.

  • sort_by – Sorts the result using SLAQuerySortByFieldEnum.

  • sort_order – Sorting orders ASC or DESC.

  • show_protected_object_count – A Boolean option to return data with protected object count.

Returns

List of SLAs.

Return type

iterator

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error.

rubrik_polaris.gps.vm module

Collection of methods for live mount of a virtual machine.

rubrik_polaris.gps.vm.create_vm_livemount(self, snapshot_fid: str, host_id: Optional[str] = None, vm_name: Optional[str] = None, disable_network: Optional[bool] = None, remove_network_devices: Optional[bool] = None, power_on: Optional[bool] = None, keep_mac_addresses: Optional[bool] = None, data_store_name: Optional[str] = None, create_data_store_only: Optional[bool] = None, vlan: Optional[int] = None, should_recover_tags: Optional[bool] = None)

Perform a live mount of a virtual machine snapshot. :param snapshot_fid: The Snapshot FID of the snapshot. :param host_id: The Host ID. :param vm_name: The VM Name. :param disable_network: Whether to disable network. :param remove_network_devices: Whether to remove network devices. :param power_on: Whether to power on. :param keep_mac_addresses: Whether to keep MAC address. :param data_store_name: Name of the data store. :param create_data_store_only: Whether to create data store. :param vlan: VLAN ID. :param should_recover_tags: Whether to recover tags.

Returns

Dictionary containing live mount information

Return type

dict

Raises

RequestException – If the query to Polaris returned an error

rubrik_polaris.gps.vm.create_vm_livemount_v2(self, snappable_id: str, should_recover_tags: bool, power_on: bool, keep_mac_addresses: bool, remove_network_devices: bool, host_id: Optional[str] = None, cluster_id: Optional[str] = None, resource_pool_id: Optional[str] = None, snapshot_fid: Optional[str] = None, vm_name: Optional[str] = None, vnic_bindings: Optional[dict] = None, recovery_point: Optional[str] = None)
Perform a live mount of a virtual machine snapshot.

When the snapshot ID is passed without a timestamp, this endpoint triggers a live mount using the given snapshot ID. When this endpoint is passed a recovery point or a recovery point and snapshot ID, the endpoint triggers a live mount using the point in time (PIT) for recovery. Calling this endpoint without a recovery point or a snapshot ID triggers a PIT live mount that uses the most recent time or snapshot available.

Parameters
  • snappable_id – The snappable ID.

  • should_recover_tags – Whether to recover tags.

  • power_on – Whether to power on.

  • keep_mac_addresses – Whether to keep MAC addresses.

  • remove_network_devices – Whether to remove network interfaces from the VM.

  • host_id – ID of the ESXi host to mount the new VM on.

  • cluster_id – ID of the compute cluster where the new VM will be mounted.

  • resource_pool_id – ID of the resource pool where the new VM will be mounted.

  • snapshot_fid – ID of the snapshot to recover.

  • vm_name – Name of the new VM.

  • vnic_bindings

    List of network bindings for vNIC of the VM. e.g.: [

    {
    “backingNetworkInfo”: {

    “moid”: <string>, “name”: <string>

    }, “networkDeviceInfo”: {

    ”key”: <int>, “name”: <string>

    }

    }

    ]

  • recovery_point – Point in time to recover to, e.g.: “2023-03-04T05:06:07.890”

rubrik_polaris.gps.vm.create_vm_snapshot(self, snapshot_id: str, sla_id: Optional[str] = None)

Create snapshot of a system. :param snapshot_id: The Snapshot ID of the snapshot that needs to be created. :param sla_id: The SLA ID of the snapshot that needs to be created.

Returns:

dict: Dictionary containing snapshot information.

Raises

RequestException – If the query to Polaris returned an error

rubrik_polaris.gps.vm.list_vsphere_hosts(self, first: int, after: Optional[str] = None, filters: Optional[list] = None, sort_by: Optional[enumerate] = None, sort_order: Optional[enumerate] = None)

Retrieves a list of available Vsphere hosts. :param after: The next page cursor to retrieve the next set of results. :param first: Number of results to retrieve in the response. :param filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. :param sort_by: Sorts the result using HierarchySortByField. :param sort_order: Sorting orders ASC or DESC.

Returns

Dictionary containing list of Vsphere hosts.

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error.

rubrik_polaris.gps.vm.export_vm_snapshot(self, config: dict, id_: str)

Export a snapshot of a virtual machine. :param id_: The object ID. :param config: Configuration parameters for exporting snapshot.

Returns

Dictionary containing snapshot information.

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error

rubrik_polaris.gps.vm.list_vsphere_datastores(self, host_id: str, first: Optional[int] = None, after: Optional[str] = None, filters: Optional[list] = None, sort_by: Optional[enumerate] = None, sort_order: Optional[enumerate] = None)

Retrieves a list of datastores on a Vsphere host. :param host_id: The Host ID. :param after: The next page cursor to retrieve the next set of results. :param first: Number of results to retrieve in the response. :param filters: Filters the SLA result. Supported fields of class GlobalSlaQueryFilterInputField. :param sort_by: Sorts the result using HierarchySortByField. :param sort_order: Sorting orders ASC or DESC.

Returns

Dictionary containing list of Vsphere datastores.

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error.

rubrik_polaris.gps.vm.get_async_request_result(self, request_id: str, cluster_id: str)

Retrieves the result of an asynchronous request. These requests can be triggered by calling functions such as export_vm_snapshot, create_vm_livemount, request_download_snapshot_files or create_vm_snapshot. :param request_id: The ID of the asynchronous request. :param cluster_id: The ID of the cluster where the request was made.

Returns

Dictionary containing the result of the request.

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error.

rubrik_polaris.gps.vm.recover_vsphere_vm_files(self, snapshot_id: str, cluster_id: str, restore_config: Union[dict, list], destination_object_id: Optional[str] = None, should_use_agent: bool = False, should_restore_x_attrs: bool = False, ignore_errors: bool = False)

Recover files from a snapshot back into a Vsphere VM. :param snapshot_id: ID of the snapshot from which to recover files. :param cluster_id: ID of the cluster where the snapshot resides. :param restore_config: List or dict of type RestorePathPairInput. :param destination_object_id: ID of the object where the files will be restored into. If not provided, Rubrik will use

the snapshots object.

Parameters
  • should_use_agent – Whether to use an agent.

  • should_restore_x_attrs – Whether to preserve custom attributes of the machine.

  • ignore_errors – Whether to ignore errors.

Returns

Dictionary containing recovery request ID.

Return type

dict

Raises
  • ValueError – If input is invalid

  • RequestException – If the query to Polaris returned an error

Module contents

Collection of functions that interact with Polaris object primitives.