### Display SDK Setup Script Help Options (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/README.md This command displays the available command-line options for the vSphere SDK setup script. It is useful for understanding different execution modes and parameters. ```shell $ python samples/vsphere/vcenter/setup/main.py -h ``` -------------------------------- ### Connect to VCF Installer Server (Python) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Connects to a VCF Installer server to retrieve appliance information. This example uses the 'utils.client.create_vcf_installer_client' function. The 'ca_certs=False' argument is used for development environments to bypass self-signed certificate validation and should not be used in production. ```python from utils.client import create_vcf_installer_client # never use ca_certs=False in production! This is used in dev environments to avoid self-signed certificate validations client = create_vcf_installer_client(server=, password=, ca_certs=False) client.v1.system.ApplianceInfo.get_appliance_info() ``` -------------------------------- ### Install SDK from Local Zip (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Commands to install the VCF SDK and its dependencies from a local zip file on an air-gapped system. It assumes the zip file has been transferred to the target system. ```shell unzip pypi.zip -d pypi pip install --no-index -U pypi/**/*.whl ``` -------------------------------- ### Install VCF SDK Python Package Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Installs the main VMware Cloud Foundation SDK for Python from PyPI. This is the recommended installation method to get all SDK libraries and dependencies. ```shell pip install vcf-sdk ``` -------------------------------- ### Install SDK Libraries using requirements.txt (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Command to install all necessary VCF SDK libraries and their dependencies using the provided requirements.txt file. This is required to run the SDK samples. ```shell pip install -r requirements.txt ``` -------------------------------- ### Execute vSphere SDK Sample Setup Script (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/README.md This command executes the main Python script for setting up the vSphere test environment. It requires the script to be present in the `samples/vsphere/vcenter/setup/` directory and uses the `-sv` flag for setup and validation. ```shell $ python samples/vsphere/vcenter/setup/main.py -sv ``` -------------------------------- ### Install SDK from Local Zip (Air-gapped, Alternative) (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Alternative commands for installing SDK packages and dependencies from a local zip archive on an air-gapped system. This method uses a different zip file name and extraction path. ```shell unzip libs_pypi.zip -d libs_pypi pip install -U libs_pypi/**/*.whl ``` -------------------------------- ### Download and Install SDK Zip (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Steps to download the VCF SDK from GitHub releases, extract it, download dependencies, and package it for air-gapped installation. This method is used when an internet connection is available to download the initial zip file. ```shell wget https://github.com/vmware/vcf-sdk-python/archive/refs/tags/v9.0.0.0.zip unzip v9.0.0.0.zip -d vcf-sdk-python cd vcf-sdk-python pip download -r requirements.txt -d pypi/ cd .. zip -r vcf-sdk-python.zip vcf-sdk-python/ ``` -------------------------------- ### RDU Steps Configuration with Python SDK Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/rdu/README.md This script handles various RDU (vCenter Upgrade) steps, starting with configuration. It requires vCenter connection details, upgrade repository information, target version, and OVA file URL. Optional parameters control automatic cancellation and preserve original VM names. For uber-managed vCenters, additional parameters for the managing vCenter are needed. ```python python rdu_steps.py configure # Example with optional parameters: # python rdu_steps.py configure --autocancellation --preserve-original-name # Example for uber-managed vCenter: # python rdu_steps.py configure --uber-vc-hostname --uber-vc-username --uber-vc-password ``` -------------------------------- ### Install Individual VCF SDK Component Package Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Installs a specific component package of the VCF SDK, such as SDDC Manager, directly from PyPI. This allows for targeted installation of only the necessary components. Replace `` with the actual package name. ```shell pip install # e.g. To install SDDC Manager pip install sddc-manager ``` -------------------------------- ### Install vSAN Data Protection SDK Libraries Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsan/snapservice/README.md Installs the required Python SDK libraries for vSAN Data Protection APIs. It uses pip to manage packages, offering options to install pyVmomi with SSO support (which includes lxml) or to install lxml and pyVmomi separately. ```bash pip install pyVmomi[sso] ``` ```bash pip install lxml pip install pyVmomi ``` -------------------------------- ### Display Help for Cluster Installed Images Sample Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/vlcm/cluster/installed_images/README.md This command displays the available command-line options for the Python sample script used to interact with the vSphere vLCM cluster installed images API. It helps users understand how to configure and run the sample. ```bash python samples/vsphere/vcenter/vlcm/cluster/installed_images/installed_images.py -h ``` -------------------------------- ### Install VCF SDK Python Packages Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Installs the VCF SDK Python libraries from the unzipped SDK archive. The '--no-index' flag prevents pip from accessing PyPI, ensuring installation only from local wheels. ```shell # Install vcf sdk libraries from deflated sdk zip pip install --no-index -U pypi/**/*.whl ``` -------------------------------- ### Install Third-Party Dependencies from PyPI Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Installs all required third-party Python packages listed in 'requirements-third-party.txt' directly from the Python Package Index (PyPI). This requires an active internet connection. ```shell # Install the third party dependencies from PyPI pip install -r requirements-third-party.txt ``` -------------------------------- ### Connect to vCenter Server and List VMs (Python) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Connects to a vCenter Server using provided credentials and then lists all virtual machines within it. This example utilizes the 'vmware.vapi.vsphere.client' library and 'requests' for session handling. Similar to the SDDC Manager example, disabling SSL verification is shown for demonstration but is not advised for production. ```python import requests import urllib3 from vmware.vapi.vsphere.client import create_vsphere_client session = requests.session() # Disable cert verification for demo purpose. # This is not recommended in a production environment. session.verify = False # Disable the secure connection warning for demo purpose. # This is not recommended in a production environment. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Connect to a vCenter Server using username and password vsphere_client = create_vsphere_client(server='', username='', password='', session=session) # List all VMs inside the vCenter Server vsphere_client.vcenter.VM.list() ``` -------------------------------- ### Download and Install Third-Party Dependencies Locally Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Downloads third-party Python packages from PyPI into a local directory and then installs them from that location. This is useful for managing dependencies or for use in environments with limited internet access. ```shell # Download third party dependencies from PyPI pip download -r requirements-third-party.txt -d third-party_libs/ pip install --no-index -U third-party_libs/**/*.whl ``` -------------------------------- ### Upgrade Setuptools Package Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Upgrades the setuptools package to its latest version. Setuptools is essential for Python packaging and is a common requirement for installing VCF SDK components. ```shell pip install --upgrade setuptools ``` -------------------------------- ### Install SDK in Air-Gapped System Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Installs the VCF SDK Python packages and their dependencies within an air-gapped environment. It assumes the SDK and dependencies have been pre-downloaded and transferred as a zip archive. ```shell unzip vcf-sdk-python.zip -d vcf-sdk-python cd vcf-sdk-python/ pip install --no-index -U pypi/**/*.whl ``` -------------------------------- ### Run vSphere CLI Sample for Cluster Installed Images Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/vlcm/cluster/installed_images/README.md This command-line sample allows you to interact with the vSphere API to retrieve installed images for a cluster. It requires vCenter server details, credentials, and the cluster MoID. The sample utilizes Python and likely depends on the vSphere SDK. ```bash python samples/vsphere/vcenter/vlcm/cluster/installed_images/installed_images.py -v -s -u -p --cluster ``` -------------------------------- ### Download VCF Fleet Bundles (First Instance) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md Configures an online depot and downloads bundles for deploying the first VCF Instance within a VCF Fleet. It requires VCF Installer host and credentials, along with depot account details. Optional parameters control synchronization and download polling timeouts. ```python python download_bundles_vcf_fleet_first_vcf_instance.py \ --vcf_installer_host_address \ --vcf_installer_admin_password \ --depot_account_username \ --depot_account_password \ [--ca_certs ] \ [--time_to_wait_for_depot_sync_in_minutes ] \ [--time_to_wait_in_between_polls_for_depot_sync_in_seconds ] \ [--max_time_to_poll_download_status_in_hours ] \ [--time_to_sleep_in_between_polls_for_download_status_in_seconds ] ``` -------------------------------- ### Download VVF Instance Bundles (Existing vCenter) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md Configures an online depot and downloads bundles for deploying a VVF instance, assuming an existing vCenter is present. It requires VCF Installer host and credentials, along with depot account details. Optional parameters control synchronization and download polling timeouts. ```python python download_bundles_vvf_instance_existing_vcenter.py \ --vcf_installer_host_address \ --vcf_installer_admin_password \ --depot_account_username \ --depot_account_password \ [--ca_certs ] \ [--time_to_wait_for_depot_sync_in_minutes ] \ [--time_to_wait_in_between_polls_for_depot_sync_in_seconds ] \ [--max_time_to_poll_download_status_in_hours ] \ [--time_to_sleep_in_between_polls_for_download_status_in_seconds ] ``` -------------------------------- ### Download VVF Instance Bundles Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md Configures an online depot and downloads bundles necessary for deploying a VVF instance. It requires VCF Installer host and credentials, along with depot account details. Optional parameters control synchronization and download polling timeouts. ```python python download_bundles_vvf_instance.py \ --vcf_installer_host_address \ --vcf_installer_admin_password \ --depot_account_username \ --depot_account_password \ [--ca_certs ] \ [--time_to_wait_for_depot_sync_in_minutes ] \ [--time_to_wait_in_between_polls_for_depot_sync_in_seconds ] \ [--max_time_to_poll_download_status_in_hours ] \ [--time_to_sleep_in_between_polls_for_download_status_in_seconds ] ``` -------------------------------- ### Connect to vCenter Server and List VMs using Python SDK Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/README.md Demonstrates how to establish a connection to a vCenter Server using the vSphere Automation Python SDK and then list all virtual machines. It includes necessary imports and session setup, with a note about disabling certificate verification for demonstration purposes. ```python import requests import urllib3 from vmware.vapi.vsphere.client import create_vsphere_client session = requests.session() # Disable cert verification for demo purpose. # This is not recommended in a production environment. session.verify = False # Disable the secure connection warning for demo purpose. # This is not recommended in a production environment. urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) # Connect to a vCenter Server using username and password vsphere_client = create_vsphere_client(server='', username='', password='', session=session) # List all VMs inside the vCenter Server vsphere_client.vcenter.VM.list() ``` -------------------------------- ### Deploy VVF Instance using Python Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/deploy/README.md This script deploys a new VVF instance. It requires VCF Installer credentials, host root passwords, thumbprints, and network configuration for management and other essential services. Ensure all hostnames are resolvable from the VCF Installer appliance. ```python python deploy_vvf_instance.py --vcf_installer_server_address \ --vcf_installer_admin_password \ --esxi_host_root_password \ --host_fqdn_to_thumbprint \ --dns_domain \ --dns_nameserver \ --ntp_servers \ --vcf_ops_fqdn \ --vcenter_fqdn \ [--vcenter_sso_domain ] \ --management_network_gateway \ --management_network_subnet ``` -------------------------------- ### Deploy VCF Fleet First VCF Instance using Python Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/deploy/README.md This script deploys a new VCF Fleet with its first VCF Instance. It requires detailed network configuration, host credentials, and FQDNs for various VCF components. Ensure all hostnames and component addresses are resolvable from the VCF Installer appliance. ```python python deploy_vcf_fleet_first_vcf_instance.py \ --vcf_installer_server_address \ --vcf_installer_admin_password \ --esxi_host_root_password \ --host_fqdn_to_thumbprint \ --dns_domain \ --dns_nameserver \ --ntp_servers \ --sddc_manager_hostname \ --vcenter_fqdn \ [--vcenter_sso_domain ] \ --nsx_fqdn \ --nsx_vip_fqdn \ --management_network_gateway \ --management_network_subnet \ --management_network_vlan_id \ --vsan_network_gateway \ --vsan_network_subnet \ --vsan_network_vlan_id \ --vsan_network_ip_range_start \ --vsan_network_ip_range_end \ --vmotion_network_gateway \ --vmotion_network_subnet \ --vmotion_network_vlan_id \ --vmotion_ip_range_start \ --vmotion_ip_range_end \ --vcf_ops_fleet_management_fqdn \ --vcf_ops_fqdn \ [--vcf_automation_fqdn ] \ [--vcf_automation_pool_ip_range_start ] \ [--vcf_automation_pool_ip_range_end ] \ --vcf_ops_collector_fqdn \ [--ca_certs CA_CERTS] \ [--validate_only] ``` -------------------------------- ### Download Bundles for Extending VCF Fleet Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md This sample script is designed to configure an online depot and download the necessary bundles for extending an existing VCF Fleet with a new VCF Instance. It requires VCF Installer host details and depot account credentials, with optional parameters for managing synchronization and download polling. ```python This sample script is designed to configure an online depot and download the necessary bundles for extending an existing VCF Fleet with a new VCF Instance. It requires VCF Installer host details and depot account credentials, with optional parameters for managing synchronization and download polling. ``` -------------------------------- ### Two-Phase vCenter Upgrade with Python SDK Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/rdu/README.md This script demonstrates a two-phase vCenter upgrade. It allows pausing the upgrade before downtime and resuming it later. Key steps include updating the lifecycle plugin, creating and configuring the init spec, and managing apply specs to control the upgrade flow. ```python python two_phase_upgrade.py ``` -------------------------------- ### GET /api/vlcm/cluster/installed-images/{cluster_moid} Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/vlcm/cluster/installed_images/README.md Retrieves the most recently generated installed images report for a specified cluster. This is a synchronous operation. ```APIDOC ## GET /api/vlcm/cluster/installed-images/{cluster_moid} ### Description Retrieves the most recently generated installed images report for the specified cluster. This is a synchronous operation. ### Method GET ### Endpoint /api/vlcm/cluster/installed-images/{cluster_moid} ### Parameters #### Path Parameters - **cluster_moid** (string) - Required - The MoID of the cluster for which to retrieve the installed images report. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **highest_versioned_image** (object) - Details about the highest versioned image found across hosts in the cluster. - **version** (string) - The version string of the image. - **count** (integer) - The number of hosts running this image version. - **most_widely_used_image** (object) - Details about the most widely used image across hosts in the cluster. - **version** (string) - The version string of the image. - **count** (integer) - The number of hosts running this image version. - **host_image_list** (array) - A list of all images found on hosts within the cluster. - Each element is an object with: - **host_moid** (string) - The MoID of the host. - **image_list** (array) - A list of images installed on the host. - Each element is an object with: - **version** (string) - The version string of the image. #### Response Example ```json { "highest_versioned_image": { "version": "7.0.2", "count": 5 }, "most_widely_used_image": { "version": "7.0.2", "count": 5 }, "host_image_list": [ { "host_moid": "host-123", "image_list": [ { "version": "7.0.2" }, { "version": "7.0.1" } ] }, { "host_moid": "host-456", "image_list": [ { "version": "7.0.2" } ] } ] } ``` ``` -------------------------------- ### Cancel Running vCenter Upgrade (Python) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/rdu/README.md Demonstrates how to cancel a vCenter upgrade that is currently in progress. This scenario follows similar setup steps as the full upgrade, including updating the lifecycle plugin, creating an init spec, configuring the upgrade, and running initial prechecks, before triggering the cancellation and monitoring its completion. It utilizes the same parameters as the full upgrade script. ```python python upgrade_with_cancelation.py ``` -------------------------------- ### Run vAPI vCenter Sample Suite (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/README.md This command initiates the execution of the vAPI vCenter sample suite. It is used after the test environment has been successfully set up. ```shell $ python samples/vsphere/vcenter/setup/main.py -riv ``` -------------------------------- ### Install vSphere Automation SDK for Python using pip Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/README.md Installs or upgrades the vSphere Automation SDK for Python from a Git repository using pip. This command assumes you have pip and setuptools installed and upgraded. ```cmd pip install --upgrade git+https://github.com/vmware/vsphere-automation-sdk-python.git ``` -------------------------------- ### Download VCF Fleet Bundles (Existing Components) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md Configures an online depot and downloads bundles for deploying the first VCF Instance within a VCF Fleet, assuming vCenter and NSX are already deployed. It requires VCF Installer host and credentials, along with depot account details. Optional parameters control synchronization and download polling timeouts. ```python python download_bundles_vcf_fleet_first_vcf_instance_from_existing_components.py \ --vcf_installer_host_address \ --vcf_installer_admin_password \ --depot_account_username \ --depot_account_password \ [--ca_certs ] \ [--time_to_wait_for_depot_sync_in_minutes ] \ [--time_to_wait_in_between_polls_for_depot_sync_in_seconds ] \ [--max_time_to_poll_download_status_in_hours ] \ [--time_to_sleep_in_between_polls_for_download_status_in_seconds ] ``` -------------------------------- ### Prepare SDK for Air-Gapped Environment Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md This sequence downloads the VCF SDK zip, extracts it, downloads all third-party dependencies, and then re-zips the SDK along with its dependencies for transfer to an air-gapped system. ```shell # Unzip the VCF SDK zip unzip vcf-python-sdk-9.0.0.0-24798170.zip -d vcf-sdk-python cd vcf-sdk-python # Download third party dependencies from PyPI pip download -r requirements-third-party.txt -d pypi/ cd .. # zip the vcf-sdk-python with downloaded third party libraries zip -r vcf-sdk-python.zip vcf-sdk-python/ ``` -------------------------------- ### POST /api/vlcm/cluster/installed-images/extract Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/vlcm/cluster/installed_images/README.md Triggers an asynchronous workflow to scan hosts in a cluster and generate a report of installed software images. Returns a task ID for progress monitoring. ```APIDOC ## POST /api/vlcm/cluster/installed-images/extract ### Description Triggers the installed images workflow, which scans hosts in a cluster to generate a report of installed software. This is an asynchronous operation. ### Method POST ### Endpoint /api/vlcm/cluster/installed-images/extract ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **cluster_moid** (string) - Required - The MoID of the cluster for which to extract installed images. ### Request Example ```json { "cluster_moid": "group-h01" } ``` ### Response #### Success Response (200) - **task_id** (string) - The ID of the asynchronous task created to generate the installed images report. #### Response Example ```json { "task_id": "task-12345" } ``` ``` -------------------------------- ### Discover VMware Products using Python Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/vcenter/discovery_and_plan/README.md This sample demonstrates a workflow to discover VMware products. It utilizes REST APIs to fetch the product catalog, list associated products, and manage product deployments. Ensure the vCenter Server is accessible and provides the necessary credentials. ```python import requests def discover_products(server, username, password, skip_verification): session = requests.Session() session.auth = (username, password) session.verify = not skip_verification # Get product catalog catalog_url = f"https://{server}/lcm/rest/vcenter/lcm/discovery/product-catalog" response = session.get(catalog_url) print("Product Catalog:", response.json()) # Get associated products associated_products_url = f"https://{server}/lcm/rest/vcenter/lcm/discovery/associated-products" response = session.get(associated_products_url) print("Associated Products:", response.json()) # Example: Add a new product (replace with actual details) # create_spec = { # "productName": "ExampleProduct", # "version": "1.0", # "deployments": ["192.168.1.10"] # } # response = session.post(associated_products_url, json=create_spec) # print("Add Product Response:", response.json()) if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description='Run VMware Discovery workflow.') parser.add_argument('--server', required=True, help='vCenter Server IP address') parser.add_argument('--username', required=True, help='vCenter username') parser.add_argument('--password', required=True, help='vCenter password') parser.add_argument('--skipverification', action='store_true', help='Skip SSL certificate verification') args = parser.parse_args() discover_products(args.server, args.username, args.password, args.skipverification) ``` -------------------------------- ### Download VVF Instance Bundles (Existing VCF Operations) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vcf-installer-samples/bundle/README.md Configures an online depot and downloads bundles for deploying a VVF instance, assuming existing VCF Operations components are in place. It requires VCF Installer host and credentials, along with depot account details. Optional parameters control synchronization and download polling timeouts. ```python python download_bundles_vvf_instance_existing_vcf_ops.py \ --vcf_installer_host_address \ --vcf_installer_admin_password \ --depot_account_username \ --depot_account_password \ [--ca_certs ] \ [--time_to_wait_for_depot_sync_in_minutes ] \ [--time_to_wait_in_between_polls_for_depot_sync_in_seconds ] \ [--max_time_to_poll_download_status_in_hours ] \ [--time_to_sleep_in_between_polls_for_download_status_in_seconds ] ``` -------------------------------- ### Upgrade Pip Package Manager Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Upgrades the pip package manager to the latest version, which is a prerequisite for installing and managing Python packages for the VCF SDK. Ensure you have a compatible Python version installed. ```shell pip install --upgrade pip ``` -------------------------------- ### View Command-Line Options for vSAN Samples Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsan/snapservice/README.md Displays the available command-line arguments and options for a specific vSAN Data Protection API sample script. This is useful for understanding how to configure and run individual samples. ```bash python samples/vsan/snapservice/ --help ``` -------------------------------- ### Connect to VCF Installer using Python SDK Source: https://context7.com/vmware/vcf-sdk-python/llms.txt Establishes a connection to the VCF Installer appliance, enabling the download of bundles and deployment of new VCF environments. It uses the `utils.client.create_vcf_installer_client` function. SSL verification is disabled by setting `ca_certs=False`, which is suitable for development and testing. ```python from utils.client import create_vcf_installer_client # Connect to VCF Installer (disable SSL verification for dev/test only) client = create_vcf_installer_client( server='192.168.1.50', password='VCFInstaller123!', ca_certs=False ) # Get appliance information try: appliance_info = client.v1.system.ApplianceInfo.get_appliance_info() print(f"Appliance Role: {appliance_info.role}") print(f"Version: {appliance_info.version}") except Exception as e: print(f"Error getting appliance info: {e}") ``` -------------------------------- ### Applmgmt Patching APIs Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/appliances/patching/README.md This section details the various endpoints available for managing patching operations on vCenter Server appliances. These APIs are used to check for pending updates, perform prechecks, validate, stage, and install patches. ```APIDOC ## GET /rest/appliance/update/pending ### Description Retrieves a list of pending updates for the vCenter Server appliance. ### Method GET ### Endpoint /rest/appliance/update/pending ### Parameters #### Query Parameters - **server** (string) - Required - The vCenter Server IP address or hostname. - **username** (string) - Required - The username for authentication. - **password** (string) - Required - The password for authentication. - **url** (string) - Optional - A custom URL for the vCenter Server. - **skipverification** (boolean) - Optional - Skips SSL certificate verification. ### Request Example ```json { "server": "your_vcenter_ip", "username": "your_username", "password": "your_password" } ``` ### Response #### Success Response (200) - **update_id** (string) - The ID of the pending update. - **component** (string) - The name of the component for which the update is available. #### Response Example ```json { "update_id": "update-1234", "component": "vCenter Server" } ``` ## GET /rest/appliance/update/pending/{{update_id}}/components ### Description Retrieves details about the components available for a specific pending update. ### Method GET ### Endpoint /rest/appliance/update/pending/{{update_id}}/components ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. ### Request Example ```json { "update_id": "update-1234" } ``` ### Response #### Success Response (200) - **component_name** (string) - The name of the component. - **version** (string) - The version of the component. #### Response Example ```json { "component_name": "vCenter Server", "version": "8.0.2" } ``` ## GET /rest/appliance/update/pending/{{update_id}} ### Description Retrieves the status of a specific pending update for a given component. ### Method GET ### Endpoint /rest/appliance/update/pending/{{update_id}} ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. #### Query Parameters - **component** (string) - Required - The name of the component to query. ### Request Example ```json { "update_id": "update-1234", "component": "vCenter Server" } ``` ### Response #### Success Response (200) - **status** (string) - The current status of the update for the component. #### Response Example ```json { "status": "Staged" } ``` ## POST /rest/appliance/update/pending/{{update_id}}?action=precheck ### Description Performs a precheck operation for a specific pending update. ### Method POST ### Endpoint /rest/appliance/update/pending/{{update_id}}?action=precheck ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. ### Request Example ```json { "update_id": "update-1234" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the result of the precheck. #### Response Example ```json { "message": "Precheck completed successfully." } ``` ## POST /rest/appliance/update/pending/{{update_id}}?action=validate ### Description Validates a specific pending update. ### Method POST ### Endpoint /rest/appliance/update/pending/{{update_id}}?action=validate ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. ### Request Example ```json { "update_id": "update-1234" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the result of the validation. #### Response Example ```json { "message": "Validation completed successfully." } ``` ## POST /rest/appliance/update/pending/{{update_id}}?action=stage ### Description Stages a specific pending update. ### Method POST ### Endpoint /rest/appliance/update/pending/{{update_id}}?action=stage ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. ### Request Example ```json { "update_id": "update-1234" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the result of the staging operation. #### Response Example ```json { "message": "Staging completed successfully." } ``` ## POST /rest/appliance/update/pending/{{update_id}}?action=install ### Description Installs a specific pending update. ### Method POST ### Endpoint /rest/appliance/update/pending/{{update_id}}?action=install ### Parameters #### Path Parameters - **update_id** (string) - Required - The ID of the pending update. ### Request Example ```json { "update_id": "update-1234" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the result of the installation operation. #### Response Example ```json { "message": "Installation initiated successfully." } ``` ``` -------------------------------- ### Unzip VCF SDK Python Archive Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md This command extracts the VCF SDK for Python zip archive into a specified directory and navigates into it. It's a prerequisite for installing the SDK and its dependencies. ```shell # unzip the SDK to vcf-sdk-python directory unzip vcf-python-sdk-9.0.0.0-24798170.zip -d vcf-sdk-python cd vcf-sdk-python ``` -------------------------------- ### Clone SDK Repository (Shell) Source: https://github.com/vmware/vcf-sdk-python/blob/main/README.md Command to clone the VCF SDK Python GitHub repository to your local machine. This is the first step to get access to the SDK's source code and samples. ```shell git clone https://github.com/vmware/vcf-sdk-python.git cd vcf-sdk-python ``` -------------------------------- ### Run External PSC SSO Workflow Sample (Command Line) Source: https://github.com/vmware/vcf-sdk-python/blob/main/vsphere-samples/vsphere-automation-sdk/samples/vsphere/sso/README.md This command executes a Python sample script to demonstrate an external Platform Services Controller (PSC) and Single Sign-On (SSO) workflow. It requires the Lookup Service URL, administrator credentials, and a verbose flag for detailed output. The sample relies on the vSphere Automation SDK for Python and the python SUDS client. ```cmd $ python external_psc_sso_workflow.py --lsurl https:///lookupservice/sdk -u 'administrator@vsphere.local' -p 'Admin!23' -v ```