scaleway package

Subpackages

Module contents

Scaleway SDK for Python

class scaleway.API(client: Client, *, bypass_validation: bool = False)

Bases: object

class scaleway.Client(access_key: Optional[str] = None, secret_key: Optional[str] = None, api_url: str = 'https://api.scaleway.com', api_allow_insecure: bool = False, user_agent: str = 'scaleway-sdk-python/2.0.0', default_organization_id: Optional[str] = None, default_project_id: Optional[str] = None, default_region: Optional[str] = None, default_zone: Optional[str] = None, default_page_size: Optional[int] = None)

Bases: Profile

static from_profile(profile: Profile) Client
validate() bool
validate_credentials() bool
validate_settings() bool
class scaleway.Money(currency_code: str, units: float, nanos: int)

Bases: object

Represents an amount of money with its currency type.

currency_code: str

3-letter currency code defined in ISO 4217.

nanos: int

Number of nano (10^-9) units of the amount.

The value must be between -999,999,999 and +999,999,999 inclusive. If units is positive, nanos must be positive or zero. If units is zero, nanos can be positive, zero, or negative. If units is negative, nanos must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.

units: float

Whole units of the amount.

For example if currency_code is “USD”, then 1 unit is one US dollar.

class scaleway.Profile(access_key: 'Optional[str]' = None, secret_key: 'Optional[str]' = None, api_url: 'str' = 'https://api.scaleway.com', api_allow_insecure: 'bool' = False, user_agent: 'str' = 'scaleway-sdk-python/2.0.0', default_organization_id: 'Optional[str]' = None, default_project_id: 'Optional[str]' = None, default_region: 'Optional[str]' = None, default_zone: 'Optional[str]' = None, default_page_size: 'Optional[int]' = None)

Bases: ProfileDefaults, ProfileConfig

classmethod from_config_file(filepath: Optional[str] = None, profile_name: Optional[str] = 'default', force_none: bool = False) ProfileSelf
classmethod from_config_file_and_env(filepath: Optional[str] = None, profile_name: Optional[str] = 'default') ProfileSelf

Loads profile from a config file and environment variables.

Environment variables override config file.
  • If config file is not found, the profile is still loaded from environment variables.

  • If you want it to throw an error in case of missing or invalid config file, use Profile.from_config_file and Profile.from_env instead.

classmethod from_env(force_none: bool = False) ProfileSelf

Loads profile from environment variables.

classmethod get_default_config_directory() str
classmethod get_default_config_file_path(filepath: Optional[str] = None) str
merge(other: Profile) None

Merge the current profile with another one.

class scaleway.ProfileConfig(access_key: 'Optional[str]' = None, secret_key: 'Optional[str]' = None, api_url: 'str' = 'https://api.scaleway.com', api_allow_insecure: 'bool' = False, user_agent: 'str' = 'scaleway-sdk-python/2.0.0')

Bases: object

access_key: Optional[str] = None

You need an access key and a secret key to connect to Scaleway API. Generate your access key at the following address: https://console.scaleway.com/project/credentials.

api_allow_insecure: bool = False

Allow insecure connection to the API.

api_url: str = 'https://api.scaleway.com'

The Scaleway API URL. Change that if you want to direct requests to a different endpoint.

secret_key: Optional[str] = None

The secret key is the value that can be used to authenticate against the API (the value used in X-Auth-Token HTTP-header). The secret key MUST remain secret and not given to anyone or published online. Generate your secret key at the following address: https://console.scaleway.com/project/credentials.

user_agent: str = 'scaleway-sdk-python/2.0.0'

The User-Agent sent with each request.

class scaleway.ProfileDefaults(default_organization_id: 'Optional[str]' = None, default_project_id: 'Optional[str]' = None, default_region: 'Optional[str]' = None, default_zone: 'Optional[str]' = None, default_page_size: 'Optional[int]' = None)

Bases: object

default_organization_id: Optional[str] = None

Your organization ID is the identifier of your account inside Scaleway infrastructure.

default_page_size: Optional[int] = None

The default number of results when requesting a paginated resource.

default_project_id: Optional[str] = None

Your project ID is the identifier of the project your resources are attached to.

default_region: Optional[str] = None

A region is represented as a geographical area such as France (Paris) or the Netherlands (Amsterdam). It can contain multiple availability zones.

Examples: fr-par, nl-ams.

default_zone: Optional[str] = None

A region can be split into many availability zones (AZ). Latency between multiple AZ of the same region are low as they have a common network layer.

Examples: fr-par-1, nl-ams-1

scaleway.Region

alias of str

exception scaleway.ScalewayException(response: requests.models.Response)

Bases: Exception

response: Response
property status_code: int
class scaleway.ScwFile(name: str, content_type: str, content: str)

Bases: object

Represents a Scaleway file.

content: str

Content of the file in base64.

content_type: str

Content-type of the file.

name: str

Name of the file.

class scaleway.ServiceInfo(name: str, description: str, version: str, documentation_url: Optional[str] = None)

Bases: object

Represents API metadata.

These metadata are only here for debugging. Do not rely on these values.

description: str

Human readable description for the API.

documentation_url: Optional[str] = None

Web url where the documentation of the API can be found.

name: str

Name of the API

version: str

Version of the API.

class scaleway.TimeSeries(name: str, points: List[TimeSeriesPoint], metadata: Dict[str, str])

Bases: object

Represents a time series that could be used for graph purposes.

metadata: Dict[str, str]

Metadata contains some string metadata related to a metric.

name: str

Name of the metric.

points: List[TimeSeriesPoint]

Points contains all the points that composed the series.

class scaleway.TimeSeriesPoint(timestamp: datetime, value: float)

Bases: object

Represents a point in a TimeSeries.

timestamp: datetime

Date of the point.

value: float

Value of the point.

class scaleway.WaitForOptions(timeout: float = 300, min_delay: float = 1, max_delay: float = 30, stop: Optional[Callable[[T], U]] = None)

Bases: Generic[T, U]

The options to wait until a resource is ready.

max_delay: float = 30

The maximum delay before the next try in seconds.

Default:

30 seconds.

min_delay: float = 1

The minimum delay before the next try in seconds.

Default:

1 second.

stop: Optional[Callable[[T], U]] = None

The condition to stop trying.

Default:

Waits for non-transient value.

timeout: float = 300

Timeout in seconds.

Default:

300 seconds (5 minutes).

scaleway.Zone

alias of str