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)
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)
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}
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)
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)
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)
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)
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
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