Completed
Push — develop ( 0f3610...5e335d )
by
unknown
01:36
created

ComputeAPI.__init__()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
2
#
3
# Copyright (c) 2013-2015 Online SAS and Contributors. All Rights Reserved.
4
#                         Julien Castets <[email protected]>
5
#                         Kevin Deldycke <[email protected]>
6
#
7
# Licensed under the BSD 2-Clause License (the "License"); you may not use this
8
# file except in compliance with the License. You may obtain a copy of the
9
# License at http://opensource.org/licenses/BSD-2-Clause
10
11
from . import API
12
13
14
REGIONS = {
15
    'par1': {
16
        'url': 'https://cp-par1.scaleway.com/',
17
    },
18
    'ams1': {
19
        'url': 'https://cp-ams1.scaleway.com/',
20
    }
21
}
22
23
24
class ComputeAPI(API):
25
    """ The default region is par1 as it was the first availability zone
26
    provided by Scaleway, but it could change in the future.
27
    """
28
29
    def __init__(self, region='par1', **kwargs):
30
        assert region in REGIONS
31
        base_url = REGIONS[region]['url']
32
        super(ComputeAPI, self).__init__(base_url=base_url, **kwargs)
33