-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Excavator: Upgrade API Version (#37)
- Loading branch information
1 parent
b632e08
commit bff93af
Showing
10 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# FileImport | ||
|
||
Method | HTTP request | | ||
------------- | ------------- | | ||
|
||
Triggers the FileImport, which runs asynchronously as a [Foundry Build](/docs/foundry/data-integration/builds/). | ||
The returned BuildRid can be used to check the status via the Orchestration API. | ||
|
||
|
||
### Parameters | ||
|
||
Name | Type | Description | Notes | | ||
------------- | ------------- | ------------- | ------------- | | ||
**file_import_rid** | FileImportRid | fileImportRid | | | ||
**preview** | Optional[PreviewMode] | preview | [optional] | | ||
|
||
### Return type | ||
**BuildRid** | ||
|
||
### Example | ||
|
||
```python | ||
from foundry.v2 import FoundryClient | ||
import foundry | ||
from pprint import pprint | ||
|
||
foundry_client = FoundryClient( | ||
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" | ||
) | ||
|
||
# FileImportRid | fileImportRid | ||
file_import_rid = None | ||
# Optional[PreviewMode] | preview | ||
preview = None | ||
|
||
|
||
try: | ||
api_response = foundry_client.connectivity.FileImport.trigger( | ||
file_import_rid, | ||
preview=preview, | ||
) | ||
print("The trigger response:\n") | ||
pprint(api_response) | ||
except foundry.PalantirRPCException as e: | ||
print("HTTP error when calling FileImport.trigger: %s\n" % e) | ||
|
||
``` | ||
|
||
|
||
|
||
### Authorization | ||
|
||
See [README](../../../README.md#authorization) | ||
|
||
### HTTP response details | ||
| Status Code | Type | Description | Content Type | | ||
|-------------|-------------|-------------|------------------| | ||
**200** | BuildRid | | application/json | | ||
|
||
[[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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# FileImportRid | ||
|
||
The Resource Identifier (RID) of a FileImport. | ||
|
||
|
||
## Type | ||
```python | ||
RID | ||
``` | ||
|
||
|
||
[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from __future__ import annotations | ||
|
||
from foundry._core import Auth | ||
from foundry.v2.connectivity.file_import import FileImportClient | ||
|
||
|
||
class ConnectivityClient: | ||
def __init__(self, auth: Auth, hostname: str): | ||
self.FileImport = FileImportClient(auth=auth, hostname=hostname) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from __future__ import annotations | ||
|
||
from typing import Any | ||
from typing import Dict | ||
from typing import Optional | ||
|
||
from pydantic import Field | ||
from pydantic import StrictInt | ||
from pydantic import validate_call | ||
from typing_extensions import Annotated | ||
|
||
from foundry._core import ApiClient | ||
from foundry._core import Auth | ||
from foundry._core import RequestInfo | ||
from foundry._errors import handle_unexpected | ||
from foundry.v2.connectivity.models._file_import_rid import FileImportRid | ||
from foundry.v2.core.models._preview_mode import PreviewMode | ||
from foundry.v2.orchestration.models._build_rid import BuildRid | ||
|
||
|
||
class FileImportClient: | ||
def __init__(self, auth: Auth, hostname: str) -> None: | ||
self._api_client = ApiClient(auth=auth, hostname=hostname) | ||
|
||
@validate_call | ||
@handle_unexpected | ||
def trigger( | ||
self, | ||
file_import_rid: FileImportRid, | ||
*, | ||
preview: Optional[PreviewMode] = None, | ||
request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, | ||
) -> BuildRid: | ||
""" | ||
Triggers the FileImport, which runs asynchronously as a [Foundry Build](/docs/foundry/data-integration/builds/). | ||
The returned BuildRid can be used to check the status via the Orchestration API. | ||
:param file_import_rid: fileImportRid | ||
:type file_import_rid: FileImportRid | ||
:param preview: preview | ||
:type preview: Optional[PreviewMode] | ||
:param request_timeout: timeout setting for this request in seconds. | ||
:type request_timeout: Optional[int] | ||
:return: Returns the result object. | ||
:rtype: BuildRid | ||
""" | ||
|
||
return self._api_client.call_api( | ||
RequestInfo( | ||
method="POST", | ||
resource_path="/v2/connectivity/fileImports/{fileImportRid}/trigger", | ||
query_params={ | ||
"preview": preview, | ||
}, | ||
path_params={ | ||
"fileImportRid": file_import_rid, | ||
}, | ||
header_params={ | ||
"Accept": "application/json", | ||
}, | ||
body=None, | ||
body_type=None, | ||
response_type=BuildRid, | ||
request_timeout=request_timeout, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from foundry.v2.connectivity.models._file_import_rid import FileImportRid | ||
|
||
__all__ = [ | ||
"FileImportRid", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2024 Palantir Technologies, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
from __future__ import annotations | ||
|
||
from foundry._core.utils import RID | ||
|
||
FileImportRid = RID | ||
"""The Resource Identifier (RID) of a FileImport.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters