Rubrik SDK for Python
1.0.0
1.0.0
  • Introduction
  • Getting Started
    • Quick Start
  • Base API Calls
    • delete
    • get
    • job_status
    • patch
    • post
    • put
    • query
  • Bootstrap Functions
    • setup_cluster
    • status
  • Cluster Functions
    • add_floating_ips
    • add_guest_credential
    • add_vcenter
    • cluster_node_id
    • cluster_node_ip
    • cluster_node_name
    • cluster_support_tunnel
    • cluster_version
    • configure_cluster_location
    • configure_dns_servers
    • configure_login_banner
    • configure_ntp
    • configure_replication_nat
    • configure_replication_private
    • configure_search_domain
    • configure_smtp_settings
    • configure_syslog
    • configure_timezone
    • configure_vlan
    • create_user
    • delete_guest_credential
    • delete_proxy
    • end_user_authorization
    • get_all_vcenters
    • get_floating_ips
    • minimum_installed_cdm_version
    • read_only_authorization
    • refresh_vcenter
    • remove_floating_ips
    • update_proxy
  • Cloud Functions
    • add_aws_native_account
    • aws_s3_cloudon
    • aws_s3_cloudout
    • azure_cloudon
    • azure_cloudout
    • update_aws_native_account
    • update_aws_s3_cloudout
  • Data Management Functions
    • assign_sla
    • begin_managed_volume_snapshot
    • create_sla
    • delete_sla
    • end_managed_volume_snapshot
    • get_all_hosts
    • get_esxi_subnets
    • get_sla_objects
    • get_sql_db
    • get_sql_db_files
    • get_sql_live_mount
    • get_vsphere_live_mount
    • get_vsphere_live_mount_names
    • get_vsphere_vm
    • get_vsphere_vm_details
    • get_vsphere_vm_file
    • get_vsphere_vm_snapshot
    • object_id
    • on_demand_snapshot
    • pause_snapshots
    • register_vm
    • resume_snapshots
    • set_esxi_subnets
    • sql_db_export
    • sql_instant_recovery
    • sql_live_mount
    • sql_live_unmount
    • vcenter_refresh_vm
    • vsphere_instant_recovery
    • vsphere_live_mount
    • vsphere_live_unmount
  • Physical Host Functions
    • add_host_share
    • add_nas_share_to_host
    • add_physical_host
    • assign_physical_host_fileset
    • create_nas_fileset
    • create_physical_fileset
    • delete_physical_host
  • SDK Helper Functions
    • log
    • exceptions
  • Internal Functions
    • _api_validation
    • _authorization_header
    • _common_api
    • _date_time_conversion
    • _header
    • _platform_user_agent
    • _time_in_range
    • _validate_sql_db
    • _validate_sql_recovery_point
Powered by GitBook
On this page
  • Arguments
  • Keyword Arguments
  • Returns
  • Example
  • VMware
  • AHV
  • Physical Host
  • MSSQL DB
  • Oracle DB
  • NAS Share
  1. Data Management Functions

on_demand_snapshot

Initiate an on-demand snapshot.

def on_demand_snapshot(object_name, object_type, sla_name='current', fileset=None, host_os=None, sql_host=None, sql_instance=None, sql_db=None, hostname=None, force_full=False, share_type=None, timeout=15)

Arguments

Name

Type

Description

Choices

object_name

str

The name of the Rubrik object to take a on-demand snapshot of.

object_type

str

The Rubrik object type you want to backup.

vmware, physical_host, ahv

Keyword Arguments

Name

Type

Description

Choices

Default

sla_name

str

The SLA Domain name you want to assign the on-demand snapshot to. By default, the currently assigned SLA Domain will be used.

current

fileset

str

The name of the Fileset you wish to backup. Only required when taking a on-demand snapshot of a physical host or share.

None

host_os

str

The operating system for the physical host. Only required when taking a on-demand snapshot of a physical host.

Linux, Windows

None

sql_host

str

The name of the SQL Host hosting the specified database. Only required when taking a on-demand snapshot of a MSSQL DB.

None

None

sql_instance

str

The name of the SQL Instance hosting the specified database. Only required when taking a on-demand snapshot of a MSSQL DB.

None

None

sql_db

str

TThe name of the SQL DB. Only required when taking a on-demand snapshot of a MSSQL DB.

None

None

hostname

str

Required when the object_type is either oracle_db or share. When oracle_db is the object_type, this argument corresponds to the host name, or one of those host names in the cluster that the Oracle database is running. When share is the object_type this argument corresponds to the NAS server host name.

None

None

force_full

bool

If True will force a new full image backup of an Oracle database. Used when the object_type is oracle_db

True, False

False

share_type

str

The type of NAS share i.e. NFS or SMB. Only required when taking a snapshot of a Share.

NFS or SMB

False

timeout

int

The number of seconds to wait to establish a connection the Rubrik cluster before returning a timeout error.

15

Returns

Type

Return Value

tuple

When object_type is vmware, the full API response for POST /v1/vmware/vm/{ID}/snapshot and the job status URL which can be used to monitor progress of the snapshot. (api_response, job_status_url)

tuple

When object_type is physical_host, the full API response for POST /v1/fileset/{}/snapshot and the job status URL which can be used to monitor progress of the snapshot. (api_response, job_status_url)

Example

VMware

import rubrik_cdm

rubrik = rubrik_cdm.Connect()


vsphere_vm_name = "python-sdk-demo"
object_type = "vmware"

snapshot = rubrik.on_demand_snapshot(vsphere_vm_name, object_type)

AHV

import rubrik_cdm

rubrik = rubrik_cdm.Connect()

ahv_vm_name = "python-sdk-demo"
object_type = "ahv"
snapshot = rubrik.on_demand_snapshot(ahv_vm_name, object_type)

Physical Host

import rubrik_cdm

rubrik = rubrik_cdm.Connect()

physical_host_name = "python-sdk-physical-demo"
object_type = "physical_host"
sla = "Gold"
fileset = "/etc"
host_os = "Linux"

snapshot = rubrik.on_demand_snapshot(physical_host_name, object_type, sla, fileset, host_os)

MSSQL DB

import rubrik_cdm

rubrik = rubrik_cdm.Connect()

# MSSQL DB Snapshot
object_name = "AdventureWorks2014"
object_type = "mssql_db"

snapshot = rubrik.on_demand_snapshot(object_name, object_type, sql_host="hostname.rubrik.com", sql_instance="MSSQLSERVER", sql_db="AdventureWorks2014")

Oracle DB

import rubrik_cdm

rubrik = rubrik_cdm.Connect()

object_name = "oratestdb"
object_type = "oracle_db"
host = "ora_host_01"
sla = "OracleTest"

snapshot = rubrik.on_demand_snapshot(object_name, object_type, sla_name=sla, hostname=host, force_full=False )

NAS Share

import rubrik_cdm

rubrik = rubrik_cdm.Connect()

object_name = "python-sdk-share-demo"
object_type = "share"
sla = "Gold"
fileset = "/etc"
hostname = "python-sdk-demo"
share_type = "NFS"

snapshot = rubrik.on_demand_snapshot(object_name, object_type, sla, fileset, hostname=hostname, share_type=share_type)
Previousobject_idNextpause_snapshots

Last updated 5 years ago