Skip to content

Tenant

Bases: DuploResourceV2

Duplo Tenant Resource

The tenant resource provides a set of commands to manage tenants in the Duplo system.

Basic CLI Use
duploctl tenant <action>

Commands

add_user

Add User to Tenant

CLI Usage
duploctl tenant add_user <user> --tenant <tenant_name>

Returns:

Name Type Description
message dict

A message indicating the user was added to the tenant.

Parameters:

name positional
The resource name
str

apply

Apply a service.

Parameters:

--file, -f, --cli-input
A file to read the input from
FileType('r') action: YamlAction
--wait, -w
Wait for the operation to complete

billing

Tenant Billing Information

Get the spend for the tenant.

Basic CLI Use
duploctl tenant billing <tenant-name>

Returns:

Name Type Description
billing dict

The billing information for the tenant.

Parameters:

name positional
The resource name
str

config

Manage Tenant Settings

Send a series of new settings and even some to delete.

Basic CLI Use
duploctl tenant config <tenant-name> --setvar <key> <value> --deletevar key3

Returns:

Name Type Description
message dict

The message that the tenant settings were updated.

Parameters:

name positional
The resource name
str
--setvar, -V <key> <value> repeatable
a key and value to set as an environment variable
str nargs: 2
--deletevar, -D repeatable
a key to delete from the environment variables
str

create

Create Tenant.

Create a new tenant with a new body for a tenant.

Basic CLI Use
duploctl tenant create --file tenant.yaml
Tenant Body

Contents of the tenant.yaml file

AccountName: duploctl
PlanID: default
TenantBlueprint: None

Create One Liner

Here is how to create a tenant in one line.

echo """
AccountName: duploctl
PlanID: default
TenantBlueprint: None

""" | duploctl tenant create -f -

Returns:

Name Type Description
message dict

The message that the tenant was created

Model: AddTenantRequest
{
  "description": "AddTenantRequest",
  "properties": {
    "PlanID": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Planid"
    },
    "AccountName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Accountname"
    },
    "TenantId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Tenantid"
    },
    "ExistingK8sNamespace": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Existingk8Snamespace"
    }
  },
  "title": "AddTenantRequest",
  "type": "object"
}

Parameters:

--file, -f, --cli-input
A file to read the input from
AddTenantRequest action: YamlAction

delete

Delete Tenant

Delete a tenant by name. If delete protection is enabled, the delete will fail unless --force is passed, which disables delete protection first via set_metadata.

Basic CLI Use
duploctl tenant delete <name>
duploctl tenant delete <name> --force

Returns:

Name Type Description
message dict

The message that the tenant was deleted.

Parameters:

name positional
The resource name
str
--force, --force
Force the operation, bypassing safety guards such as delete protection

dns_config

Tenant DNS Config

Retrieve DNS configuration for a tenant by name..

Basic CLI Use
duploctl tenant dns_config <name>

Returns:

Name Type Description
dns_config dict

A dictionary containing the DNS configuration of the tenant.

Parameters:

name positional
The resource name
str

faults

Tenant Faults

Retrieves the list of faults for a tenant.

Basic CLI Use
duploctl tenant faults <tenant-name>

Returns:

Name Type Description
faults list

A list of faults.

Parameters:

name positional
The resource name
str

find

Find a tenant.

Find a tenant by name or id. Passing in a name directly takes highest precedence. If a name is not passed in, the id is second highest precedence. Lastly if the global tenant name is set, that will be used.

The global tenant id takes care of the commandline. For other code, sometimes the id needs to be passed in directly. If this happens, that id takes most precedence.

Basic CLI Use
duploctl tenant find <name>

Returns:

Name Type Description
tenant dict

The tenant.

Parameters:

name positional
The resource name
str

get_metadata

List Tenant Metadata

Retrieve all typed metadata entries for a tenant.

Basic CLI Use
duploctl tenant get_metadata <tenant-name>
duploctl tenant get_metadata -T myenv

Returns:

Name Type Description
metadata list

A list of metadata entry objects.

Parameters:

name positional
The resource name
str

host_images

Available Duplo Host Images

Get the list of host images for the tenant. These AMI's are region scoped.

Basic CLI Use
duploctl tenant host_images <tenant-name>

Returns:

Name Type Description
host_images list

A list of host images.

Parameters:

name positional
The resource name
str

list

List Tenants

Retrieve a list of all tenants in the Duplo system.

Basic CLI Use
duploctl tenant list

Returns:

Name Type Description
tenants list

A list of tenants.

list_users

List users assigned to a tenant

Retrieve a list of all users with access to a tenant

Basic CLI Use
duploctl tenant list_users

Returns:

Name Type Description
users list

A list of users with access to the tenants, their readonly status, and if they're an admin user

Parameters:

name positional
The resource name
str

logging

Toggle Loggine

Enable or disable logging for a tenant.

Basic CLI Use
duploctl tenant logging <tenant-name> (default: true) // false not supported

Returns:

Name Type Description
message dict

The message that the tenant logging was toggled

Parameters:

name positional
The resource name
str
--enable, -y
Enable or disable the feature
bool action: BooleanOptionalAction

region

Tenant Region

Get the region the tenants infrastructure is placed in.

Basic CLI Use
duploctl tenant region <tenant-name>

Returns:

Name Type Description
region dict

The region the tenant is in.

Parameters:

name positional
The resource name
str

remove_user

Remove a User from a Tenant

CLI Usage
duploctl tenant remove_user <user> --tenant <tenant_name>

Returns:

Name Type Description
message dict

A message indicating the user was removed from the tenant.

Parameters:

name positional
The resource name
str

set_metadata

Create and Delete Tenant Metadata

Create or update typed metadata entries and/or delete existing ones for a tenant. If a key already exists it is updated to the new value. Deletes are processed after creates/updates.

Basic CLI Use
# create a text entry
duploctl tenant set_metadata -T myenv --metadata featureFlag text enabled

# create a URL entry
duploctl tenant set_metadata -T myenv \
  --metadata dashboard url https://internal.example.com

# delete an entry
duploctl tenant set_metadata -T myenv --delete featureFlag

# mixed create and delete in one call
duploctl tenant set_metadata -T myenv \
  --metadata newKey text newValue \
  --delete oldKey

Returns:

Name Type Description
changes dict

Summary with created, updated, and deleted lists.

Raises:

Type Description
DuploError

If a key to delete does not exist, or if the API returns an error during create/update.

Parameters:

name positional
The resource name
str
--metadata, --metadata
A typed key-value metadata entry: --metadata <key> <type> <value> (repeatable). Type must be one of: aws_console, text, url.
str action: MetadataAction
--deletes, --delete repeatable
A key to delete (repeatable).
str

shutdown

Shutdown Tenant

Shutdown a tenant by name and with a schedule.

Basic CLI Use
// Below command shutdown the tenant after 5 minutes (default)
duploctl tenant shutdown <tenant-name>
// Below command shutdown the tenant after given time 'minutes'(m), 'hours'(h) and 'day'(d) and it also support overriding the shutdown time.
duploctl tenant shutdown <tenant-name> <time) // Example: 5m, 2h, 1d

Returns:

Name Type Description
message dict

The message that the tenant was shutdown

Parameters:

name positional
The resource name
str
--schedule, -s
The schedule to use
str

start

Start Tenant All Resources

Starts all resources of a tenant.

Basic CLI Use
duploctl tenant start

Returns:

Name Type Description
message dict

A success message.

Parameters:

name positional
The resource name
str
--exclude, --exclude repeatable
Exclude from the command
str

stop

Stop Tenant All Resources

Stops all resources of a tenant.

Basic CLI Use
duploctl tenant stop

Returns:

Name Type Description
message dict

A success message.

Parameters:

name positional
The resource name
str
--exclude, --exclude repeatable
Exclude from the command
str

Methods

get_hosts_to_exclude

name_from_body