osducli 0.0.50__py3-none-any.whl → 0.0.51__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.
osducli/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.50
1
+ 0.0.51
@@ -32,14 +32,15 @@ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
32
32
  show_default=True,
33
33
  help="maximum number of records to return.",
34
34
  )
35
+ @click.option("-a", "--aggregate", "_aggr", help="Aggregate by element", required=False)
35
36
  @handle_cli_exceptions
36
37
  @command_with_output("results[*].{Id:id,Kind:kind,CreateTime:createTime}")
37
- def _click_command(state: State, kind: str, _id: str, _query: str, limit: int):
38
+ def _click_command(state: State, kind: str, _id: str, _query: str, limit: int, _aggr: str):
38
39
  """Search using more advanced query terms"""
39
- return query(state, kind, _id, _query, limit)
40
+ return query(state, kind, _id, _query, limit, _aggr)
40
41
 
41
42
 
42
- def query(state: State, kind: str, identifier: str, custom_query: str, limit: int):
43
+ def query(state: State, kind: str, identifier: str, custom_query: str, limit: int, aggregate: str = None):
43
44
  """Query search service
44
45
 
45
46
  Args:
@@ -48,6 +49,7 @@ def query(state: State, kind: str, identifier: str, custom_query: str, limit: in
48
49
  identifier (str): id to search for
49
50
  custom_query (str): custom search query
50
51
  limit (int): maximum number of records to return.
52
+ aggregate (str): aggregate by element
51
53
  """
52
54
  client = CliOsduClient(state.config)
53
55
  search_client = client.get_search_client()
@@ -59,7 +61,7 @@ def query(state: State, kind: str, identifier: str, custom_query: str, limit: in
59
61
  kind = "*:*:*:*"
60
62
 
61
63
  query_val = f'id:("{identifier}")' if identifier is not None else custom_query
62
- request_data = QueryRequest(kind=kind, query=query_val, limit=limit)
64
+ request_data = QueryRequest(kind=kind, query=query_val, limit=limit, aggregate_by=aggregate)
63
65
 
64
66
  response = search_client.query_records(query_request=request_data)
65
67
  client.check_status_code(response)
@@ -0,0 +1,13 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Storage service version commands"""
@@ -0,0 +1,47 @@
1
+ # Licensed under the Apache License, Version 2.0 (the "License");
2
+ # you may not use this file except in compliance with the License.
3
+ # You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ """Storage service version get command"""
14
+
15
+ import click
16
+
17
+ from osducli.click_cli import CustomClickCommand, State, command_with_output
18
+ from osducli.cliclient import CliOsduClient, handle_cli_exceptions
19
+
20
+
21
+ # click entry point
22
+ @click.command(cls=CustomClickCommand)
23
+ @click.option("-id", "--id", "_id", help="Record id to search for", required=True)
24
+ @click.option("-v", "--version", "_ver", help="Record version to search for", required=True)
25
+ @click.option("-a", "--attributes", "_attr", help="Filter attributes to restrict the returned fields of the record.", required=False)
26
+ @handle_cli_exceptions
27
+ @command_with_output("results || {Id:id,Version:version,Kind:kind,CreateUser:createUser,CreateTime:createTime}")
28
+ def _click_command(state: State, _id: str, _ver: str, _attr: list):
29
+ """Get specific record by id and version"""
30
+ return get(state, _id, _ver, _attr)
31
+
32
+
33
+ def get(state: State, id: str, version: str, attributes: list = None): # pylint: disable=redefined-builtin
34
+ """Get specific record by id and version
35
+
36
+ Args:
37
+ state (State): Global state
38
+ id (str): Id of records
39
+ version (str): Version of records
40
+ attributes (list): Filter attributes
41
+ """
42
+ client = CliOsduClient(state.config)
43
+ record_client = client.get_storage_record_client()
44
+ response = record_client.get_specific_record(id, version, attributes)
45
+
46
+ client.check_status_code(response)
47
+ return response.json()
@@ -10,33 +10,34 @@
10
10
  # See the License for the specific language governing permissions and
11
11
  # limitations under the License.
12
12
 
13
- """Storage service versions command"""
13
+ """Storage service version list command"""
14
14
 
15
15
  import click
16
16
 
17
17
  from osducli.click_cli import CustomClickCommand, State, command_with_output
18
18
  from osducli.cliclient import CliOsduClient, handle_cli_exceptions
19
- from osducli.config import CONFIG_STORAGE_URL
20
19
 
21
20
 
22
21
  # click entry point
23
22
  @click.command(cls=CustomClickCommand)
24
- @click.option("-id", "--id", "_id", required=True, help="id to get versions for")
23
+ @click.option("-id", "--id", "_id", help="Record id to search for", required=True)
25
24
  @handle_cli_exceptions
26
25
  @command_with_output("versions")
27
26
  def _click_command(state: State, _id: str):
28
- """List record versions"""
29
- return versions(state, _id)
27
+ """Get record versions for given id"""
28
+ return get(state, _id)
30
29
 
31
30
 
32
- def versions(state: State, id: str): # pylint: disable=invalid-name,redefined-builtin
33
- """List record versions
31
+ def get(state: State, id: str): # pylint: disable=redefined-builtin
32
+ """Get record versions for given id
34
33
 
35
34
  Args:
36
35
  state (State): Global state
37
- id (str): id to get versions for
36
+ id (str): Id of records
38
37
  """
39
- connection = CliOsduClient(state.config)
40
- url = "records/versions/" + id
41
- json = connection.cli_get_returning_json(CONFIG_STORAGE_URL, url)
42
- return json
38
+ client = CliOsduClient(state.config)
39
+ record_client = client.get_storage_record_client()
40
+ response = record_client.get_record_versions(id)
41
+
42
+ client.check_status_code(response)
43
+ return response.json()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: osducli
3
- Version: 0.0.50
3
+ Version: 0.0.51
4
4
  Summary: OSDU command line
5
5
  Author-email: Equinor ASA <mhew@equinor.com>
6
6
  License-Expression: Apache-2.0
@@ -75,6 +75,11 @@ For more information, specify the `-h` flag:
75
75
  Change Log
76
76
  ==========
77
77
 
78
+ 0.0.51
79
+ ------
80
+ - Get record version command
81
+ - Aggregate by in search query
82
+
78
83
  0.0.50
79
84
  ------
80
85
  - Maintenance release
@@ -1,4 +1,4 @@
1
- osducli/VERSION,sha256=ZpjJE3lqnDmHmv4SwQLhYc-x2Nfi3YlnlDJwdkFsP2A,6
1
+ osducli/VERSION,sha256=pKLYb8I7W-9_9iuPirYhJ9jzAkpo28gEuYMDA0g7API,6
2
2
  osducli/__init__.py,sha256=J3RwqAbN7MWvz8vL24fMUar9Sfk8nMI8xq_aSHGXUy8,591
3
3
  osducli/__main__.py,sha256=4HonhahSaS3Un0f93qnbs_pmJ5pbbVHU-qdhsssVkB0,3661
4
4
  osducli/click_cli.py,sha256=EIe42DOnHDRKU3mPGwT12jI-yX3hsBOp_nS4nMTWc_Y,10864
@@ -70,7 +70,7 @@ osducli/commands/search/_const.py,sha256=YYTZd35Z9O0gEf6kb9Ntonvv3qArkAcszKAq2VA
70
70
  osducli/commands/search/id.py,sha256=1tVbgpDRhW08gyaLfQbCZjFrQDUGPh8gupf7pNhiN6c,1909
71
71
  osducli/commands/search/info.py,sha256=j6cjYDbxiiQEKXs0LJGQ_0scKReCGi6iQJrfn2X0B20,1333
72
72
  osducli/commands/search/kind.py,sha256=9vGVp4QG4dTII4LGcLYKDAE2PmcB-isgiCfwiITVauU,1786
73
- osducli/commands/search/query.py,sha256=EUHnIFvuCxAYBQK_k7YkBb8mYnedvRPMwBpeM1vj9r4,2405
73
+ osducli/commands/search/query.py,sha256=nZkOyhz0dTKEHCvICkyeEkfph4Wd6O_p51GTzJg1lEY,2606
74
74
  osducli/commands/status/__init__.py,sha256=5g1PB_tU0sqP7aplnihjfhMzVVQdlB3Y01QIeHAtSMw,595
75
75
  osducli/commands/status/status.py,sha256=yh6KVUpNYbrLJIH-7GjMyo2MpR8Wvycr4KdkxUI1V5A,4543
76
76
  osducli/commands/storage/__init__.py,sha256=Ilc97Kje3VVLZIBJucd_2jsW1GF5En00xF-A6kiLAFM,585
@@ -80,7 +80,9 @@ osducli/commands/storage/delete.py,sha256=ryjrd24wiJlTAL6jIsTW1gCxB0icAMu0YIyUTx
80
80
  osducli/commands/storage/get.py,sha256=FgjoN_1cY90cbU1osh53XviGvTZaPtRjthUmtP2Y2-k,2136
81
81
  osducli/commands/storage/info.py,sha256=CGbA92GJYkWcLXHx1Z4i9g7Auk-ws2Cg6n6X7_m27iw,1345
82
82
  osducli/commands/storage/list.py,sha256=bIN76XW70Xml0CCldNvjN-qCumqICjZkQPXs7LTY69M,1413
83
- osducli/commands/storage/versions.py,sha256=9KtVFIofIXPjozw_haeZDx28Y5SVfbYKtOyP8Q4jxx4,1483
83
+ osducli/commands/storage/version/__init__.py,sha256=h_BEt3whnDdxWHMNK9ej3_aQ_oWtRN41Wjr4XN9kQ6k,593
84
+ osducli/commands/storage/version/get.py,sha256=r7_HRE5FS2HNrltyO-RsxVcAlhlmwoKmGdOMDy76w_E,1983
85
+ osducli/commands/storage/version/list.py,sha256=F9bAHnmp-Iy2cDIjR7rT4CcPYWnrzBARC2ZEWNjg-uk,1483
84
86
  osducli/commands/unit/__init__.py,sha256=wi3jN5VORSyR-1R9p3smO6zkzejAnAI0-T9_moGSl08,582
85
87
  osducli/commands/unit/_const.py,sha256=GuBlXzsI723OKlqcBzsG21T44V_SbOPqdbaw8_c2c5s,696
86
88
  osducli/commands/unit/info.py,sha256=3mAB14C5256cDQGR_pUbSpKXN-0ohA7gxqxwq4t4VP8,1210
@@ -234,9 +236,9 @@ osducli/util/file.py,sha256=kfh6SLOI7X54gZ0hWF3kQ1npXPylNYgE1d1_w-fFyr0,1821
234
236
  osducli/util/prompt.py,sha256=0i3eNnxOHRQstvsvfiKnN0lIxXu6sEXIcU8txeYRhNs,7492
235
237
  osducli/util/pypi.py,sha256=-DW5CThkKKiOwLp2tg85BmrLKZzkMI9pu8DyWNPZH6E,1192
236
238
  osducli/util/service_info.py,sha256=YsVvoRoeG1osFjql2AgVkGoj1TePuhBZf3CQXl2a9As,2577
237
- osducli-0.0.50.dist-info/licenses/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
238
- osducli-0.0.50.dist-info/METADATA,sha256=dZXA1t4OQiGFavpnmqNh6GqJcszqJHTNz9K8oWpEB98,6251
239
- osducli-0.0.50.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
240
- osducli-0.0.50.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
241
- osducli-0.0.50.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
242
- osducli-0.0.50.dist-info/RECORD,,
239
+ osducli-0.0.51.dist-info/licenses/LICENSE.md,sha256=9xnGPjJkOAgd0kH4QLlvOIYKqY1M49gWUQpoUxAU-9Y,12788
240
+ osducli-0.0.51.dist-info/METADATA,sha256=QUUwGY12jCAaYkGbOiLNJjS0IniEkQS_sQ_aSe0Z9xM,6326
241
+ osducli-0.0.51.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
242
+ osducli-0.0.51.dist-info/entry_points.txt,sha256=gASIcihV0BSJDZOUK-zTzb8RiccZCvKfVZMna9RsEIg,47
243
+ osducli-0.0.51.dist-info/top_level.txt,sha256=lqiP5fuyH8lx7c2emYoIVZNxZAPX-bSwnMH789wxUAY,8
244
+ osducli-0.0.51.dist-info/RECORD,,