okdata-cli 4.1.0__tar.gz → 4.2.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.
Files changed (55) hide show
  1. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/LICENSE +1 -1
  2. {okdata-cli-4.1.0/okdata_cli.egg-info → okdata-cli-4.2.0}/PKG-INFO +2 -2
  3. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/__main__.py +7 -1
  4. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/command.py +19 -10
  5. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/questions.py +2 -2
  6. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/wizards.py +12 -0
  7. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/pubs.py +5 -7
  8. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/teams.py +4 -6
  9. {okdata-cli-4.1.0 → okdata-cli-4.2.0/okdata_cli.egg-info}/PKG-INFO +2 -2
  10. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/setup.py +2 -2
  11. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/README.md +0 -0
  12. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/__init__.py +0 -0
  13. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/__init__.py +0 -0
  14. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/__init__.py +0 -0
  15. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/__init__.py +0 -0
  16. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/datasets.py +0 -0
  17. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/permissions.py +0 -0
  18. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/__init__.py +0 -0
  19. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/client.py +0 -0
  20. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/questions.py +0 -0
  21. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/wizards.py +0 -0
  22. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/status.py +0 -0
  23. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/questions.py +0 -0
  24. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/util.py +0 -0
  25. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/wizards.py +0 -0
  26. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/validators.py +0 -0
  27. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/commands/wizard.py +0 -0
  28. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_config.json +0 -0
  29. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config.json +0 -0
  30. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config_2.json +0 -0
  31. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_config.json +0 -0
  32. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_config.json +0 -0
  33. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_config.json +0 -0
  34. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_distributions_config.json +0 -0
  35. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_versions_config.json +0 -0
  36. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/my_permissions_config.json +0 -0
  37. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/permissions_config.json +0 -0
  38. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_audit_log_config.json +0 -0
  39. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_clients_config.json +0 -0
  40. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_multiple_client_keys_config.json +0 -0
  41. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_single_client_keys_config.json +0 -0
  42. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/status_config.json +0 -0
  43. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/status_history_config.json +0 -0
  44. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/team_members_config.json +0 -0
  45. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/teams_config.json +0 -0
  46. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/io.py +0 -0
  47. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata/cli/output.py +0 -0
  48. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/SOURCES.txt +0 -0
  49. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/dependency_links.txt +0 -0
  50. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/entry_points.txt +0 -0
  51. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/namespace_packages.txt +0 -0
  52. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/requires.txt +0 -0
  53. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/top_level.txt +0 -0
  54. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/pyproject.toml +0 -0
  55. {okdata-cli-4.1.0 → okdata-cli-4.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2019 Oslo Origo
3
+ Copyright (c) 2019-2024 Oslo Origo
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: okdata-cli
3
- Version: 4.1.0
3
+ Version: 4.2.0
4
4
  Summary: CLI for services provided by Oslo Origo
5
5
  Home-page: https://github.com/oslokommune/okdata-cli/
6
6
  Author: Oslo Origo
7
- Author-email: dataplattform@oslo.kommune.no
7
+ Author-email: dataspeilet@oslo.kommune.no
8
8
  License: MIT
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Programming Language :: Python :: 3.8
@@ -16,9 +16,15 @@ from okdata.cli.commands.teams.teams import TeamsCommand
16
16
 
17
17
  def main():
18
18
  argv = sys.argv
19
- if len(argv) < 2 or argv[1] == "help":
19
+ if len(argv) < 2:
20
20
  BaseCommand().help()
21
21
  return
22
+ if argv[1] in ("-e", "--environment"):
23
+ BaseCommand().print_env()
24
+ return
25
+ if argv[1] in ("-v", "--version"):
26
+ BaseCommand().print_version()
27
+ return
22
28
 
23
29
  command = get_command_class(argv)
24
30
 
@@ -24,7 +24,9 @@ usage:
24
24
  okdata pubs [options]
25
25
  okdata status [options]
26
26
  okdata teams [options]
27
+ okdata -e | --environment
27
28
  okdata -h | --help
29
+ okdata -v | --version
28
30
 
29
31
  Commands available:
30
32
  datasets
@@ -89,16 +91,6 @@ Options:{BASE_COMMAND_OPTIONS}
89
91
  else:
90
92
  print(payload)
91
93
 
92
- def confirm_to_continue(self, message):
93
- """Ask the user for confirmation before continuing.
94
-
95
- Any answer other than "y" will exit the program.
96
- """
97
- self.print(message)
98
- if input("Continue? [y/N]: ") != "y":
99
- self.print("Abort.")
100
- sys.exit()
101
-
102
94
  def login(self):
103
95
  self.sdk.login()
104
96
 
@@ -119,6 +111,12 @@ Options:{BASE_COMMAND_OPTIONS}
119
111
  def help(self):
120
112
  print(self.__doc__, end="")
121
113
 
114
+ def print_env(self):
115
+ print(self.sdk.config.resolve_environment(None))
116
+
117
+ def print_version(self):
118
+ print(self.version)
119
+
122
120
  def print_error_response(self, response_body):
123
121
  if not isinstance(response_body, dict):
124
122
  print(response_body)
@@ -140,6 +138,17 @@ Options:{BASE_COMMAND_OPTIONS}
140
138
  print(response_body)
141
139
 
142
140
 
141
+ def confirm_to_continue(message):
142
+ """Ask the user for confirmation before continuing.
143
+
144
+ Any answer other than "y" will exit the program.
145
+ """
146
+ print(message)
147
+ if input("Continue? [y/N]: ") != "y":
148
+ print("Abort.")
149
+ sys.exit()
150
+
151
+
143
152
  def _format_error_message(message, errors=None):
144
153
  msg = f"An error occurred: {message}"
145
154
  sep = "\n - "
@@ -62,9 +62,9 @@ def qs_create():
62
62
  "name": "accessRights",
63
63
  "message": "Tilgangsnivå",
64
64
  "choices": [
65
+ Choice("Eksplisitt tilgangskontroll", "non-public"),
66
+ Choice("Internt til Origo", "restricted"),
65
67
  Choice("Offentlig", "public"),
66
- Choice("Begrenset offentlighet", "restricted"),
67
- Choice("Unntatt offentlighet", "non-public"),
68
68
  ],
69
69
  },
70
70
  {
@@ -1,6 +1,7 @@
1
1
  from okdata.sdk.data.dataset import Dataset
2
2
  from okdata.sdk.pipelines.client import PipelineApiClient
3
3
 
4
+ from okdata.cli.command import confirm_to_continue
4
5
  from okdata.cli.commands.datasets.questions import qs_create
5
6
  from okdata.cli.commands.wizard import run_questionnaire
6
7
 
@@ -56,6 +57,17 @@ class DatasetCreateWizard:
56
57
  env = self.command.opt("env")
57
58
  choices = run_questionnaire(*qs_create())
58
59
 
60
+ confirm_to_continue(
61
+ "Will create a new dataset '{}'.{}".format(
62
+ choices["title"],
63
+ (
64
+ "\n\nData uploaded to the dataset will be PUBLICLY AVAILABLE ON THE INTERNET.\n"
65
+ if choices["accessRights"] == "public"
66
+ else ""
67
+ ),
68
+ )
69
+ )
70
+
59
71
  self.command.print("Creating dataset...")
60
72
  dataset_client = Dataset(env=env)
61
73
  dataset_config = self.dataset_config(choices)
@@ -5,7 +5,7 @@ from operator import itemgetter
5
5
  from okdata.sdk.team.client import TeamClient
6
6
 
7
7
  from okdata.cli import MAINTAINER
8
- from okdata.cli.command import BASE_COMMAND_OPTIONS, BaseCommand
8
+ from okdata.cli.command import BASE_COMMAND_OPTIONS, BaseCommand, confirm_to_continue
9
9
  from okdata.cli.commands.pubs.client import PubsClient
10
10
  from okdata.cli.commands.pubs.questions import (
11
11
  NoClientsError,
@@ -88,7 +88,7 @@ Options:{BASE_COMMAND_OPTIONS}
88
88
  scopes = config["scopes"]
89
89
  env = config["env"]
90
90
 
91
- self.confirm_to_continue(
91
+ confirm_to_continue(
92
92
  "Will create a new {} client{} in {}{}.".format(
93
93
  client_types[client_type_id],
94
94
  f" for {providers[provider_id]}" if provider_id else "",
@@ -138,7 +138,7 @@ You may now go ahead and create a key for it by running:
138
138
  aws_account = choices["aws_account"]
139
139
  aws_region = choices["aws_region"]
140
140
 
141
- self.confirm_to_continue(
141
+ confirm_to_continue(
142
142
  "Will delete client '{}' [{}]{}.".format(
143
143
  client_name,
144
144
  env,
@@ -241,7 +241,7 @@ You may now go ahead and create a key for it by running:
241
241
  aws_region = config["aws_region"]
242
242
  enable_auto_rotate = config["enable_auto_rotate"]
243
243
 
244
- self.confirm_to_continue(
244
+ confirm_to_continue(
245
245
  "\n\n".join(
246
246
  [
247
247
  "Will create a new key for client '{}' in {} and {}.".format(
@@ -327,9 +327,7 @@ You may now go ahead and create a key for it by running:
327
327
  client_name = choices["client_name"]
328
328
  key_id = choices["key_id"]
329
329
 
330
- self.confirm_to_continue(
331
- f"Will delete key '{key_id}' from '{client_name}' [{env}]."
332
- )
330
+ confirm_to_continue(f"Will delete key '{key_id}' from '{client_name}' [{env}].")
333
331
 
334
332
  self.print(f"Deleting key '{key_id}' from '{client_name}' [{env}]...")
335
333
  self.pubs_client.delete_key(env, client_id, key_id)
@@ -3,7 +3,7 @@ from operator import itemgetter
3
3
  from okdata.sdk.team.client import TeamClient
4
4
 
5
5
  from okdata.cli import MAINTAINER
6
- from okdata.cli.command import BASE_COMMAND_OPTIONS, BaseCommand
6
+ from okdata.cli.command import BASE_COMMAND_OPTIONS, BaseCommand, confirm_to_continue
7
7
  from okdata.cli.commands.teams.questions import NoTeamError
8
8
  from okdata.cli.commands.teams.util import (
9
9
  member_representation,
@@ -122,9 +122,7 @@ Options:{BASE_COMMAND_OPTIONS}
122
122
  )
123
123
  return
124
124
 
125
- self.confirm_to_continue(
126
- "Add {} to the team?".format(member_representation(user))
127
- )
125
+ confirm_to_continue("Add {} to the team?".format(member_representation(user)))
128
126
 
129
127
  self.client.update_team_members(
130
128
  config["team_id"], team_members + [user["username"]]
@@ -150,13 +148,13 @@ Options:{BASE_COMMAND_OPTIONS}
150
148
  members_to_keep.append(member)
151
149
 
152
150
  if len(members_to_keep) == 0:
153
- self.confirm_to_continue(
151
+ confirm_to_continue(
154
152
  "You are about to delete all members from the team, including "
155
153
  "yourself. It will not be possible to edit this team any "
156
154
  "further without being re-added by a systems administrator."
157
155
  )
158
156
  else:
159
- self.confirm_to_continue(
157
+ confirm_to_continue(
160
158
  "Remove the following member{} from the team?\n - {}".format(
161
159
  "s" if len(members_to_remove) > 1 else "",
162
160
  "\n - ".join(
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: okdata-cli
3
- Version: 4.1.0
3
+ Version: 4.2.0
4
4
  Summary: CLI for services provided by Oslo Origo
5
5
  Home-page: https://github.com/oslokommune/okdata-cli/
6
6
  Author: Oslo Origo
7
- Author-email: dataplattform@oslo.kommune.no
7
+ Author-email: dataspeilet@oslo.kommune.no
8
8
  License: MIT
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Programming Language :: Python :: 3.8
@@ -5,9 +5,9 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="okdata-cli",
8
- version="4.1.0",
8
+ version="4.2.0",
9
9
  author="Oslo Origo",
10
- author_email="dataplattform@oslo.kommune.no",
10
+ author_email="dataspeilet@oslo.kommune.no",
11
11
  description="CLI for services provided by Oslo Origo",
12
12
  license="MIT",
13
13
  long_description=long_description,
File without changes
File without changes
File without changes
File without changes