snowflake-cli 3.8.2__py3-none-any.whl → 3.8.3__py3-none-any.whl

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.
@@ -16,7 +16,7 @@ from __future__ import annotations
16
16
 
17
17
  from enum import Enum, unique
18
18
 
19
- VERSION = "3.8.2"
19
+ VERSION = "3.8.3"
20
20
 
21
21
 
22
22
  @unique
@@ -24,6 +24,14 @@ app = SnowTyperFactory(
24
24
  short_help="Manages image registries.",
25
25
  )
26
26
 
27
+ import typer
28
+
29
+ PrivateLinkOption: bool = typer.Option(
30
+ False,
31
+ "--private-link",
32
+ help="Get the private link URL instead of the public URL.",
33
+ )
34
+
27
35
 
28
36
  _TOKEN_EPILOG = """\
29
37
  Usage Example: snow spcs image-registry token --format JSON | docker login $(snow spcs image-registry url) -u 0sessiontoken --password-stdin
@@ -46,13 +54,13 @@ def token(**options) -> ObjectResult:
46
54
 
47
55
 
48
56
  @app.command(requires_connection=True)
49
- def url(**options) -> MessageResult:
57
+ def url(private_link: bool = PrivateLinkOption, **options) -> MessageResult:
50
58
  """
51
59
  Gets the image registry URL for the current account.
52
60
 
53
61
  Must be called from a role that can view at least one image repository in the image registry.
54
62
  """
55
- return MessageResult(RegistryManager().get_registry_url())
63
+ return MessageResult(RegistryManager().get_registry_url(private_link))
56
64
 
57
65
 
58
66
  @app.command(requires_connection=True)
@@ -73,7 +73,7 @@ class RegistryManager(SqlExecutionMixin):
73
73
  def _has_url_scheme(self, url: str):
74
74
  return re.fullmatch(r"^.*//.+", url) is not None
75
75
 
76
- def get_registry_url(self) -> str:
76
+ def get_registry_url(self, private_link: bool = False) -> str:
77
77
  images_query = "show image repositories in schema snowflake.images;"
78
78
  images_result = self.execute_query(images_query, cursor_class=DictCursor)
79
79
 
@@ -88,7 +88,15 @@ class RegistryManager(SqlExecutionMixin):
88
88
  if not results:
89
89
  raise NoImageRepositoriesFoundError()
90
90
 
91
- sample_repository_url = results["repository_url"]
91
+ if private_link:
92
+ privatelink_repository_url = "privatelink_repository_url"
93
+
94
+ if privatelink_repository_url not in results:
95
+ return ""
96
+ sample_repository_url = results[privatelink_repository_url]
97
+ else:
98
+ sample_repository_url = results["repository_url"]
99
+
92
100
  if not self._has_url_scheme(sample_repository_url):
93
101
  sample_repository_url = f"//{sample_repository_url}"
94
102
  return urlparse(sample_repository_url).netloc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: snowflake-cli
3
- Version: 3.8.2
3
+ Version: 3.8.3
4
4
  Summary: Snowflake CLI
5
5
  Project-URL: Source code, https://github.com/snowflakedb/snowflake-cli
6
6
  Project-URL: Bug Tracker, https://github.com/snowflakedb/snowflake-cli/issues
@@ -1,4 +1,4 @@
1
- snowflake/cli/__about__.py,sha256=mhNhCoCLJcfBJgE3CHSDoO2i67GJGbXO4YXY7sq80wQ,852
1
+ snowflake/cli/__about__.py,sha256=vo4Y2IjCu3t8SBhzMac_KvSAae1j682mmLovxzEhMW8,852
2
2
  snowflake/cli/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
3
3
  snowflake/cli/_app/__init__.py,sha256=CR_uTgoqHnU1XdyRhm5iQsS86yWXGVx5Ht7aGSDNFmc,765
4
4
  snowflake/cli/_app/__main__.py,sha256=ZmcFdFqAtk2mFMz-cqCFdGd0iYzc7UsLH1oT1U40S0k,858
@@ -149,8 +149,8 @@ snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity.py,sha256=Uf1B26_AR
149
149
  snowflake/cli/_plugins/spcs/compute_pool/compute_pool_entity_model.py,sha256=XnI8hPeaXQ7d3AtOQVtYVnvWhGuDz6bhYSD2Uji1HqU,1639
150
150
  snowflake/cli/_plugins/spcs/compute_pool/manager.py,sha256=pf8fXBf84Snw6grHE31Rdj0HYNYKAQHRxgGQ7cnSNlk,6013
151
151
  snowflake/cli/_plugins/spcs/image_registry/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
152
- snowflake/cli/_plugins/spcs/image_registry/commands.py,sha256=W2FxH8ugY-LO8yOs5TWCNfi7DKmTmCOFTJwk-rpEsnw,2425
153
- snowflake/cli/_plugins/spcs/image_registry/manager.py,sha256=2AWGhHmMih_yaTnoT25LN2Zja-Vq1SyFgFISEq-d40o,4312
152
+ snowflake/cli/_plugins/spcs/image_registry/commands.py,sha256=W2AKp8i5Wmyys2H2x-ORJt7oEmmxzbnMPsyS5wq2e_g,2631
153
+ snowflake/cli/_plugins/spcs/image_registry/manager.py,sha256=8ZI2PhiyIsiskK0RdguBKK5GoDkgTk27Wg5brQgKA9M,4611
154
154
  snowflake/cli/_plugins/spcs/image_repository/__init__.py,sha256=uGA_QRGW3iGwaegpFsLgOhup0zBliBSXh9ou8J439uU,578
155
155
  snowflake/cli/_plugins/spcs/image_repository/commands.py,sha256=SVLrqwl9iVA74GSRCY8ATVfW164Ay3b_GkHUdSY9qpg,6391
156
156
  snowflake/cli/_plugins/spcs/image_repository/image_repository_entity.py,sha256=GT2h1xkefD6js38uYbZYN_NjBffJqBBZrz6-F5zyJPs,260
@@ -285,8 +285,8 @@ snowflake/cli/api/utils/path_utils.py,sha256=OgR7cwbHXqP875RgPJGrAvDC1RRTU-2-Yss
285
285
  snowflake/cli/api/utils/python_api_utils.py,sha256=wTNxXrma78wPvBz-Jo-ixNtP8ZjDCDh4TvciEnhYIAM,300
286
286
  snowflake/cli/api/utils/templating_functions.py,sha256=zu2oK1BEC9yyWtDx17Hr-VAYHvCtagaOdxIrm70JQys,4955
287
287
  snowflake/cli/api/utils/types.py,sha256=fVKuls8axKSsBzPqWwrkwkwoXXmedqxNJKqfXrrGyBM,1190
288
- snowflake_cli-3.8.2.dist-info/METADATA,sha256=Y67_Em62B6KSwPR5LO0NFjoAvvoHiV6GtCSj5xvNq_E,18316
289
- snowflake_cli-3.8.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
290
- snowflake_cli-3.8.2.dist-info/entry_points.txt,sha256=6QmSI0wUX6p7f-dGvrPdswlQyVAVGi1AtOUbE8X6bho,58
291
- snowflake_cli-3.8.2.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
292
- snowflake_cli-3.8.2.dist-info/RECORD,,
288
+ snowflake_cli-3.8.3.dist-info/METADATA,sha256=qF-mPBZxbJlpYd_ru9dfzzZaFMd40ofJwaQReUbhCyQ,18316
289
+ snowflake_cli-3.8.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
290
+ snowflake_cli-3.8.3.dist-info/entry_points.txt,sha256=6QmSI0wUX6p7f-dGvrPdswlQyVAVGi1AtOUbE8X6bho,58
291
+ snowflake_cli-3.8.3.dist-info/licenses/LICENSE,sha256=mJMA3Uz2AbjU_kVggo1CAx01XhBsI7BSi2H7ggUg_-c,11344
292
+ snowflake_cli-3.8.3.dist-info/RECORD,,