okdata-cli 4.0.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.
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/LICENSE +1 -1
- {okdata-cli-4.0.0/okdata_cli.egg-info → okdata-cli-4.2.0}/PKG-INFO +2 -2
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/__main__.py +11 -4
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/command.py +19 -10
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/questions.py +4 -47
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/wizards.py +12 -7
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/pubs.py +5 -7
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/teams.py +4 -6
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/validators.py +0 -63
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_config.json +0 -1
- {okdata-cli-4.0.0 → okdata-cli-4.2.0/okdata_cli.egg-info}/PKG-INFO +2 -2
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/requires.txt +1 -1
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/setup.py +3 -3
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/README.md +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/datasets/datasets.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/permissions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/__init__.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/client.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/questions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/pubs/wizards.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/status.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/questions.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/util.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/teams/wizards.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/commands/wizard.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config_2.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_version_edition_distributions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_dataset_versions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/my_permissions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/permissions_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_audit_log_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_clients_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_multiple_client_keys_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_single_client_keys_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/status_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/status_history_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/team_members_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/teams_config.json +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/io.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/output.py +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/SOURCES.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/dependency_links.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/entry_points.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/namespace_packages.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata_cli.egg-info/top_level.txt +0 -0
- {okdata-cli-4.0.0 → okdata-cli-4.2.0}/pyproject.toml +0 -0
- {okdata-cli-4.0.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.
|
|
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:
|
|
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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import sys
|
|
3
3
|
|
|
4
|
-
from keycloak.exceptions import KeycloakGetError
|
|
4
|
+
from keycloak.exceptions import KeycloakGetError, KeycloakPostError
|
|
5
5
|
from okdata.sdk.exceptions import ApiAuthenticateError
|
|
6
6
|
from requests.exceptions import RequestException
|
|
7
7
|
|
|
@@ -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
|
|
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
|
|
|
@@ -40,11 +46,12 @@ def main():
|
|
|
40
46
|
"An error occurred (ApiAuthenticateError): Invalid credentials",
|
|
41
47
|
{"error": 1, "message": "Invalid credentials"},
|
|
42
48
|
)
|
|
43
|
-
except KeycloakGetError as e:
|
|
49
|
+
except (KeycloakGetError, KeycloakPostError) as e:
|
|
44
50
|
error = json.loads(e.error_message)
|
|
51
|
+
error_type = e.__class__.__name__
|
|
45
52
|
instance.log.info(f"Keycloak reported: {e}")
|
|
46
53
|
instance.print(
|
|
47
|
-
f"An error occurred (
|
|
54
|
+
f"An error occurred ({error_type}): {error['error_description']}"
|
|
48
55
|
)
|
|
49
56
|
except (EOFError, KeyboardInterrupt):
|
|
50
57
|
instance.print("\nAbort.")
|
|
@@ -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 - "
|
|
@@ -2,11 +2,7 @@ from questionary import Choice
|
|
|
2
2
|
|
|
3
3
|
from okdata.cli.commands.validators import (
|
|
4
4
|
KeywordValidator,
|
|
5
|
-
PhoneValidator,
|
|
6
5
|
SimpleEmailValidator,
|
|
7
|
-
SpatialResolutionValidator,
|
|
8
|
-
SpatialValidator,
|
|
9
|
-
StandardsValidator,
|
|
10
6
|
TitleValidator,
|
|
11
7
|
)
|
|
12
8
|
from okdata.cli.commands.wizard import filter_comma_separated, required_style
|
|
@@ -15,6 +11,7 @@ pipeline_choices = {
|
|
|
15
11
|
"file": [
|
|
16
12
|
Choice("Lagre dataen slik den er", "data-copy"),
|
|
17
13
|
Choice("Konverter fra CSV til Delta", "csv-to-delta"),
|
|
14
|
+
Choice("Konverter fra JSON til Delta", "json-to-delta"),
|
|
18
15
|
Choice("Konverter fra CSV til Parquet", "csv-to-parquet"),
|
|
19
16
|
Choice("Konverter fra Excel til CSV", "pipeline-excel-to-csv"),
|
|
20
17
|
Choice("Ingen prosessering (krever manuell konfigurasjon av pipeline)", False),
|
|
@@ -29,7 +26,7 @@ available_pipelines = [
|
|
|
29
26
|
]
|
|
30
27
|
|
|
31
28
|
|
|
32
|
-
def qs_create(
|
|
29
|
+
def qs_create():
|
|
33
30
|
return [
|
|
34
31
|
{
|
|
35
32
|
**required_style,
|
|
@@ -59,47 +56,15 @@ def qs_create(include_extra_metadata=True):
|
|
|
59
56
|
"validate": KeywordValidator,
|
|
60
57
|
"filter": filter_comma_separated,
|
|
61
58
|
},
|
|
62
|
-
{
|
|
63
|
-
**required_style,
|
|
64
|
-
"type": "confirm",
|
|
65
|
-
"name": "contains_geodata",
|
|
66
|
-
"message": "Inneholder datasettet geodata?",
|
|
67
|
-
"default": False,
|
|
68
|
-
"when": lambda x: include_extra_metadata,
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"type": "text",
|
|
72
|
-
"name": "spatial",
|
|
73
|
-
"message": "Romlig avgrensning (komma-separert)",
|
|
74
|
-
"validate": SpatialValidator,
|
|
75
|
-
"filter": filter_comma_separated,
|
|
76
|
-
"when": lambda x: include_extra_metadata and x["contains_geodata"],
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"type": "text",
|
|
80
|
-
"name": "spatialResolutionInMeters",
|
|
81
|
-
"message": "Romlig oppløsning (i meter)",
|
|
82
|
-
"validate": SpatialResolutionValidator,
|
|
83
|
-
"filter": lambda v: float(v.replace(",", ".")) if v else None,
|
|
84
|
-
"when": lambda x: include_extra_metadata and x["contains_geodata"],
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"type": "text",
|
|
88
|
-
"name": "conformsTo",
|
|
89
|
-
"message": "I samsvar med standarder (komma-separert)",
|
|
90
|
-
"validate": StandardsValidator,
|
|
91
|
-
"filter": filter_comma_separated,
|
|
92
|
-
"when": lambda x: include_extra_metadata,
|
|
93
|
-
},
|
|
94
59
|
{
|
|
95
60
|
**required_style,
|
|
96
61
|
"type": "select",
|
|
97
62
|
"name": "accessRights",
|
|
98
63
|
"message": "Tilgangsnivå",
|
|
99
64
|
"choices": [
|
|
65
|
+
Choice("Eksplisitt tilgangskontroll", "non-public"),
|
|
66
|
+
Choice("Internt til Origo", "restricted"),
|
|
100
67
|
Choice("Offentlig", "public"),
|
|
101
|
-
Choice("Begrenset offentlighet", "restricted"),
|
|
102
|
-
Choice("Unntatt offentlighet", "non-public"),
|
|
103
68
|
],
|
|
104
69
|
},
|
|
105
70
|
{
|
|
@@ -130,7 +95,6 @@ def qs_create(include_extra_metadata=True):
|
|
|
130
95
|
"http://creativecommons.org/publicdomain/zero/1.0/",
|
|
131
96
|
),
|
|
132
97
|
],
|
|
133
|
-
"when": lambda x: include_extra_metadata,
|
|
134
98
|
},
|
|
135
99
|
{"type": "text", "name": "name", "message": "Kontaktperson – navn"},
|
|
136
100
|
{
|
|
@@ -140,13 +104,6 @@ def qs_create(include_extra_metadata=True):
|
|
|
140
104
|
"message": "Kontaktperson – epost",
|
|
141
105
|
"validate": SimpleEmailValidator,
|
|
142
106
|
},
|
|
143
|
-
{
|
|
144
|
-
**required_style,
|
|
145
|
-
"type": "text",
|
|
146
|
-
"name": "phone",
|
|
147
|
-
"message": "Kontaktperson – telefon",
|
|
148
|
-
"validate": PhoneValidator,
|
|
149
|
-
},
|
|
150
107
|
{"type": "text", "name": "publisher", "message": "Utgiver"},
|
|
151
108
|
{
|
|
152
109
|
**required_style,
|
|
@@ -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
|
|
|
@@ -29,17 +30,10 @@ class DatasetCreateWizard:
|
|
|
29
30
|
"contactPoint": {
|
|
30
31
|
"name": choices["name"],
|
|
31
32
|
"email": choices["email"],
|
|
32
|
-
"phone": choices["phone"],
|
|
33
33
|
},
|
|
34
34
|
"publisher": choices["publisher"],
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
if choices.get("spatial"):
|
|
38
|
-
config["spatial"] = choices["spatial"]
|
|
39
|
-
if choices.get("spatialResolutionInMeters"):
|
|
40
|
-
config["spatialResolutionInMeters"] = choices["spatialResolutionInMeters"]
|
|
41
|
-
if choices.get("conformsTo"):
|
|
42
|
-
config["conformsTo"] = choices["conformsTo"]
|
|
43
37
|
if choices.get("license"):
|
|
44
38
|
config["license"] = choices["license"]
|
|
45
39
|
|
|
@@ -63,6 +57,17 @@ class DatasetCreateWizard:
|
|
|
63
57
|
env = self.command.opt("env")
|
|
64
58
|
choices = run_questionnaire(*qs_create())
|
|
65
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
|
+
|
|
66
71
|
self.command.print("Creating dataset...")
|
|
67
72
|
dataset_client = Dataset(env=env)
|
|
68
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
@@ -33,15 +33,6 @@ class SimpleEmailValidator(Validator):
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
class PhoneValidator(Validator):
|
|
37
|
-
def validate(self, document):
|
|
38
|
-
if not re.match(r"^[0-9]+$", document.text):
|
|
39
|
-
raise ValidationError(
|
|
40
|
-
message="Please enter a valid phone - all numbers and no space, example: 232334455",
|
|
41
|
-
cursor_position=len(document.text),
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
|
|
45
36
|
class TitleValidator(Validator):
|
|
46
37
|
def validate(self, document):
|
|
47
38
|
if len(document.text) < 5:
|
|
@@ -70,60 +61,6 @@ class KeywordValidator(Validator):
|
|
|
70
61
|
)
|
|
71
62
|
|
|
72
63
|
|
|
73
|
-
class StandardsValidator(Validator):
|
|
74
|
-
def validate(self, document):
|
|
75
|
-
standards = csv.reader(
|
|
76
|
-
[document.text], delimiter=",", escapechar="\\", skipinitialspace=True
|
|
77
|
-
)
|
|
78
|
-
standards = [x.strip() for x in next(standards)]
|
|
79
|
-
for standard in standards:
|
|
80
|
-
if len(standard) < 3:
|
|
81
|
-
raise ValidationError(
|
|
82
|
-
message="Each standard reference must be at least 3 characters",
|
|
83
|
-
cursor_position=len(document.text),
|
|
84
|
-
)
|
|
85
|
-
if len(standards) != len(set(standards)):
|
|
86
|
-
raise ValidationError(
|
|
87
|
-
message="Each standard reference must be unique",
|
|
88
|
-
cursor_position=len(document.text),
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class SpatialValidator(Validator):
|
|
93
|
-
def validate(self, document):
|
|
94
|
-
locations = csv.reader(
|
|
95
|
-
[document.text], delimiter=",", escapechar="\\", skipinitialspace=True
|
|
96
|
-
)
|
|
97
|
-
locations = [x.strip() for x in next(locations)]
|
|
98
|
-
for location in locations:
|
|
99
|
-
if len(location) < 1:
|
|
100
|
-
raise ValidationError(
|
|
101
|
-
message="Each location must be at least 1 character",
|
|
102
|
-
cursor_position=len(document.text),
|
|
103
|
-
)
|
|
104
|
-
if len(locations) != len(set(locations)):
|
|
105
|
-
raise ValidationError(
|
|
106
|
-
message="Each location must be unique",
|
|
107
|
-
cursor_position=len(document.text),
|
|
108
|
-
)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
class SpatialResolutionValidator(Validator):
|
|
112
|
-
def validate(self, document):
|
|
113
|
-
if not document.text:
|
|
114
|
-
return None
|
|
115
|
-
try:
|
|
116
|
-
number = float(document.text.replace(",", "."))
|
|
117
|
-
if number <= 0:
|
|
118
|
-
raise ValueError
|
|
119
|
-
except ValueError:
|
|
120
|
-
raise ValidationError(
|
|
121
|
-
message="Please enter a positive (decimal) number",
|
|
122
|
-
cursor_position=len(document.text),
|
|
123
|
-
)
|
|
124
|
-
return None
|
|
125
|
-
|
|
126
|
-
|
|
127
64
|
class IntegrationValidator(Validator):
|
|
128
65
|
def validate(self, document):
|
|
129
66
|
if len(document.text) > 30:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: okdata-cli
|
|
3
|
-
Version: 4.
|
|
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:
|
|
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.
|
|
8
|
+
version="4.2.0",
|
|
9
9
|
author="Oslo Origo",
|
|
10
|
-
author_email="
|
|
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,
|
|
@@ -25,7 +25,7 @@ setuptools.setup(
|
|
|
25
25
|
install_requires=[
|
|
26
26
|
"PrettyTable",
|
|
27
27
|
"docopt",
|
|
28
|
-
"okdata-sdk>=3.1,<4",
|
|
28
|
+
"okdata-sdk>=3.1.1,<4",
|
|
29
29
|
"questionary>=1.10.0,<2.0.0",
|
|
30
30
|
"requests",
|
|
31
31
|
],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/datasets_copy_file_config_2.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/my_permissions_config.json
RENAMED
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_audit_log_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/pubs_clients_config.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/status_history_config.json
RENAMED
|
File without changes
|
{okdata-cli-4.0.0 → okdata-cli-4.2.0}/okdata/cli/data/output-format/team_members_config.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|