Skip to content

Commit

Permalink
Excavator: Upgrade API Version (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored Sep 30, 2024
1 parent b632e08 commit bff93af
Show file tree
Hide file tree
Showing 10 changed files with 255 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ Namespace | Resource | Operation | HTTP request |
- [UserDict](docs/v2/models/UserDict.md)
- [UserSearchFilterDict](docs/v2/models/UserSearchFilterDict.md)
- [UserUsername](docs/v2/models/UserUsername.md)
- [FileImportRid](docs/v2/models/FileImportRid.md)
- [AttachmentType](docs/v2/models/AttachmentType.md)
- [AttachmentTypeDict](docs/v2/models/AttachmentTypeDict.md)
- [BooleanType](docs/v2/models/BooleanType.md)
Expand Down
61 changes: 61 additions & 0 deletions docs/v2/Connectivity/FileImport.md
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)

12 changes: 12 additions & 0 deletions docs/v2/connectivity/models/FileImportRid.md
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)
31 changes: 31 additions & 0 deletions foundry/v2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,37 @@ def admin_group_group_member_remove(
click.echo(repr(result))


@cli.group("connectivity")
def connectivity():
pass


@connectivity.group("file_import")
def connectivity_file_import():
pass


@connectivity_file_import.command("trigger")
@click.argument("file_import_rid", type=str, required=True)
@click.option("--preview", type=bool, required=False, help="""preview""")
@click.pass_obj
def connectivity_file_import_trigger(
client: foundry.v2.FoundryClient,
file_import_rid: str,
preview: Optional[bool],
):
"""
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.
"""
result = client.connectivity.FileImport.trigger(
file_import_rid=file_import_rid,
preview=preview,
)
click.echo(repr(result))


@cli.group("core")
def core():
pass
Expand Down
2 changes: 2 additions & 0 deletions foundry/v2/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class FoundryClient:

def __init__(self, auth: Auth, hostname: str):
from foundry.v2.admin.client import AdminClient
from foundry.v2.connectivity.client import ConnectivityClient
from foundry.v2.datasets.client import DatasetsClient
from foundry.v2.filesystem.client import FilesystemClient
from foundry.v2.functions.client import FunctionsClient
Expand All @@ -35,6 +36,7 @@ def __init__(self, auth: Auth, hostname: str):
from foundry.v2.third_party_applications.client import ThirdPartyApplicationsClient # NOQA

self.admin = AdminClient(auth=auth, hostname=hostname)
self.connectivity = ConnectivityClient(auth=auth, hostname=hostname)
self.datasets = DatasetsClient(auth=auth, hostname=hostname)
self.filesystem = FilesystemClient(auth=auth, hostname=hostname)
self.functions = FunctionsClient(auth=auth, hostname=hostname)
Expand Down
24 changes: 24 additions & 0 deletions foundry/v2/connectivity/client.py
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)
81 changes: 81 additions & 0 deletions foundry/v2/connectivity/file_import.py
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,
),
)
20 changes: 20 additions & 0 deletions foundry/v2/connectivity/models/__init__.py
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",
]
21 changes: 21 additions & 0 deletions foundry/v2/connectivity/models/_file_import_rid.py
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."""
2 changes: 2 additions & 0 deletions tests/test_discriminators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from foundry.v1.geo import models as models_geo_v1
from foundry.v1.ontologies import models as models_ontologies_v1
from foundry.v2.admin import models as models_admin_v2
from foundry.v2.connectivity import models as models_connectivity_v2
from foundry.v2.core import models as models_core_v2
from foundry.v2.datasets import models as models_datasets_v2
from foundry.v2.filesystem import models as models_filesystem_v2
Expand All @@ -46,6 +47,7 @@ def test_can_validate_types():
*[(models_geo_v1, model_name) for model_name in dir(models_geo_v1)],
*[(models_ontologies_v1, model_name) for model_name in dir(models_ontologies_v1)],
*[(models_admin_v2, model_name) for model_name in dir(models_admin_v2)],
*[(models_connectivity_v2, model_name) for model_name in dir(models_connectivity_v2)],
*[(models_core_v2, model_name) for model_name in dir(models_core_v2)],
*[(models_datasets_v2, model_name) for model_name in dir(models_datasets_v2)],
*[(models_filesystem_v2, model_name) for model_name in dir(models_filesystem_v2)],
Expand Down

0 comments on commit bff93af

Please sign in to comment.