sightline.simon.config — Configuration Functions

These functions are for managing the SDK configuration, primarily for authentication and profile management.

sightline.simon.config.CONFIG_DIR

The directory that is being used to contain the SDK configuration files

sightline.simon.config.CONFIG_FILE

The base SDK configuration file

sightline.simon.config.DOCKER_CONFIG_FILE

The SDK docker configuration file, used to hold credentials used with the docker credential helper.

class sightline.simon.config.Profile[source]

A Python object representation of a DTaaS Profile.

  • full_url

    The full URL of the node that this Profile references

  • get_from_config(profile_name: str)[source]

    Returns the Profile from the config with the name profile_name. Raises ConfigError if the profile does not exist.

  • client_data

    The Client ID and Secret for the node that this Profile references

  • to_dict()[source]

    Returns the Profile data as a dictionary

sightline.simon.config.get_profile(profile_name: str)[source]

Returns the Profile with name matching profile_name

sightline.simon.config.set_profile(name: str, domain: str, access_token: str, refresh_token: str = None, expiry: float = None, tls: bool = True)[source]

Creates a Profile in the SDK configuration. Returns None.

sightline.simon.config.get_active_profile()[source]

Returns the currently active Profile from the configuration.

sightline.simon.config.as_profile(profile_name: str)[source]

Returns a ContextManager that can be used to impersonate the Profile with profile_name.

sightline.simon.config.list_profiles()[source]

Returns a list of all known Profiles.

sightline.simon.config.remove_profile(profile_name: str)[source]

Removes the Profile identified by profile_name and saves the configuration. If the active Profile is the one removed, a new Profile is set as active. If no remaining Profiles are available, no Profiles will be active afterwards.

sightline.simon.config.set_oauth_credentials(domain: str, client_id: str, client_secret: str, tls: bool = True)[source]

Low level function used to set the OAuth client credentials for a particular node identified by domain.

sightline.simon.config.get_oauth_credentials(domain: str)[source]

Low level function used to get the OAuth client credentials for a particular node identified by domain.