Skip to content

Commit bff93af

Browse files
Excavator: Upgrade API Version (#37)
1 parent b632e08 commit bff93af

File tree

10 files changed

+255
-0
lines changed

10 files changed

+255
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,7 @@ Namespace | Resource | Operation | HTTP request |
509509
- [UserDict](docs/v2/models/UserDict.md)
510510
- [UserSearchFilterDict](docs/v2/models/UserSearchFilterDict.md)
511511
- [UserUsername](docs/v2/models/UserUsername.md)
512+
- [FileImportRid](docs/v2/models/FileImportRid.md)
512513
- [AttachmentType](docs/v2/models/AttachmentType.md)
513514
- [AttachmentTypeDict](docs/v2/models/AttachmentTypeDict.md)
514515
- [BooleanType](docs/v2/models/BooleanType.md)

docs/v2/Connectivity/FileImport.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# FileImport
2+
3+
Method | HTTP request |
4+
------------- | ------------- |
5+
6+
Triggers the FileImport, which runs asynchronously as a [Foundry Build](/docs/foundry/data-integration/builds/).
7+
The returned BuildRid can be used to check the status via the Orchestration API.
8+
9+
10+
### Parameters
11+
12+
Name | Type | Description | Notes |
13+
------------- | ------------- | ------------- | ------------- |
14+
**file_import_rid** | FileImportRid | fileImportRid | |
15+
**preview** | Optional[PreviewMode] | preview | [optional] |
16+
17+
### Return type
18+
**BuildRid**
19+
20+
### Example
21+
22+
```python
23+
from foundry.v2 import FoundryClient
24+
import foundry
25+
from pprint import pprint
26+
27+
foundry_client = FoundryClient(
28+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
29+
)
30+
31+
# FileImportRid | fileImportRid
32+
file_import_rid = None
33+
# Optional[PreviewMode] | preview
34+
preview = None
35+
36+
37+
try:
38+
api_response = foundry_client.connectivity.FileImport.trigger(
39+
file_import_rid,
40+
preview=preview,
41+
)
42+
print("The trigger response:\n")
43+
pprint(api_response)
44+
except foundry.PalantirRPCException as e:
45+
print("HTTP error when calling FileImport.trigger: %s\n" % e)
46+
47+
```
48+
49+
50+
51+
### Authorization
52+
53+
See [README](../../../README.md#authorization)
54+
55+
### HTTP response details
56+
| Status Code | Type | Description | Content Type |
57+
|-------------|-------------|-------------|------------------|
58+
**200** | BuildRid | | application/json |
59+
60+
[[Back to top]](#) [[Back to API list]](../../../README.md#apis-v2-link) [[Back to Model list]](../../../README.md#models-v2-link) [[Back to README]](../../../README.md)
61+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# FileImportRid
2+
3+
The Resource Identifier (RID) of a FileImport.
4+
5+
6+
## Type
7+
```python
8+
RID
9+
```
10+
11+
12+
[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md)

foundry/v2/cli.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,37 @@ def admin_group_group_member_remove(
730730
click.echo(repr(result))
731731

732732

733+
@cli.group("connectivity")
734+
def connectivity():
735+
pass
736+
737+
738+
@connectivity.group("file_import")
739+
def connectivity_file_import():
740+
pass
741+
742+
743+
@connectivity_file_import.command("trigger")
744+
@click.argument("file_import_rid", type=str, required=True)
745+
@click.option("--preview", type=bool, required=False, help="""preview""")
746+
@click.pass_obj
747+
def connectivity_file_import_trigger(
748+
client: foundry.v2.FoundryClient,
749+
file_import_rid: str,
750+
preview: Optional[bool],
751+
):
752+
"""
753+
Triggers the FileImport, which runs asynchronously as a [Foundry Build](/docs/foundry/data-integration/builds/).
754+
The returned BuildRid can be used to check the status via the Orchestration API.
755+
756+
"""
757+
result = client.connectivity.FileImport.trigger(
758+
file_import_rid=file_import_rid,
759+
preview=preview,
760+
)
761+
click.echo(repr(result))
762+
763+
733764
@cli.group("core")
734765
def core():
735766
pass

foundry/v2/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class FoundryClient:
2626

2727
def __init__(self, auth: Auth, hostname: str):
2828
from foundry.v2.admin.client import AdminClient
29+
from foundry.v2.connectivity.client import ConnectivityClient
2930
from foundry.v2.datasets.client import DatasetsClient
3031
from foundry.v2.filesystem.client import FilesystemClient
3132
from foundry.v2.functions.client import FunctionsClient
@@ -35,6 +36,7 @@ def __init__(self, auth: Auth, hostname: str):
3536
from foundry.v2.third_party_applications.client import ThirdPartyApplicationsClient # NOQA
3637

3738
self.admin = AdminClient(auth=auth, hostname=hostname)
39+
self.connectivity = ConnectivityClient(auth=auth, hostname=hostname)
3840
self.datasets = DatasetsClient(auth=auth, hostname=hostname)
3941
self.filesystem = FilesystemClient(auth=auth, hostname=hostname)
4042
self.functions = FunctionsClient(auth=auth, hostname=hostname)

foundry/v2/connectivity/client.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2024 Palantir Technologies, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from __future__ import annotations
17+
18+
from foundry._core import Auth
19+
from foundry.v2.connectivity.file_import import FileImportClient
20+
21+
22+
class ConnectivityClient:
23+
def __init__(self, auth: Auth, hostname: str):
24+
self.FileImport = FileImportClient(auth=auth, hostname=hostname)
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Copyright 2024 Palantir Technologies, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from __future__ import annotations
17+
18+
from typing import Any
19+
from typing import Dict
20+
from typing import Optional
21+
22+
from pydantic import Field
23+
from pydantic import StrictInt
24+
from pydantic import validate_call
25+
from typing_extensions import Annotated
26+
27+
from foundry._core import ApiClient
28+
from foundry._core import Auth
29+
from foundry._core import RequestInfo
30+
from foundry._errors import handle_unexpected
31+
from foundry.v2.connectivity.models._file_import_rid import FileImportRid
32+
from foundry.v2.core.models._preview_mode import PreviewMode
33+
from foundry.v2.orchestration.models._build_rid import BuildRid
34+
35+
36+
class FileImportClient:
37+
def __init__(self, auth: Auth, hostname: str) -> None:
38+
self._api_client = ApiClient(auth=auth, hostname=hostname)
39+
40+
@validate_call
41+
@handle_unexpected
42+
def trigger(
43+
self,
44+
file_import_rid: FileImportRid,
45+
*,
46+
preview: Optional[PreviewMode] = None,
47+
request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None,
48+
) -> BuildRid:
49+
"""
50+
Triggers the FileImport, which runs asynchronously as a [Foundry Build](/docs/foundry/data-integration/builds/).
51+
The returned BuildRid can be used to check the status via the Orchestration API.
52+
53+
:param file_import_rid: fileImportRid
54+
:type file_import_rid: FileImportRid
55+
:param preview: preview
56+
:type preview: Optional[PreviewMode]
57+
:param request_timeout: timeout setting for this request in seconds.
58+
:type request_timeout: Optional[int]
59+
:return: Returns the result object.
60+
:rtype: BuildRid
61+
"""
62+
63+
return self._api_client.call_api(
64+
RequestInfo(
65+
method="POST",
66+
resource_path="/v2/connectivity/fileImports/{fileImportRid}/trigger",
67+
query_params={
68+
"preview": preview,
69+
},
70+
path_params={
71+
"fileImportRid": file_import_rid,
72+
},
73+
header_params={
74+
"Accept": "application/json",
75+
},
76+
body=None,
77+
body_type=None,
78+
response_type=BuildRid,
79+
request_timeout=request_timeout,
80+
),
81+
)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Copyright 2024 Palantir Technologies, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from foundry.v2.connectivity.models._file_import_rid import FileImportRid
17+
18+
__all__ = [
19+
"FileImportRid",
20+
]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2024 Palantir Technologies, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
16+
from __future__ import annotations
17+
18+
from foundry._core.utils import RID
19+
20+
FileImportRid = RID
21+
"""The Resource Identifier (RID) of a FileImport."""

tests/test_discriminators.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from foundry.v1.geo import models as models_geo_v1
2424
from foundry.v1.ontologies import models as models_ontologies_v1
2525
from foundry.v2.admin import models as models_admin_v2
26+
from foundry.v2.connectivity import models as models_connectivity_v2
2627
from foundry.v2.core import models as models_core_v2
2728
from foundry.v2.datasets import models as models_datasets_v2
2829
from foundry.v2.filesystem import models as models_filesystem_v2
@@ -46,6 +47,7 @@ def test_can_validate_types():
4647
*[(models_geo_v1, model_name) for model_name in dir(models_geo_v1)],
4748
*[(models_ontologies_v1, model_name) for model_name in dir(models_ontologies_v1)],
4849
*[(models_admin_v2, model_name) for model_name in dir(models_admin_v2)],
50+
*[(models_connectivity_v2, model_name) for model_name in dir(models_connectivity_v2)],
4951
*[(models_core_v2, model_name) for model_name in dir(models_core_v2)],
5052
*[(models_datasets_v2, model_name) for model_name in dir(models_datasets_v2)],
5153
*[(models_filesystem_v2, model_name) for model_name in dir(models_filesystem_v2)],

0 commit comments

Comments
 (0)