fluke.auth

class fluke.auth.AWSAuth(aws_access_key_id: str, aws_secret_access_key: str, aws_session_token: Optional[str] = None, region: Optional[Region] = None)[source]

This class is used for authenticating with AWS.

Parameters
  • aws_access_key_id (str) – The access key for your AWS account.

  • aws_secret_access_key (str) – The secret key for your AWS account.

  • aws_session_token (str | None) – The session key for your AWS account. Defaults to None.

  • region (AWSAuth.Region | None) – The AWS Region used in instantiating the client. Defaults to None.

class Region(value)[source]

This enum-class represents various AWS regions.

AFRICA_SOUTH_1 = 'af-south-1'
ASIA_PACIFIC_EAST_1 = 'ap-east-1'
ASIA_PACIFIC_NORTHEAST_1 = 'ap-northeast-1'
ASIA_PACIFIC_NORTHEAST_2 = 'ap-northeast-2'
ASIA_PACIFIC_NORTHEAST_3 = 'ap-northeast-3'
ASIA_PACIFIC_SOUTHEAST_1 = 'ap-southeast-1'
ASIA_PACIFIC_SOUTHEAST_2 = 'ap-southeast-2'
ASIA_PACIFIC_SOUTHEAST_3 = 'ap-southeast-3'
ASIA_PACIFIC_SOUTHEAST_4 = 'ap-southeast-4'
ASIA_PACIFIC_SOUTH_1 = 'ap-south-1'
ASIA_PACIFIC_SOUTH_2 = 'ap-south-2'
CANADA_CENTRAL_1 = 'ca-central-1'
EUROPE_CENTRAL_1 = 'eu-central-1'
EUROPE_CENTRAL_2 = 'eu-central-2'
EUROPE_NORTH_1 = 'eu-north-1'
EUROPE_SOUTH_1 = 'eu-south-1'
EUROPE_WEST_1 = 'eu-west-1'
EUROPE_WEST_2 = 'eu-west-2'
EUROPE_WEST_3 = 'eu-west-3'
MIDDLE_EAST_CENTRAL_1 = 'me-central-1'
SOUTH_AMERICA_EAST_1 = 'sa-east-1'
US_EAST_1 = 'us-east-1'
US_EAST_2 = 'us-east-2'
US_GOV_EAST_1 = 'us-gov-east-1'
US_GOV_EAST_2 = 'us-gov-east-2'
US_WEST_1 = 'us-west-1'
US_WEST_2 = 'us-west-2'
get_credentials() dict[str, str][source]

Returns the provided credentials stored within a dictionary.

class fluke.auth.AzureAuth[source]

This class is used for authenticating with Microsoft Azure.

classmethod from_conn_string(conn_string: str) AzureAuth[source]

Returns an AzureAuth instance used for authenticating with Microsoft Azure via a connection string.

classmethod from_service_principal(account_url: str, tenant_id: str, client_id: str, client_secret: str) AzureAuth[source]

Returns an AzureAuth instance used for authenticating with Microsoft Azure via a, Azure service principal.

Parameters
  • account_url (str) – The URI to the storage account.

  • tenant_id (str) – ID of the service principal’s tenant.

  • client_id (str) – The service principal’s client ID.

  • client_secret (str) – One of the service principal’s client secrets.

get_credentials() dict[str, str][source]

Returns the provided credentials stored within a dictionary.

class fluke.auth.GCPAuth[source]

This class is used for authenticating with GCP.

classmethod from_application_default_credentials(project_id: str, credentials: str) GCPAuth[source]

Returns a GCPAuth instance used for authenticating with a GCP project via the Application Default Credentials (ADC) strategy.

Parameters
  • project_id (str) – The GCP project’s identifier.

  • credentials (str) – The path to the JSON file containing the credentials.

classmethod from_service_account_key(credentials: str) GCPAuth[source]

Returns a GCPAuth instance used for authenticating with a GCP project via a service account key file.

Parameters

credentials (str) – The path to the service account key JSON file.

get_credentials() dict[str, str][source]

Returns the provided credentials stored within a dictionary.

class fluke.auth.RemoteAuth[source]

This class is used for authenticating with a remote machine via the SSH protocol.

class PublicKey[source]

This class is used in order to generate a keys in case you need to explicitly provide the public of the host to which you wish to establish a connection.

classmethod generate_ecdsa_sha2_nistp256_key(key: str) PublicKey[source]

Generates an SHA2 NISTP256 key.

Parameters

key (str) – The public key.

classmethod generate_ecdsa_sha2_nistp384_key(key: str) PublicKey[source]

Generates an SHA2 NISTP384 key.

Parameters

key (str) – The public key.

classmethod generate_ecdsa_sha2_nistp521_key(key: str) PublicKey[source]

Generates an SHA2 NISTP521 key.

Parameters

key (str) – The public key.

classmethod generate_ssh_dss_key(key: str) PublicKey[source]

Generates an SSH DSA key.

Parameters

key (str) – The public key.

classmethod generate_ssh_ed25519_key(key: str) PublicKey[source]

Generates an SSH ED25519 key.

Parameters

key (str) – The public key.

classmethod generate_ssh_rsa_key(key: str) PublicKey[source]

Generates an SSH RSA key.

Parameters

key (str) – The public key.

classmethod from_key(hostname: str, username: str, pkey: str, passphrase: Optional[str] = None, port: int = 22, public_key: Optional[PublicKey] = None, verify_host: bool = True) RemoteAuth[source]

Returns a RemoteAuth instance used in authenticating with a remote machine via an SSH key.

Parameters
  • hostname (str) – The remote machine’s host name.

  • username (str) – The name of the user you will be logging in as.

  • pkey (str) – A path pointing to a file containing your machine’s private SSH key.

  • passphrase (str | None) – A passphrase used for decrypting the private key, only to be used in case it has been previously encrypted. Defaults to None.

  • port (int) – The port to which you will be connecting. Defaults to 22.

  • public_key (RemoteAuth.PublicKey | None) – The host’s public SSH key. Defaults to None.

  • verify_host (bool) – Unless set to False, a connection can only be established if the host is known to the local machine. Defaults to True.

classmethod from_password(hostname: str, username: str, password: str, port: int = 22, public_key: Optional[PublicKey] = None, verify_host: bool = True) RemoteAuth[source]

Returns a RemoteAuth instance used in authenticating with a remote machine via password.

Parameters
  • hostname (str) – The remote machine’s host name.

  • username (str) – The name of the user you will be logging in as.

  • password (str) – The user’s password.

  • port (int) – The port to which you will be connecting. Defaults to 22.

  • public_key (RemoteAuth.PublicKey | None) – The host’s public SSH key. Defaults to None.

  • verify_host (bool) – Unless set to False, a connection can only be established if the host is known to the local machine. Defaults to True.

get_credentials() dict[str, str][source]

Returns the provided credentials stored within a dictionary.