예제 #1
0
async def async_main(args):
    deploy_config = get_deploy_config()
    if args.namespace:
        deploy_config = deploy_config.with_default_namespace(args.namespace)
    headers = namespace_auth_headers(deploy_config, deploy_config.default_namespace(), authorize_target=False)
    async with client_session(headers=headers) as session:
        await auth_flow(deploy_config, deploy_config.default_namespace(), session)
예제 #2
0
async def async_main(args):
    deploy_config = get_deploy_config()
    if args.namespace:
        auth_ns = args.namespace
        deploy_config = deploy_config.with_service('auth', auth_ns)
    else:
        auth_ns = deploy_config.service_ns('auth')
    headers = namespace_auth_headers(deploy_config, auth_ns, authorize_target=False)
    async with ssl_client_session(
            raise_for_status=True, timeout=aiohttp.ClientTimeout(total=60), headers=headers) as session:
        await auth_flow(deploy_config, auth_ns, session)
예제 #3
0
async def async_main(args):
    deploy_config = get_deploy_config()
    if args.namespace:
        deploy_config = deploy_config.with_default_namespace(args.namespace)
    headers = namespace_auth_headers(deploy_config,
                                     deploy_config.default_namespace(),
                                     authorize_target=False)
    async with client_session(raise_for_status=True,
                              timeout=aiohttp.ClientTimeout(total=60),
                              headers=headers) as session:
        await auth_flow(deploy_config, deploy_config.default_namespace(),
                        session)
예제 #4
0
def main(args):
    if len(args) < 3:
        print('hailctl curl NAMESPACE SERVICE PATH [args] ...',
              file=sys.stderr)
        sys.exit(1)
    ns = args[0]
    svc = args[1]
    path = args[2]
    deploy_config = get_deploy_config()
    headers = namespace_auth_headers(deploy_config, ns)
    headers = [x for k, v in headers.items() for x in ['-H', f'{k}: {v}']]
    path = deploy_config.with_service(svc, ns).url(svc, path)
    os.execvp('curl', ['curl', *headers, *args[3:], path])
예제 #5
0
def main(args):
    if len(args) < 3:
        print('hailctl curl NAMESPACE SERVICE PATH [args] ...', file=sys.stderr)
        sys.exit(1)
    ns = args[0]
    svc = args[1]
    path = args[2]
    deploy_config = get_deploy_config()
    headers = namespace_auth_headers(deploy_config, ns)
    headers = [x
               for k, v in headers.items()
               for x in ['-H', f'{k}: {v}']]
    path = deploy_config.with_service(svc, ns).external_url(svc, path)
    print('curl ' + ' '.join(headers) + ' ' + ' '.join(args[3:]) + ' ' + path)
    subprocess.check_call(['curl', *headers, *args[3:], path])