Retrieves NSX credentials for a Private Cloud.

## Explore further


For detailed documentation that includes this code sample, see the following:

- [Creating a VMware Engine private cloud](https://docs.cloud.google.com/vmware-engine/docs/private-clouds/howto-create-private-cloud.md.txt)

## Code sample

### Python


To authenticate to VMware Engine, set up Application Default Credentials.
For more information, see

[Set up authentication for a local development environment](https://docs.cloud.google.com/docs/authentication/set-up-adc-local-dev-environment.md.txt).

```python
from google.cloud import vmwareengine_v1


def get_nsx_credentials(
    project_id: str, zone: str, private_cloud_name: str
) -> vmwareengine_v1.Credentials:
    """
    Retrieves NSX credentials for a Private Cloud.

    Args:
        project_id: name of the project hosting the private cloud.
        zone: name of the zone hosting the private cloud.
        private_cloud_name: name of the private cloud.

    Returns:
        A Credentials object.
    """
    client = vmwareengine_v1.VmwareEngineClient()
    credentials = client.show_nsx_credentials(
        private_cloud=f"projects/{project_id}/locations/{zone}/privateClouds/{private_cloud_name}"
    )
    return credentials

```

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples.md.txt?product=googlecloudvmwareengine).