development-framework-cli 1.7.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.
- development_framework_cli-1.7.3.dist-info/METADATA +141 -0
- development_framework_cli-1.7.3.dist-info/RECORD +71 -0
- development_framework_cli-1.7.3.dist-info/WHEEL +4 -0
- development_framework_cli-1.7.3.dist-info/entry_points.txt +2 -0
- development_framework_cli-1.7.3.dist-info/licenses/LICENSE +21 -0
- dm_cli/__init__.py +1 -0
- dm_cli/cli.py +180 -0
- dm_cli/command_group/__init__.py +0 -0
- dm_cli/command_group/data_source.py +176 -0
- dm_cli/command_group/entities.py +116 -0
- dm_cli/dmss.py +104 -0
- dm_cli/dmss_api/__init__.py +27 -0
- dm_cli/dmss_api/api/__init__.py +3 -0
- dm_cli/dmss_api/api/access_control_api.py +349 -0
- dm_cli/dmss_api/api/attribute_api.py +175 -0
- dm_cli/dmss_api/api/blob_api.py +344 -0
- dm_cli/dmss_api/api/blueprint_api.py +326 -0
- dm_cli/dmss_api/api/datasource_api.py +448 -0
- dm_cli/dmss_api/api/default_api.py +4439 -0
- dm_cli/dmss_api/api/document_api.py +922 -0
- dm_cli/dmss_api/api/entity_api.py +464 -0
- dm_cli/dmss_api/api/export_api.py +313 -0
- dm_cli/dmss_api/api/file_api.py +197 -0
- dm_cli/dmss_api/api/health_check_api.py +160 -0
- dm_cli/dmss_api/api/lookup_table_api.py +323 -0
- dm_cli/dmss_api/api/meta_api.py +185 -0
- dm_cli/dmss_api/api/personal_access_token_api.py +433 -0
- dm_cli/dmss_api/api/reference_api.py +174 -0
- dm_cli/dmss_api/api/search_api.py +183 -0
- dm_cli/dmss_api/api/whoami_api.py +163 -0
- dm_cli/dmss_api/api_client.py +896 -0
- dm_cli/dmss_api/apis/__init__.py +32 -0
- dm_cli/dmss_api/configuration.py +482 -0
- dm_cli/dmss_api/exceptions.py +158 -0
- dm_cli/dmss_api/model/__init__.py +5 -0
- dm_cli/dmss_api/model/access_control_list.py +287 -0
- dm_cli/dmss_api/model/access_level.py +290 -0
- dm_cli/dmss_api/model/acl.py +287 -0
- dm_cli/dmss_api/model/data_source_information.py +282 -0
- dm_cli/dmss_api/model/data_source_request.py +281 -0
- dm_cli/dmss_api/model/dependency.py +294 -0
- dm_cli/dmss_api/model/entity.py +275 -0
- dm_cli/dmss_api/model/error_response.py +278 -0
- dm_cli/dmss_api/model/export_meta_response.py +277 -0
- dm_cli/dmss_api/model/get_blueprint_response.py +280 -0
- dm_cli/dmss_api/model/lookup.py +283 -0
- dm_cli/dmss_api/model/pat_data.py +299 -0
- dm_cli/dmss_api/model/recipe.py +311 -0
- dm_cli/dmss_api/model/recipe_attribute.py +304 -0
- dm_cli/dmss_api/model/reference.py +280 -0
- dm_cli/dmss_api/model/reference_entity.py +288 -0
- dm_cli/dmss_api/model/repository.py +317 -0
- dm_cli/dmss_api/model/repository_type.py +290 -0
- dm_cli/dmss_api/model/storage_attribute.py +295 -0
- dm_cli/dmss_api/model/storage_data_types.py +292 -0
- dm_cli/dmss_api/model/storage_recipe.py +293 -0
- dm_cli/dmss_api/model_utils.py +2057 -0
- dm_cli/dmss_api/models/__init__.py +29 -0
- dm_cli/dmss_api/rest.py +358 -0
- dm_cli/domain.py +166 -0
- dm_cli/enums.py +48 -0
- dm_cli/import_entity.py +128 -0
- dm_cli/import_package.py +173 -0
- dm_cli/package_tree_from_zip.py +120 -0
- dm_cli/state.py +12 -0
- dm_cli/utils/__init__.py +0 -0
- dm_cli/utils/file_structure.py +31 -0
- dm_cli/utils/reference.py +129 -0
- dm_cli/utils/resolve_local_ids.py +142 -0
- dm_cli/utils/utils.py +161 -0
- dm_cli/utils/zip.py +70 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
from rich import print
|
|
6
|
+
from tenacity import (
|
|
7
|
+
retry,
|
|
8
|
+
retry_if_not_exception_type,
|
|
9
|
+
stop_after_attempt,
|
|
10
|
+
wait_random_exponential,
|
|
11
|
+
)
|
|
12
|
+
from typing_extensions import Annotated
|
|
13
|
+
|
|
14
|
+
from dm_cli.dmss import ApplicationException, console, dmss_api, dmss_exception_wrapper
|
|
15
|
+
from dm_cli.dmss_api import ApiException
|
|
16
|
+
from dm_cli.import_entity import import_folder_entity, import_single_entity
|
|
17
|
+
from dm_cli.utils.utils import destination_is_root
|
|
18
|
+
|
|
19
|
+
entities_app = typer.Typer(help="Import, delete, or validate entities and/or blueprints")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@entities_app.command("import")
|
|
23
|
+
def import_entity(
|
|
24
|
+
source: Annotated[
|
|
25
|
+
str,
|
|
26
|
+
typer.Argument(
|
|
27
|
+
help="Path to file or folder on local filesystem to import. Trailing '/' will result in the content being imported instead of the folder itself."
|
|
28
|
+
),
|
|
29
|
+
],
|
|
30
|
+
destination: Annotated[
|
|
31
|
+
str,
|
|
32
|
+
typer.Argument(
|
|
33
|
+
help="Address for the folder or file. Should be on the format <DataSource>/<rootPackage>/<subPackage>/<entity>"
|
|
34
|
+
),
|
|
35
|
+
],
|
|
36
|
+
validate: Annotated[bool, typer.Option(help="if True, all entities uploaded will be validated.")] = True,
|
|
37
|
+
) -> bool:
|
|
38
|
+
"""
|
|
39
|
+
Import an entity (file or package) <source> to the given <destination>.
|
|
40
|
+
"""
|
|
41
|
+
source_path = Path(source)
|
|
42
|
+
destination = destination.rstrip("/\\")
|
|
43
|
+
# Not replacing a package, but appending to. Can therefore not use "fast mode"
|
|
44
|
+
fast = destination_is_root(Path(destination))
|
|
45
|
+
|
|
46
|
+
def inner_import():
|
|
47
|
+
if source_path.is_dir():
|
|
48
|
+
# If source path ends with "/" or windows "\", import content instead of the package itself
|
|
49
|
+
if source[-1] in ("/", "\\"):
|
|
50
|
+
print(f"Importing all content from '{source}*' --> '{destination}'")
|
|
51
|
+
for file in source_path.iterdir():
|
|
52
|
+
if file.is_file():
|
|
53
|
+
import_single_entity(file, destination, validate)
|
|
54
|
+
continue
|
|
55
|
+
import_folder_entity(file, destination, fast)
|
|
56
|
+
if validate:
|
|
57
|
+
print(f"Validating entities in: {destination}/{file.name}")
|
|
58
|
+
dmss_api.validate_existing_entity(f"{destination}/{file.name}")
|
|
59
|
+
return True
|
|
60
|
+
print(f"Importing PACKAGE '{source}' --> '{destination}'")
|
|
61
|
+
import_folder_entity(source_path, destination, fast)
|
|
62
|
+
if validate:
|
|
63
|
+
print(f"Validating entities in: {destination}/{source_path.name}")
|
|
64
|
+
dmss_api.validate_existing_entity(f"{destination}/{source_path.name}")
|
|
65
|
+
return True
|
|
66
|
+
else:
|
|
67
|
+
import_single_entity(source_path, destination, validate)
|
|
68
|
+
return True
|
|
69
|
+
|
|
70
|
+
return dmss_exception_wrapper(inner_import)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@entities_app.command("validate")
|
|
74
|
+
def validate_entity(
|
|
75
|
+
destination: Annotated[
|
|
76
|
+
str,
|
|
77
|
+
typer.Argument(
|
|
78
|
+
help="Address for the folder or file. Should be on the format <DataSource>/<rootPackage>/<subPackage>/<entity>"
|
|
79
|
+
),
|
|
80
|
+
],
|
|
81
|
+
) -> bool:
|
|
82
|
+
"""Recursively validate entity at remote target"""
|
|
83
|
+
print(f"Validating entities recursively in: {destination}")
|
|
84
|
+
|
|
85
|
+
@retry(
|
|
86
|
+
wait=wait_random_exponential(multiplier=1, max=60),
|
|
87
|
+
stop=stop_after_attempt(5),
|
|
88
|
+
retry=retry_if_not_exception_type((ApplicationException, RuntimeError)),
|
|
89
|
+
)
|
|
90
|
+
def validation_error_wrapper():
|
|
91
|
+
try:
|
|
92
|
+
dmss_api.validate_existing_entity(destination)
|
|
93
|
+
except ApiException as e:
|
|
94
|
+
exception_body = json.loads(e.body)
|
|
95
|
+
if exception_body["type"] == "ValidationException":
|
|
96
|
+
console.print(exception_body, style="red1")
|
|
97
|
+
raise typer.Exit(code=1)
|
|
98
|
+
raise e
|
|
99
|
+
|
|
100
|
+
dmss_exception_wrapper(validation_error_wrapper)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@entities_app.command("delete")
|
|
104
|
+
def delete_entity(
|
|
105
|
+
target: Annotated[
|
|
106
|
+
str,
|
|
107
|
+
typer.Argument(
|
|
108
|
+
help="Delete an entity from DMSS. Target should be an address on the format <DataSource>/<rootPackage>/<subPackage>/<entity>"
|
|
109
|
+
),
|
|
110
|
+
],
|
|
111
|
+
):
|
|
112
|
+
"""
|
|
113
|
+
Delete an entity from DMSS.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
dmss_exception_wrapper(dmss_api.document_remove, target)
|
dm_cli/dmss.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from typing import Any, Callable
|
|
3
|
+
|
|
4
|
+
import requests
|
|
5
|
+
import typer
|
|
6
|
+
from rich.console import Console
|
|
7
|
+
from rich.text import Text
|
|
8
|
+
from tenacity import (
|
|
9
|
+
retry,
|
|
10
|
+
retry_if_exception_type,
|
|
11
|
+
stop_after_attempt,
|
|
12
|
+
wait_random_exponential,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from dm_cli.dmss_api import ApiException
|
|
16
|
+
from dm_cli.dmss_api.api.default_api import DefaultApi
|
|
17
|
+
from dm_cli.dmss_api.exceptions import NotFoundException, ServiceException
|
|
18
|
+
from dm_cli.state import state
|
|
19
|
+
|
|
20
|
+
console = Console()
|
|
21
|
+
|
|
22
|
+
dmss_api = DefaultApi()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ApplicationException(Exception):
|
|
26
|
+
status: int = 500
|
|
27
|
+
type: str = "ApplicationException"
|
|
28
|
+
message: str = "The requested operation failed"
|
|
29
|
+
debug: str = "An unknown and unhandled exception occurred in the API"
|
|
30
|
+
data: dict = None
|
|
31
|
+
|
|
32
|
+
def __init__(
|
|
33
|
+
self,
|
|
34
|
+
message: str = "The requested operation failed",
|
|
35
|
+
debug: str = "An unknown and unhandled exception occurred in the API",
|
|
36
|
+
data: dict = None,
|
|
37
|
+
status: int = 500,
|
|
38
|
+
type: str = "ApplicationException",
|
|
39
|
+
):
|
|
40
|
+
self.type = type
|
|
41
|
+
self.status = status
|
|
42
|
+
self.type = self.__class__.__name__
|
|
43
|
+
self.message = message
|
|
44
|
+
self.debug = debug
|
|
45
|
+
self.data = data
|
|
46
|
+
|
|
47
|
+
def dict(self):
|
|
48
|
+
return {
|
|
49
|
+
"status": self.status,
|
|
50
|
+
"type": self.type,
|
|
51
|
+
"message": self.message,
|
|
52
|
+
"debug": self.debug,
|
|
53
|
+
"data": self.data,
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@retry(
|
|
58
|
+
wait=wait_random_exponential(multiplier=1, max=60),
|
|
59
|
+
stop=stop_after_attempt(5),
|
|
60
|
+
reraise=True,
|
|
61
|
+
retry=retry_if_exception_type(ServiceException),
|
|
62
|
+
)
|
|
63
|
+
def export(absolute_document_ref: str):
|
|
64
|
+
"""Call export endpoint from DMSS to download document(s) as zip.
|
|
65
|
+
|
|
66
|
+
The reason dmss_api cannot be used directly is that there were some issues with interpreting the JSON schema,
|
|
67
|
+
which caused the export function in the generated DMSS api to not work properly.
|
|
68
|
+
"""
|
|
69
|
+
headers = {"Access-Key": state.token}
|
|
70
|
+
|
|
71
|
+
response = requests.get(f"{state.dmss_url}/api/export/{absolute_document_ref}", headers=headers) # nosec
|
|
72
|
+
if response.status_code != 200:
|
|
73
|
+
raise ApplicationException(
|
|
74
|
+
message=f"Could not export document(s) from {absolute_document_ref} (status code {response.status_code})."
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return response
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def dmss_exception_wrapper(
|
|
81
|
+
function: Callable,
|
|
82
|
+
*args,
|
|
83
|
+
**kwargs,
|
|
84
|
+
) -> Any:
|
|
85
|
+
try:
|
|
86
|
+
return function(*args, **kwargs)
|
|
87
|
+
except ApplicationException as e:
|
|
88
|
+
if state.debug:
|
|
89
|
+
console.print_exception()
|
|
90
|
+
exception = e.dict()
|
|
91
|
+
console.print(exception, style="red1")
|
|
92
|
+
raise typer.Exit(code=1)
|
|
93
|
+
except (NotFoundException, ApiException) as e:
|
|
94
|
+
if state.debug:
|
|
95
|
+
console.print_exception()
|
|
96
|
+
exception = json.loads(e.body)
|
|
97
|
+
console.print(exception, style="red1")
|
|
98
|
+
raise typer.Exit(code=1)
|
|
99
|
+
except Exception as error:
|
|
100
|
+
if state.debug:
|
|
101
|
+
console.print_exception()
|
|
102
|
+
text = Text(str(error))
|
|
103
|
+
console.print(text, style="red1")
|
|
104
|
+
raise typer.Exit(code=1)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# flake8: noqa
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Data Modelling Storage Service
|
|
5
|
+
|
|
6
|
+
API for basic data modelling interaction # noqa: E501
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.3.0
|
|
9
|
+
Generated by: https://openapi-generator.tech
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__version__ = "1.0.0"
|
|
14
|
+
|
|
15
|
+
# import ApiClient
|
|
16
|
+
from dm_cli.dmss_api.api_client import ApiClient
|
|
17
|
+
|
|
18
|
+
# import Configuration
|
|
19
|
+
from dm_cli.dmss_api.configuration import Configuration
|
|
20
|
+
|
|
21
|
+
# import exceptions
|
|
22
|
+
from dm_cli.dmss_api.exceptions import OpenApiException
|
|
23
|
+
from dm_cli.dmss_api.exceptions import ApiAttributeError
|
|
24
|
+
from dm_cli.dmss_api.exceptions import ApiTypeError
|
|
25
|
+
from dm_cli.dmss_api.exceptions import ApiValueError
|
|
26
|
+
from dm_cli.dmss_api.exceptions import ApiKeyError
|
|
27
|
+
from dm_cli.dmss_api.exceptions import ApiException
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Data Modelling Storage Service
|
|
3
|
+
|
|
4
|
+
API for basic data modelling interaction # noqa: E501
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.3.0
|
|
7
|
+
Generated by: https://openapi-generator.tech
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
import re # noqa: F401
|
|
12
|
+
import sys # noqa: F401
|
|
13
|
+
|
|
14
|
+
from dm_cli.dmss_api.api_client import ApiClient
|
|
15
|
+
from dm_cli.dmss_api.api_client import Endpoint as _Endpoint
|
|
16
|
+
from dm_cli.dmss_api.model.access_control_list import AccessControlList
|
|
17
|
+
from dm_cli.dmss_api.model.error_response import ErrorResponse
|
|
18
|
+
from dm_cli.dmss_api.model_utils import ( # noqa: F401
|
|
19
|
+
check_allowed_values,
|
|
20
|
+
check_validations,
|
|
21
|
+
date,
|
|
22
|
+
datetime,
|
|
23
|
+
file_type,
|
|
24
|
+
none_type,
|
|
25
|
+
validate_and_convert_types,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class AccessControlApi(object):
|
|
30
|
+
"""NOTE: This class is auto generated by OpenAPI Generator
|
|
31
|
+
Ref: https://openapi-generator.tech
|
|
32
|
+
|
|
33
|
+
Do not edit the class manually.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, api_client=None):
|
|
37
|
+
if api_client is None:
|
|
38
|
+
api_client = ApiClient()
|
|
39
|
+
self.api_client = api_client
|
|
40
|
+
self.get_acl_endpoint = _Endpoint(
|
|
41
|
+
settings={
|
|
42
|
+
'response_type': (AccessControlList,),
|
|
43
|
+
'auth': [
|
|
44
|
+
'APIKeyHeader',
|
|
45
|
+
'OAuth2AuthorizationCodeBearer'
|
|
46
|
+
],
|
|
47
|
+
'endpoint_path': '/api/acl/{data_source_id}/{document_id}',
|
|
48
|
+
'operation_id': 'get_acl',
|
|
49
|
+
'http_method': 'GET',
|
|
50
|
+
'servers': None,
|
|
51
|
+
},
|
|
52
|
+
params_map={
|
|
53
|
+
'all': [
|
|
54
|
+
'data_source_id',
|
|
55
|
+
'document_id',
|
|
56
|
+
],
|
|
57
|
+
'required': [
|
|
58
|
+
'data_source_id',
|
|
59
|
+
'document_id',
|
|
60
|
+
],
|
|
61
|
+
'nullable': [
|
|
62
|
+
],
|
|
63
|
+
'enum': [
|
|
64
|
+
],
|
|
65
|
+
'validation': [
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
root_map={
|
|
69
|
+
'validations': {
|
|
70
|
+
},
|
|
71
|
+
'allowed_values': {
|
|
72
|
+
},
|
|
73
|
+
'openapi_types': {
|
|
74
|
+
'data_source_id':
|
|
75
|
+
(str,),
|
|
76
|
+
'document_id':
|
|
77
|
+
(str,),
|
|
78
|
+
},
|
|
79
|
+
'attribute_map': {
|
|
80
|
+
'data_source_id': 'data_source_id',
|
|
81
|
+
'document_id': 'document_id',
|
|
82
|
+
},
|
|
83
|
+
'location_map': {
|
|
84
|
+
'data_source_id': 'path',
|
|
85
|
+
'document_id': 'path',
|
|
86
|
+
},
|
|
87
|
+
'collection_format_map': {
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
headers_map={
|
|
91
|
+
'accept': [
|
|
92
|
+
'application/json',
|
|
93
|
+
'text/plain'
|
|
94
|
+
],
|
|
95
|
+
'content_type': [],
|
|
96
|
+
},
|
|
97
|
+
api_client=api_client
|
|
98
|
+
)
|
|
99
|
+
self.set_acl_endpoint = _Endpoint(
|
|
100
|
+
settings={
|
|
101
|
+
'response_type': (str,),
|
|
102
|
+
'auth': [
|
|
103
|
+
'APIKeyHeader',
|
|
104
|
+
'OAuth2AuthorizationCodeBearer'
|
|
105
|
+
],
|
|
106
|
+
'endpoint_path': '/api/acl/{data_source_id}/{document_id}',
|
|
107
|
+
'operation_id': 'set_acl',
|
|
108
|
+
'http_method': 'PUT',
|
|
109
|
+
'servers': None,
|
|
110
|
+
},
|
|
111
|
+
params_map={
|
|
112
|
+
'all': [
|
|
113
|
+
'data_source_id',
|
|
114
|
+
'document_id',
|
|
115
|
+
'access_control_list',
|
|
116
|
+
'recursively',
|
|
117
|
+
],
|
|
118
|
+
'required': [
|
|
119
|
+
'data_source_id',
|
|
120
|
+
'document_id',
|
|
121
|
+
'access_control_list',
|
|
122
|
+
],
|
|
123
|
+
'nullable': [
|
|
124
|
+
],
|
|
125
|
+
'enum': [
|
|
126
|
+
],
|
|
127
|
+
'validation': [
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
root_map={
|
|
131
|
+
'validations': {
|
|
132
|
+
},
|
|
133
|
+
'allowed_values': {
|
|
134
|
+
},
|
|
135
|
+
'openapi_types': {
|
|
136
|
+
'data_source_id':
|
|
137
|
+
(str,),
|
|
138
|
+
'document_id':
|
|
139
|
+
(str,),
|
|
140
|
+
'access_control_list':
|
|
141
|
+
(AccessControlList,),
|
|
142
|
+
'recursively':
|
|
143
|
+
(bool,),
|
|
144
|
+
},
|
|
145
|
+
'attribute_map': {
|
|
146
|
+
'data_source_id': 'data_source_id',
|
|
147
|
+
'document_id': 'document_id',
|
|
148
|
+
'recursively': 'recursively',
|
|
149
|
+
},
|
|
150
|
+
'location_map': {
|
|
151
|
+
'data_source_id': 'path',
|
|
152
|
+
'document_id': 'path',
|
|
153
|
+
'access_control_list': 'body',
|
|
154
|
+
'recursively': 'query',
|
|
155
|
+
},
|
|
156
|
+
'collection_format_map': {
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
headers_map={
|
|
160
|
+
'accept': [
|
|
161
|
+
'application/json',
|
|
162
|
+
'text/plain'
|
|
163
|
+
],
|
|
164
|
+
'content_type': [
|
|
165
|
+
'application/json'
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
api_client=api_client
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
def get_acl(
|
|
172
|
+
self,
|
|
173
|
+
data_source_id,
|
|
174
|
+
document_id,
|
|
175
|
+
**kwargs
|
|
176
|
+
):
|
|
177
|
+
"""Get Acl # noqa: E501
|
|
178
|
+
|
|
179
|
+
GET the access control list (ACL) for a document. The ACL determines which access a given user has for a document (Read, Write or None). Args: - data_source_id (str): The ID of the data source which the document resides in. - document_id (str): The ID of the document for which to check the ACL. - user (User): The authenticated user accessing the endpoint, automatically generated from provided bearer token or Access-Key. Returns: - ACL: The access control list requested. # noqa: E501
|
|
180
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
181
|
+
asynchronous HTTP request, please pass async_req=True
|
|
182
|
+
|
|
183
|
+
>>> thread = api.get_acl(data_source_id, document_id, async_req=True)
|
|
184
|
+
>>> result = thread.get()
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
data_source_id (str):
|
|
188
|
+
document_id (str):
|
|
189
|
+
|
|
190
|
+
Keyword Args:
|
|
191
|
+
_return_http_data_only (bool): response data without head status
|
|
192
|
+
code and headers. Default is True.
|
|
193
|
+
_preload_content (bool): if False, the urllib3.HTTPResponse object
|
|
194
|
+
will be returned without reading/decoding response data.
|
|
195
|
+
Default is True.
|
|
196
|
+
_request_timeout (int/float/tuple): timeout setting for this request. If
|
|
197
|
+
one number provided, it will be total request timeout. It can also
|
|
198
|
+
be a pair (tuple) of (connection, read) timeouts.
|
|
199
|
+
Default is None.
|
|
200
|
+
_check_input_type (bool): specifies if type checking
|
|
201
|
+
should be done one the data sent to the server.
|
|
202
|
+
Default is True.
|
|
203
|
+
_check_return_type (bool): specifies if type checking
|
|
204
|
+
should be done one the data received from the server.
|
|
205
|
+
Default is True.
|
|
206
|
+
_spec_property_naming (bool): True if the variable names in the input data
|
|
207
|
+
are serialized names, as specified in the OpenAPI document.
|
|
208
|
+
False if the variable names in the input data
|
|
209
|
+
are pythonic names, e.g. snake case (default)
|
|
210
|
+
_content_type (str/None): force body content-type.
|
|
211
|
+
Default is None and content-type will be predicted by allowed
|
|
212
|
+
content-types and body.
|
|
213
|
+
_host_index (int/None): specifies the index of the server
|
|
214
|
+
that we want to use.
|
|
215
|
+
Default is read from the configuration.
|
|
216
|
+
_request_auths (list): set to override the auth_settings for an a single
|
|
217
|
+
request; this effectively ignores the authentication
|
|
218
|
+
in the spec for a single request.
|
|
219
|
+
Default is None
|
|
220
|
+
async_req (bool): execute request asynchronously
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
AccessControlList
|
|
224
|
+
If the method is called asynchronously, returns the request
|
|
225
|
+
thread.
|
|
226
|
+
"""
|
|
227
|
+
kwargs['async_req'] = kwargs.get(
|
|
228
|
+
'async_req', False
|
|
229
|
+
)
|
|
230
|
+
kwargs['_return_http_data_only'] = kwargs.get(
|
|
231
|
+
'_return_http_data_only', True
|
|
232
|
+
)
|
|
233
|
+
kwargs['_preload_content'] = kwargs.get(
|
|
234
|
+
'_preload_content', True
|
|
235
|
+
)
|
|
236
|
+
kwargs['_request_timeout'] = kwargs.get(
|
|
237
|
+
'_request_timeout', None
|
|
238
|
+
)
|
|
239
|
+
kwargs['_check_input_type'] = kwargs.get(
|
|
240
|
+
'_check_input_type', True
|
|
241
|
+
)
|
|
242
|
+
kwargs['_check_return_type'] = kwargs.get(
|
|
243
|
+
'_check_return_type', True
|
|
244
|
+
)
|
|
245
|
+
kwargs['_spec_property_naming'] = kwargs.get(
|
|
246
|
+
'_spec_property_naming', False
|
|
247
|
+
)
|
|
248
|
+
kwargs['_content_type'] = kwargs.get(
|
|
249
|
+
'_content_type')
|
|
250
|
+
kwargs['_host_index'] = kwargs.get('_host_index')
|
|
251
|
+
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
|
|
252
|
+
kwargs['data_source_id'] = \
|
|
253
|
+
data_source_id
|
|
254
|
+
kwargs['document_id'] = \
|
|
255
|
+
document_id
|
|
256
|
+
return self.get_acl_endpoint.call_with_http_info(**kwargs)
|
|
257
|
+
|
|
258
|
+
def set_acl(
|
|
259
|
+
self,
|
|
260
|
+
data_source_id,
|
|
261
|
+
document_id,
|
|
262
|
+
access_control_list,
|
|
263
|
+
**kwargs
|
|
264
|
+
):
|
|
265
|
+
"""Set Acl # noqa: E501
|
|
266
|
+
|
|
267
|
+
Update access control list (ACL) for a document. Args: - data_source_id (str): The ID of the data source which the document resides in. - document_id (str): The ID of the document for which to set the ACL. - acl (ACL): An access control list. - user (User): The authenticated user accessing the endpoint, automatically generated from provided bearer token or Access-Key. Returns: - str: \"OK\" (200) # noqa: E501
|
|
268
|
+
This method makes a synchronous HTTP request by default. To make an
|
|
269
|
+
asynchronous HTTP request, please pass async_req=True
|
|
270
|
+
|
|
271
|
+
>>> thread = api.set_acl(data_source_id, document_id, access_control_list, async_req=True)
|
|
272
|
+
>>> result = thread.get()
|
|
273
|
+
|
|
274
|
+
Args:
|
|
275
|
+
data_source_id (str):
|
|
276
|
+
document_id (str):
|
|
277
|
+
access_control_list (AccessControlList):
|
|
278
|
+
|
|
279
|
+
Keyword Args:
|
|
280
|
+
recursively (bool): [optional] if omitted the server will use the default value of True
|
|
281
|
+
_return_http_data_only (bool): response data without head status
|
|
282
|
+
code and headers. Default is True.
|
|
283
|
+
_preload_content (bool): if False, the urllib3.HTTPResponse object
|
|
284
|
+
will be returned without reading/decoding response data.
|
|
285
|
+
Default is True.
|
|
286
|
+
_request_timeout (int/float/tuple): timeout setting for this request. If
|
|
287
|
+
one number provided, it will be total request timeout. It can also
|
|
288
|
+
be a pair (tuple) of (connection, read) timeouts.
|
|
289
|
+
Default is None.
|
|
290
|
+
_check_input_type (bool): specifies if type checking
|
|
291
|
+
should be done one the data sent to the server.
|
|
292
|
+
Default is True.
|
|
293
|
+
_check_return_type (bool): specifies if type checking
|
|
294
|
+
should be done one the data received from the server.
|
|
295
|
+
Default is True.
|
|
296
|
+
_spec_property_naming (bool): True if the variable names in the input data
|
|
297
|
+
are serialized names, as specified in the OpenAPI document.
|
|
298
|
+
False if the variable names in the input data
|
|
299
|
+
are pythonic names, e.g. snake case (default)
|
|
300
|
+
_content_type (str/None): force body content-type.
|
|
301
|
+
Default is None and content-type will be predicted by allowed
|
|
302
|
+
content-types and body.
|
|
303
|
+
_host_index (int/None): specifies the index of the server
|
|
304
|
+
that we want to use.
|
|
305
|
+
Default is read from the configuration.
|
|
306
|
+
_request_auths (list): set to override the auth_settings for an a single
|
|
307
|
+
request; this effectively ignores the authentication
|
|
308
|
+
in the spec for a single request.
|
|
309
|
+
Default is None
|
|
310
|
+
async_req (bool): execute request asynchronously
|
|
311
|
+
|
|
312
|
+
Returns:
|
|
313
|
+
str
|
|
314
|
+
If the method is called asynchronously, returns the request
|
|
315
|
+
thread.
|
|
316
|
+
"""
|
|
317
|
+
kwargs['async_req'] = kwargs.get(
|
|
318
|
+
'async_req', False
|
|
319
|
+
)
|
|
320
|
+
kwargs['_return_http_data_only'] = kwargs.get(
|
|
321
|
+
'_return_http_data_only', True
|
|
322
|
+
)
|
|
323
|
+
kwargs['_preload_content'] = kwargs.get(
|
|
324
|
+
'_preload_content', True
|
|
325
|
+
)
|
|
326
|
+
kwargs['_request_timeout'] = kwargs.get(
|
|
327
|
+
'_request_timeout', None
|
|
328
|
+
)
|
|
329
|
+
kwargs['_check_input_type'] = kwargs.get(
|
|
330
|
+
'_check_input_type', True
|
|
331
|
+
)
|
|
332
|
+
kwargs['_check_return_type'] = kwargs.get(
|
|
333
|
+
'_check_return_type', True
|
|
334
|
+
)
|
|
335
|
+
kwargs['_spec_property_naming'] = kwargs.get(
|
|
336
|
+
'_spec_property_naming', False
|
|
337
|
+
)
|
|
338
|
+
kwargs['_content_type'] = kwargs.get(
|
|
339
|
+
'_content_type')
|
|
340
|
+
kwargs['_host_index'] = kwargs.get('_host_index')
|
|
341
|
+
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
|
|
342
|
+
kwargs['data_source_id'] = \
|
|
343
|
+
data_source_id
|
|
344
|
+
kwargs['document_id'] = \
|
|
345
|
+
document_id
|
|
346
|
+
kwargs['access_control_list'] = \
|
|
347
|
+
access_control_list
|
|
348
|
+
return self.set_acl_endpoint.call_with_http_info(**kwargs)
|
|
349
|
+
|