Secret module

A secret is an object containing sensitive information or confidential data such as a password, SSH private key, SSL certificate. It grants rapyuta.io access to private git repositories and private docker images so that the platform can build source code in private git repositories or use private docker images.

Client Module

class Client(auth_token, project=None)

Client class provides access to device, package, volume and deployment classes.

__init__(auth_token, project=None)

Get new client object

Parameters
  • auth_token (string) – Authentication token

  • project (string) – project_guid of the user

create_secret(secret)

Create a new Secret on the Platform under the project.

Parameters

secret (Secret) – Secret object

Return type

Secret

Following example demonstrates the use of this method for creating a new Secret.

>>> from rapyuta_io.clients.secret import Secret, SecretConfigSourceBasicAuth
>>> client = Client(auth_token='auth_token', project='project_guid')
>>> secret_config = SecretConfigSourceBasicAuth('user', 'password')
>>> secret = Secret('secret-name', secret_config)
>>> client.create_secret(secret)
delete_secret(guid)

Delete a secret using its GUID.

Parameters

guid (str) – Project’s GUID

Following example demonstrates how to delete a Secret using this method.

>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.delete_secret('secret-guid')
get_secret(guid)

Get a Secret using its GUID.

Parameters

guid (str) – Secret’s GUID

Return type

Secret

Following example demonstrates how a Secret can be fetched using this method.

>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.get_secret('secret-guid')
list_secrets()

List all the Secrets under the Project on the Platform.

Returns

A list of all available Secrets under the selected Project.

Return type

list(Secret)

Following example demonstrates how to fetch the list of all Secrets.

>>> client = Client(auth_token='auth_token', project='project_guid')
>>> client.list_secrets()

Secret Module

class Secret(name, secret_config)

Secret is a resource that let’s the IO Platform access private resources (Git or Docker Repositories) from third-party providers.

Variables
  • name – Name of the Secret

  • guid – GUID of the Secret

  • secret_type – Type of the Secret

  • created_at – Creation Time of the Secret

  • creator – Create of the Secret

Parameters
class SecretConfigDocker(username, password, email, registry='https://index.docker.io/v1/')

SecretConfigDocker represents Docker Secret for Docker registries. This type of secrets can be used to access private Docker repositories for either pulling base images or pushing the images from Builds.

Parameters
  • username (str) – Username for the Container Registry

  • password (str) – Password/Token for the Container Registry

  • registry (str) – The URL for the Container Registry, by default it uses DockerHub Registry

class SecretConfigSourceBasicAuth(username, password, ca_cert=None)

SecretConfigSourceBasicAuth represents Source Secret with Basic Authentication. This type of secrets can be used to access private Git repositories exposing HTTP interface, for building the Docker images from Source Code.

Parameters
  • username (str) – Username for the Git repository hosting

  • password (str) – Password for the Git repository hosting

  • ca_cert (str) – If the Git repository is using self-signed certificates, a CA Root Certificate can optionally be provided.

class SecretConfigSourceSSHAuth(ssh_key)

SecretConfigSSHAuth represents Source Secret with SSH Authentication. This type of secrets can be used to access private Git repositories using SSH, for building the Docker images from Source Code.

Parameters

ssh_key (str) – Private SSH key for authenticating with the Git repository hosting

class SecretType(value)

SecretType is a Enum type defining different types of Secrets possible on the Platform.

SecretType can be any of the following types

SecretType.DOCKER

SecretType.SOURCE_BASIC_AUTH

SecretType.SOURCE_SSH_AUTH