Ejemplo n.º 1
0
def bind_client(req, resp, kwargs):
    client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'])
    client.auth = None
    req.env['sl_client'] = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = get_auth(auth_token)
Ejemplo n.º 2
0
def bind_client(req, resp, kwargs):
    client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'],
                    proxy=cfg.CONF['softlayer']['proxy'])
    client.auth = None
    req.env['sl_client'] = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = get_auth(auth_token)
Ejemplo n.º 3
0
    def on_get(self, req, resp, token_id):
        token_details = get_token_details(token_id,
                                          tenant_id=req.get_param('belongsTo'))
        client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'])
        client.auth = get_auth(token_details)

        user = client['Account'].getCurrentUser(mask='id, username')
        access = get_access(token_id, token_details, user)

        resp.status = 200
        resp.body = {'access': access}
Ejemplo n.º 4
0
    def on_get(self, req, resp, token_id):
        token_details = get_token_details(token_id,
                                          tenant_id=req.get_param('belongsTo'))
        client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'])
        client.auth = get_auth(token_details)

        user = client['Account'].getCurrentUser(mask='id, username')
        access = get_access(token_id, token_details, user)

        resp.status = 200
        resp.body = {'access': access}
Ejemplo n.º 5
0
def bind_client(req, resp, kwargs):
    req.env['sl_timehook_start_time'] = time.time()
    client = TimedClient(endpoint_url=cfg.CONF['softlayer']['endpoint'],
                         proxy=cfg.CONF['softlayer']['proxy'])
    client.auth = None
    req.env['sl_client'] = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = get_auth(auth_token)
Ejemplo n.º 6
0
def bind_client(req, resp, kwargs):
    req.env['sl_timehook_start_time'] = time.time()
    endpoint = cfg.CONF['softlayer']['endpoint']
    client = SoftLayer.TimedClient(endpoint_url=endpoint,
                                   proxy=cfg.CONF['softlayer']['proxy'])
    client.auth = None
    req.sl_client = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = auth.get_auth(auth_token)
Ejemplo n.º 7
0
def bind_client(req, resp, kwargs):
    extra_args = {}
    if SoftLayer.__version__ > 'v3.0.3':
        extra_args['proxy'] = cfg.CONF['softlayer']['proxy']

    endpoint = cfg.CONF['softlayer']['endpoint']
    client = SoftLayer.Client(endpoint_url=endpoint, **extra_args)
    client.auth = None
    req.sl_client = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = auth.get_auth(auth_token)
Ejemplo n.º 8
0
def bind_client(req, resp, kwargs):
    extra_args = {}
    if SoftLayer.__version__ > 'v3.0.3':
        extra_args['proxy'] = cfg.CONF['softlayer']['proxy']

    endpoint = cfg.CONF['softlayer']['endpoint']
    client = SoftLayer.Client(endpoint_url=endpoint, **extra_args)
    client.auth = None
    req.env['sl_client'] = client

    auth_token = req.env.get('auth', None)

    if auth_token is not None:
        client.auth = auth.get_auth(auth_token)
Ejemplo n.º 9
0
def hook_get_client(req, resp, kwargs):
    client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'])
    client.auth = None
    req.env['tenant_id'] = None

    if req.headers.get('X-AUTH-TOKEN'):
        if 'X-AUTH-TOKEN' in req.headers:
            tenant_id = kwargs.get('tenant_id',
                                   req.headers.get('X-AUTH-PROJECT-ID'))
            token_details = get_token_details(req.headers['X-AUTH-TOKEN'],
                                              tenant_id=tenant_id)

            client.auth = get_auth(token_details)

            req.env['tenant_id'] = token_details['tenant_id']

    req.env['sl_client'] = client
Ejemplo n.º 10
0
def hook_get_client(req, resp, kwargs):
    client = Client(endpoint_url=cfg.CONF['softlayer']['endpoint'])
    client.auth = None
    req.env['tenant_id'] = None

    if req.headers.get('X-AUTH-TOKEN'):
        if 'X-AUTH-TOKEN' in req.headers:
            tenant_id = kwargs.get('tenant_id',
                                   req.headers.get('X-AUTH-PROJECT-ID'))
            token_details = get_token_details(req.headers['X-AUTH-TOKEN'],
                                              tenant_id=tenant_id)

            client.auth = get_auth(token_details)

            req.env['tenant_id'] = token_details['tenant_id']

    req.env['sl_client'] = client
Ejemplo n.º 11
0
def hook_get_client(req, resp, kwargs):
    endpoint = config.PARSER.get('softlayer', 'endpoint')
    client = SoftLayer.Client(endpoint_url=endpoint)
    client.auth = None
    req.env['tenant_id'] = None

    if req.headers.get('X-AUTH-TOKEN'):
        if 'X-AUTH-TOKEN' in req.headers:
            tenant_id = kwargs.get('tenant_id',
                                   req.headers.get('X-AUTH-PROJECT-ID'))
            token_details = auth.get_token_details(req.headers['X-AUTH-TOKEN'],
                                                   tenant_id=tenant_id)

            client.auth = auth.get_auth(token_details)

            req.env['tenant_id'] = token_details['tenant_id']

    req.sl_client = client