dataall-cli 0.5.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dataall-cli
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: AWS data.all CLI
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -18,7 +18,7 @@ Requires-Dist: atomicfile (>=1.0.1)
18
18
  Requires-Dist: boto3 (>=1.40.55)
19
19
  Requires-Dist: botocore (>=1.40.55)
20
20
  Requires-Dist: click (>=8.1.6)
21
- Requires-Dist: dataall-core (>=0.5.0,<0.6.0)
21
+ Requires-Dist: dataall-core (>=0.6.0,<0.7.0)
22
22
  Requires-Dist: packaging (>=24.2)
23
23
  Requires-Dist: setuptools ; python_version >= "3.12"
24
24
  Requires-Dist: typing-extensions (>=4.4.0)
@@ -7,6 +7,11 @@ from pathlib import Path
7
7
  from typing import Any, Dict, List, Optional
8
8
 
9
9
  import click
10
+ from dataall_core.auth.oidc_browser_auth import (
11
+ DEFAULT_FALLBACK_REDIRECT_URI,
12
+ DEFAULT_REDIRECT_URI,
13
+ DEFAULT_SCOPES,
14
+ )
10
15
  from dataall_core.dataall_client import DataallClient
11
16
  from dataall_core.profile import CONFIG_PATH
12
17
 
@@ -52,9 +57,6 @@ bind(
52
57
 
53
58
 
54
59
  AUTH_TYPES = ["CognitoAuth", "CustomAuth", "OidcBrowserAuth"]
55
- DEFAULT_REDIRECT_URI = "http://localhost:8765/callback"
56
- DEFAULT_FALLBACK_REDIRECT_URI = "http://localhost:8766/callback"
57
- DEFAULT_SCOPES = "openid offline_access"
58
60
  DISCOVERED = "dataall_discovered"
59
61
  DISCOVERED_FOR = "dataall_discovered_for"
60
62
 
@@ -1,6 +1,7 @@
1
1
  """data.all cli utils."""
2
2
 
3
+ from dataall_core.discovery import discover_from_frontend, frontend_origin
4
+
3
5
  from .config import load_config, save_config
4
- from .discovery import discover_from_frontend, frontend_origin
5
6
 
6
7
  __all__ = ["discover_from_frontend", "frontend_origin", "load_config", "save_config"]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "dataall-cli"
3
- version = "0.5.0"
3
+ version = "0.6.0"
4
4
  description = "AWS data.all CLI"
5
5
  authors = [{ name = "Amazon Web Services" }]
6
6
  license = { text = "Apache License 2.0" }
@@ -22,7 +22,7 @@ dependencies = [
22
22
  "atomicfile>=1.0.1",
23
23
  "PyYAML>=6.0.1",
24
24
  "setuptools; python_version >= '3.12'",
25
- "dataall-core>=0.5.0,<0.6.0",
25
+ "dataall-core>=0.6.0,<0.7.0",
26
26
  ]
27
27
 
28
28
  [project.scripts]
@@ -1,54 +0,0 @@
1
- """Discover CLI settings from a deployed data.all front page."""
2
-
3
- import re
4
- from typing import Dict
5
- from urllib.parse import urljoin, urlparse
6
-
7
- import httpx
8
-
9
- BUNDLE_PATTERN = re.compile(r'src="([^"]*static/js/main\.[^"]+\.js)"')
10
- VALUE_PATTERN = re.compile(r'(REACT_APP_[A-Z_]+):"([^"]*)"')
11
- API_SUFFIX = "/graphql/api"
12
-
13
-
14
- def frontend_origin(dataall_url: str) -> str:
15
- """Return ``scheme://host`` of a data.all URL."""
16
- parsed = urlparse(dataall_url)
17
- return f"{parsed.scheme}://{parsed.netloc}"
18
-
19
-
20
- def discover_from_frontend(dataall_url: str) -> Dict[str, str]:
21
- """Read the auth type, identity provider, client id and API endpoint from the front page bundle.
22
-
23
- Returns ``frontend_url`` plus whichever values were found.
24
- """
25
- found = {"frontend_url": frontend_origin(dataall_url)}
26
- base = dataall_url.rstrip("/") + "/"
27
- index = httpx.get(base, follow_redirects=True, timeout=30)
28
- index.raise_for_status()
29
- match = BUNDLE_PATTERN.search(index.text)
30
- if not match:
31
- return found
32
- bundle = httpx.get(urljoin(base, match.group(1)), follow_redirects=True, timeout=60)
33
- bundle.raise_for_status()
34
- values = dict(VALUE_PATTERN.findall(bundle.text))
35
-
36
- if values.get("REACT_APP_CUSTOM_AUTH") and values.get("REACT_APP_CUSTOM_AUTH_URL"):
37
- found["auth_type"] = "OidcBrowserAuth"
38
- found["idp_domain_url"] = values["REACT_APP_CUSTOM_AUTH_URL"]
39
- if values.get("REACT_APP_CUSTOM_AUTH_CLIENT_ID"):
40
- found["client_id"] = values["REACT_APP_CUSTOM_AUTH_CLIENT_ID"]
41
- elif values.get("REACT_APP_COGNITO_APP_CLIENT_ID"):
42
- found["auth_type"] = "CognitoAuth"
43
- found["client_id"] = values["REACT_APP_COGNITO_APP_CLIENT_ID"]
44
- domain = values.get("REACT_APP_COGNITO_DOMAIN", "")
45
- if domain:
46
- found["idp_domain_url"] = domain if "://" in domain else f"https://{domain}"
47
- if values.get("REACT_APP_COGNITO_REDIRECT_SIGNIN"):
48
- found["redirect_uri"] = values["REACT_APP_COGNITO_REDIRECT_SIGNIN"]
49
- api = values.get("REACT_APP_GRAPHQL_API", "")
50
- if api:
51
- found["api_endpoint_url"] = (
52
- api[: -len(API_SUFFIX)] if api.endswith(API_SUFFIX) else api
53
- )
54
- return found
File without changes
File without changes
File without changes
File without changes