From 431176fbfe56cc28bfd110ed474395e7e11cc1d6 Mon Sep 17 00:00:00 2001 From: Excavator Bot <33266368+svc-excavator-bot@users.noreply.github.com> Date: Wed, 2 Oct 2024 05:18:16 -0700 Subject: [PATCH] Excavator: Upgrade API Version (#38) --- README.md | 15 +- docs/v2/Connectivity/FileImport.md | 54 ++++ docs/v2/Filesystem/Folder.md | 252 ++++++++++++++++++ docs/v2/connectivity/models/ConnectionRid.md | 12 + docs/v2/connectivity/models/FileImport.md | 15 ++ docs/v2/connectivity/models/FileImportDict.md | 15 ++ .../models/FileImportDisplayName.md | 11 + docs/v2/connectivity/models/FileImportRid.md | 2 +- docs/v2/filesystem/models/Folder.md | 24 ++ docs/v2/filesystem/models/FolderDict.md | 24 ++ docs/v2/filesystem/models/FolderType.md | 15 ++ .../models/ListChildrenOfFolderResponse.md | 12 + .../ListChildrenOfFolderResponseDict.md | 12 + docs/v2/filesystem/models/Resource.md | 2 +- docs/v2/filesystem/models/ResourceDict.md | 2 +- .../{TrashedStatus.md => TrashStatus.md} | 4 +- foundry/_versions.py | 2 +- foundry/v2/cli.py | 127 +++++++++ foundry/v2/connectivity/file_import.py | 42 +++ foundry/v2/connectivity/models/__init__.py | 8 + .../v2/connectivity/models/_connection_rid.py | 21 ++ .../v2/connectivity/models/_file_import.py | 52 ++++ .../connectivity/models/_file_import_dict.py | 44 +++ .../models/_file_import_display_name.py | 21 ++ .../connectivity/models/_file_import_rid.py | 2 +- foundry/v2/filesystem/client.py | 2 + foundry/v2/filesystem/folder.py | 242 +++++++++++++++++ foundry/v2/filesystem/models/__init__.py | 18 +- foundry/v2/filesystem/models/_folder.py | 92 +++++++ foundry/v2/filesystem/models/_folder_dict.py | 84 ++++++ foundry/v2/filesystem/models/_folder_type.py | 25 ++ .../_list_children_of_folder_response.py | 45 ++++ .../_list_children_of_folder_response_dict.py | 34 +++ foundry/v2/filesystem/models/_resource.py | 8 +- .../v2/filesystem/models/_resource_dict.py | 8 +- .../{_trashed_status.py => _trash_status.py} | 4 +- 36 files changed, 1332 insertions(+), 20 deletions(-) create mode 100644 docs/v2/Filesystem/Folder.md create mode 100644 docs/v2/connectivity/models/ConnectionRid.md create mode 100644 docs/v2/connectivity/models/FileImport.md create mode 100644 docs/v2/connectivity/models/FileImportDict.md create mode 100644 docs/v2/connectivity/models/FileImportDisplayName.md create mode 100644 docs/v2/filesystem/models/Folder.md create mode 100644 docs/v2/filesystem/models/FolderDict.md create mode 100644 docs/v2/filesystem/models/FolderType.md create mode 100644 docs/v2/filesystem/models/ListChildrenOfFolderResponse.md create mode 100644 docs/v2/filesystem/models/ListChildrenOfFolderResponseDict.md rename docs/v2/filesystem/models/{TrashedStatus.md => TrashStatus.md} (89%) create mode 100644 foundry/v2/connectivity/models/_connection_rid.py create mode 100644 foundry/v2/connectivity/models/_file_import.py create mode 100644 foundry/v2/connectivity/models/_file_import_dict.py create mode 100644 foundry/v2/connectivity/models/_file_import_display_name.py create mode 100644 foundry/v2/filesystem/folder.py create mode 100644 foundry/v2/filesystem/models/_folder.py create mode 100644 foundry/v2/filesystem/models/_folder_dict.py create mode 100644 foundry/v2/filesystem/models/_folder_type.py create mode 100644 foundry/v2/filesystem/models/_list_children_of_folder_response.py create mode 100644 foundry/v2/filesystem/models/_list_children_of_folder_response_dict.py rename foundry/v2/filesystem/models/{_trashed_status.py => _trash_status.py} (87%) diff --git a/README.md b/README.md index afb0de6b..984b6e7a 100644 --- a/README.md +++ b/README.md @@ -349,6 +349,10 @@ Namespace | Resource | Operation | HTTP request | **Datasets** | Transaction | [**commit**](docs/v2/Datasets/Transaction.md#commit) | **POST** /v2/datasets/{datasetRid}/transactions/{transactionRid}/commit | **Datasets** | Transaction | [**create**](docs/v2/Datasets/Transaction.md#create) | **POST** /v2/datasets/{datasetRid}/transactions | **Datasets** | Transaction | [**get**](docs/v2/Datasets/Transaction.md#get) | **GET** /v2/datasets/{datasetRid}/transactions/{transactionRid} | +**Filesystem** | Folder | [**children**](docs/v2/Filesystem/Folder.md#children) | **GET** /v2/filesystem/folders/{folderRid}/children | +**Filesystem** | Folder | [**children_page**](docs/v2/Filesystem/Folder.md#children_page) | **GET** /v2/filesystem/folders/{folderRid}/children | +**Filesystem** | Folder | [**create**](docs/v2/Filesystem/Folder.md#create) | **POST** /v2/filesystem/folders | +**Filesystem** | Folder | [**get**](docs/v2/Filesystem/Folder.md#get) | **GET** /v2/filesystem/folders/{folderRid} | **OntologiesV2** | Action | [**apply**](docs/v2/OntologiesV2/Action.md#apply) | **POST** /v2/ontologies/{ontology}/actions/{action}/apply | **OntologiesV2** | Action | [**apply_batch**](docs/v2/OntologiesV2/Action.md#apply_batch) | **POST** /v2/ontologies/{ontology}/actions/{action}/applyBatch | **OntologiesV2** | ActionTypeV2 | [**get**](docs/v2/OntologiesV2/ActionTypeV2.md#get) | **GET** /v2/ontologies/{ontology}/actionTypes/{actionType} | @@ -509,6 +513,10 @@ Namespace | Resource | Operation | HTTP request | - [UserDict](docs/v2/models/UserDict.md) - [UserSearchFilterDict](docs/v2/models/UserSearchFilterDict.md) - [UserUsername](docs/v2/models/UserUsername.md) +- [ConnectionRid](docs/v2/models/ConnectionRid.md) +- [FileImport](docs/v2/models/FileImport.md) +- [FileImportDict](docs/v2/models/FileImportDict.md) +- [FileImportDisplayName](docs/v2/models/FileImportDisplayName.md) - [FileImportRid](docs/v2/models/FileImportRid.md) - [AttachmentType](docs/v2/models/AttachmentType.md) - [AttachmentTypeDict](docs/v2/models/AttachmentTypeDict.md) @@ -602,7 +610,12 @@ Namespace | Resource | Operation | HTTP request | - [TransactionRid](docs/v2/models/TransactionRid.md) - [TransactionStatus](docs/v2/models/TransactionStatus.md) - [TransactionType](docs/v2/models/TransactionType.md) +- [Folder](docs/v2/models/Folder.md) +- [FolderDict](docs/v2/models/FolderDict.md) - [FolderRid](docs/v2/models/FolderRid.md) +- [FolderType](docs/v2/models/FolderType.md) +- [ListChildrenOfFolderResponse](docs/v2/models/ListChildrenOfFolderResponse.md) +- [ListChildrenOfFolderResponseDict](docs/v2/models/ListChildrenOfFolderResponseDict.md) - [ProjectRid](docs/v2/models/ProjectRid.md) - [Resource](docs/v2/models/Resource.md) - [ResourceDict](docs/v2/models/ResourceDict.md) @@ -611,7 +624,7 @@ Namespace | Resource | Operation | HTTP request | - [ResourceRid](docs/v2/models/ResourceRid.md) - [ResourceType](docs/v2/models/ResourceType.md) - [SpaceRid](docs/v2/models/SpaceRid.md) -- [TrashedStatus](docs/v2/models/TrashedStatus.md) +- [TrashStatus](docs/v2/models/TrashStatus.md) - [DataValue](docs/v2/models/DataValue.md) - [ExecuteQueryResponse](docs/v2/models/ExecuteQueryResponse.md) - [ExecuteQueryResponseDict](docs/v2/models/ExecuteQueryResponseDict.md) diff --git a/docs/v2/Connectivity/FileImport.md b/docs/v2/Connectivity/FileImport.md index 33f3f97c..08efceef 100644 --- a/docs/v2/Connectivity/FileImport.md +++ b/docs/v2/Connectivity/FileImport.md @@ -3,6 +3,60 @@ Method | HTTP request | ------------- | ------------- | +Get the FileImport with the specified rid. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**file_import_rid** | FileImportRid | fileImportRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**FileImport** + +### 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.get( + file_import_rid, + preview=preview, + ) + print("The get response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling FileImport.get: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | FileImport | | 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) + 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. diff --git a/docs/v2/Filesystem/Folder.md b/docs/v2/Filesystem/Folder.md new file mode 100644 index 00000000..e6c6ea0f --- /dev/null +++ b/docs/v2/Filesystem/Folder.md @@ -0,0 +1,252 @@ +# Folder + +Method | HTTP request | +------------- | ------------- | +[**children**](#children) | **GET** /v2/filesystem/folders/{folderRid}/children | +[**children_page**](#children_page) | **GET** /v2/filesystem/folders/{folderRid}/children | +[**create**](#create) | **POST** /v2/filesystem/folders | +[**get**](#get) | **GET** /v2/filesystem/folders/{folderRid} | + +# **children** +List all child Resources of the Folder. + +This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is +provided, this page size will also be used as the default. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**folder_rid** | FolderRid | folderRid | | +**page_size** | Optional[PageSize] | pageSize | [optional] | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**ResourceIterator[Resource]** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# FolderRid | folderRid +folder_rid = "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8" +# Optional[PageSize] | pageSize +page_size = None +# Optional[PreviewMode] | preview +preview = None + + +try: + for folder in foundry_client.filesystem.Folder.children( + folder_rid, + page_size=page_size, + preview=preview, + ): + pprint(folder) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Folder.children: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | ListChildrenOfFolderResponse | | 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) + +# **children_page** +List all child Resources of the Folder. + +This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is +provided, this page size will also be used as the default. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**folder_rid** | FolderRid | folderRid | | +**page_size** | Optional[PageSize] | pageSize | [optional] | +**page_token** | Optional[PageToken] | pageToken | [optional] | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**ListChildrenOfFolderResponse** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# FolderRid | folderRid +folder_rid = "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8" +# Optional[PageSize] | pageSize +page_size = None +# Optional[PageToken] | pageToken +page_token = None +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Folder.children_page( + folder_rid, + page_size=page_size, + page_token=page_token, + preview=preview, + ) + print("The children_page response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Folder.children_page: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | ListChildrenOfFolderResponse | | 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) + +# **create** +Creates a new Folder. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**display_name** | ResourceDisplayName | | | +**parent_folder_rid** | FolderRid | The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, this value will be the root folder (`ri.compass.main.folder.0`). | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**Folder** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ResourceDisplayName | +display_name = "My Folder" +# FolderRid | The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, this value will be the root folder (`ri.compass.main.folder.0`). +parent_folder_rid = "ri.compass.main.folder.4cae7c13-b59f-48f6-9ef2-dbde603e4e33" +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Folder.create( + display_name=display_name, + parent_folder_rid=parent_folder_rid, + preview=preview, + ) + print("The create response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Folder.create: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | Folder | The created Folder | 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) + +# **get** +Get the Folder with the specified rid. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**folder_rid** | FolderRid | folderRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**Folder** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# FolderRid | folderRid +folder_rid = "ri.compass.main.folder.01a79a9d-e293-48db-a585-9ffe221536e8" +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Folder.get( + folder_rid, + preview=preview, + ) + print("The get response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Folder.get: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | Folder | | 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) + diff --git a/docs/v2/connectivity/models/ConnectionRid.md b/docs/v2/connectivity/models/ConnectionRid.md new file mode 100644 index 00000000..51e43bf3 --- /dev/null +++ b/docs/v2/connectivity/models/ConnectionRid.md @@ -0,0 +1,12 @@ +# ConnectionRid + +The Resource Identifier (RID) of a Connection (formerly known as a source). + + +## 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) diff --git a/docs/v2/connectivity/models/FileImport.md b/docs/v2/connectivity/models/FileImport.md new file mode 100644 index 00000000..51d36bc1 --- /dev/null +++ b/docs/v2/connectivity/models/FileImport.md @@ -0,0 +1,15 @@ +# FileImport + +FileImport + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**rid** | FileImportRid | Yes | | +**connection_rid** | ConnectionRid | Yes | The RID of the Connection (formerly known as a source) that the File Import uses to import data. | +**dataset_rid** | DatasetRid | Yes | The RID of the output dataset. | +**branch_name** | Optional[BranchName] | No | The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. | +**display_name** | FileImportDisplayName | Yes | | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/connectivity/models/FileImportDict.md b/docs/v2/connectivity/models/FileImportDict.md new file mode 100644 index 00000000..5c4b9ba9 --- /dev/null +++ b/docs/v2/connectivity/models/FileImportDict.md @@ -0,0 +1,15 @@ +# FileImportDict + +FileImport + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**rid** | FileImportRid | Yes | | +**connectionRid** | ConnectionRid | Yes | The RID of the Connection (formerly known as a source) that the File Import uses to import data. | +**datasetRid** | DatasetRid | Yes | The RID of the output dataset. | +**branchName** | NotRequired[BranchName] | No | The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. | +**displayName** | FileImportDisplayName | Yes | | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/connectivity/models/FileImportDisplayName.md b/docs/v2/connectivity/models/FileImportDisplayName.md new file mode 100644 index 00000000..5d0f93b8 --- /dev/null +++ b/docs/v2/connectivity/models/FileImportDisplayName.md @@ -0,0 +1,11 @@ +# FileImportDisplayName + +FileImportDisplayName + +## Type +```python +StrictStr +``` + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/connectivity/models/FileImportRid.md b/docs/v2/connectivity/models/FileImportRid.md index 1c6f6266..22d5756e 100644 --- a/docs/v2/connectivity/models/FileImportRid.md +++ b/docs/v2/connectivity/models/FileImportRid.md @@ -1,6 +1,6 @@ # FileImportRid -The Resource Identifier (RID) of a FileImport. +The Resource Identifier (RID) of a FileImport (formerly known as a batch sync). ## Type diff --git a/docs/v2/filesystem/models/Folder.md b/docs/v2/filesystem/models/Folder.md new file mode 100644 index 00000000..6c8bea5b --- /dev/null +++ b/docs/v2/filesystem/models/Folder.md @@ -0,0 +1,24 @@ +# Folder + +Folder + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**rid** | FolderRid | Yes | | +**display_name** | ResourceDisplayName | Yes | | +**description** | Optional[StrictStr] | No | The description associated with the Folder. | +**documentation** | Optional[StrictStr] | No | The documentation associated with the Folder. | +**path** | ResourcePath | Yes | | +**type** | FolderType | Yes | | +**created_by** | CreatedBy | Yes | | +**updated_by** | UpdatedBy | Yes | | +**created_time** | CreatedTime | Yes | | +**updated_time** | UpdatedTime | Yes | | +**trash_status** | TrashStatus | Yes | The trash status of the Folder. If trashed, this could either be because the Folder itself has been trashed or because one of its ancestors has been trashed. | +**parent_folder_rid** | FolderRid | Yes | The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, this value will be the root folder (`ri.compass.main.folder.0`). | +**project_rid** | Optional[ProjectRid] | No | The Project Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will not be defined. | +**space_rid** | SpaceRid | Yes | The Space Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will be the same as the Folder RID. | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/filesystem/models/FolderDict.md b/docs/v2/filesystem/models/FolderDict.md new file mode 100644 index 00000000..cd17f466 --- /dev/null +++ b/docs/v2/filesystem/models/FolderDict.md @@ -0,0 +1,24 @@ +# FolderDict + +Folder + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**rid** | FolderRid | Yes | | +**displayName** | ResourceDisplayName | Yes | | +**description** | NotRequired[StrictStr] | No | The description associated with the Folder. | +**documentation** | NotRequired[StrictStr] | No | The documentation associated with the Folder. | +**path** | ResourcePath | Yes | | +**type** | FolderType | Yes | | +**createdBy** | CreatedBy | Yes | | +**updatedBy** | UpdatedBy | Yes | | +**createdTime** | CreatedTime | Yes | | +**updatedTime** | UpdatedTime | Yes | | +**trashStatus** | TrashStatus | Yes | The trash status of the Folder. If trashed, this could either be because the Folder itself has been trashed or because one of its ancestors has been trashed. | +**parentFolderRid** | FolderRid | Yes | The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, this value will be the root folder (`ri.compass.main.folder.0`). | +**projectRid** | NotRequired[ProjectRid] | No | The Project Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will not be defined. | +**spaceRid** | SpaceRid | Yes | The Space Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will be the same as the Folder RID. | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/filesystem/models/FolderType.md b/docs/v2/filesystem/models/FolderType.md new file mode 100644 index 00000000..ba3bdd0f --- /dev/null +++ b/docs/v2/filesystem/models/FolderType.md @@ -0,0 +1,15 @@ +# FolderType + +A folder can either a regular Folder, a +[Project](https://www.palantir.com/docs/foundry/getting-started/projects-and-resources/#projects) or a +[Space](/docs/foundry/security/orgs-and-spaces/#spaces). + + +| **Value** | +| --------- | +| `"FOLDER"` | +| `"SPACE"` | +| `"PROJECT"` | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/filesystem/models/ListChildrenOfFolderResponse.md b/docs/v2/filesystem/models/ListChildrenOfFolderResponse.md new file mode 100644 index 00000000..ac37ac6d --- /dev/null +++ b/docs/v2/filesystem/models/ListChildrenOfFolderResponse.md @@ -0,0 +1,12 @@ +# ListChildrenOfFolderResponse + +ListChildrenOfFolderResponse + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**data** | List[Resource] | Yes | | +**next_page_token** | Optional[PageToken] | No | | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/filesystem/models/ListChildrenOfFolderResponseDict.md b/docs/v2/filesystem/models/ListChildrenOfFolderResponseDict.md new file mode 100644 index 00000000..d6a1bf94 --- /dev/null +++ b/docs/v2/filesystem/models/ListChildrenOfFolderResponseDict.md @@ -0,0 +1,12 @@ +# ListChildrenOfFolderResponseDict + +ListChildrenOfFolderResponse + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**data** | List[ResourceDict] | Yes | | +**nextPageToken** | NotRequired[PageToken] | No | | + + +[[Back to Model list]](../../../../README.md#models-v2-link) [[Back to API list]](../../../../README.md#apis-v2-link) [[Back to README]](../../../../README.md) diff --git a/docs/v2/filesystem/models/Resource.md b/docs/v2/filesystem/models/Resource.md index 1b5f9e87..3b535429 100644 --- a/docs/v2/filesystem/models/Resource.md +++ b/docs/v2/filesystem/models/Resource.md @@ -15,7 +15,7 @@ Resource **updated_by** | UpdatedBy | Yes | The user that last updated the Resource. | **created_time** | CreatedTime | Yes | The timestamp that the Resource was last created. | **updated_time** | UpdatedTime | Yes | The timestamp that the Resource was last modified. For folders, this includes any of its descendants. For top level folders (spaces and projects), this is not updated by child updates for performance reasons. | -**trashed** | TrashedStatus | Yes | The trash status of the resource. If trashed, a resource can either be directly trashed or one of its ancestors can be trashed. | +**trash_status** | TrashStatus | Yes | The trash status of the Resource. If trashed, this could either be because the Resource itself has been trashed or because one of its ancestors has been trashed. | **parent_folder_rid** | FolderRid | Yes | The parent folder Resource Identifier (RID). For projects, this will be the Space RID. | **project_rid** | ProjectRid | Yes | The Project Resource Identifier (RID) that the Resource lives in. If the Resource itself is a Project, this value will still be populated with the Project RID. | **space_rid** | SpaceRid | Yes | The Space Resource Identifier (RID) that the Resource lives in. | diff --git a/docs/v2/filesystem/models/ResourceDict.md b/docs/v2/filesystem/models/ResourceDict.md index 40fd8cde..830af352 100644 --- a/docs/v2/filesystem/models/ResourceDict.md +++ b/docs/v2/filesystem/models/ResourceDict.md @@ -15,7 +15,7 @@ Resource **updatedBy** | UpdatedBy | Yes | The user that last updated the Resource. | **createdTime** | CreatedTime | Yes | The timestamp that the Resource was last created. | **updatedTime** | UpdatedTime | Yes | The timestamp that the Resource was last modified. For folders, this includes any of its descendants. For top level folders (spaces and projects), this is not updated by child updates for performance reasons. | -**trashed** | TrashedStatus | Yes | The trash status of the resource. If trashed, a resource can either be directly trashed or one of its ancestors can be trashed. | +**trashStatus** | TrashStatus | Yes | The trash status of the Resource. If trashed, this could either be because the Resource itself has been trashed or because one of its ancestors has been trashed. | **parentFolderRid** | FolderRid | Yes | The parent folder Resource Identifier (RID). For projects, this will be the Space RID. | **projectRid** | ProjectRid | Yes | The Project Resource Identifier (RID) that the Resource lives in. If the Resource itself is a Project, this value will still be populated with the Project RID. | **spaceRid** | SpaceRid | Yes | The Space Resource Identifier (RID) that the Resource lives in. | diff --git a/docs/v2/filesystem/models/TrashedStatus.md b/docs/v2/filesystem/models/TrashStatus.md similarity index 89% rename from docs/v2/filesystem/models/TrashedStatus.md rename to docs/v2/filesystem/models/TrashStatus.md index ce865066..2a81d0fa 100644 --- a/docs/v2/filesystem/models/TrashedStatus.md +++ b/docs/v2/filesystem/models/TrashStatus.md @@ -1,6 +1,6 @@ -# TrashedStatus +# TrashStatus -TrashedStatus +TrashStatus | **Value** | | --------- | diff --git a/foundry/_versions.py b/foundry/_versions.py index 1be530da..34b816b2 100644 --- a/foundry/_versions.py +++ b/foundry/_versions.py @@ -17,4 +17,4 @@ # using the autorelease bot __version__ = "0.0.0" -__openapi_document_version__ = "1.940.0" +__openapi_document_version__ = "1.942.0" diff --git a/foundry/v2/cli.py b/foundry/v2/cli.py index d9e9ae7a..2ea2375c 100644 --- a/foundry/v2/cli.py +++ b/foundry/v2/cli.py @@ -740,6 +740,25 @@ def connectivity_file_import(): pass +@connectivity_file_import.command("get") +@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_get( + client: foundry.v2.FoundryClient, + file_import_rid: str, + preview: Optional[bool], +): + """ + Get the FileImport with the specified rid. + """ + result = client.connectivity.FileImport.get( + file_import_rid=file_import_rid, + preview=preview, + ) + click.echo(repr(result)) + + @connectivity_file_import.command("trigger") @click.argument("file_import_rid", type=str, required=True) @click.option("--preview", type=bool, required=False, help="""preview""") @@ -1474,6 +1493,114 @@ def filesystem_resource_restore( click.echo(repr(result)) +@filesystem.group("folder") +def filesystem_folder(): + pass + + +@filesystem_folder.command("children") +@click.argument("folder_rid", type=str, required=True) +@click.option("--page_size", type=int, required=False, help="""pageSize""") +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_folder_children( + client: foundry.v2.FoundryClient, + folder_rid: str, + page_size: Optional[int], + preview: Optional[bool], +): + """ + List all child Resources of the Folder. + + This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is + provided, this page size will also be used as the default. + + """ + result = client.filesystem.Folder.children( + folder_rid=folder_rid, + page_size=page_size, + preview=preview, + ) + click.echo(repr(result)) + + +@filesystem_folder.command("children_page") +@click.argument("folder_rid", type=str, required=True) +@click.option("--page_size", type=int, required=False, help="""pageSize""") +@click.option("--page_token", type=str, required=False, help="""pageToken""") +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_folder_children_page( + client: foundry.v2.FoundryClient, + folder_rid: str, + page_size: Optional[int], + page_token: Optional[str], + preview: Optional[bool], +): + """ + List all child Resources of the Folder. + + This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is + provided, this page size will also be used as the default. + + """ + result = client.filesystem.Folder.children_page( + folder_rid=folder_rid, + page_size=page_size, + page_token=page_token, + preview=preview, + ) + click.echo(repr(result)) + + +@filesystem_folder.command("create") +@click.option("--display_name", type=str, required=True, help="""""") +@click.option( + "--parent_folder_rid", + type=str, + required=True, + help="""The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, +this value will be the root folder (`ri.compass.main.folder.0`). +""", +) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_folder_create( + client: foundry.v2.FoundryClient, + display_name: str, + parent_folder_rid: str, + preview: Optional[bool], +): + """ + Creates a new Folder. + """ + result = client.filesystem.Folder.create( + display_name=display_name, + parent_folder_rid=parent_folder_rid, + preview=preview, + ) + click.echo(repr(result)) + + +@filesystem_folder.command("get") +@click.argument("folder_rid", type=str, required=True) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_folder_get( + client: foundry.v2.FoundryClient, + folder_rid: str, + preview: Optional[bool], +): + """ + Get the Folder with the specified rid. + """ + result = client.filesystem.Folder.get( + folder_rid=folder_rid, + preview=preview, + ) + click.echo(repr(result)) + + @cli.group("functions") def functions(): pass diff --git a/foundry/v2/connectivity/file_import.py b/foundry/v2/connectivity/file_import.py index ff00a91d..6c9380fa 100644 --- a/foundry/v2/connectivity/file_import.py +++ b/foundry/v2/connectivity/file_import.py @@ -28,6 +28,7 @@ from foundry._core import Auth from foundry._core import RequestInfo from foundry._errors import handle_unexpected +from foundry.v2.connectivity.models._file_import import FileImport 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 @@ -37,6 +38,47 @@ class FileImportClient: def __init__(self, auth: Auth, hostname: str) -> None: self._api_client = ApiClient(auth=auth, hostname=hostname) + @validate_call + @handle_unexpected + def get( + self, + file_import_rid: FileImportRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> FileImport: + """ + Get the FileImport with the specified rid. + :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: FileImport + """ + + return self._api_client.call_api( + RequestInfo( + method="GET", + resource_path="/v2/connectivity/fileImports/{fileImportRid}", + query_params={ + "preview": preview, + }, + path_params={ + "fileImportRid": file_import_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=FileImport, + request_timeout=request_timeout, + ), + ) + @validate_call @handle_unexpected def trigger( diff --git a/foundry/v2/connectivity/models/__init__.py b/foundry/v2/connectivity/models/__init__.py index fbae085d..8c4909ef 100644 --- a/foundry/v2/connectivity/models/__init__.py +++ b/foundry/v2/connectivity/models/__init__.py @@ -13,8 +13,16 @@ # limitations under the License. +from foundry.v2.connectivity.models._connection_rid import ConnectionRid +from foundry.v2.connectivity.models._file_import import FileImport +from foundry.v2.connectivity.models._file_import_dict import FileImportDict +from foundry.v2.connectivity.models._file_import_display_name import FileImportDisplayName # NOQA from foundry.v2.connectivity.models._file_import_rid import FileImportRid __all__ = [ + "ConnectionRid", + "FileImport", + "FileImportDict", + "FileImportDisplayName", "FileImportRid", ] diff --git a/foundry/v2/connectivity/models/_connection_rid.py b/foundry/v2/connectivity/models/_connection_rid.py new file mode 100644 index 00000000..b3aed8d6 --- /dev/null +++ b/foundry/v2/connectivity/models/_connection_rid.py @@ -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 + +ConnectionRid = RID +"""The Resource Identifier (RID) of a Connection (formerly known as a source).""" diff --git a/foundry/v2/connectivity/models/_file_import.py b/foundry/v2/connectivity/models/_file_import.py new file mode 100644 index 00000000..e336d3ae --- /dev/null +++ b/foundry/v2/connectivity/models/_file_import.py @@ -0,0 +1,52 @@ +# 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 Optional +from typing import cast + +from pydantic import BaseModel +from pydantic import Field + +from foundry.v2.connectivity.models._connection_rid import ConnectionRid +from foundry.v2.connectivity.models._file_import_dict import FileImportDict +from foundry.v2.connectivity.models._file_import_display_name import FileImportDisplayName # NOQA +from foundry.v2.connectivity.models._file_import_rid import FileImportRid +from foundry.v2.datasets.models._branch_name import BranchName +from foundry.v2.datasets.models._dataset_rid import DatasetRid + + +class FileImport(BaseModel): + """FileImport""" + + rid: FileImportRid + + connection_rid: ConnectionRid = Field(alias="connectionRid") + """The RID of the Connection (formerly known as a source) that the File Import uses to import data.""" + + dataset_rid: DatasetRid = Field(alias="datasetRid") + """The RID of the output dataset.""" + + branch_name: Optional[BranchName] = Field(alias="branchName", default=None) + """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""" + + display_name: FileImportDisplayName = Field(alias="displayName") + + model_config = {"extra": "allow"} + + def to_dict(self) -> FileImportDict: + """Return the dictionary representation of the model using the field aliases.""" + return cast(FileImportDict, self.model_dump(by_alias=True, exclude_unset=True)) diff --git a/foundry/v2/connectivity/models/_file_import_dict.py b/foundry/v2/connectivity/models/_file_import_dict.py new file mode 100644 index 00000000..b3904975 --- /dev/null +++ b/foundry/v2/connectivity/models/_file_import_dict.py @@ -0,0 +1,44 @@ +# 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_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.connectivity.models._connection_rid import ConnectionRid +from foundry.v2.connectivity.models._file_import_display_name import FileImportDisplayName # NOQA +from foundry.v2.connectivity.models._file_import_rid import FileImportRid +from foundry.v2.datasets.models._branch_name import BranchName +from foundry.v2.datasets.models._dataset_rid import DatasetRid + + +class FileImportDict(TypedDict): + """FileImport""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + rid: FileImportRid + + connectionRid: ConnectionRid + """The RID of the Connection (formerly known as a source) that the File Import uses to import data.""" + + datasetRid: DatasetRid + """The RID of the output dataset.""" + + branchName: NotRequired[BranchName] + """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""" + + displayName: FileImportDisplayName diff --git a/foundry/v2/connectivity/models/_file_import_display_name.py b/foundry/v2/connectivity/models/_file_import_display_name.py new file mode 100644 index 00000000..5e3b049b --- /dev/null +++ b/foundry/v2/connectivity/models/_file_import_display_name.py @@ -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 pydantic import StrictStr + +FileImportDisplayName = StrictStr +"""FileImportDisplayName""" diff --git a/foundry/v2/connectivity/models/_file_import_rid.py b/foundry/v2/connectivity/models/_file_import_rid.py index 215ac69c..758b2027 100644 --- a/foundry/v2/connectivity/models/_file_import_rid.py +++ b/foundry/v2/connectivity/models/_file_import_rid.py @@ -18,4 +18,4 @@ from foundry._core.utils import RID FileImportRid = RID -"""The Resource Identifier (RID) of a FileImport.""" +"""The Resource Identifier (RID) of a FileImport (formerly known as a batch sync).""" diff --git a/foundry/v2/filesystem/client.py b/foundry/v2/filesystem/client.py index 9a3c9aa5..5822f5fc 100644 --- a/foundry/v2/filesystem/client.py +++ b/foundry/v2/filesystem/client.py @@ -16,9 +16,11 @@ from __future__ import annotations from foundry._core import Auth +from foundry.v2.filesystem.folder import FolderClient from foundry.v2.filesystem.resource import ResourceClient class FilesystemClient: def __init__(self, auth: Auth, hostname: str): + self.Folder = FolderClient(auth=auth, hostname=hostname) self.Resource = ResourceClient(auth=auth, hostname=hostname) diff --git a/foundry/v2/filesystem/folder.py b/foundry/v2/filesystem/folder.py new file mode 100644 index 00000000..d24cb7db --- /dev/null +++ b/foundry/v2/filesystem/folder.py @@ -0,0 +1,242 @@ +# 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 typing_extensions import TypedDict + +from foundry._core import ApiClient +from foundry._core import Auth +from foundry._core import RequestInfo +from foundry._core import ResourceIterator +from foundry._errors import handle_unexpected +from foundry.v2.core.models._page_size import PageSize +from foundry.v2.core.models._page_token import PageToken +from foundry.v2.core.models._preview_mode import PreviewMode +from foundry.v2.filesystem.models._folder import Folder +from foundry.v2.filesystem.models._folder_rid import FolderRid +from foundry.v2.filesystem.models._list_children_of_folder_response import ( + ListChildrenOfFolderResponse, +) # NOQA +from foundry.v2.filesystem.models._resource import Resource +from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName + + +class FolderClient: + def __init__(self, auth: Auth, hostname: str) -> None: + self._api_client = ApiClient(auth=auth, hostname=hostname) + + @validate_call + @handle_unexpected + def children( + self, + folder_rid: FolderRid, + *, + page_size: Optional[PageSize] = None, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> ResourceIterator[Resource]: + """ + List all child Resources of the Folder. + + This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is + provided, this page size will also be used as the default. + + :param folder_rid: folderRid + :type folder_rid: FolderRid + :param page_size: pageSize + :type page_size: Optional[PageSize] + :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: ResourceIterator[Resource] + """ + + return self._api_client.iterate_api( + RequestInfo( + method="GET", + resource_path="/v2/filesystem/folders/{folderRid}/children", + query_params={ + "pageSize": page_size, + "preview": preview, + }, + path_params={ + "folderRid": folder_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=ListChildrenOfFolderResponse, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def children_page( + self, + folder_rid: FolderRid, + *, + page_size: Optional[PageSize] = None, + page_token: Optional[PageToken] = None, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> ListChildrenOfFolderResponse: + """ + List all child Resources of the Folder. + + This is a paged endpoint. The page size will be limited to 2,000 results per page. If no page size is + provided, this page size will also be used as the default. + + :param folder_rid: folderRid + :type folder_rid: FolderRid + :param page_size: pageSize + :type page_size: Optional[PageSize] + :param page_token: pageToken + :type page_token: Optional[PageToken] + :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: ListChildrenOfFolderResponse + """ + + return self._api_client.call_api( + RequestInfo( + method="GET", + resource_path="/v2/filesystem/folders/{folderRid}/children", + query_params={ + "pageSize": page_size, + "pageToken": page_token, + "preview": preview, + }, + path_params={ + "folderRid": folder_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=ListChildrenOfFolderResponse, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def create( + self, + *, + display_name: ResourceDisplayName, + parent_folder_rid: FolderRid, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> Folder: + """ + Creates a new Folder. + :param display_name: + :type display_name: ResourceDisplayName + :param parent_folder_rid: The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, this value will be the root folder (`ri.compass.main.folder.0`). + :type parent_folder_rid: FolderRid + :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: Folder + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/filesystem/folders", + query_params={ + "preview": preview, + }, + path_params={}, + header_params={ + "Content-Type": "application/json", + "Accept": "application/json", + }, + body={ + "parentFolderRid": parent_folder_rid, + "displayName": display_name, + }, + body_type=TypedDict( + "Body", + { # type: ignore + "parentFolderRid": FolderRid, + "displayName": ResourceDisplayName, + }, + ), + response_type=Folder, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def get( + self, + folder_rid: FolderRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> Folder: + """ + Get the Folder with the specified rid. + :param folder_rid: folderRid + :type folder_rid: FolderRid + :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: Folder + """ + + return self._api_client.call_api( + RequestInfo( + method="GET", + resource_path="/v2/filesystem/folders/{folderRid}", + query_params={ + "preview": preview, + }, + path_params={ + "folderRid": folder_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=Folder, + request_timeout=request_timeout, + ), + ) diff --git a/foundry/v2/filesystem/models/__init__.py b/foundry/v2/filesystem/models/__init__.py index 9c135316..b05bde4b 100644 --- a/foundry/v2/filesystem/models/__init__.py +++ b/foundry/v2/filesystem/models/__init__.py @@ -13,7 +13,16 @@ # limitations under the License. +from foundry.v2.filesystem.models._folder import Folder +from foundry.v2.filesystem.models._folder_dict import FolderDict from foundry.v2.filesystem.models._folder_rid import FolderRid +from foundry.v2.filesystem.models._folder_type import FolderType +from foundry.v2.filesystem.models._list_children_of_folder_response import ( + ListChildrenOfFolderResponse, +) # NOQA +from foundry.v2.filesystem.models._list_children_of_folder_response_dict import ( + ListChildrenOfFolderResponseDict, +) # NOQA from foundry.v2.filesystem.models._project_rid import ProjectRid from foundry.v2.filesystem.models._resource import Resource from foundry.v2.filesystem.models._resource_dict import ResourceDict @@ -22,10 +31,15 @@ from foundry.v2.filesystem.models._resource_rid import ResourceRid from foundry.v2.filesystem.models._resource_type import ResourceType from foundry.v2.filesystem.models._space_rid import SpaceRid -from foundry.v2.filesystem.models._trashed_status import TrashedStatus +from foundry.v2.filesystem.models._trash_status import TrashStatus __all__ = [ + "Folder", + "FolderDict", "FolderRid", + "FolderType", + "ListChildrenOfFolderResponse", + "ListChildrenOfFolderResponseDict", "ProjectRid", "Resource", "ResourceDict", @@ -34,5 +48,5 @@ "ResourceRid", "ResourceType", "SpaceRid", - "TrashedStatus", + "TrashStatus", ] diff --git a/foundry/v2/filesystem/models/_folder.py b/foundry/v2/filesystem/models/_folder.py new file mode 100644 index 00000000..899b121d --- /dev/null +++ b/foundry/v2/filesystem/models/_folder.py @@ -0,0 +1,92 @@ +# 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 Optional +from typing import cast + +from pydantic import BaseModel +from pydantic import Field +from pydantic import StrictStr + +from foundry.v2.core.models._created_by import CreatedBy +from foundry.v2.core.models._created_time import CreatedTime +from foundry.v2.core.models._updated_by import UpdatedBy +from foundry.v2.core.models._updated_time import UpdatedTime +from foundry.v2.filesystem.models._folder_dict import FolderDict +from foundry.v2.filesystem.models._folder_rid import FolderRid +from foundry.v2.filesystem.models._folder_type import FolderType +from foundry.v2.filesystem.models._project_rid import ProjectRid +from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName +from foundry.v2.filesystem.models._resource_path import ResourcePath +from foundry.v2.filesystem.models._space_rid import SpaceRid +from foundry.v2.filesystem.models._trash_status import TrashStatus + + +class Folder(BaseModel): + """Folder""" + + rid: FolderRid + + display_name: ResourceDisplayName = Field(alias="displayName") + + description: Optional[StrictStr] = None + """The description associated with the Folder.""" + + documentation: Optional[StrictStr] = None + """The documentation associated with the Folder.""" + + path: ResourcePath + + type: FolderType + + created_by: CreatedBy = Field(alias="createdBy") + + updated_by: UpdatedBy = Field(alias="updatedBy") + + created_time: CreatedTime = Field(alias="createdTime") + + updated_time: UpdatedTime = Field(alias="updatedTime") + + trash_status: TrashStatus = Field(alias="trashStatus") + """ + The trash status of the Folder. If trashed, this could either be because the Folder itself has been + trashed or because one of its ancestors has been trashed. + """ + + parent_folder_rid: FolderRid = Field(alias="parentFolderRid") + """ + The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, + this value will be the root folder (`ri.compass.main.folder.0`). + """ + + project_rid: Optional[ProjectRid] = Field(alias="projectRid", default=None) + """ + The Project Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will + not be defined. + """ + + space_rid: SpaceRid = Field(alias="spaceRid") + """ + The Space Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will + be the same as the Folder RID. + """ + + model_config = {"extra": "allow"} + + def to_dict(self) -> FolderDict: + """Return the dictionary representation of the model using the field aliases.""" + return cast(FolderDict, self.model_dump(by_alias=True, exclude_unset=True)) diff --git a/foundry/v2/filesystem/models/_folder_dict.py b/foundry/v2/filesystem/models/_folder_dict.py new file mode 100644 index 00000000..99dc54a7 --- /dev/null +++ b/foundry/v2/filesystem/models/_folder_dict.py @@ -0,0 +1,84 @@ +# 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 pydantic import StrictStr +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.core.models._created_by import CreatedBy +from foundry.v2.core.models._created_time import CreatedTime +from foundry.v2.core.models._updated_by import UpdatedBy +from foundry.v2.core.models._updated_time import UpdatedTime +from foundry.v2.filesystem.models._folder_rid import FolderRid +from foundry.v2.filesystem.models._folder_type import FolderType +from foundry.v2.filesystem.models._project_rid import ProjectRid +from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName +from foundry.v2.filesystem.models._resource_path import ResourcePath +from foundry.v2.filesystem.models._space_rid import SpaceRid +from foundry.v2.filesystem.models._trash_status import TrashStatus + + +class FolderDict(TypedDict): + """Folder""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + rid: FolderRid + + displayName: ResourceDisplayName + + description: NotRequired[StrictStr] + """The description associated with the Folder.""" + + documentation: NotRequired[StrictStr] + """The documentation associated with the Folder.""" + + path: ResourcePath + + type: FolderType + + createdBy: CreatedBy + + updatedBy: UpdatedBy + + createdTime: CreatedTime + + updatedTime: UpdatedTime + + trashStatus: TrashStatus + """ + The trash status of the Folder. If trashed, this could either be because the Folder itself has been + trashed or because one of its ancestors has been trashed. + """ + + parentFolderRid: FolderRid + """ + The parent folder Resource Identifier (RID). For Projects, this will be the Space RID and for Spaces, + this value will be the root folder (`ri.compass.main.folder.0`). + """ + + projectRid: NotRequired[ProjectRid] + """ + The Project Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will + not be defined. + """ + + spaceRid: SpaceRid + """ + The Space Resource Identifier (RID) that the Folder lives in. If the Folder is a Space, this value will + be the same as the Folder RID. + """ diff --git a/foundry/v2/filesystem/models/_folder_type.py b/foundry/v2/filesystem/models/_folder_type.py new file mode 100644 index 00000000..7f583ce2 --- /dev/null +++ b/foundry/v2/filesystem/models/_folder_type.py @@ -0,0 +1,25 @@ +# 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 Literal + +FolderType = Literal["FOLDER", "SPACE", "PROJECT"] +""" +A folder can either a regular Folder, a +[Project](https://www.palantir.com/docs/foundry/getting-started/projects-and-resources/#projects) or a +[Space](/docs/foundry/security/orgs-and-spaces/#spaces). +""" diff --git a/foundry/v2/filesystem/models/_list_children_of_folder_response.py b/foundry/v2/filesystem/models/_list_children_of_folder_response.py new file mode 100644 index 00000000..96110a41 --- /dev/null +++ b/foundry/v2/filesystem/models/_list_children_of_folder_response.py @@ -0,0 +1,45 @@ +# 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 List +from typing import Optional +from typing import cast + +from pydantic import BaseModel +from pydantic import Field + +from foundry.v2.core.models._page_token import PageToken +from foundry.v2.filesystem.models._list_children_of_folder_response_dict import ( + ListChildrenOfFolderResponseDict, +) # NOQA +from foundry.v2.filesystem.models._resource import Resource + + +class ListChildrenOfFolderResponse(BaseModel): + """ListChildrenOfFolderResponse""" + + data: List[Resource] + + next_page_token: Optional[PageToken] = Field(alias="nextPageToken", default=None) + + model_config = {"extra": "allow"} + + def to_dict(self) -> ListChildrenOfFolderResponseDict: + """Return the dictionary representation of the model using the field aliases.""" + return cast( + ListChildrenOfFolderResponseDict, self.model_dump(by_alias=True, exclude_unset=True) + ) diff --git a/foundry/v2/filesystem/models/_list_children_of_folder_response_dict.py b/foundry/v2/filesystem/models/_list_children_of_folder_response_dict.py new file mode 100644 index 00000000..a87ac9ed --- /dev/null +++ b/foundry/v2/filesystem/models/_list_children_of_folder_response_dict.py @@ -0,0 +1,34 @@ +# 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 List + +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.core.models._page_token import PageToken +from foundry.v2.filesystem.models._resource_dict import ResourceDict + + +class ListChildrenOfFolderResponseDict(TypedDict): + """ListChildrenOfFolderResponse""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + data: List[ResourceDict] + + nextPageToken: NotRequired[PageToken] diff --git a/foundry/v2/filesystem/models/_resource.py b/foundry/v2/filesystem/models/_resource.py index 5663b69c..2c4c0a3f 100644 --- a/foundry/v2/filesystem/models/_resource.py +++ b/foundry/v2/filesystem/models/_resource.py @@ -34,7 +34,7 @@ from foundry.v2.filesystem.models._resource_rid import ResourceRid from foundry.v2.filesystem.models._resource_type import ResourceType from foundry.v2.filesystem.models._space_rid import SpaceRid -from foundry.v2.filesystem.models._trashed_status import TrashedStatus +from foundry.v2.filesystem.models._trash_status import TrashStatus class Resource(BaseModel): @@ -72,10 +72,10 @@ class Resource(BaseModel): top level folders (spaces and projects), this is not updated by child updates for performance reasons. """ - trashed: TrashedStatus + trash_status: TrashStatus = Field(alias="trashStatus") """ - The trash status of the resource. If trashed, a resource can either be directly trashed or one - of its ancestors can be trashed. + The trash status of the Resource. If trashed, this could either be because the Resource itself has been + trashed or because one of its ancestors has been trashed. """ parent_folder_rid: FolderRid = Field(alias="parentFolderRid") diff --git a/foundry/v2/filesystem/models/_resource_dict.py b/foundry/v2/filesystem/models/_resource_dict.py index c7779fdf..0e5c9e52 100644 --- a/foundry/v2/filesystem/models/_resource_dict.py +++ b/foundry/v2/filesystem/models/_resource_dict.py @@ -30,7 +30,7 @@ from foundry.v2.filesystem.models._resource_rid import ResourceRid from foundry.v2.filesystem.models._resource_type import ResourceType from foundry.v2.filesystem.models._space_rid import SpaceRid -from foundry.v2.filesystem.models._trashed_status import TrashedStatus +from foundry.v2.filesystem.models._trash_status import TrashStatus class ResourceDict(TypedDict): @@ -70,10 +70,10 @@ class ResourceDict(TypedDict): top level folders (spaces and projects), this is not updated by child updates for performance reasons. """ - trashed: TrashedStatus + trashStatus: TrashStatus """ - The trash status of the resource. If trashed, a resource can either be directly trashed or one - of its ancestors can be trashed. + The trash status of the Resource. If trashed, this could either be because the Resource itself has been + trashed or because one of its ancestors has been trashed. """ parentFolderRid: FolderRid diff --git a/foundry/v2/filesystem/models/_trashed_status.py b/foundry/v2/filesystem/models/_trash_status.py similarity index 87% rename from foundry/v2/filesystem/models/_trashed_status.py rename to foundry/v2/filesystem/models/_trash_status.py index 59a7001a..6cf6e4b3 100644 --- a/foundry/v2/filesystem/models/_trashed_status.py +++ b/foundry/v2/filesystem/models/_trash_status.py @@ -17,5 +17,5 @@ from typing import Literal -TrashedStatus = Literal["DIRECTLY_TRASHED", "ANCESTOR_TRASHED", "NOT_TRASHED"] -"""TrashedStatus""" +TrashStatus = Literal["DIRECTLY_TRASHED", "ANCESTOR_TRASHED", "NOT_TRASHED"] +"""TrashStatus"""