diff --git a/README.md b/README.md index 57c10489..f3ade9db 100644 --- a/README.md +++ b/README.md @@ -386,8 +386,11 @@ Namespace | Resource | Operation | HTTP request | **OntologiesV2** | TimeSeriesPropertyV2 | [**stream_points**](docs/v2/OntologiesV2/TimeSeriesPropertyV2.md#stream_points) | **POST** /v2/ontologies/{ontology}/objects/{objectType}/{primaryKey}/timeseries/{property}/streamPoints | **Orchestration** | Build | [**create**](docs/v2/Orchestration/Build.md#create) | **POST** /v2/orchestration/builds/create | **Orchestration** | Build | [**get**](docs/v2/Orchestration/Build.md#get) | **GET** /v2/orchestration/builds/{buildRid} | +**Orchestration** | Schedule | [**create**](docs/v2/Orchestration/Schedule.md#create) | **POST** /v2/orchestration/schedules | +**Orchestration** | Schedule | [**delete**](docs/v2/Orchestration/Schedule.md#delete) | **DELETE** /v2/orchestration/schedules/{scheduleRid} | **Orchestration** | Schedule | [**get**](docs/v2/Orchestration/Schedule.md#get) | **GET** /v2/orchestration/schedules/{scheduleRid} | **Orchestration** | Schedule | [**pause**](docs/v2/Orchestration/Schedule.md#pause) | **POST** /v2/orchestration/schedules/{scheduleRid}/pause | +**Orchestration** | Schedule | [**replace**](docs/v2/Orchestration/Schedule.md#replace) | **PUT** /v2/orchestration/schedules/{scheduleRid} | **Orchestration** | Schedule | [**run**](docs/v2/Orchestration/Schedule.md#run) | **POST** /v2/orchestration/schedules/{scheduleRid}/run | **Orchestration** | Schedule | [**unpause**](docs/v2/Orchestration/Schedule.md#unpause) | **POST** /v2/orchestration/schedules/{scheduleRid}/unpause | **ThirdPartyApplications** | Version | [**delete**](docs/v2/ThirdPartyApplications/Version.md#delete) | **DELETE** /v2/thirdPartyApplications/{thirdPartyApplicationRid}/website/versions/{versionVersion} | @@ -557,7 +560,6 @@ Namespace | Resource | Operation | HTTP request | - [PrincipalType](docs/v2/models/PrincipalType.md) - [Realm](docs/v2/models/Realm.md) - [ReleaseStatus](docs/v2/models/ReleaseStatus.md) -- [ResourceType](docs/v2/models/ResourceType.md) - [ShortType](docs/v2/models/ShortType.md) - [ShortTypeDict](docs/v2/models/ShortTypeDict.md) - [SizeBytes](docs/v2/models/SizeBytes.md) @@ -577,6 +579,7 @@ Namespace | Resource | Operation | HTTP request | - [UpdatedBy](docs/v2/models/UpdatedBy.md) - [UpdatedTime](docs/v2/models/UpdatedTime.md) - [UserId](docs/v2/models/UserId.md) +- [ZoneId](docs/v2/models/ZoneId.md) - [Branch](docs/v2/models/Branch.md) - [BranchDict](docs/v2/models/BranchDict.md) - [BranchName](docs/v2/models/BranchName.md) @@ -605,6 +608,7 @@ Namespace | Resource | Operation | HTTP request | - [ResourceDisplayName](docs/v2/models/ResourceDisplayName.md) - [ResourcePath](docs/v2/models/ResourcePath.md) - [ResourceRid](docs/v2/models/ResourceRid.md) +- [ResourceType](docs/v2/models/ResourceType.md) - [SpaceRid](docs/v2/models/SpaceRid.md) - [TrashedStatus](docs/v2/models/TrashedStatus.md) - [DataValue](docs/v2/models/DataValue.md) @@ -979,6 +983,7 @@ Namespace | Resource | Operation | HTTP request | - [AndTrigger](docs/v2/models/AndTrigger.md) - [AndTriggerDict](docs/v2/models/AndTriggerDict.md) - [Build](docs/v2/models/Build.md) +- [BuildableRid](docs/v2/models/BuildableRid.md) - [BuildDict](docs/v2/models/BuildDict.md) - [BuildRid](docs/v2/models/BuildRid.md) - [BuildStatus](docs/v2/models/BuildStatus.md) @@ -986,6 +991,14 @@ Namespace | Resource | Operation | HTTP request | - [BuildTargetDict](docs/v2/models/BuildTargetDict.md) - [ConnectingTarget](docs/v2/models/ConnectingTarget.md) - [ConnectingTargetDict](docs/v2/models/ConnectingTargetDict.md) +- [CreateScheduleRequestActionBuildTargetConnectingTargetDict](docs/v2/models/CreateScheduleRequestActionBuildTargetConnectingTargetDict.md) +- [CreateScheduleRequestActionBuildTargetDict](docs/v2/models/CreateScheduleRequestActionBuildTargetDict.md) +- [CreateScheduleRequestActionBuildTargetManualTargetDict](docs/v2/models/CreateScheduleRequestActionBuildTargetManualTargetDict.md) +- [CreateScheduleRequestActionBuildTargetUpstreamTargetDict](docs/v2/models/CreateScheduleRequestActionBuildTargetUpstreamTargetDict.md) +- [CreateScheduleRequestActionDict](docs/v2/models/CreateScheduleRequestActionDict.md) +- [CreateScheduleRequestScopeModeDict](docs/v2/models/CreateScheduleRequestScopeModeDict.md) +- [CreateScheduleRequestScopeModeProjectScopeDict](docs/v2/models/CreateScheduleRequestScopeModeProjectScopeDict.md) +- [CreateScheduleRequestScopeModeUserScopeDict](docs/v2/models/CreateScheduleRequestScopeModeUserScopeDict.md) - [CronExpression](docs/v2/models/CronExpression.md) - [DatasetUpdatedTrigger](docs/v2/models/DatasetUpdatedTrigger.md) - [DatasetUpdatedTriggerDict](docs/v2/models/DatasetUpdatedTriggerDict.md) @@ -1004,6 +1017,14 @@ Namespace | Resource | Operation | HTTP request | - [OrTriggerDict](docs/v2/models/OrTriggerDict.md) - [ProjectScope](docs/v2/models/ProjectScope.md) - [ProjectScopeDict](docs/v2/models/ProjectScopeDict.md) +- [ReplaceScheduleRequestActionBuildTargetConnectingTargetDict](docs/v2/models/ReplaceScheduleRequestActionBuildTargetConnectingTargetDict.md) +- [ReplaceScheduleRequestActionBuildTargetDict](docs/v2/models/ReplaceScheduleRequestActionBuildTargetDict.md) +- [ReplaceScheduleRequestActionBuildTargetManualTargetDict](docs/v2/models/ReplaceScheduleRequestActionBuildTargetManualTargetDict.md) +- [ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict](docs/v2/models/ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict.md) +- [ReplaceScheduleRequestActionDict](docs/v2/models/ReplaceScheduleRequestActionDict.md) +- [ReplaceScheduleRequestScopeModeDict](docs/v2/models/ReplaceScheduleRequestScopeModeDict.md) +- [ReplaceScheduleRequestScopeModeProjectScopeDict](docs/v2/models/ReplaceScheduleRequestScopeModeProjectScopeDict.md) +- [ReplaceScheduleRequestScopeModeUserScopeDict](docs/v2/models/ReplaceScheduleRequestScopeModeUserScopeDict.md) - [RetryBackoffDuration](docs/v2/models/RetryBackoffDuration.md) - [RetryBackoffDurationDict](docs/v2/models/RetryBackoffDurationDict.md) - [RetryCount](docs/v2/models/RetryCount.md) @@ -1036,11 +1057,11 @@ Namespace | Resource | Operation | HTTP request | - [UpstreamTargetDict](docs/v2/models/UpstreamTargetDict.md) - [UserScope](docs/v2/models/UserScope.md) - [UserScopeDict](docs/v2/models/UserScopeDict.md) -- [ZoneId](docs/v2/models/ZoneId.md) - [Compressed](docs/v2/models/Compressed.md) - [Dataset](docs/v2/models/Dataset.md) - [DatasetDict](docs/v2/models/DatasetDict.md) - [PartitionsCount](docs/v2/models/PartitionsCount.md) +- [Record](docs/v2/models/Record.md) - [Stream](docs/v2/models/Stream.md) - [StreamDict](docs/v2/models/StreamDict.md) - [StreamType](docs/v2/models/StreamType.md) diff --git a/docs/v2/Filesystem/Resource.md b/docs/v2/Filesystem/Resource.md index 8c701adc..797ab2c9 100644 --- a/docs/v2/Filesystem/Resource.md +++ b/docs/v2/Filesystem/Resource.md @@ -3,6 +3,62 @@ Method | HTTP request | ------------- | ------------- | +Move the given resource to the trash. Following this operation, the resource can be restored, using the +`restore` operation, or permanently deleted using the `permanentlyDelete` operation. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**resource_rid** | ResourceRid | resourceRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ResourceRid | resourceRid +resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Resource.delete( + resource_rid, + preview=preview, + ) + print("The delete response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Resource.delete: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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 the Resource with the specified rid. ### Parameters @@ -57,3 +113,115 @@ See [README](../../../README.md#authorization) [[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) +Permanently delete the given resource from the trash. If the Resource is not directly trashed, a +`ResourceNotTrashed` error will be thrown. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**resource_rid** | ResourceRid | resourceRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ResourceRid | resourceRid +resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Resource.permanently_delete( + resource_rid, + preview=preview, + ) + print("The permanently_delete response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Resource.permanently_delete: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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) + +Restore the given resource and any directly trashed ancestors from the trash. If the resource is not +trashed, this operation will be ignored. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**resource_rid** | ResourceRid | resourceRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ResourceRid | resourceRid +resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.filesystem.Resource.restore( + resource_rid, + preview=preview, + ) + print("The restore response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Resource.restore: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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/Orchestration/Schedule.md b/docs/v2/Orchestration/Schedule.md index bc59f9c6..b351a92a 100644 --- a/docs/v2/Orchestration/Schedule.md +++ b/docs/v2/Orchestration/Schedule.md @@ -2,11 +2,154 @@ Method | HTTP request | ------------- | ------------- | +[**create**](#create) | **POST** /v2/orchestration/schedules | +[**delete**](#delete) | **DELETE** /v2/orchestration/schedules/{scheduleRid} | [**get**](#get) | **GET** /v2/orchestration/schedules/{scheduleRid} | [**pause**](#pause) | **POST** /v2/orchestration/schedules/{scheduleRid}/pause | +[**replace**](#replace) | **PUT** /v2/orchestration/schedules/{scheduleRid} | [**run**](#run) | **POST** /v2/orchestration/schedules/{scheduleRid}/run | [**unpause**](#unpause) | **POST** /v2/orchestration/schedules/{scheduleRid}/unpause | +# **create** +Creates a new Schedule. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**action** | CreateScheduleRequestActionDict | | | +**description** | Optional[StrictStr] | | [optional] | +**display_name** | Optional[StrictStr] | | [optional] | +**preview** | Optional[PreviewMode] | preview | [optional] | +**scope_mode** | Optional[CreateScheduleRequestScopeModeDict] | | [optional] | +**trigger** | Optional[TriggerDict] | The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. | [optional] | + +### Return type +**Schedule** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# CreateScheduleRequestActionDict | +action = { + "abortOnFailure": False, + "forceBuild": False, + "retryBackoffDuration": {"unit": "SECONDS", "value": 30}, + "fallbackBranches": [], + "branchName": "master", + "notificationsEnabled": False, + "target": { + "type": "manual", + "targetRids": [ + "ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e", + "ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43", + ], + }, +} +# Optional[StrictStr] | +description = "Run all the transforms at midnight" +# Optional[StrictStr] | +display_name = "My Daily Schedule" +# Optional[PreviewMode] | preview +preview = None +# Optional[CreateScheduleRequestScopeModeDict] | +scope_mode = {"type": "user"} +# Optional[TriggerDict] | The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. +trigger = {"type": "time", "cronExpression": "0 0 * * *", "timeZone": "UTC"} + + +try: + api_response = foundry_client.orchestration.Schedule.create( + action=action, + description=description, + display_name=display_name, + preview=preview, + scope_mode=scope_mode, + trigger=trigger, + ) + print("The create response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Schedule.create: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | Schedule | The created Schedule | 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) + +# **delete** +Delete the Schedule with the specified rid. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**schedule_rid** | ScheduleRid | scheduleRid | | +**preview** | Optional[PreviewMode] | preview | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ScheduleRid | scheduleRid +schedule_rid = None +# Optional[PreviewMode] | preview +preview = None + + +try: + api_response = foundry_client.orchestration.Schedule.delete( + schedule_rid, + preview=preview, + ) + print("The delete response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Schedule.delete: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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 Schedule with the specified rid. @@ -117,6 +260,95 @@ See [README](../../../README.md#authorization) [[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) +# **replace** +Replace the Schedule with the specified rid. + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**schedule_rid** | ScheduleRid | scheduleRid | | +**action** | ReplaceScheduleRequestActionDict | | | +**description** | Optional[StrictStr] | | [optional] | +**display_name** | Optional[StrictStr] | | [optional] | +**preview** | Optional[PreviewMode] | preview | [optional] | +**scope_mode** | Optional[ReplaceScheduleRequestScopeModeDict] | | [optional] | +**trigger** | Optional[TriggerDict] | The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. | [optional] | + +### Return type +**Schedule** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# ScheduleRid | scheduleRid +schedule_rid = None +# ReplaceScheduleRequestActionDict | +action = { + "abortOnFailure": False, + "forceBuild": False, + "retryBackoffDuration": {"unit": "SECONDS", "value": 30}, + "fallbackBranches": [], + "branchName": "master", + "notificationsEnabled": False, + "target": { + "type": "manual", + "targetRids": [ + "ri.foundry.main.dataset.b737e24d-6b19-43aa-93d5-da9fc4073f6e", + "ri.foundry.main.dataset.d2452a94-a755-4778-8bfc-a315ab52fc43", + ], + }, +} +# Optional[StrictStr] | +description = "Run all the transforms at midnight" +# Optional[StrictStr] | +display_name = "My Daily Schedule" +# Optional[PreviewMode] | preview +preview = None +# Optional[ReplaceScheduleRequestScopeModeDict] | +scope_mode = {"type": "user"} +# Optional[TriggerDict] | The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. +trigger = {"type": "time", "cronExpression": "0 0 * * *", "timeZone": "UTC"} + + +try: + api_response = foundry_client.orchestration.Schedule.replace( + schedule_rid, + action=action, + description=description, + display_name=display_name, + preview=preview, + scope_mode=scope_mode, + trigger=trigger, + ) + print("The replace response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Schedule.replace: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**200** | Schedule | The replaced Schedule | 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) + # **run** diff --git a/docs/v2/Streams/Stream.md b/docs/v2/Streams/Stream.md index 9d2768a1..c03a4adc 100644 --- a/docs/v2/Streams/Stream.md +++ b/docs/v2/Streams/Stream.md @@ -63,3 +63,139 @@ See [README](../../../README.md#authorization) [[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) +Publish a single record to the stream. The record will be validated against the stream's schema, and +rejected if it is invalid. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**dataset_rid** | DatasetRid | datasetRid | | +**stream_branch_name** | BranchName | streamBranchName | | +**record** | Record | The record to publish to the stream | | +**preview** | Optional[PreviewMode] | preview | [optional] | +**view_rid** | Optional[ViewRid] | If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# DatasetRid | datasetRid +dataset_rid = None +# BranchName | streamBranchName +stream_branch_name = None +# Record | The record to publish to the stream +record = None +# Optional[PreviewMode] | preview +preview = None +# Optional[ViewRid] | If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. +view_rid = None + + +try: + api_response = foundry_client.streams.Dataset.Stream.publish_record( + dataset_rid, + stream_branch_name, + record=record, + preview=preview, + view_rid=view_rid, + ) + print("The publish_record response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Stream.publish_record: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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) + +Publish a batch of records to the stream. The records will be validated against the stream's schema, and +the batch will be rejected if one or more of the records are invalid. + + +### Parameters + +Name | Type | Description | Notes | +------------- | ------------- | ------------- | ------------- | +**dataset_rid** | DatasetRid | datasetRid | | +**stream_branch_name** | BranchName | streamBranchName | | +**records** | List[Record] | The records to publish to the stream | | +**preview** | Optional[PreviewMode] | preview | [optional] | +**view_rid** | Optional[ViewRid] | If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write to the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. | [optional] | + +### Return type +**None** + +### Example + +```python +from foundry.v2 import FoundryClient +import foundry +from pprint import pprint + +foundry_client = FoundryClient( + auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com" +) + +# DatasetRid | datasetRid +dataset_rid = None +# BranchName | streamBranchName +stream_branch_name = None +# List[Record] | The records to publish to the stream +records = None +# Optional[PreviewMode] | preview +preview = None +# Optional[ViewRid] | If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write to the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. +view_rid = None + + +try: + api_response = foundry_client.streams.Dataset.Stream.publish_records( + dataset_rid, + stream_branch_name, + records=records, + preview=preview, + view_rid=view_rid, + ) + print("The publish_records response:\n") + pprint(api_response) +except foundry.PalantirRPCException as e: + print("HTTP error when calling Stream.publish_records: %s\n" % e) + +``` + + + +### Authorization + +See [README](../../../README.md#authorization) + +### HTTP response details +| Status Code | Type | Description | Content Type | +|-------------|-------------|-------------|------------------| +**204** | None | | None | + +[[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/core/models/ResourceType.md b/docs/v2/core/models/ResourceType.md deleted file mode 100644 index 92ac32fb..00000000 --- a/docs/v2/core/models/ResourceType.md +++ /dev/null @@ -1,58 +0,0 @@ -# ResourceType - -The type of a resource. - -| **Value** | -| --------- | -| `"Academy_Tutorial"` | -| `"Artifacts_Repository"` | -| `"Automate_Automation"` | -| `"Builder_Pipeline"` | -| `"Carbon_Workspace"` | -| `"Cipher_Channel"` | -| `"Code_Repository"` | -| `"Code_Workbook"` | -| `"Code_Workspace"` | -| `"Connectivity_Agent"` | -| `"Connectivity_Source"` | -| `"Connectivity_VirtualTable"` | -| `"Contour_Analysis"` | -| `"Data_Lineage_Graph"` | -| `"Datasets_Dataset"` | -| `"Filesystem_Document"` | -| `"Filesystem_Folder"` | -| `"Filesystem_Image"` | -| `"Filesystem_Project"` | -| `"Filesystem_Space"` | -| `"Filesystem_WebLink"` | -| `"Foundry_Form"` | -| `"Foundry_Report"` | -| `"Foundry_Template"` | -| `"FoundryRules_Workflow"` | -| `"Fusion_Document"` | -| `"Logic_Function"` | -| `"Machinery_ProcessGraph"` | -| `"Maps_Layer"` | -| `"Maps_Map"` | -| `"Marketplace_Installation"` | -| `"Marketplace_LocalStore"` | -| `"Marketplace_RemoteStore"` | -| `"Media_Set"` | -| `"Modeling_Model"` | -| `"Modeling_ModelVersion"` | -| `"Modeling_Objective"` | -| `"Monitoring_MonitoringView"` | -| `"Notepad_Document"` | -| `"Notepad_Template"` | -| `"ObjectExploration_Exploration"` | -| `"ObjectExploration_Layout"` | -| `"Quiver_Analysis"` | -| `"Slate_Application"` | -| `"SolutionDesigner_Diagram"` | -| `"ThirdPartyApplication_ThirdPartyApplication"` | -| `"Unknown"` | -| `"Vertex_Graph"` | -| `"Workshop_Module"` | - - -[[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/orchestration/models/ZoneId.md b/docs/v2/core/models/ZoneId.md similarity index 100% rename from docs/v2/orchestration/models/ZoneId.md rename to docs/v2/core/models/ZoneId.md diff --git a/docs/v2/filesystem/models/ResourceType.md b/docs/v2/filesystem/models/ResourceType.md new file mode 100644 index 00000000..f2ac5898 --- /dev/null +++ b/docs/v2/filesystem/models/ResourceType.md @@ -0,0 +1,55 @@ +# ResourceType + +The type of the Resource derived from the Resource Identifier (RID). + +| **Value** | +| --------- | +| `"ARTIFACTS_REPOSITORY"` | +| `"BELLASO_CIPHER_CHANNEL"` | +| `"BLOBSTER_DOCUMENT"` | +| `"BLOBSTER_IMAGE"` | +| `"CARBON_WORKSPACE"` | +| `"COMPASS_FOLDER"` | +| `"COMPASS_WEB_LINK"` | +| `"CONTOUR_ANALYSIS"` | +| `"DATA_HEALTH_MONITORING_VIEW"` | +| `"EDDIE_LOGIC"` | +| `"EDDIE_PIPELINE"` | +| `"FFORMS_FORM"` | +| `"FOUNDRY_DATASET"` | +| `"FOUNDRY_ACADEMY_TUTORIAL"` | +| `"FOUNDRY_CONTAINER_SERVICE_CONTAINER"` | +| `"FOUNDRY_ML_OBJECTIVE"` | +| `"FOUNDRY_TEMPLATES_TEMPLATE"` | +| `"FUSION_DOCUMENT"` | +| `"HUBBLE_EXPLORATION_LAYOUT"` | +| `"MACHINERY_DOCUMENT"` | +| `"MAGRITTE_AGENT"` | +| `"MAGRITTE_SOURCE"` | +| `"MARKETPLACE_BLOCK_SET_INSTALLATION"` | +| `"MARKETPLACE_LOCAL"` | +| `"MARKETPLACE_REMOTE_STORE"` | +| `"MIO_MEDIA_SET"` | +| `"MODELS_MODEL"` | +| `"MODELS_MODEL_VERSION"` | +| `"MONOCLE_GRAPH"` | +| `"NOTEPAD_NOTEPAD"` | +| `"NOTEPAD_NOTEPAD_TEMPLATE"` | +| `"OBJECT_SENTINEL_MONITOR"` | +| `"OBJECT_SET_VERSIONED_OBJECT_SET"` | +| `"OPUS_GRAPH"` | +| `"OPUS_MAP"` | +| `"OPUS_MAP_LAYER"` | +| `"QUIVER_ANALYSIS"` | +| `"REPORT_REPORT"` | +| `"SLATE_DOCUMENT"` | +| `"SOLUTION_DESIGN_DIAGRAM"` | +| `"STEMMA_REPOSITORY"` | +| `"TABLES_TABLE"` | +| `"TAURUS_WORKFLOW"` | +| `"THIRD_PARTY_APPLICATIONS_APPLICATION"` | +| `"VECTOR_WORKBOOK"` | +| `"WORKSHOP_MODULE"` | + + +[[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/orchestration/models/BuildableRid.md b/docs/v2/orchestration/models/BuildableRid.md new file mode 100644 index 00000000..42a348e5 --- /dev/null +++ b/docs/v2/orchestration/models/BuildableRid.md @@ -0,0 +1,13 @@ +# BuildableRid + +The Resource Identifier (RID) of a Resource that can be built. For example, this is a Dataset RID, Media Set +RID or Restricted View RID. + + +## 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/orchestration/models/ConnectingTarget.md b/docs/v2/orchestration/models/ConnectingTarget.md index 75f0b97b..1a665f42 100644 --- a/docs/v2/orchestration/models/ConnectingTarget.md +++ b/docs/v2/orchestration/models/ConnectingTarget.md @@ -7,9 +7,9 @@ target datasets (inclusive) except for the datasets to ignore. ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**input_dataset_rids** | List[DatasetRid] | Yes | The upstream input datasets (exclusive). | -**target_dataset_rids** | List[DatasetRid] | Yes | The downstream target datasets (inclusive). | -**ignored_dataset_rids** | List[DatasetRid] | Yes | The datasets between the input datasets and target datasets to exclude. | +**input_rids** | List[BuildableRid] | Yes | The upstream input datasets (exclusive). | +**target_rids** | List[BuildableRid] | Yes | The downstream target datasets (inclusive). | +**ignored_rids** | List[BuildableRid] | Yes | The datasets between the input datasets and target datasets to exclude. | **type** | Literal["connecting"] | Yes | None | diff --git a/docs/v2/orchestration/models/ConnectingTargetDict.md b/docs/v2/orchestration/models/ConnectingTargetDict.md index e119d58f..95a01f6e 100644 --- a/docs/v2/orchestration/models/ConnectingTargetDict.md +++ b/docs/v2/orchestration/models/ConnectingTargetDict.md @@ -7,9 +7,9 @@ target datasets (inclusive) except for the datasets to ignore. ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**inputDatasetRids** | List[DatasetRid] | Yes | The upstream input datasets (exclusive). | -**targetDatasetRids** | List[DatasetRid] | Yes | The downstream target datasets (inclusive). | -**ignoredDatasetRids** | List[DatasetRid] | Yes | The datasets between the input datasets and target datasets to exclude. | +**inputRids** | List[BuildableRid] | Yes | The upstream input datasets (exclusive). | +**targetRids** | List[BuildableRid] | Yes | The downstream target datasets (inclusive). | +**ignoredRids** | List[BuildableRid] | Yes | The datasets between the input datasets and target datasets to exclude. | **type** | Literal["connecting"] | Yes | None | diff --git a/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetConnectingTargetDict.md b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetConnectingTargetDict.md new file mode 100644 index 00000000..0857d58f --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetConnectingTargetDict.md @@ -0,0 +1,14 @@ +# CreateScheduleRequestActionBuildTargetConnectingTargetDict + +CreateScheduleRequestActionBuildTargetConnectingTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**ignoredRids** | NotRequired[List[BuildableRid]] | No | The datasets between the input datasets and target datasets to exclude. | +**targetRids** | List[BuildableRid] | Yes | The downstream target datasets (inclusive). | +**inputRids** | List[BuildableRid] | Yes | The upstream input datasets (exclusive). | +**type** | Literal["connecting"] | Yes | None | + + +[[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/orchestration/models/CreateScheduleRequestActionBuildTargetDict.md b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetDict.md new file mode 100644 index 00000000..54c0483b --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetDict.md @@ -0,0 +1,17 @@ +# CreateScheduleRequestActionBuildTargetDict + +The targets of the build. + +This is a discriminator type and does not contain any fields. Instead, it is a union +of of the models listed below. + +This discriminator class uses the `type` field to differentiate between classes. + +| Class | Value +| ------------ | ------------- +CreateScheduleRequestActionBuildTargetUpstreamTargetDict | upstream +CreateScheduleRequestActionBuildTargetManualTargetDict | manual +CreateScheduleRequestActionBuildTargetConnectingTargetDict | connecting + + +[[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/orchestration/models/CreateScheduleRequestActionBuildTargetManualTargetDict.md b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetManualTargetDict.md new file mode 100644 index 00000000..a6dcc519 --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetManualTargetDict.md @@ -0,0 +1,12 @@ +# CreateScheduleRequestActionBuildTargetManualTargetDict + +CreateScheduleRequestActionBuildTargetManualTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**targetRids** | List[BuildableRid] | Yes | | +**type** | Literal["manual"] | Yes | None | + + +[[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/orchestration/models/CreateScheduleRequestActionBuildTargetUpstreamTargetDict.md b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetUpstreamTargetDict.md new file mode 100644 index 00000000..d9c479be --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestActionBuildTargetUpstreamTargetDict.md @@ -0,0 +1,13 @@ +# CreateScheduleRequestActionBuildTargetUpstreamTargetDict + +CreateScheduleRequestActionBuildTargetUpstreamTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**ignoredRids** | NotRequired[List[BuildableRid]] | No | The datasets to ignore when calculating the final set of dataset to build. | +**targetRids** | List[BuildableRid] | Yes | The target datasets. | +**type** | Literal["upstream"] | Yes | None | + + +[[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/orchestration/models/CreateScheduleRequestActionDict.md b/docs/v2/orchestration/models/CreateScheduleRequestActionDict.md new file mode 100644 index 00000000..5f8ba8eb --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestActionDict.md @@ -0,0 +1,18 @@ +# CreateScheduleRequestActionDict + +CreateScheduleRequestAction + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**abortOnFailure** | NotRequired[AbortOnFailure] | No | | +**forceBuild** | NotRequired[ForceBuild] | No | | +**retryBackoffDuration** | NotRequired[RetryBackoffDurationDict] | No | | +**retryCount** | NotRequired[RetryCount] | No | | +**fallbackBranches** | NotRequired[FallbackBranches] | No | | +**branchName** | NotRequired[BranchName] | No | The target branch the schedule should run on. | +**notificationsEnabled** | NotRequired[NotificationsEnabled] | No | | +**target** | CreateScheduleRequestActionBuildTargetDict | 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/orchestration/models/CreateScheduleRequestScopeModeDict.md b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeDict.md new file mode 100644 index 00000000..e951b4b2 --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeDict.md @@ -0,0 +1,16 @@ +# CreateScheduleRequestScopeModeDict + +The boundaries for the schedule build. + +This is a discriminator type and does not contain any fields. Instead, it is a union +of of the models listed below. + +This discriminator class uses the `type` field to differentiate between classes. + +| Class | Value +| ------------ | ------------- +CreateScheduleRequestScopeModeProjectScopeDict | project +CreateScheduleRequestScopeModeUserScopeDict | user + + +[[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/orchestration/models/CreateScheduleRequestScopeModeProjectScopeDict.md b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeProjectScopeDict.md new file mode 100644 index 00000000..d0334691 --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeProjectScopeDict.md @@ -0,0 +1,12 @@ +# CreateScheduleRequestScopeModeProjectScopeDict + +CreateScheduleRequestScopeModeProjectScope + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**projectRids** | List[ProjectRid] | Yes | | +**type** | Literal["project"] | Yes | None | + + +[[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/orchestration/models/CreateScheduleRequestScopeModeUserScopeDict.md b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeUserScopeDict.md new file mode 100644 index 00000000..5dcfaf6c --- /dev/null +++ b/docs/v2/orchestration/models/CreateScheduleRequestScopeModeUserScopeDict.md @@ -0,0 +1,11 @@ +# CreateScheduleRequestScopeModeUserScopeDict + +CreateScheduleRequestScopeModeUserScope + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**type** | Literal["user"] | Yes | None | + + +[[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/orchestration/models/ManualTarget.md b/docs/v2/orchestration/models/ManualTarget.md index 7903a872..4e45c5ec 100644 --- a/docs/v2/orchestration/models/ManualTarget.md +++ b/docs/v2/orchestration/models/ManualTarget.md @@ -5,7 +5,7 @@ Manually specify all datasets to build. ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**dataset_rids** | List[DatasetRid] | Yes | | +**target_rids** | List[BuildableRid] | Yes | | **type** | Literal["manual"] | Yes | None | diff --git a/docs/v2/orchestration/models/ManualTargetDict.md b/docs/v2/orchestration/models/ManualTargetDict.md index 380b8647..5b6db7dd 100644 --- a/docs/v2/orchestration/models/ManualTargetDict.md +++ b/docs/v2/orchestration/models/ManualTargetDict.md @@ -5,7 +5,7 @@ Manually specify all datasets to build. ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**datasetRids** | List[DatasetRid] | Yes | | +**targetRids** | List[BuildableRid] | Yes | | **type** | Literal["manual"] | Yes | None | diff --git a/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetConnectingTargetDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetConnectingTargetDict.md new file mode 100644 index 00000000..e2d59a5c --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetConnectingTargetDict.md @@ -0,0 +1,14 @@ +# ReplaceScheduleRequestActionBuildTargetConnectingTargetDict + +ReplaceScheduleRequestActionBuildTargetConnectingTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**ignoredRids** | NotRequired[List[BuildableRid]] | No | The datasets between the input datasets and target datasets to exclude. | +**targetRids** | List[BuildableRid] | Yes | The downstream target datasets (inclusive). | +**inputRids** | List[BuildableRid] | Yes | The upstream input datasets (exclusive). | +**type** | Literal["connecting"] | Yes | None | + + +[[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/orchestration/models/ReplaceScheduleRequestActionBuildTargetDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetDict.md new file mode 100644 index 00000000..c8e1e0e9 --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetDict.md @@ -0,0 +1,17 @@ +# ReplaceScheduleRequestActionBuildTargetDict + +The targets of the build. + +This is a discriminator type and does not contain any fields. Instead, it is a union +of of the models listed below. + +This discriminator class uses the `type` field to differentiate between classes. + +| Class | Value +| ------------ | ------------- +ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict | upstream +ReplaceScheduleRequestActionBuildTargetManualTargetDict | manual +ReplaceScheduleRequestActionBuildTargetConnectingTargetDict | connecting + + +[[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/orchestration/models/ReplaceScheduleRequestActionBuildTargetManualTargetDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetManualTargetDict.md new file mode 100644 index 00000000..5af72caa --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetManualTargetDict.md @@ -0,0 +1,12 @@ +# ReplaceScheduleRequestActionBuildTargetManualTargetDict + +ReplaceScheduleRequestActionBuildTargetManualTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**targetRids** | List[BuildableRid] | Yes | | +**type** | Literal["manual"] | Yes | None | + + +[[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/orchestration/models/ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict.md new file mode 100644 index 00000000..737e2812 --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict.md @@ -0,0 +1,13 @@ +# ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict + +ReplaceScheduleRequestActionBuildTargetUpstreamTarget + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**ignoredRids** | NotRequired[List[BuildableRid]] | No | The datasets to ignore when calculating the final set of dataset to build. | +**targetRids** | List[BuildableRid] | Yes | The target datasets. | +**type** | Literal["upstream"] | Yes | None | + + +[[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/orchestration/models/ReplaceScheduleRequestActionDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestActionDict.md new file mode 100644 index 00000000..f3113fd9 --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestActionDict.md @@ -0,0 +1,18 @@ +# ReplaceScheduleRequestActionDict + +ReplaceScheduleRequestAction + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**abortOnFailure** | NotRequired[AbortOnFailure] | No | | +**forceBuild** | NotRequired[ForceBuild] | No | | +**retryBackoffDuration** | NotRequired[RetryBackoffDurationDict] | No | | +**retryCount** | NotRequired[RetryCount] | No | | +**fallbackBranches** | NotRequired[FallbackBranches] | No | | +**branchName** | NotRequired[BranchName] | No | The target branch the schedule should run on. | +**notificationsEnabled** | NotRequired[NotificationsEnabled] | No | | +**target** | ReplaceScheduleRequestActionBuildTargetDict | 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/orchestration/models/ReplaceScheduleRequestScopeModeDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeDict.md new file mode 100644 index 00000000..e66e1977 --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeDict.md @@ -0,0 +1,16 @@ +# ReplaceScheduleRequestScopeModeDict + +The boundaries for the schedule build. + +This is a discriminator type and does not contain any fields. Instead, it is a union +of of the models listed below. + +This discriminator class uses the `type` field to differentiate between classes. + +| Class | Value +| ------------ | ------------- +ReplaceScheduleRequestScopeModeProjectScopeDict | project +ReplaceScheduleRequestScopeModeUserScopeDict | user + + +[[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/orchestration/models/ReplaceScheduleRequestScopeModeProjectScopeDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeProjectScopeDict.md new file mode 100644 index 00000000..5031a9d7 --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeProjectScopeDict.md @@ -0,0 +1,12 @@ +# ReplaceScheduleRequestScopeModeProjectScopeDict + +ReplaceScheduleRequestScopeModeProjectScope + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**projectRids** | List[ProjectRid] | Yes | | +**type** | Literal["project"] | Yes | None | + + +[[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/orchestration/models/ReplaceScheduleRequestScopeModeUserScopeDict.md b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeUserScopeDict.md new file mode 100644 index 00000000..4632bf9a --- /dev/null +++ b/docs/v2/orchestration/models/ReplaceScheduleRequestScopeModeUserScopeDict.md @@ -0,0 +1,11 @@ +# ReplaceScheduleRequestScopeModeUserScopeDict + +ReplaceScheduleRequestScopeModeUserScope + +## Properties +| Name | Type | Required | Description | +| ------------ | ------------- | ------------- | ------------- | +**type** | Literal["user"] | Yes | None | + + +[[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/orchestration/models/UpstreamTarget.md b/docs/v2/orchestration/models/UpstreamTarget.md index cd16d488..0af7fbc9 100644 --- a/docs/v2/orchestration/models/UpstreamTarget.md +++ b/docs/v2/orchestration/models/UpstreamTarget.md @@ -5,8 +5,8 @@ Target the specified datasets along with all upstream datasets except the ignore ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**dataset_rids** | List[DatasetRid] | Yes | The target datasets. | -**ignored_dataset_rids** | List[DatasetRid] | Yes | The datasets to ignore when calculating the final set of dataset to build. | +**target_rids** | List[BuildableRid] | Yes | The target datasets. | +**ignored_rids** | List[BuildableRid] | Yes | The datasets to ignore when calculating the final set of dataset to build. | **type** | Literal["upstream"] | Yes | None | diff --git a/docs/v2/orchestration/models/UpstreamTargetDict.md b/docs/v2/orchestration/models/UpstreamTargetDict.md index 59ef27d4..21183854 100644 --- a/docs/v2/orchestration/models/UpstreamTargetDict.md +++ b/docs/v2/orchestration/models/UpstreamTargetDict.md @@ -5,8 +5,8 @@ Target the specified datasets along with all upstream datasets except the ignore ## Properties | Name | Type | Required | Description | | ------------ | ------------- | ------------- | ------------- | -**datasetRids** | List[DatasetRid] | Yes | The target datasets. | -**ignoredDatasetRids** | List[DatasetRid] | Yes | The datasets to ignore when calculating the final set of dataset to build. | +**targetRids** | List[BuildableRid] | Yes | The target datasets. | +**ignoredRids** | List[BuildableRid] | Yes | The datasets to ignore when calculating the final set of dataset to build. | **type** | Literal["upstream"] | Yes | None | diff --git a/docs/v2/streams/models/Record.md b/docs/v2/streams/models/Record.md new file mode 100644 index 00000000..10b3a607 --- /dev/null +++ b/docs/v2/streams/models/Record.md @@ -0,0 +1,12 @@ +# Record + +A record to be published to a stream. + + +## Type +```python +Dict[StrictStr, Any] +``` + + +[[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/foundry/_versions.py b/foundry/_versions.py index f70a680b..1be530da 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.932.0" +__openapi_document_version__ = "1.940.0" diff --git a/foundry/v2/cli.py b/foundry/v2/cli.py index 3117d751..7a774df5 100644 --- a/foundry/v2/cli.py +++ b/foundry/v2/cli.py @@ -1361,6 +1361,27 @@ def filesystem_resource(): pass +@filesystem_resource.command("delete") +@click.argument("resource_rid", type=str, required=True) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_resource_delete( + client: foundry.v2.FoundryClient, + resource_rid: str, + preview: Optional[bool], +): + """ + Move the given resource to the trash. Following this operation, the resource can be restored, using the + `restore` operation, or permanently deleted using the `permanentlyDelete` operation. + + """ + result = client.filesystem.Resource.delete( + resource_rid=resource_rid, + preview=preview, + ) + click.echo(repr(result)) + + @filesystem_resource.command("get") @click.argument("resource_rid", type=str, required=True) @click.option("--preview", type=bool, required=False, help="""preview""") @@ -1380,6 +1401,48 @@ def filesystem_resource_get( click.echo(repr(result)) +@filesystem_resource.command("permanently_delete") +@click.argument("resource_rid", type=str, required=True) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_resource_permanently_delete( + client: foundry.v2.FoundryClient, + resource_rid: str, + preview: Optional[bool], +): + """ + Permanently delete the given resource from the trash. If the Resource is not directly trashed, a + `ResourceNotTrashed` error will be thrown. + + """ + result = client.filesystem.Resource.permanently_delete( + resource_rid=resource_rid, + preview=preview, + ) + click.echo(repr(result)) + + +@filesystem_resource.command("restore") +@click.argument("resource_rid", type=str, required=True) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def filesystem_resource_restore( + client: foundry.v2.FoundryClient, + resource_rid: str, + preview: Optional[bool], +): + """ + Restore the given resource and any directly trashed ancestors from the trash. If the resource is not + trashed, this operation will be ignored. + + """ + result = client.filesystem.Resource.restore( + resource_rid=resource_rid, + preview=preview, + ) + click.echo(repr(result)) + + @cli.group("functions") def functions(): pass @@ -3061,6 +3124,63 @@ def orchestration_schedule(): pass +@orchestration_schedule.command("create") +@click.option("--action", type=str, required=True, help="""""") +@click.option("--description", type=str, required=False, help="""""") +@click.option("--display_name", type=str, required=False, help="""""") +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.option("--scope_mode", type=str, required=False, help="""""") +@click.option( + "--trigger", + type=str, + required=False, + help="""The schedule trigger. If the requesting user does not have +permission to see the trigger, this will be empty. +""", +) +@click.pass_obj +def orchestration_schedule_create( + client: foundry.v2.FoundryClient, + action: str, + description: Optional[str], + display_name: Optional[str], + preview: Optional[bool], + scope_mode: Optional[str], + trigger: Optional[str], +): + """ + Creates a new Schedule. + """ + result = client.orchestration.Schedule.create( + action=json.loads(action), + description=description, + display_name=display_name, + preview=preview, + scope_mode=None if scope_mode is None else json.loads(scope_mode), + trigger=None if trigger is None else json.loads(trigger), + ) + click.echo(repr(result)) + + +@orchestration_schedule.command("delete") +@click.argument("schedule_rid", type=str, required=True) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.pass_obj +def orchestration_schedule_delete( + client: foundry.v2.FoundryClient, + schedule_rid: str, + preview: Optional[bool], +): + """ + Delete the Schedule with the specified rid. + """ + result = client.orchestration.Schedule.delete( + schedule_rid=schedule_rid, + preview=preview, + ) + click.echo(repr(result)) + + @orchestration_schedule.command("get") @click.argument("schedule_rid", type=str, required=True) @click.option("--preview", type=bool, required=False, help="""preview""") @@ -3097,6 +3217,47 @@ def orchestration_schedule_pause( click.echo(repr(result)) +@orchestration_schedule.command("replace") +@click.argument("schedule_rid", type=str, required=True) +@click.option("--action", type=str, required=True, help="""""") +@click.option("--description", type=str, required=False, help="""""") +@click.option("--display_name", type=str, required=False, help="""""") +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.option("--scope_mode", type=str, required=False, help="""""") +@click.option( + "--trigger", + type=str, + required=False, + help="""The schedule trigger. If the requesting user does not have +permission to see the trigger, this will be empty. +""", +) +@click.pass_obj +def orchestration_schedule_replace( + client: foundry.v2.FoundryClient, + schedule_rid: str, + action: str, + description: Optional[str], + display_name: Optional[str], + preview: Optional[bool], + scope_mode: Optional[str], + trigger: Optional[str], +): + """ + Replace the Schedule with the specified rid. + """ + result = client.orchestration.Schedule.replace( + schedule_rid=schedule_rid, + action=json.loads(action), + description=description, + display_name=display_name, + preview=preview, + scope_mode=None if scope_mode is None else json.loads(scope_mode), + trigger=None if trigger is None else json.loads(trigger), + ) + click.echo(repr(result)) + + @orchestration_schedule.command("run") @click.argument("schedule_rid", type=str, required=True) @click.option("--preview", type=bool, required=False, help="""preview""") @@ -3311,6 +3472,98 @@ def streams_dataset_stream_get( click.echo(repr(result)) +@streams_dataset_stream.command("publish_record") +@click.argument("dataset_rid", type=str, required=True) +@click.argument("stream_branch_name", type=str, required=True) +@click.option( + "--record", + type=str, + required=True, + help="""The record to publish to the stream +""", +) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.option( + "--view_rid", + type=str, + required=False, + help="""If provided, this endpoint will only write to the stream corresponding to the specified view rid. If +not provided, this endpoint will write the latest stream on the branch. + +Providing this value is an advanced configuration, to be used when additional control over the +underlying streaming data structures is needed. +""", +) +@click.pass_obj +def streams_dataset_stream_publish_record( + client: foundry.v2.FoundryClient, + dataset_rid: str, + stream_branch_name: str, + record: str, + preview: Optional[bool], + view_rid: Optional[str], +): + """ + Publish a single record to the stream. The record will be validated against the stream's schema, and + rejected if it is invalid. + + """ + result = client.streams.Dataset.Stream.publish_record( + dataset_rid=dataset_rid, + stream_branch_name=stream_branch_name, + record=json.loads(record), + preview=preview, + view_rid=view_rid, + ) + click.echo(repr(result)) + + +@streams_dataset_stream.command("publish_records") +@click.argument("dataset_rid", type=str, required=True) +@click.argument("stream_branch_name", type=str, required=True) +@click.option( + "--records", + type=str, + required=True, + help="""The records to publish to the stream +""", +) +@click.option("--preview", type=bool, required=False, help="""preview""") +@click.option( + "--view_rid", + type=str, + required=False, + help="""If provided, this endpoint will only write to the stream corresponding to the specified view rid. If +not provided, this endpoint will write to the latest stream on the branch. + +Providing this value is an advanced configuration, to be used when additional control over the +underlying streaming data structures is needed. +""", +) +@click.pass_obj +def streams_dataset_stream_publish_records( + client: foundry.v2.FoundryClient, + dataset_rid: str, + stream_branch_name: str, + records: str, + preview: Optional[bool], + view_rid: Optional[str], +): + """ + Publish a batch of records to the stream. The records will be validated against the stream's schema, and + the batch will be rejected if one or more of the records are invalid. + + """ + result = client.streams.Dataset.Stream.publish_records( + dataset_rid=dataset_rid, + stream_branch_name=stream_branch_name, + records=json.loads(records), + preview=preview, + view_rid=view_rid, + ) + click.echo(repr(result)) + + @cli.group("third_party_applications") def third_party_applications(): pass diff --git a/foundry/v2/core/models/__init__.py b/foundry/v2/core/models/__init__.py index b12075cf..b4dd35f0 100644 --- a/foundry/v2/core/models/__init__.py +++ b/foundry/v2/core/models/__init__.py @@ -66,7 +66,6 @@ from foundry.v2.core.models._principal_type import PrincipalType from foundry.v2.core.models._realm import Realm from foundry.v2.core.models._release_status import ReleaseStatus -from foundry.v2.core.models._resource_type import ResourceType from foundry.v2.core.models._short_type import ShortType from foundry.v2.core.models._short_type_dict import ShortTypeDict from foundry.v2.core.models._size_bytes import SizeBytes @@ -86,6 +85,7 @@ from foundry.v2.core.models._updated_by import UpdatedBy from foundry.v2.core.models._updated_time import UpdatedTime from foundry.v2.core.models._user_id import UserId +from foundry.v2.core.models._zone_id import ZoneId __all__ = [ "AttachmentType", @@ -139,7 +139,6 @@ "PrincipalType", "Realm", "ReleaseStatus", - "ResourceType", "ShortType", "ShortTypeDict", "SizeBytes", @@ -159,4 +158,5 @@ "UpdatedBy", "UpdatedTime", "UserId", + "ZoneId", ] diff --git a/foundry/v2/core/models/_resource_type.py b/foundry/v2/core/models/_resource_type.py deleted file mode 100644 index 62ae4866..00000000 --- a/foundry/v2/core/models/_resource_type.py +++ /dev/null @@ -1,71 +0,0 @@ -# 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 - -ResourceType = Literal[ - "Academy_Tutorial", - "Artifacts_Repository", - "Automate_Automation", - "Builder_Pipeline", - "Carbon_Workspace", - "Cipher_Channel", - "Code_Repository", - "Code_Workbook", - "Code_Workspace", - "Connectivity_Agent", - "Connectivity_Source", - "Connectivity_VirtualTable", - "Contour_Analysis", - "Data_Lineage_Graph", - "Datasets_Dataset", - "Filesystem_Document", - "Filesystem_Folder", - "Filesystem_Image", - "Filesystem_Project", - "Filesystem_Space", - "Filesystem_WebLink", - "Foundry_Form", - "Foundry_Report", - "Foundry_Template", - "FoundryRules_Workflow", - "Fusion_Document", - "Logic_Function", - "Machinery_ProcessGraph", - "Maps_Layer", - "Maps_Map", - "Marketplace_Installation", - "Marketplace_LocalStore", - "Marketplace_RemoteStore", - "Media_Set", - "Modeling_Model", - "Modeling_ModelVersion", - "Modeling_Objective", - "Monitoring_MonitoringView", - "Notepad_Document", - "Notepad_Template", - "ObjectExploration_Exploration", - "ObjectExploration_Layout", - "Quiver_Analysis", - "Slate_Application", - "SolutionDesigner_Diagram", - "ThirdPartyApplication_ThirdPartyApplication", - "Unknown", - "Vertex_Graph", - "Workshop_Module", -] -"""The type of a resource.""" diff --git a/foundry/v2/orchestration/models/_zone_id.py b/foundry/v2/core/models/_zone_id.py similarity index 100% rename from foundry/v2/orchestration/models/_zone_id.py rename to foundry/v2/core/models/_zone_id.py diff --git a/foundry/v2/filesystem/models/__init__.py b/foundry/v2/filesystem/models/__init__.py index 1d4e6006..9c135316 100644 --- a/foundry/v2/filesystem/models/__init__.py +++ b/foundry/v2/filesystem/models/__init__.py @@ -20,6 +20,7 @@ from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName from foundry.v2.filesystem.models._resource_path import ResourcePath 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 @@ -31,6 +32,7 @@ "ResourceDisplayName", "ResourcePath", "ResourceRid", + "ResourceType", "SpaceRid", "TrashedStatus", ] diff --git a/foundry/v2/filesystem/models/_resource.py b/foundry/v2/filesystem/models/_resource.py index 9496503a..5663b69c 100644 --- a/foundry/v2/filesystem/models/_resource.py +++ b/foundry/v2/filesystem/models/_resource.py @@ -24,7 +24,6 @@ from foundry.v2.core.models._created_by import CreatedBy from foundry.v2.core.models._created_time import CreatedTime -from foundry.v2.core.models._resource_type import ResourceType 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 @@ -33,6 +32,7 @@ from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName from foundry.v2.filesystem.models._resource_path import ResourcePath 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 diff --git a/foundry/v2/filesystem/models/_resource_dict.py b/foundry/v2/filesystem/models/_resource_dict.py index aad0a788..c7779fdf 100644 --- a/foundry/v2/filesystem/models/_resource_dict.py +++ b/foundry/v2/filesystem/models/_resource_dict.py @@ -21,7 +21,6 @@ from foundry.v2.core.models._created_by import CreatedBy from foundry.v2.core.models._created_time import CreatedTime -from foundry.v2.core.models._resource_type import ResourceType 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 @@ -29,6 +28,7 @@ from foundry.v2.filesystem.models._resource_display_name import ResourceDisplayName from foundry.v2.filesystem.models._resource_path import ResourcePath 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 diff --git a/foundry/v2/filesystem/models/_resource_type.py b/foundry/v2/filesystem/models/_resource_type.py new file mode 100644 index 00000000..a8d0fa28 --- /dev/null +++ b/foundry/v2/filesystem/models/_resource_type.py @@ -0,0 +1,68 @@ +# 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 + +ResourceType = Literal[ + "ARTIFACTS_REPOSITORY", + "BELLASO_CIPHER_CHANNEL", + "BLOBSTER_DOCUMENT", + "BLOBSTER_IMAGE", + "CARBON_WORKSPACE", + "COMPASS_FOLDER", + "COMPASS_WEB_LINK", + "CONTOUR_ANALYSIS", + "DATA_HEALTH_MONITORING_VIEW", + "EDDIE_LOGIC", + "EDDIE_PIPELINE", + "FFORMS_FORM", + "FOUNDRY_DATASET", + "FOUNDRY_ACADEMY_TUTORIAL", + "FOUNDRY_CONTAINER_SERVICE_CONTAINER", + "FOUNDRY_ML_OBJECTIVE", + "FOUNDRY_TEMPLATES_TEMPLATE", + "FUSION_DOCUMENT", + "HUBBLE_EXPLORATION_LAYOUT", + "MACHINERY_DOCUMENT", + "MAGRITTE_AGENT", + "MAGRITTE_SOURCE", + "MARKETPLACE_BLOCK_SET_INSTALLATION", + "MARKETPLACE_LOCAL", + "MARKETPLACE_REMOTE_STORE", + "MIO_MEDIA_SET", + "MODELS_MODEL", + "MODELS_MODEL_VERSION", + "MONOCLE_GRAPH", + "NOTEPAD_NOTEPAD", + "NOTEPAD_NOTEPAD_TEMPLATE", + "OBJECT_SENTINEL_MONITOR", + "OBJECT_SET_VERSIONED_OBJECT_SET", + "OPUS_GRAPH", + "OPUS_MAP", + "OPUS_MAP_LAYER", + "QUIVER_ANALYSIS", + "REPORT_REPORT", + "SLATE_DOCUMENT", + "SOLUTION_DESIGN_DIAGRAM", + "STEMMA_REPOSITORY", + "TABLES_TABLE", + "TAURUS_WORKFLOW", + "THIRD_PARTY_APPLICATIONS_APPLICATION", + "VECTOR_WORKBOOK", + "WORKSHOP_MODULE", +] +"""The type of the Resource derived from the Resource Identifier (RID).""" diff --git a/foundry/v2/filesystem/resource.py b/foundry/v2/filesystem/resource.py index c04d0907..53651a66 100644 --- a/foundry/v2/filesystem/resource.py +++ b/foundry/v2/filesystem/resource.py @@ -37,6 +37,47 @@ class ResourceClient: def __init__(self, auth: Auth, hostname: str) -> None: self._api_client = ApiClient(auth=auth, hostname=hostname) + @validate_call + @handle_unexpected + def delete( + self, + resource_rid: ResourceRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Move the given resource to the trash. Following this operation, the resource can be restored, using the + `restore` operation, or permanently deleted using the `permanentlyDelete` operation. + + :param resource_rid: resourceRid + :type resource_rid: ResourceRid + :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: None + """ + + return self._api_client.call_api( + RequestInfo( + method="DELETE", + resource_path="/v2/filesystem/resources/{resourceRid}", + query_params={ + "preview": preview, + }, + path_params={ + "resourceRid": resource_rid, + }, + header_params={}, + body=None, + body_type=None, + response_type=None, + request_timeout=request_timeout, + ), + ) + @validate_call @handle_unexpected def get( @@ -77,3 +118,85 @@ def get( request_timeout=request_timeout, ), ) + + @validate_call + @handle_unexpected + def permanently_delete( + self, + resource_rid: ResourceRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Permanently delete the given resource from the trash. If the Resource is not directly trashed, a + `ResourceNotTrashed` error will be thrown. + + :param resource_rid: resourceRid + :type resource_rid: ResourceRid + :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: None + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/filesystem/resources/{resourceRid}/permanentlyDelete", + query_params={ + "preview": preview, + }, + path_params={ + "resourceRid": resource_rid, + }, + header_params={}, + body=None, + body_type=None, + response_type=None, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def restore( + self, + resource_rid: ResourceRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Restore the given resource and any directly trashed ancestors from the trash. If the resource is not + trashed, this operation will be ignored. + + :param resource_rid: resourceRid + :type resource_rid: ResourceRid + :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: None + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/filesystem/resources/{resourceRid}/restore", + query_params={ + "preview": preview, + }, + path_params={ + "resourceRid": resource_rid, + }, + header_params={}, + body=None, + body_type=None, + response_type=None, + request_timeout=request_timeout, + ), + ) diff --git a/foundry/v2/orchestration/models/__init__.py b/foundry/v2/orchestration/models/__init__.py index 5e4d4fa4..372dcdcb 100644 --- a/foundry/v2/orchestration/models/__init__.py +++ b/foundry/v2/orchestration/models/__init__.py @@ -24,8 +24,33 @@ from foundry.v2.orchestration.models._build_status import BuildStatus from foundry.v2.orchestration.models._build_target import BuildTarget from foundry.v2.orchestration.models._build_target_dict import BuildTargetDict +from foundry.v2.orchestration.models._buildable_rid import BuildableRid from foundry.v2.orchestration.models._connecting_target import ConnectingTarget from foundry.v2.orchestration.models._connecting_target_dict import ConnectingTargetDict +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_connecting_target_dict import ( + CreateScheduleRequestActionBuildTargetConnectingTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_dict import ( + CreateScheduleRequestActionBuildTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_manual_target_dict import ( + CreateScheduleRequestActionBuildTargetManualTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_upstream_target_dict import ( + CreateScheduleRequestActionBuildTargetUpstreamTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_dict import ( + CreateScheduleRequestActionDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_dict import ( + CreateScheduleRequestScopeModeDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_project_scope_dict import ( + CreateScheduleRequestScopeModeProjectScopeDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_user_scope_dict import ( + CreateScheduleRequestScopeModeUserScopeDict, +) # NOQA from foundry.v2.orchestration.models._cron_expression import CronExpression from foundry.v2.orchestration.models._dataset_updated_trigger import DatasetUpdatedTrigger # NOQA from foundry.v2.orchestration.models._dataset_updated_trigger_dict import ( @@ -52,6 +77,30 @@ from foundry.v2.orchestration.models._or_trigger_dict import OrTriggerDict from foundry.v2.orchestration.models._project_scope import ProjectScope from foundry.v2.orchestration.models._project_scope_dict import ProjectScopeDict +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_connecting_target_dict import ( + ReplaceScheduleRequestActionBuildTargetConnectingTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_dict import ( + ReplaceScheduleRequestActionBuildTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_manual_target_dict import ( + ReplaceScheduleRequestActionBuildTargetManualTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_upstream_target_dict import ( + ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_dict import ( + ReplaceScheduleRequestActionDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_dict import ( + ReplaceScheduleRequestScopeModeDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_project_scope_dict import ( + ReplaceScheduleRequestScopeModeProjectScopeDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_user_scope_dict import ( + ReplaceScheduleRequestScopeModeUserScopeDict, +) # NOQA from foundry.v2.orchestration.models._retry_backoff_duration import RetryBackoffDuration from foundry.v2.orchestration.models._retry_backoff_duration_dict import ( RetryBackoffDurationDict, @@ -94,7 +143,6 @@ from foundry.v2.orchestration.models._upstream_target_dict import UpstreamTargetDict from foundry.v2.orchestration.models._user_scope import UserScope from foundry.v2.orchestration.models._user_scope_dict import UserScopeDict -from foundry.v2.orchestration.models._zone_id import ZoneId __all__ = [ "AbortOnFailure", @@ -108,8 +156,17 @@ "BuildStatus", "BuildTarget", "BuildTargetDict", + "BuildableRid", "ConnectingTarget", "ConnectingTargetDict", + "CreateScheduleRequestActionBuildTargetConnectingTargetDict", + "CreateScheduleRequestActionBuildTargetDict", + "CreateScheduleRequestActionBuildTargetManualTargetDict", + "CreateScheduleRequestActionBuildTargetUpstreamTargetDict", + "CreateScheduleRequestActionDict", + "CreateScheduleRequestScopeModeDict", + "CreateScheduleRequestScopeModeProjectScopeDict", + "CreateScheduleRequestScopeModeUserScopeDict", "CronExpression", "DatasetUpdatedTrigger", "DatasetUpdatedTriggerDict", @@ -128,6 +185,14 @@ "OrTriggerDict", "ProjectScope", "ProjectScopeDict", + "ReplaceScheduleRequestActionBuildTargetConnectingTargetDict", + "ReplaceScheduleRequestActionBuildTargetDict", + "ReplaceScheduleRequestActionBuildTargetManualTargetDict", + "ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict", + "ReplaceScheduleRequestActionDict", + "ReplaceScheduleRequestScopeModeDict", + "ReplaceScheduleRequestScopeModeProjectScopeDict", + "ReplaceScheduleRequestScopeModeUserScopeDict", "RetryBackoffDuration", "RetryBackoffDurationDict", "RetryCount", @@ -160,5 +225,4 @@ "UpstreamTargetDict", "UserScope", "UserScopeDict", - "ZoneId", ] diff --git a/foundry/v2/orchestration/models/_buildable_rid.py b/foundry/v2/orchestration/models/_buildable_rid.py new file mode 100644 index 00000000..4b6c8e85 --- /dev/null +++ b/foundry/v2/orchestration/models/_buildable_rid.py @@ -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.utils import RID + +BuildableRid = RID +""" +The Resource Identifier (RID) of a Resource that can be built. For example, this is a Dataset RID, Media Set +RID or Restricted View RID. +""" diff --git a/foundry/v2/orchestration/models/_connecting_target.py b/foundry/v2/orchestration/models/_connecting_target.py index d9df857e..88e32f1f 100644 --- a/foundry/v2/orchestration/models/_connecting_target.py +++ b/foundry/v2/orchestration/models/_connecting_target.py @@ -22,7 +22,7 @@ from pydantic import BaseModel from pydantic import Field -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid from foundry.v2.orchestration.models._connecting_target_dict import ConnectingTargetDict @@ -32,13 +32,13 @@ class ConnectingTarget(BaseModel): target datasets (inclusive) except for the datasets to ignore. """ - input_dataset_rids: List[DatasetRid] = Field(alias="inputDatasetRids") + input_rids: List[BuildableRid] = Field(alias="inputRids") """The upstream input datasets (exclusive).""" - target_dataset_rids: List[DatasetRid] = Field(alias="targetDatasetRids") + target_rids: List[BuildableRid] = Field(alias="targetRids") """The downstream target datasets (inclusive).""" - ignored_dataset_rids: List[DatasetRid] = Field(alias="ignoredDatasetRids") + ignored_rids: List[BuildableRid] = Field(alias="ignoredRids") """The datasets between the input datasets and target datasets to exclude.""" type: Literal["connecting"] diff --git a/foundry/v2/orchestration/models/_connecting_target_dict.py b/foundry/v2/orchestration/models/_connecting_target_dict.py index 1250aba2..226782be 100644 --- a/foundry/v2/orchestration/models/_connecting_target_dict.py +++ b/foundry/v2/orchestration/models/_connecting_target_dict.py @@ -20,7 +20,7 @@ from typing_extensions import TypedDict -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid class ConnectingTargetDict(TypedDict): @@ -31,13 +31,13 @@ class ConnectingTargetDict(TypedDict): __pydantic_config__ = {"extra": "allow"} # type: ignore - inputDatasetRids: List[DatasetRid] + inputRids: List[BuildableRid] """The upstream input datasets (exclusive).""" - targetDatasetRids: List[DatasetRid] + targetRids: List[BuildableRid] """The downstream target datasets (inclusive).""" - ignoredDatasetRids: List[DatasetRid] + ignoredRids: List[BuildableRid] """The datasets between the input datasets and target datasets to exclude.""" type: Literal["connecting"] diff --git a/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_connecting_target_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_connecting_target_dict.py new file mode 100644 index 00000000..b6a1770f --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_connecting_target_dict.py @@ -0,0 +1,41 @@ +# 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 Literal + +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class CreateScheduleRequestActionBuildTargetConnectingTargetDict(TypedDict): + """CreateScheduleRequestActionBuildTargetConnectingTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + ignoredRids: NotRequired[List[BuildableRid]] + """The datasets between the input datasets and target datasets to exclude.""" + + targetRids: List[BuildableRid] + """The downstream target datasets (inclusive).""" + + inputRids: List[BuildableRid] + """The upstream input datasets (exclusive).""" + + type: Literal["connecting"] diff --git a/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_dict.py new file mode 100644 index 00000000..22f00129 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_dict.py @@ -0,0 +1,41 @@ +# 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 Union + +from pydantic import Field +from typing_extensions import Annotated + +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_connecting_target_dict import ( + CreateScheduleRequestActionBuildTargetConnectingTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_manual_target_dict import ( + CreateScheduleRequestActionBuildTargetManualTargetDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_upstream_target_dict import ( + CreateScheduleRequestActionBuildTargetUpstreamTargetDict, +) # NOQA + +CreateScheduleRequestActionBuildTargetDict = Annotated[ + Union[ + CreateScheduleRequestActionBuildTargetUpstreamTargetDict, + CreateScheduleRequestActionBuildTargetManualTargetDict, + CreateScheduleRequestActionBuildTargetConnectingTargetDict, + ], + Field(discriminator="type"), +] +"""The targets of the build.""" diff --git a/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_manual_target_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_manual_target_dict.py new file mode 100644 index 00000000..c9e69976 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_manual_target_dict.py @@ -0,0 +1,33 @@ +# 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 Literal + +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class CreateScheduleRequestActionBuildTargetManualTargetDict(TypedDict): + """CreateScheduleRequestActionBuildTargetManualTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + targetRids: List[BuildableRid] + + type: Literal["manual"] diff --git a/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_upstream_target_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_upstream_target_dict.py new file mode 100644 index 00000000..12babc08 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_action_build_target_upstream_target_dict.py @@ -0,0 +1,38 @@ +# 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 Literal + +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class CreateScheduleRequestActionBuildTargetUpstreamTargetDict(TypedDict): + """CreateScheduleRequestActionBuildTargetUpstreamTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + ignoredRids: NotRequired[List[BuildableRid]] + """The datasets to ignore when calculating the final set of dataset to build.""" + + targetRids: List[BuildableRid] + """The target datasets.""" + + type: Literal["upstream"] diff --git a/foundry/v2/orchestration/models/_create_schedule_request_action_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_action_dict.py new file mode 100644 index 00000000..c124bbdd --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_action_dict.py @@ -0,0 +1,55 @@ +# 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.datasets.models._branch_name import BranchName +from foundry.v2.orchestration.models._abort_on_failure import AbortOnFailure +from foundry.v2.orchestration.models._create_schedule_request_action_build_target_dict import ( + CreateScheduleRequestActionBuildTargetDict, +) # NOQA +from foundry.v2.orchestration.models._fallback_branches import FallbackBranches +from foundry.v2.orchestration.models._force_build import ForceBuild +from foundry.v2.orchestration.models._notifications_enabled import NotificationsEnabled +from foundry.v2.orchestration.models._retry_backoff_duration_dict import ( + RetryBackoffDurationDict, +) # NOQA +from foundry.v2.orchestration.models._retry_count import RetryCount + + +class CreateScheduleRequestActionDict(TypedDict): + """CreateScheduleRequestAction""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + abortOnFailure: NotRequired[AbortOnFailure] + + forceBuild: NotRequired[ForceBuild] + + retryBackoffDuration: NotRequired[RetryBackoffDurationDict] + + retryCount: NotRequired[RetryCount] + + fallbackBranches: NotRequired[FallbackBranches] + + branchName: NotRequired[BranchName] + """The target branch the schedule should run on.""" + + notificationsEnabled: NotRequired[NotificationsEnabled] + + target: CreateScheduleRequestActionBuildTargetDict diff --git a/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_dict.py new file mode 100644 index 00000000..59de7420 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_dict.py @@ -0,0 +1,36 @@ +# 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 Union + +from pydantic import Field +from typing_extensions import Annotated + +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_project_scope_dict import ( + CreateScheduleRequestScopeModeProjectScopeDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_user_scope_dict import ( + CreateScheduleRequestScopeModeUserScopeDict, +) # NOQA + +CreateScheduleRequestScopeModeDict = Annotated[ + Union[ + CreateScheduleRequestScopeModeProjectScopeDict, CreateScheduleRequestScopeModeUserScopeDict + ], + Field(discriminator="type"), +] +"""The boundaries for the schedule build.""" diff --git a/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_project_scope_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_project_scope_dict.py new file mode 100644 index 00000000..953718f5 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_project_scope_dict.py @@ -0,0 +1,33 @@ +# 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 Literal + +from typing_extensions import TypedDict + +from foundry.v2.filesystem.models._project_rid import ProjectRid + + +class CreateScheduleRequestScopeModeProjectScopeDict(TypedDict): + """CreateScheduleRequestScopeModeProjectScope""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + projectRids: List[ProjectRid] + + type: Literal["project"] diff --git a/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_user_scope_dict.py b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_user_scope_dict.py new file mode 100644 index 00000000..a91d25c0 --- /dev/null +++ b/foundry/v2/orchestration/models/_create_schedule_request_scope_mode_user_scope_dict.py @@ -0,0 +1,28 @@ +# 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 + +from typing_extensions import TypedDict + + +class CreateScheduleRequestScopeModeUserScopeDict(TypedDict): + """CreateScheduleRequestScopeModeUserScope""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + type: Literal["user"] diff --git a/foundry/v2/orchestration/models/_manual_target.py b/foundry/v2/orchestration/models/_manual_target.py index 3e0cd51f..7bc4bb72 100644 --- a/foundry/v2/orchestration/models/_manual_target.py +++ b/foundry/v2/orchestration/models/_manual_target.py @@ -22,14 +22,14 @@ from pydantic import BaseModel from pydantic import Field -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid from foundry.v2.orchestration.models._manual_target_dict import ManualTargetDict class ManualTarget(BaseModel): """Manually specify all datasets to build.""" - dataset_rids: List[DatasetRid] = Field(alias="datasetRids") + target_rids: List[BuildableRid] = Field(alias="targetRids") type: Literal["manual"] diff --git a/foundry/v2/orchestration/models/_manual_target_dict.py b/foundry/v2/orchestration/models/_manual_target_dict.py index 55f49842..a99a5f0e 100644 --- a/foundry/v2/orchestration/models/_manual_target_dict.py +++ b/foundry/v2/orchestration/models/_manual_target_dict.py @@ -20,7 +20,7 @@ from typing_extensions import TypedDict -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid class ManualTargetDict(TypedDict): @@ -28,6 +28,6 @@ class ManualTargetDict(TypedDict): __pydantic_config__ = {"extra": "allow"} # type: ignore - datasetRids: List[DatasetRid] + targetRids: List[BuildableRid] type: Literal["manual"] diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_connecting_target_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_connecting_target_dict.py new file mode 100644 index 00000000..38cd668d --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_connecting_target_dict.py @@ -0,0 +1,41 @@ +# 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 Literal + +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class ReplaceScheduleRequestActionBuildTargetConnectingTargetDict(TypedDict): + """ReplaceScheduleRequestActionBuildTargetConnectingTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + ignoredRids: NotRequired[List[BuildableRid]] + """The datasets between the input datasets and target datasets to exclude.""" + + targetRids: List[BuildableRid] + """The downstream target datasets (inclusive).""" + + inputRids: List[BuildableRid] + """The upstream input datasets (exclusive).""" + + type: Literal["connecting"] diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_dict.py new file mode 100644 index 00000000..7a211624 --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_dict.py @@ -0,0 +1,41 @@ +# 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 Union + +from pydantic import Field +from typing_extensions import Annotated + +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_connecting_target_dict import ( + ReplaceScheduleRequestActionBuildTargetConnectingTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_manual_target_dict import ( + ReplaceScheduleRequestActionBuildTargetManualTargetDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_upstream_target_dict import ( + ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict, +) # NOQA + +ReplaceScheduleRequestActionBuildTargetDict = Annotated[ + Union[ + ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict, + ReplaceScheduleRequestActionBuildTargetManualTargetDict, + ReplaceScheduleRequestActionBuildTargetConnectingTargetDict, + ], + Field(discriminator="type"), +] +"""The targets of the build.""" diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_manual_target_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_manual_target_dict.py new file mode 100644 index 00000000..a4ee214b --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_manual_target_dict.py @@ -0,0 +1,33 @@ +# 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 Literal + +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class ReplaceScheduleRequestActionBuildTargetManualTargetDict(TypedDict): + """ReplaceScheduleRequestActionBuildTargetManualTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + targetRids: List[BuildableRid] + + type: Literal["manual"] diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_upstream_target_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_upstream_target_dict.py new file mode 100644 index 00000000..60062077 --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_action_build_target_upstream_target_dict.py @@ -0,0 +1,38 @@ +# 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 Literal + +from typing_extensions import NotRequired +from typing_extensions import TypedDict + +from foundry.v2.orchestration.models._buildable_rid import BuildableRid + + +class ReplaceScheduleRequestActionBuildTargetUpstreamTargetDict(TypedDict): + """ReplaceScheduleRequestActionBuildTargetUpstreamTarget""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + ignoredRids: NotRequired[List[BuildableRid]] + """The datasets to ignore when calculating the final set of dataset to build.""" + + targetRids: List[BuildableRid] + """The target datasets.""" + + type: Literal["upstream"] diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_action_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_action_dict.py new file mode 100644 index 00000000..6a405982 --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_action_dict.py @@ -0,0 +1,55 @@ +# 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.datasets.models._branch_name import BranchName +from foundry.v2.orchestration.models._abort_on_failure import AbortOnFailure +from foundry.v2.orchestration.models._fallback_branches import FallbackBranches +from foundry.v2.orchestration.models._force_build import ForceBuild +from foundry.v2.orchestration.models._notifications_enabled import NotificationsEnabled +from foundry.v2.orchestration.models._replace_schedule_request_action_build_target_dict import ( + ReplaceScheduleRequestActionBuildTargetDict, +) # NOQA +from foundry.v2.orchestration.models._retry_backoff_duration_dict import ( + RetryBackoffDurationDict, +) # NOQA +from foundry.v2.orchestration.models._retry_count import RetryCount + + +class ReplaceScheduleRequestActionDict(TypedDict): + """ReplaceScheduleRequestAction""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + abortOnFailure: NotRequired[AbortOnFailure] + + forceBuild: NotRequired[ForceBuild] + + retryBackoffDuration: NotRequired[RetryBackoffDurationDict] + + retryCount: NotRequired[RetryCount] + + fallbackBranches: NotRequired[FallbackBranches] + + branchName: NotRequired[BranchName] + """The target branch the schedule should run on.""" + + notificationsEnabled: NotRequired[NotificationsEnabled] + + target: ReplaceScheduleRequestActionBuildTargetDict diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_dict.py new file mode 100644 index 00000000..d551cf5c --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_dict.py @@ -0,0 +1,37 @@ +# 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 Union + +from pydantic import Field +from typing_extensions import Annotated + +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_project_scope_dict import ( + ReplaceScheduleRequestScopeModeProjectScopeDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_user_scope_dict import ( + ReplaceScheduleRequestScopeModeUserScopeDict, +) # NOQA + +ReplaceScheduleRequestScopeModeDict = Annotated[ + Union[ + ReplaceScheduleRequestScopeModeProjectScopeDict, + ReplaceScheduleRequestScopeModeUserScopeDict, + ], + Field(discriminator="type"), +] +"""The boundaries for the schedule build.""" diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_project_scope_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_project_scope_dict.py new file mode 100644 index 00000000..624ab46c --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_project_scope_dict.py @@ -0,0 +1,33 @@ +# 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 Literal + +from typing_extensions import TypedDict + +from foundry.v2.filesystem.models._project_rid import ProjectRid + + +class ReplaceScheduleRequestScopeModeProjectScopeDict(TypedDict): + """ReplaceScheduleRequestScopeModeProjectScope""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + projectRids: List[ProjectRid] + + type: Literal["project"] diff --git a/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_user_scope_dict.py b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_user_scope_dict.py new file mode 100644 index 00000000..3b0c57e6 --- /dev/null +++ b/foundry/v2/orchestration/models/_replace_schedule_request_scope_mode_user_scope_dict.py @@ -0,0 +1,28 @@ +# 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 + +from typing_extensions import TypedDict + + +class ReplaceScheduleRequestScopeModeUserScopeDict(TypedDict): + """ReplaceScheduleRequestScopeModeUserScope""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + type: Literal["user"] diff --git a/foundry/v2/orchestration/models/_time_trigger.py b/foundry/v2/orchestration/models/_time_trigger.py index 1f8d5e10..3cb248a0 100644 --- a/foundry/v2/orchestration/models/_time_trigger.py +++ b/foundry/v2/orchestration/models/_time_trigger.py @@ -21,9 +21,9 @@ from pydantic import BaseModel from pydantic import Field +from foundry.v2.core.models._zone_id import ZoneId from foundry.v2.orchestration.models._cron_expression import CronExpression from foundry.v2.orchestration.models._time_trigger_dict import TimeTriggerDict -from foundry.v2.orchestration.models._zone_id import ZoneId class TimeTrigger(BaseModel): diff --git a/foundry/v2/orchestration/models/_time_trigger_dict.py b/foundry/v2/orchestration/models/_time_trigger_dict.py index 745500bb..5602f1e5 100644 --- a/foundry/v2/orchestration/models/_time_trigger_dict.py +++ b/foundry/v2/orchestration/models/_time_trigger_dict.py @@ -19,8 +19,8 @@ from typing_extensions import TypedDict +from foundry.v2.core.models._zone_id import ZoneId from foundry.v2.orchestration.models._cron_expression import CronExpression -from foundry.v2.orchestration.models._zone_id import ZoneId class TimeTriggerDict(TypedDict): diff --git a/foundry/v2/orchestration/models/_upstream_target.py b/foundry/v2/orchestration/models/_upstream_target.py index 916b739e..65a123f1 100644 --- a/foundry/v2/orchestration/models/_upstream_target.py +++ b/foundry/v2/orchestration/models/_upstream_target.py @@ -22,17 +22,17 @@ from pydantic import BaseModel from pydantic import Field -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid from foundry.v2.orchestration.models._upstream_target_dict import UpstreamTargetDict class UpstreamTarget(BaseModel): """Target the specified datasets along with all upstream datasets except the ignored datasets.""" - dataset_rids: List[DatasetRid] = Field(alias="datasetRids") + target_rids: List[BuildableRid] = Field(alias="targetRids") """The target datasets.""" - ignored_dataset_rids: List[DatasetRid] = Field(alias="ignoredDatasetRids") + ignored_rids: List[BuildableRid] = Field(alias="ignoredRids") """The datasets to ignore when calculating the final set of dataset to build.""" type: Literal["upstream"] diff --git a/foundry/v2/orchestration/models/_upstream_target_dict.py b/foundry/v2/orchestration/models/_upstream_target_dict.py index 685e3048..08fed5d6 100644 --- a/foundry/v2/orchestration/models/_upstream_target_dict.py +++ b/foundry/v2/orchestration/models/_upstream_target_dict.py @@ -20,7 +20,7 @@ from typing_extensions import TypedDict -from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.orchestration.models._buildable_rid import BuildableRid class UpstreamTargetDict(TypedDict): @@ -28,10 +28,10 @@ class UpstreamTargetDict(TypedDict): __pydantic_config__ = {"extra": "allow"} # type: ignore - datasetRids: List[DatasetRid] + targetRids: List[BuildableRid] """The target datasets.""" - ignoredDatasetRids: List[DatasetRid] + ignoredRids: List[BuildableRid] """The datasets to ignore when calculating the final set of dataset to build.""" type: Literal["upstream"] diff --git a/foundry/v2/orchestration/schedule.py b/foundry/v2/orchestration/schedule.py index e33d4be8..f43df6ad 100644 --- a/foundry/v2/orchestration/schedule.py +++ b/foundry/v2/orchestration/schedule.py @@ -21,23 +21,144 @@ from pydantic import Field from pydantic import StrictInt +from pydantic import StrictStr 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._errors import handle_unexpected from foundry.v2.core.models._preview_mode import PreviewMode +from foundry.v2.orchestration.models._create_schedule_request_action_dict import ( + CreateScheduleRequestActionDict, +) # NOQA +from foundry.v2.orchestration.models._create_schedule_request_scope_mode_dict import ( + CreateScheduleRequestScopeModeDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_action_dict import ( + ReplaceScheduleRequestActionDict, +) # NOQA +from foundry.v2.orchestration.models._replace_schedule_request_scope_mode_dict import ( + ReplaceScheduleRequestScopeModeDict, +) # NOQA from foundry.v2.orchestration.models._schedule import Schedule from foundry.v2.orchestration.models._schedule_rid import ScheduleRid from foundry.v2.orchestration.models._schedule_run import ScheduleRun +from foundry.v2.orchestration.models._trigger_dict import TriggerDict class ScheduleClient: def __init__(self, auth: Auth, hostname: str) -> None: self._api_client = ApiClient(auth=auth, hostname=hostname) + @validate_call + @handle_unexpected + def create( + self, + *, + action: CreateScheduleRequestActionDict, + description: Optional[StrictStr] = None, + display_name: Optional[StrictStr] = None, + preview: Optional[PreviewMode] = None, + scope_mode: Optional[CreateScheduleRequestScopeModeDict] = None, + trigger: Optional[TriggerDict] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> Schedule: + """ + Creates a new Schedule. + :param action: + :type action: CreateScheduleRequestActionDict + :param description: + :type description: Optional[StrictStr] + :param display_name: + :type display_name: Optional[StrictStr] + :param preview: preview + :type preview: Optional[PreviewMode] + :param scope_mode: + :type scope_mode: Optional[CreateScheduleRequestScopeModeDict] + :param trigger: The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. + :type trigger: Optional[TriggerDict] + :param request_timeout: timeout setting for this request in seconds. + :type request_timeout: Optional[int] + :return: Returns the result object. + :rtype: Schedule + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/orchestration/schedules", + query_params={ + "preview": preview, + }, + path_params={}, + header_params={ + "Content-Type": "application/json", + "Accept": "application/json", + }, + body={ + "displayName": display_name, + "description": description, + "action": action, + "trigger": trigger, + "scopeMode": scope_mode, + }, + body_type=TypedDict( + "Body", + { # type: ignore + "displayName": Optional[StrictStr], + "description": Optional[StrictStr], + "action": CreateScheduleRequestActionDict, + "trigger": Optional[TriggerDict], + "scopeMode": Optional[CreateScheduleRequestScopeModeDict], + }, + ), + response_type=Schedule, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def delete( + self, + schedule_rid: ScheduleRid, + *, + preview: Optional[PreviewMode] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Delete the Schedule with the specified rid. + :param schedule_rid: scheduleRid + :type schedule_rid: ScheduleRid + :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: None + """ + + return self._api_client.call_api( + RequestInfo( + method="DELETE", + resource_path="/v2/orchestration/schedules/{scheduleRid}", + query_params={ + "preview": preview, + }, + path_params={ + "scheduleRid": schedule_rid, + }, + header_params={}, + body=None, + body_type=None, + response_type=None, + request_timeout=request_timeout, + ), + ) + @validate_call @handle_unexpected def get( @@ -118,6 +239,78 @@ def pause( ), ) + @validate_call + @handle_unexpected + def replace( + self, + schedule_rid: ScheduleRid, + *, + action: ReplaceScheduleRequestActionDict, + description: Optional[StrictStr] = None, + display_name: Optional[StrictStr] = None, + preview: Optional[PreviewMode] = None, + scope_mode: Optional[ReplaceScheduleRequestScopeModeDict] = None, + trigger: Optional[TriggerDict] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> Schedule: + """ + Replace the Schedule with the specified rid. + :param schedule_rid: scheduleRid + :type schedule_rid: ScheduleRid + :param action: + :type action: ReplaceScheduleRequestActionDict + :param description: + :type description: Optional[StrictStr] + :param display_name: + :type display_name: Optional[StrictStr] + :param preview: preview + :type preview: Optional[PreviewMode] + :param scope_mode: + :type scope_mode: Optional[ReplaceScheduleRequestScopeModeDict] + :param trigger: The schedule trigger. If the requesting user does not have permission to see the trigger, this will be empty. + :type trigger: Optional[TriggerDict] + :param request_timeout: timeout setting for this request in seconds. + :type request_timeout: Optional[int] + :return: Returns the result object. + :rtype: Schedule + """ + + return self._api_client.call_api( + RequestInfo( + method="PUT", + resource_path="/v2/orchestration/schedules/{scheduleRid}", + query_params={ + "preview": preview, + }, + path_params={ + "scheduleRid": schedule_rid, + }, + header_params={ + "Content-Type": "application/json", + "Accept": "application/json", + }, + body={ + "displayName": display_name, + "description": description, + "action": action, + "trigger": trigger, + "scopeMode": scope_mode, + }, + body_type=TypedDict( + "Body", + { # type: ignore + "displayName": Optional[StrictStr], + "description": Optional[StrictStr], + "action": ReplaceScheduleRequestActionDict, + "trigger": Optional[TriggerDict], + "scopeMode": Optional[ReplaceScheduleRequestScopeModeDict], + }, + ), + response_type=Schedule, + request_timeout=request_timeout, + ), + ) + @validate_call @handle_unexpected def run( diff --git a/foundry/v2/streams/models/__init__.py b/foundry/v2/streams/models/__init__.py index 0131abe2..86c45fc1 100644 --- a/foundry/v2/streams/models/__init__.py +++ b/foundry/v2/streams/models/__init__.py @@ -17,6 +17,7 @@ from foundry.v2.streams.models._dataset import Dataset from foundry.v2.streams.models._dataset_dict import DatasetDict from foundry.v2.streams.models._partitions_count import PartitionsCount +from foundry.v2.streams.models._record import Record from foundry.v2.streams.models._stream import Stream from foundry.v2.streams.models._stream_dict import StreamDict from foundry.v2.streams.models._stream_type import StreamType @@ -27,6 +28,7 @@ "Dataset", "DatasetDict", "PartitionsCount", + "Record", "Stream", "StreamDict", "StreamType", diff --git a/foundry/v2/streams/models/_record.py b/foundry/v2/streams/models/_record.py new file mode 100644 index 00000000..ecde22c6 --- /dev/null +++ b/foundry/v2/streams/models/_record.py @@ -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 typing import Any +from typing import Dict + +from pydantic import StrictStr + +Record = Dict[StrictStr, Any] +"""A record to be published to a stream.""" diff --git a/foundry/v2/streams/stream.py b/foundry/v2/streams/stream.py index 7f9756e8..419103bf 100644 --- a/foundry/v2/streams/stream.py +++ b/foundry/v2/streams/stream.py @@ -17,12 +17,14 @@ from typing import Any from typing import Dict +from typing import List 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 @@ -31,7 +33,9 @@ from foundry.v2.core.models._preview_mode import PreviewMode from foundry.v2.datasets.models._branch_name import BranchName from foundry.v2.datasets.models._dataset_rid import DatasetRid +from foundry.v2.streams.models._record import Record from foundry.v2.streams.models._stream import Stream +from foundry.v2.streams.models._view_rid import ViewRid class StreamClient: @@ -84,3 +88,127 @@ def get( request_timeout=request_timeout, ), ) + + @validate_call + @handle_unexpected + def publish_record( + self, + dataset_rid: DatasetRid, + stream_branch_name: BranchName, + *, + record: Record, + preview: Optional[PreviewMode] = None, + view_rid: Optional[ViewRid] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Publish a single record to the stream. The record will be validated against the stream's schema, and + rejected if it is invalid. + + :param dataset_rid: datasetRid + :type dataset_rid: DatasetRid + :param stream_branch_name: streamBranchName + :type stream_branch_name: BranchName + :param record: The record to publish to the stream + :type record: Record + :param preview: preview + :type preview: Optional[PreviewMode] + :param view_rid: If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. + :type view_rid: Optional[ViewRid] + :param request_timeout: timeout setting for this request in seconds. + :type request_timeout: Optional[int] + :return: Returns the result object. + :rtype: None + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/highScale/streams/datasets/{datasetRid}/streams/{streamBranchName}/publishRecord", + query_params={ + "preview": preview, + }, + path_params={ + "datasetRid": dataset_rid, + "streamBranchName": stream_branch_name, + }, + header_params={ + "Content-Type": "application/json", + }, + body={ + "record": record, + "viewRid": view_rid, + }, + body_type=TypedDict( + "Body", + { # type: ignore + "record": Record, + "viewRid": Optional[ViewRid], + }, + ), + response_type=None, + request_timeout=request_timeout, + ), + ) + + @validate_call + @handle_unexpected + def publish_records( + self, + dataset_rid: DatasetRid, + stream_branch_name: BranchName, + *, + records: List[Record], + preview: Optional[PreviewMode] = None, + view_rid: Optional[ViewRid] = None, + request_timeout: Optional[Annotated[StrictInt, Field(gt=0)]] = None, + ) -> None: + """ + Publish a batch of records to the stream. The records will be validated against the stream's schema, and + the batch will be rejected if one or more of the records are invalid. + + :param dataset_rid: datasetRid + :type dataset_rid: DatasetRid + :param stream_branch_name: streamBranchName + :type stream_branch_name: BranchName + :param records: The records to publish to the stream + :type records: List[Record] + :param preview: preview + :type preview: Optional[PreviewMode] + :param view_rid: If provided, this endpoint will only write to the stream corresponding to the specified view rid. If not provided, this endpoint will write to the latest stream on the branch. Providing this value is an advanced configuration, to be used when additional control over the underlying streaming data structures is needed. + :type view_rid: Optional[ViewRid] + :param request_timeout: timeout setting for this request in seconds. + :type request_timeout: Optional[int] + :return: Returns the result object. + :rtype: None + """ + + return self._api_client.call_api( + RequestInfo( + method="POST", + resource_path="/v2/highScale/streams/datasets/{datasetRid}/streams/{streamBranchName}/publishRecords", + query_params={ + "preview": preview, + }, + path_params={ + "datasetRid": dataset_rid, + "streamBranchName": stream_branch_name, + }, + header_params={ + "Content-Type": "application/json", + }, + body={ + "records": records, + "viewRid": view_rid, + }, + body_type=TypedDict( + "Body", + { # type: ignore + "records": List[Record], + "viewRid": Optional[ViewRid], + }, + ), + response_type=None, + request_timeout=request_timeout, + ), + ) diff --git a/tests/v2/filesystem/test_v2_filesystem_resource.py b/tests/v2/filesystem/test_v2_filesystem_resource.py new file mode 100644 index 00000000..cc52e693 --- /dev/null +++ b/tests/v2/filesystem/test_v2_filesystem_resource.py @@ -0,0 +1,113 @@ +# 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 pydantic import ValidationError + +from tests.utils import client_v2 +from tests.utils import mock_requests +from tests.utils import serialize_response + + +def test_delete(client_v2): + with mock_requests( + [ + { + "method": "DELETE", + "url": "https://example.palantirfoundry.com/api/v2/filesystem/resources/{resourceRid}", + "path_params": { + "resourceRid": "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da", + }, + "json": None, + "response": { + "status": 200, + "json": None, + "content_type": "None", + }, + } + ] + ): + resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" + preview = None + try: + response = client_v2.filesystem.Resource.delete( + resource_rid, + preview=preview, + ) + except ValidationError as e: + raise Exception("There was a validation error with deleteResource") from e + + assert serialize_response(response) == None + + +def test_permanently_delete(client_v2): + with mock_requests( + [ + { + "method": "POST", + "url": "https://example.palantirfoundry.com/api/v2/filesystem/resources/{resourceRid}/permanentlyDelete", + "path_params": { + "resourceRid": "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da", + }, + "json": None, + "response": { + "status": 200, + "json": None, + "content_type": "None", + }, + } + ] + ): + resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" + preview = None + try: + response = client_v2.filesystem.Resource.permanently_delete( + resource_rid, + preview=preview, + ) + except ValidationError as e: + raise Exception("There was a validation error with permanentlyDeleteResource") from e + + assert serialize_response(response) == None + + +def test_restore(client_v2): + with mock_requests( + [ + { + "method": "POST", + "url": "https://example.palantirfoundry.com/api/v2/filesystem/resources/{resourceRid}/restore", + "path_params": { + "resourceRid": "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da", + }, + "json": None, + "response": { + "status": 200, + "json": None, + "content_type": "None", + }, + } + ] + ): + resource_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da" + preview = None + try: + response = client_v2.filesystem.Resource.restore( + resource_rid, + preview=preview, + ) + except ValidationError as e: + raise Exception("There was a validation error with restoreResource") from e + + assert serialize_response(response) == None