Credentials

class Credentials(session_kwargs, client, return_type='raw')

Methods

delete(id)

Delete a credential

delete_shares_groups(id, group_id)

Revoke the permissions a group has on this object

delete_shares_users(id, user_id)

Revoke the permissions a user has on this object

get(id)

Get a credential

list(*[, type, remote_host_id, default, ...])

List credentials

list_dependencies(id, *[, user_id])

List dependent objects for this object

list_shares(id)

List users and groups permissioned on this object

list_types()

Get list of Credential Types

patch(id, *[, name, type, description, ...])

Update some attributes of a credential

post(type, username, password, *[, name, ...])

Create a credential

post_authenticate(url, remote_host_type, ...)

Authenticate against a remote host

post_temporary(id, *[, duration])

Generate a temporary credential for accessing S3

put(id, type, username, password, *[, name, ...])

Update an existing credential

put_shares_groups(id, group_ids, ...[, ...])

Set the permissions groups has on this object

put_shares_users(id, user_ids, ...[, ...])

Set the permissions users have on this object

put_transfer(id, user_id, ...[, email_body, ...])

Transfer ownership of this object to another user

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.credentials.list_types(...)
delete(id: int)

Delete a credential

Parameters:
idint

The ID of the credential.

Returns:
None

Response code 204: success

delete_shares_groups(id: int, group_id: int)

Revoke the permissions a group has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idint

The ID of the group.

Returns:
None

Response code 204: success

delete_shares_users(id: int, user_id: int)

Revoke the permissions a user has on this object

Parameters:
idint

The ID of the resource that is shared.

user_idint

The ID of the user.

Returns:
None

Response code 204: success

get(id: int)

Get a credential

Parameters:
idint

The ID of the credential.

Returns:
civis.response.Response
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

list(*, type: str = None, remote_host_id: int = None, default: bool = None, system_credentials: bool = None, users: str = None, name: str = None, limit: int = None, page_num: int = None, order: str = None, order_dir: str = None, iterator: bool = None)

List credentials

Parameters:
typestr, optional

The type (or types) of credentials to return. One or more of: Amazon Web Services S3, Bitbucket, CASS/NCOA PAF, Certificate, Civis Platform, Custom, Database, Google, Github, Salesforce User, Salesforce Client, and TableauUser. Specify multiple values as a comma-separated list (e.g., “A,B”).

remote_host_idint, optional

The ID of the remote host associated with the credentials to return.

defaultbool, optional

If true, will return a list with a single credential which is the current user’s default credential.

system_credentialsbool, optional

If true, will only return system credentials. System credentials can only be created and viewed by Civis Admins.

usersstr, optional

A comma-separated list of user ids. If specified, returns set of credentials owned by the users that requesting user has at least read access on.

namestr, optional

If specified, will be used to filter the credentials returned. Will search across name and will return any full name containing the search string.

limitint, optional

Number of results to return. Defaults to its maximum of 1000.

page_numint, optional

Page number of the results to return. Defaults to the first page, 1.

orderstr, optional

The field on which to order the result set. Defaults to updated_at. Must be one of: updated_at, created_at, name.

order_dirstr, optional

Direction in which to sort, either asc (ascending) or desc (descending) defaulting to desc.

iteratorbool, optional

If True, return a generator to iterate over all responses. Use when more results than the maximum allowed by limit are needed. When True, limit and page_num are ignored. Defaults to False.

Returns:
civis.response.PaginatedResponse
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

list_dependencies(id: int, *, user_id: int = None)

List dependent objects for this object

Parameters:
idint

The ID of the resource that is shared.

user_idint, optional

ID of target user

Returns:
civis.response.Response
  • object_typestr

    Dependent object type

  • fco_typestr

    Human readable dependent object type

  • idint

    Dependent object ID

  • namestr

    Dependent object name, or nil if the requesting user cannot read this object

  • permission_levelstr

    Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

  • descriptionstr

    Additional information about the dependency, if relevant

  • shareablebool

    Whether or not the requesting user can share this object.

list_shares(id: int)

List users and groups permissioned on this object

Parameters:
idint

The ID of the resource that is shared.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

list_types()

Get list of Credential Types

Returns:
civis.response.Response
  • typesList[str]

    list of acceptable credential types

patch(id: int, *, name: str = None, type: str = None, description: str = None, username: str = None, password: str = None, remote_host_id: int = None, user_id: int = None, state: str = None, system_credential: bool = None, default: bool = None, oauth: bool = None)

Update some attributes of a credential

Parameters:
idint

The ID of the credential.

namestr, optional

The name identifying the credential.

typestr, optional

The type of credential. Note: only these credentials can be created or edited via this API [“Amazon Web Services S3”, “CASS/NCOA PAF”, “Certificate”, “Civis Platform”, “Custom”, “Database”, “Google”, “Salesforce User”, “Salesforce Client”, “TableauUser”]

descriptionstr, optional

A long description of the credential.

usernamestr, optional

The username for the credential.

passwordstr, optional

The password for the credential.

remote_host_idint, optional

The ID of the remote host associated with the credential.

user_idint, optional

The ID of the user the credential is created for. Note: This attribute is only accepted if you are a Civis Admin User.

statestr, optional

The U.S. state for the credential. Only for VAN credentials.

system_credentialbool, optional

Boolean flag that sets a credential to be a system credential. System credentials can only be created by Civis Admins and will create a credential owned by the Civis Robot user.

defaultbool, optional

Whether or not the credential is a default. Only for Database credentials.

oauthbool, optional

Whether or not the credential is an OAuth credential.

Returns:
civis.response.Response
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

post(type: str, username: str, password: str, *, name: str = None, description: str = None, remote_host_id: int = None, user_id: int = None, state: str = None, system_credential: bool = None, default: bool = None, oauth: bool = None)

Create a credential

Parameters:
typestr

The type of credential. Note: only these credentials can be created or edited via this API [“Amazon Web Services S3”, “CASS/NCOA PAF”, “Certificate”, “Civis Platform”, “Custom”, “Database”, “Google”, “Salesforce User”, “Salesforce Client”, “TableauUser”]

usernamestr

The username for the credential.

passwordstr

The password for the credential.

namestr, optional

The name identifying the credential.

descriptionstr, optional

A long description of the credential.

remote_host_idint, optional

The ID of the remote host associated with the credential.

user_idint, optional

The ID of the user the credential is created for. Note: This attribute is only accepted if you are a Civis Admin User.

statestr, optional

The U.S. state for the credential. Only for VAN credentials.

system_credentialbool, optional

Boolean flag that sets a credential to be a system credential. System credentials can only be created by Civis Admins and will create a credential owned by the Civis Robot user.

defaultbool, optional

Whether or not the credential is a default. Only for Database credentials.

oauthbool, optional

Whether or not the credential is an OAuth credential.

Returns:
civis.response.Response
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

post_authenticate(url: str, remote_host_type: str, username: str, password: str)

Authenticate against a remote host

Parameters:
urlstr

The URL to your host.

remote_host_typestr

The type of remote host. One of: RemoteHostTypes::Bigquery, RemoteHostTypes::Bitbucket, RemoteHostTypes::GitSSH, RemoteHostTypes::Github, RemoteHostTypes::GoogleDoc, RemoteHostTypes::JDBC, RemoteHostTypes::Postgres, RemoteHostTypes::Redshift, RemoteHostTypes::S3Storage, and RemoteHostTypes::Salesforce

usernamestr

The username for the credential.

passwordstr

The password for the credential.

Returns:
civis.response.Response
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

post_temporary(id: int, *, duration: int = None)

Generate a temporary credential for accessing S3

Parameters:
idint

The ID of the credential.

durationint, optional

The number of seconds the temporary credential should be valid. Defaults to 15 minutes. Must not be less than 15 minutes or greater than 36 hours.

Returns:
civis.response.Response
  • access_keystr

    The identifier of the credential.

  • secret_access_keystr

    The secret part of the credential.

  • session_tokenstr

    The session token identifier.

put(id: int, type: str, username: str, password: str, *, name: str = None, description: str = None, remote_host_id: int = None, user_id: int = None, state: str = None, system_credential: bool = None, default: bool = None, oauth: bool = None)

Update an existing credential

Parameters:
idint

The ID of the credential.

typestr

The type of credential. Note: only these credentials can be created or edited via this API [“Amazon Web Services S3”, “CASS/NCOA PAF”, “Certificate”, “Civis Platform”, “Custom”, “Database”, “Google”, “Salesforce User”, “Salesforce Client”, “TableauUser”]

usernamestr

The username for the credential.

passwordstr

The password for the credential.

namestr, optional

The name identifying the credential.

descriptionstr, optional

A long description of the credential.

remote_host_idint, optional

The ID of the remote host associated with the credential.

user_idint, optional

The ID of the user the credential is created for. Note: This attribute is only accepted if you are a Civis Admin User.

statestr, optional

The U.S. state for the credential. Only for VAN credentials.

system_credentialbool, optional

Boolean flag that sets a credential to be a system credential. System credentials can only be created by Civis Admins and will create a credential owned by the Civis Robot user.

defaultbool, optional

Whether or not the credential is a default. Only for Database credentials.

oauthbool, optional

Whether or not the credential is an OAuth credential.

Returns:
civis.response.Response
  • idint

    The ID of the credential.

  • namestr

    The name identifying the credential

  • typestr

    The credential’s type.

  • usernamestr

    The username for the credential.

  • descriptionstr

    A long description of the credential.

  • ownerstr

    The username of the user who this credential belongs to. Using user.username is preferred.

  • userdict
    • idint

      The ID of this user.

    • namestr

      This user’s name.

    • usernamestr

      This user’s username.

    • initialsstr

      This user’s initials.

    • onlinebool

      Whether this user is online.

  • remote_host_idint

    The ID of the remote host associated with this credential.

  • remote_host_namestr

    The name of the remote host associated with this credential.

  • statestr

    The U.S. state for the credential. Only for VAN credentials.

  • created_atstr (time)

    The creation time for this credential.

  • updated_atstr (time)

    The last modification time for this credential.

  • defaultbool

    Whether or not the credential is a default. Only for Database credentials.

  • oauthbool

    Whether or not the credential is an OAuth credential.

put_shares_groups(id: int, group_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions groups has on this object

Parameters:
idint

The ID of the resource that is shared.

group_idsList[int]

An array of one or more group IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_shares_users(id: int, user_ids: List[int], permission_level: str, *, share_email_body: str = None, send_shared_email: bool = None)

Set the permissions users have on this object

Parameters:
idint

The ID of the resource that is shared.

user_idsList[int]

An array of one or more user IDs.

permission_levelstr

Options are: “read”, “write”, or “manage”.

share_email_bodystr, optional

Custom body text for e-mail sent on a share.

send_shared_emailbool, optional

Send email to the recipients of a share.

Returns:
civis.response.Response
  • readersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • writersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • ownersdict
    • usersList[dict]
      • id : int

      • name : str

    • groupsList[dict]
      • id : int

      • name : str

  • total_user_sharesint

    For owners, the number of total users shared. For writers and readers, the number of visible users shared.

  • total_group_sharesint

    For owners, the number of total groups shared. For writers and readers, the number of visible groups shared.

put_transfer(id: int, user_id: int, include_dependencies: bool, *, email_body: str = None, send_email: bool = None)

Transfer ownership of this object to another user

Parameters:
idint

The ID of the resource that is shared.

user_idint

ID of target user

include_dependenciesbool

Whether or not to give manage permissions on all dependencies

email_bodystr, optional

Custom body text for e-mail sent on transfer.

send_emailbool, optional

Send email to the target user of the transfer?

Returns:
civis.response.Response
  • dependenciesList[dict]

    Dependent objects for this object

    • object_typestr

      Dependent object type

    • fco_typestr

      Human readable dependent object type

    • idint

      Dependent object ID

    • namestr

      Dependent object name, or nil if the requesting user cannot read this object

    • permission_levelstr

      Permission level of target user (not user’s groups) for dependent object. Null if no target user or not shareable (e.g. a database table).

    • descriptionstr

      Additional information about the dependency, if relevant

    • sharedbool

      Whether dependent object was successfully shared with target user