Delete tenant (v4beta1)

Delete tenant.

Explore further

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

Code sample

Node.js

To learn how to install and use the client library for CTS, see CTS client libraries. For more information, see the CTS Node.js API reference documentation.

To authenticate to CTS, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


const talent = require('@google-cloud/talent').v4;

/** Delete Tenant */
function sampleDeleteTenant(projectId, tenantId) {
  const client = new talent.TenantServiceClient();
  // const projectId = 'Your Google Cloud Project ID';
  // const tenantId = 'Your Tenant ID)';
  const formattedName = client.tenantPath(projectId, tenantId);
  client.deleteTenant({name: formattedName}).catch(err => {
    console.error(err);
  });
  console.log('Deleted Tenant.');
}

Python

To learn how to install and use the client library for CTS, see CTS client libraries. For more information, see the CTS Python API reference documentation.

To authenticate to CTS, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


from google.cloud import talent


def delete_tenant(project_id, tenant_id):
    """Delete Tenant"""

    client = talent.TenantServiceClient()

    # project_id = 'Your Google Cloud Project ID'
    # tenant_id = 'Your Tenant ID)'

    if isinstance(project_id, bytes):
        project_id = project_id.decode("utf-8")
    if isinstance(tenant_id, bytes):
        tenant_id = tenant_id.decode("utf-8")
    name = client.tenant_path(project_id, tenant_id)

    client.delete_tenant(name=name)
    print("Deleted Tenant.")

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.