Exemplo n.º 1
0
        click.echo(
            tabulate(_secrets_to_table(secrets_json), headers=SECRET_HEADER))


@click.command(
    context_settings=CONTEXT_SETTINGS,
    short_help=
    'Creates or overwrites an access control rule for a principal applied to '
    'a given secret scope. "write-acl" is an alias for "put-acl".')
@click.option('--scope',
              required=True,
              type=SecretScopeClickType(),
              help=SecretScopeClickType.help)
@click.option('--principal',
              required=True,
              type=SecretPrincipalClickType(),
              help=SecretPrincipalClickType.help)
@click.option('--permission',
              type=click.Choice(['MANAGE', 'WRITE', 'READ']),
              required=True,
              help='The permission to apply.')
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def put_acl(api_client, scope, principal, permission):
    """
    Creates or overwrites the ACL associated with the given principal (user or group) on the
    specified secret scope.

    "databricks secrets write-acl" is an alias for "databricks secrets put-acl",
Exemplo n.º 2
0
    """
    Lists the secret keys that are stored at this scope. Also lists the last updated timestamp
    (UNIX time in milliseconds) if available.
    """
    secrets_json = SecretApi(api_client).list_secrets(scope)
    if OutputClickType.is_json(output):
        click.echo(pretty_format(secrets_json))
    else:
        click.echo(tabulate(_secrets_to_table(secrets_json), headers=SECRET_HEADER))


@click.command(context_settings=CONTEXT_SETTINGS,
               short_help='Creates or overwrites an access control rule for a principal applied to '
                          'a given secret scope. "write-acl" is an alias for "put-acl".')
@click.option('--scope', required=True, type=SecretScopeClickType(), help=SecretScopeClickType.help)
@click.option('--principal', required=True, type=SecretPrincipalClickType(),
              help=SecretPrincipalClickType.help)
@click.option('--permission', type=click.Choice(['MANAGE', 'WRITE', 'READ']),
              required=True, help='The permission to apply.')
@debug_option
@profile_option
@eat_exceptions
@provide_api_client
def put_acl(api_client, scope, principal, permission):
    """
    Creates or overwrites the ACL associated with the given principal (user or group) on the
    specified secret scope.

    "databricks secrets write-acl" is an alias for "databricks secrets put-acl",
    and will be deprecated in a future release.
    """