From 621a60983222b2232f17ba87ba1377b960df2a6a Mon Sep 17 00:00:00 2001 From: svc-excavator-bot Date: Wed, 21 May 2025 16:01:15 +0000 Subject: [PATCH] Excavator: Upgrade API Version --- README.md | 62 ++++- docs-snippets-npm/package.json | 4 +- docs-snippets-npm/src/index.ts | 41 ++- docs/v1/Ontologies/models/PropertyTypeRid.md | 11 + docs/v1/Ontologies/models/SdkPackageRid.md | 11 + docs/v1/Ontologies/models/SdkVersion.md | 11 + docs/v2/Admin/Organization.md | 52 ++++ docs/v2/Admin/OrganizationRoleAssignment.md | 183 +++++++++++++ .../ListAvailableOrganizationRolesResponse.md | 11 + ...ListOrganizationRoleAssignmentsResponse.md | 12 + .../models/OrganizationRoleAssignment.md | 13 + docs/v2/AipAgents/Session.md | 8 + docs/v2/AipAgents/SessionTrace.md | 67 +++++ .../AipAgents/models/FailureToolCallOutput.md | 12 + docs/v2/AipAgents/models/RidToolInputValue.md | 12 + .../v2/AipAgents/models/RidToolOutputValue.md | 12 + .../AipAgents/models/SessionExchangeResult.md | 1 + docs/v2/AipAgents/models/SessionTrace.md | 14 + docs/v2/AipAgents/models/SessionTraceId.md | 13 + .../v2/AipAgents/models/SessionTraceStatus.md | 11 + .../AipAgents/models/StringToolInputValue.md | 12 + .../AipAgents/models/StringToolOutputValue.md | 12 + .../AipAgents/models/SuccessToolCallOutput.md | 12 + docs/v2/AipAgents/models/ToolCall.md | 13 + docs/v2/AipAgents/models/ToolCallGroup.md | 12 + docs/v2/AipAgents/models/ToolCallInput.md | 12 + docs/v2/AipAgents/models/ToolCallOutput.md | 16 ++ docs/v2/AipAgents/models/ToolInputName.md | 11 + docs/v2/AipAgents/models/ToolInputValue.md | 16 ++ docs/v2/AipAgents/models/ToolMetadata.md | 12 + docs/v2/AipAgents/models/ToolOutputValue.md | 16 ++ docs/v2/AipAgents/models/ToolType.md | 15 ++ docs/v2/Connectivity/FileImport.md | 18 +- docs/v2/Connectivity/TableImport.md | 18 +- docs/v2/Connectivity/models/FileImport.md | 4 +- docs/v2/Connectivity/models/TableImport.md | 4 +- docs/v2/Core/models/Operation.md | 13 + docs/v2/Core/models/Role.md | 18 ++ docs/v2/Core/models/RoleAssignmentUpdate.md | 12 + docs/v2/Core/models/RoleContext.md | 10 + docs/v2/Core/models/RoleSetId.md | 11 + docs/v2/Ontologies/OntologyObject.md | 16 +- docs/v2/Ontologies/models/SdkPackageRid.md | 11 + docs/v2/Ontologies/models/SdkVersion.md | 11 + foundry_sdk/_core/confidential_client_auth.py | 4 +- foundry_sdk/_core/oauth_utils.py | 49 ++-- foundry_sdk/_core/public_client_auth.py | 4 +- foundry_sdk/_versions.py | 2 +- foundry_sdk/v1/datasets/branch.py | 43 ++- foundry_sdk/v1/datasets/dataset.py | 100 ++++++- foundry_sdk/v1/datasets/file.py | 112 +++++++- foundry_sdk/v1/datasets/transaction.py | 47 +++- foundry_sdk/v1/ontologies/errors.py | 146 +++++++++++ foundry_sdk/v1/ontologies/models.py | 15 ++ foundry_sdk/v2/admin/errors.py | 64 +++++ foundry_sdk/v2/admin/models.py | 39 +++ foundry_sdk/v2/admin/organization.py | 73 ++++++ .../v2/admin/organization_role_assignment.py | 247 ++++++++++++++++++ foundry_sdk/v2/aip_agents/errors.py | 41 +++ foundry_sdk/v2/aip_agents/models.py | 241 +++++++++++++++++ foundry_sdk/v2/aip_agents/session.py | 24 ++ foundry_sdk/v2/aip_agents/session_trace.py | 127 +++++++++ foundry_sdk/v2/cli.py | 225 +++++++++++++--- foundry_sdk/v2/connectivity/errors.py | 35 --- foundry_sdk/v2/connectivity/file_import.py | 14 +- foundry_sdk/v2/connectivity/models.py | 8 +- foundry_sdk/v2/connectivity/table_import.py | 18 +- foundry_sdk/v2/core/models.py | 55 ++++ foundry_sdk/v2/datasets/branch.py | 13 + foundry_sdk/v2/datasets/dataset.py | 25 ++ foundry_sdk/v2/datasets/file.py | 61 +++++ foundry_sdk/v2/datasets/transaction.py | 24 ++ foundry_sdk/v2/functions/errors.py | 22 ++ foundry_sdk/v2/ontologies/errors.py | 146 +++++++++++ foundry_sdk/v2/ontologies/models.py | 10 + foundry_sdk/v2/ontologies/ontology_object.py | 16 +- foundry_sdk/v2/sql_queries/sql_query.py | 34 +++ foundry_sdk/v2/streams/dataset.py | 9 + foundry_sdk/v2/streams/stream.py | 26 ++ tests/test_api_client.py | 35 ++- tests/test_resorce_import.py | 14 + 81 files changed, 2823 insertions(+), 211 deletions(-) create mode 100644 docs/v1/Ontologies/models/PropertyTypeRid.md create mode 100644 docs/v1/Ontologies/models/SdkPackageRid.md create mode 100644 docs/v1/Ontologies/models/SdkVersion.md create mode 100644 docs/v2/Admin/OrganizationRoleAssignment.md create mode 100644 docs/v2/Admin/models/ListAvailableOrganizationRolesResponse.md create mode 100644 docs/v2/Admin/models/ListOrganizationRoleAssignmentsResponse.md create mode 100644 docs/v2/Admin/models/OrganizationRoleAssignment.md create mode 100644 docs/v2/AipAgents/SessionTrace.md create mode 100644 docs/v2/AipAgents/models/FailureToolCallOutput.md create mode 100644 docs/v2/AipAgents/models/RidToolInputValue.md create mode 100644 docs/v2/AipAgents/models/RidToolOutputValue.md create mode 100644 docs/v2/AipAgents/models/SessionTrace.md create mode 100644 docs/v2/AipAgents/models/SessionTraceId.md create mode 100644 docs/v2/AipAgents/models/SessionTraceStatus.md create mode 100644 docs/v2/AipAgents/models/StringToolInputValue.md create mode 100644 docs/v2/AipAgents/models/StringToolOutputValue.md create mode 100644 docs/v2/AipAgents/models/SuccessToolCallOutput.md create mode 100644 docs/v2/AipAgents/models/ToolCall.md create mode 100644 docs/v2/AipAgents/models/ToolCallGroup.md create mode 100644 docs/v2/AipAgents/models/ToolCallInput.md create mode 100644 docs/v2/AipAgents/models/ToolCallOutput.md create mode 100644 docs/v2/AipAgents/models/ToolInputName.md create mode 100644 docs/v2/AipAgents/models/ToolInputValue.md create mode 100644 docs/v2/AipAgents/models/ToolMetadata.md create mode 100644 docs/v2/AipAgents/models/ToolOutputValue.md create mode 100644 docs/v2/AipAgents/models/ToolType.md create mode 100644 docs/v2/Core/models/Operation.md create mode 100644 docs/v2/Core/models/Role.md create mode 100644 docs/v2/Core/models/RoleAssignmentUpdate.md create mode 100644 docs/v2/Core/models/RoleContext.md create mode 100644 docs/v2/Core/models/RoleSetId.md create mode 100644 docs/v2/Ontologies/models/SdkPackageRid.md create mode 100644 docs/v2/Ontologies/models/SdkVersion.md create mode 100644 foundry_sdk/v2/admin/organization_role_assignment.py create mode 100644 foundry_sdk/v2/aip_agents/session_trace.py diff --git a/README.md b/README.md index 1ec2c628e..f931e9a2d 100644 --- a/README.md +++ b/README.md @@ -511,7 +511,11 @@ Namespace | Resource | Operation | HTTP request | **Admin** | MarkingRoleAssignment | [**list**](docs/v2/Admin/MarkingRoleAssignment.md#list) | **GET** /v2/admin/markings/{markingId}/roleAssignments | **Admin** | MarkingRoleAssignment | [**remove**](docs/v2/Admin/MarkingRoleAssignment.md#remove) | **POST** /v2/admin/markings/{markingId}/roleAssignments/remove | **Admin** | Organization | [**get**](docs/v2/Admin/Organization.md#get) | **GET** /v2/admin/organizations/{organizationRid} | +**Admin** | Organization | [**list_available_roles**](docs/v2/Admin/Organization.md#list_available_roles) | **GET** /v2/admin/organizations/{organizationRid}/listAvailableRoles | **Admin** | Organization | [**replace**](docs/v2/Admin/Organization.md#replace) | **PUT** /v2/admin/organizations/{organizationRid} | +**Admin** | OrganizationRoleAssignment | [**add**](docs/v2/Admin/OrganizationRoleAssignment.md#add) | **POST** /v2/admin/organizations/{organizationRid}/roleAssignments/add | +**Admin** | OrganizationRoleAssignment | [**list**](docs/v2/Admin/OrganizationRoleAssignment.md#list) | **GET** /v2/admin/organizations/{organizationRid}/roleAssignments | +**Admin** | OrganizationRoleAssignment | [**remove**](docs/v2/Admin/OrganizationRoleAssignment.md#remove) | **POST** /v2/admin/organizations/{organizationRid}/roleAssignments/remove | **Admin** | User | [**delete**](docs/v2/Admin/User.md#delete) | **DELETE** /v2/admin/users/{userId} | **Admin** | User | [**get**](docs/v2/Admin/User.md#get) | **GET** /v2/admin/users/{userId} | **Admin** | User | [**get_batch**](docs/v2/Admin/User.md#get_batch) | **POST** /v2/admin/users/getBatch | @@ -544,11 +548,13 @@ Namespace | Resource | Operation | HTTP request | **Connectivity** | FileImport | [**execute**](docs/v2/Connectivity/FileImport.md#execute) | **POST** /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid}/execute | **Connectivity** | FileImport | [**get**](docs/v2/Connectivity/FileImport.md#get) | **GET** /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid} | **Connectivity** | FileImport | [**list**](docs/v2/Connectivity/FileImport.md#list) | **GET** /v2/connectivity/connections/{connectionRid}/fileImports | +**Connectivity** | FileImport | [**replace**](docs/v2/Connectivity/FileImport.md#replace) | **PUT** /v2/connectivity/connections/{connectionRid}/fileImports/{fileImportRid} | **Connectivity** | TableImport | [**create**](docs/v2/Connectivity/TableImport.md#create) | **POST** /v2/connectivity/connections/{connectionRid}/tableImports | **Connectivity** | TableImport | [**delete**](docs/v2/Connectivity/TableImport.md#delete) | **DELETE** /v2/connectivity/connections/{connectionRid}/tableImports/{tableImportRid} | **Connectivity** | TableImport | [**execute**](docs/v2/Connectivity/TableImport.md#execute) | **POST** /v2/connectivity/connections/{connectionRid}/tableImports/{tableImportRid}/execute | **Connectivity** | TableImport | [**get**](docs/v2/Connectivity/TableImport.md#get) | **GET** /v2/connectivity/connections/{connectionRid}/tableImports/{tableImportRid} | **Connectivity** | TableImport | [**list**](docs/v2/Connectivity/TableImport.md#list) | **GET** /v2/connectivity/connections/{connectionRid}/tableImports | +**Connectivity** | TableImport | [**replace**](docs/v2/Connectivity/TableImport.md#replace) | **PUT** /v2/connectivity/connections/{connectionRid}/tableImports/{tableImportRid} | **Datasets** | Branch | [**create**](docs/v2/Datasets/Branch.md#create) | **POST** /v2/datasets/{datasetRid}/branches | **Datasets** | Branch | [**delete**](docs/v2/Datasets/Branch.md#delete) | **DELETE** /v2/datasets/{datasetRid}/branches/{branchName} | **Datasets** | Branch | [**get**](docs/v2/Datasets/Branch.md#get) | **GET** /v2/datasets/{datasetRid}/branches/{branchName} | @@ -752,6 +758,7 @@ Namespace | Name | Import | **Admin** | [Host](docs/v2/Admin/models/Host.md) | `from foundry_sdk.v2.admin.models import Host` | **Admin** | [HostName](docs/v2/Admin/models/HostName.md) | `from foundry_sdk.v2.admin.models import HostName` | **Admin** | [ListAuthenticationProvidersResponse](docs/v2/Admin/models/ListAuthenticationProvidersResponse.md) | `from foundry_sdk.v2.admin.models import ListAuthenticationProvidersResponse` | +**Admin** | [ListAvailableOrganizationRolesResponse](docs/v2/Admin/models/ListAvailableOrganizationRolesResponse.md) | `from foundry_sdk.v2.admin.models import ListAvailableOrganizationRolesResponse` | **Admin** | [ListGroupMembershipsResponse](docs/v2/Admin/models/ListGroupMembershipsResponse.md) | `from foundry_sdk.v2.admin.models import ListGroupMembershipsResponse` | **Admin** | [ListGroupMembersResponse](docs/v2/Admin/models/ListGroupMembersResponse.md) | `from foundry_sdk.v2.admin.models import ListGroupMembersResponse` | **Admin** | [ListGroupsResponse](docs/v2/Admin/models/ListGroupsResponse.md) | `from foundry_sdk.v2.admin.models import ListGroupsResponse` | @@ -760,6 +767,7 @@ Namespace | Name | Import | **Admin** | [ListMarkingMembersResponse](docs/v2/Admin/models/ListMarkingMembersResponse.md) | `from foundry_sdk.v2.admin.models import ListMarkingMembersResponse` | **Admin** | [ListMarkingRoleAssignmentsResponse](docs/v2/Admin/models/ListMarkingRoleAssignmentsResponse.md) | `from foundry_sdk.v2.admin.models import ListMarkingRoleAssignmentsResponse` | **Admin** | [ListMarkingsResponse](docs/v2/Admin/models/ListMarkingsResponse.md) | `from foundry_sdk.v2.admin.models import ListMarkingsResponse` | +**Admin** | [ListOrganizationRoleAssignmentsResponse](docs/v2/Admin/models/ListOrganizationRoleAssignmentsResponse.md) | `from foundry_sdk.v2.admin.models import ListOrganizationRoleAssignmentsResponse` | **Admin** | [ListUsersResponse](docs/v2/Admin/models/ListUsersResponse.md) | `from foundry_sdk.v2.admin.models import ListUsersResponse` | **Admin** | [Marking](docs/v2/Admin/models/Marking.md) | `from foundry_sdk.v2.admin.models import Marking` | **Admin** | [MarkingCategory](docs/v2/Admin/models/MarkingCategory.md) | `from foundry_sdk.v2.admin.models import MarkingCategory` | @@ -775,6 +783,7 @@ Namespace | Name | Import | **Admin** | [OidcAuthenticationProtocol](docs/v2/Admin/models/OidcAuthenticationProtocol.md) | `from foundry_sdk.v2.admin.models import OidcAuthenticationProtocol` | **Admin** | [Organization](docs/v2/Admin/models/Organization.md) | `from foundry_sdk.v2.admin.models import Organization` | **Admin** | [OrganizationName](docs/v2/Admin/models/OrganizationName.md) | `from foundry_sdk.v2.admin.models import OrganizationName` | +**Admin** | [OrganizationRoleAssignment](docs/v2/Admin/models/OrganizationRoleAssignment.md) | `from foundry_sdk.v2.admin.models import OrganizationRoleAssignment` | **Admin** | [PrincipalFilterType](docs/v2/Admin/models/PrincipalFilterType.md) | `from foundry_sdk.v2.admin.models import PrincipalFilterType` | **Admin** | [ProviderId](docs/v2/Admin/models/ProviderId.md) | `from foundry_sdk.v2.admin.models import ProviderId` | **Admin** | [Role](docs/v2/Admin/models/Role.md) | `from foundry_sdk.v2.admin.models import Role` | @@ -799,6 +808,7 @@ Namespace | Name | Import | **AipAgents** | [AgentVersionString](docs/v2/AipAgents/models/AgentVersionString.md) | `from foundry_sdk.v2.aip_agents.models import AgentVersionString` | **AipAgents** | [CancelSessionResponse](docs/v2/AipAgents/models/CancelSessionResponse.md) | `from foundry_sdk.v2.aip_agents.models import CancelSessionResponse` | **AipAgents** | [Content](docs/v2/AipAgents/models/Content.md) | `from foundry_sdk.v2.aip_agents.models import Content` | +**AipAgents** | [FailureToolCallOutput](docs/v2/AipAgents/models/FailureToolCallOutput.md) | `from foundry_sdk.v2.aip_agents.models import FailureToolCallOutput` | **AipAgents** | [FunctionRetrievedContext](docs/v2/AipAgents/models/FunctionRetrievedContext.md) | `from foundry_sdk.v2.aip_agents.models import FunctionRetrievedContext` | **AipAgents** | [InputContext](docs/v2/AipAgents/models/InputContext.md) | `from foundry_sdk.v2.aip_agents.models import InputContext` | **AipAgents** | [ListAgentVersionsResponse](docs/v2/AipAgents/models/ListAgentVersionsResponse.md) | `from foundry_sdk.v2.aip_agents.models import ListAgentVersionsResponse` | @@ -814,14 +824,31 @@ Namespace | Name | Import | **AipAgents** | [ParameterType](docs/v2/AipAgents/models/ParameterType.md) | `from foundry_sdk.v2.aip_agents.models import ParameterType` | **AipAgents** | [ParameterValue](docs/v2/AipAgents/models/ParameterValue.md) | `from foundry_sdk.v2.aip_agents.models import ParameterValue` | **AipAgents** | [ParameterValueUpdate](docs/v2/AipAgents/models/ParameterValueUpdate.md) | `from foundry_sdk.v2.aip_agents.models import ParameterValueUpdate` | +**AipAgents** | [RidToolInputValue](docs/v2/AipAgents/models/RidToolInputValue.md) | `from foundry_sdk.v2.aip_agents.models import RidToolInputValue` | +**AipAgents** | [RidToolOutputValue](docs/v2/AipAgents/models/RidToolOutputValue.md) | `from foundry_sdk.v2.aip_agents.models import RidToolOutputValue` | **AipAgents** | [Session](docs/v2/AipAgents/models/Session.md) | `from foundry_sdk.v2.aip_agents.models import Session` | **AipAgents** | [SessionExchange](docs/v2/AipAgents/models/SessionExchange.md) | `from foundry_sdk.v2.aip_agents.models import SessionExchange` | **AipAgents** | [SessionExchangeContexts](docs/v2/AipAgents/models/SessionExchangeContexts.md) | `from foundry_sdk.v2.aip_agents.models import SessionExchangeContexts` | **AipAgents** | [SessionExchangeResult](docs/v2/AipAgents/models/SessionExchangeResult.md) | `from foundry_sdk.v2.aip_agents.models import SessionExchangeResult` | **AipAgents** | [SessionMetadata](docs/v2/AipAgents/models/SessionMetadata.md) | `from foundry_sdk.v2.aip_agents.models import SessionMetadata` | **AipAgents** | [SessionRid](docs/v2/AipAgents/models/SessionRid.md) | `from foundry_sdk.v2.aip_agents.models import SessionRid` | +**AipAgents** | [SessionTrace](docs/v2/AipAgents/models/SessionTrace.md) | `from foundry_sdk.v2.aip_agents.models import SessionTrace` | +**AipAgents** | [SessionTraceId](docs/v2/AipAgents/models/SessionTraceId.md) | `from foundry_sdk.v2.aip_agents.models import SessionTraceId` | +**AipAgents** | [SessionTraceStatus](docs/v2/AipAgents/models/SessionTraceStatus.md) | `from foundry_sdk.v2.aip_agents.models import SessionTraceStatus` | **AipAgents** | [StringParameter](docs/v2/AipAgents/models/StringParameter.md) | `from foundry_sdk.v2.aip_agents.models import StringParameter` | **AipAgents** | [StringParameterValue](docs/v2/AipAgents/models/StringParameterValue.md) | `from foundry_sdk.v2.aip_agents.models import StringParameterValue` | +**AipAgents** | [StringToolInputValue](docs/v2/AipAgents/models/StringToolInputValue.md) | `from foundry_sdk.v2.aip_agents.models import StringToolInputValue` | +**AipAgents** | [StringToolOutputValue](docs/v2/AipAgents/models/StringToolOutputValue.md) | `from foundry_sdk.v2.aip_agents.models import StringToolOutputValue` | +**AipAgents** | [SuccessToolCallOutput](docs/v2/AipAgents/models/SuccessToolCallOutput.md) | `from foundry_sdk.v2.aip_agents.models import SuccessToolCallOutput` | +**AipAgents** | [ToolCall](docs/v2/AipAgents/models/ToolCall.md) | `from foundry_sdk.v2.aip_agents.models import ToolCall` | +**AipAgents** | [ToolCallGroup](docs/v2/AipAgents/models/ToolCallGroup.md) | `from foundry_sdk.v2.aip_agents.models import ToolCallGroup` | +**AipAgents** | [ToolCallInput](docs/v2/AipAgents/models/ToolCallInput.md) | `from foundry_sdk.v2.aip_agents.models import ToolCallInput` | +**AipAgents** | [ToolCallOutput](docs/v2/AipAgents/models/ToolCallOutput.md) | `from foundry_sdk.v2.aip_agents.models import ToolCallOutput` | +**AipAgents** | [ToolInputName](docs/v2/AipAgents/models/ToolInputName.md) | `from foundry_sdk.v2.aip_agents.models import ToolInputName` | +**AipAgents** | [ToolInputValue](docs/v2/AipAgents/models/ToolInputValue.md) | `from foundry_sdk.v2.aip_agents.models import ToolInputValue` | +**AipAgents** | [ToolMetadata](docs/v2/AipAgents/models/ToolMetadata.md) | `from foundry_sdk.v2.aip_agents.models import ToolMetadata` | +**AipAgents** | [ToolOutputValue](docs/v2/AipAgents/models/ToolOutputValue.md) | `from foundry_sdk.v2.aip_agents.models import ToolOutputValue` | +**AipAgents** | [ToolType](docs/v2/AipAgents/models/ToolType.md) | `from foundry_sdk.v2.aip_agents.models import ToolType` | **AipAgents** | [UserTextInput](docs/v2/AipAgents/models/UserTextInput.md) | `from foundry_sdk.v2.aip_agents.models import UserTextInput` | **Connectivity** | [ApiKeyAuthentication](docs/v2/Connectivity/models/ApiKeyAuthentication.md) | `from foundry_sdk.v2.connectivity.models import ApiKeyAuthentication` | **Connectivity** | [AsPlaintextValue](docs/v2/Connectivity/models/AsPlaintextValue.md) | `from foundry_sdk.v2.connectivity.models import AsPlaintextValue` | @@ -996,6 +1023,7 @@ Namespace | Name | Import | **Core** | [MediaSetViewRid](docs/v2/Core/models/MediaSetViewRid.md) | `from foundry_sdk.v2.core.models import MediaSetViewRid` | **Core** | [MediaType](docs/v2/Core/models/MediaType.md) | `from foundry_sdk.v2.core.models import MediaType` | **Core** | [NullType](docs/v2/Core/models/NullType.md) | `from foundry_sdk.v2.core.models import NullType` | +**Core** | [Operation](docs/v2/Core/models/Operation.md) | `from foundry_sdk.v2.core.models import Operation` | **Core** | [OperationScope](docs/v2/Core/models/OperationScope.md) | `from foundry_sdk.v2.core.models import OperationScope` | **Core** | [OrderByDirection](docs/v2/Core/models/OrderByDirection.md) | `from foundry_sdk.v2.core.models import OrderByDirection` | **Core** | [OrganizationRid](docs/v2/Core/models/OrganizationRid.md) | `from foundry_sdk.v2.core.models import OrganizationRid` | @@ -1007,7 +1035,11 @@ Namespace | Name | Import | **Core** | [Realm](docs/v2/Core/models/Realm.md) | `from foundry_sdk.v2.core.models import Realm` | **Core** | [Reference](docs/v2/Core/models/Reference.md) | `from foundry_sdk.v2.core.models import Reference` | **Core** | [ReleaseStatus](docs/v2/Core/models/ReleaseStatus.md) | `from foundry_sdk.v2.core.models import ReleaseStatus` | +**Core** | [Role](docs/v2/Core/models/Role.md) | `from foundry_sdk.v2.core.models import Role` | +**Core** | [RoleAssignmentUpdate](docs/v2/Core/models/RoleAssignmentUpdate.md) | `from foundry_sdk.v2.core.models import RoleAssignmentUpdate` | +**Core** | [RoleContext](docs/v2/Core/models/RoleContext.md) | `from foundry_sdk.v2.core.models import RoleContext` | **Core** | [RoleId](docs/v2/Core/models/RoleId.md) | `from foundry_sdk.v2.core.models import RoleId` | +**Core** | [RoleSetId](docs/v2/Core/models/RoleSetId.md) | `from foundry_sdk.v2.core.models import RoleSetId` | **Core** | [ScheduleRid](docs/v2/Core/models/ScheduleRid.md) | `from foundry_sdk.v2.core.models import ScheduleRid` | **Core** | [ShortType](docs/v2/Core/models/ShortType.md) | `from foundry_sdk.v2.core.models import ShortType` | **Core** | [SizeBytes](docs/v2/Core/models/SizeBytes.md) | `from foundry_sdk.v2.core.models import SizeBytes` | @@ -1388,6 +1420,8 @@ Namespace | Name | Import | **Ontologies** | [ReturnEditsMode](docs/v2/Ontologies/models/ReturnEditsMode.md) | `from foundry_sdk.v2.ontologies.models import ReturnEditsMode` | **Ontologies** | [RollingAggregateWindowPoints](docs/v2/Ontologies/models/RollingAggregateWindowPoints.md) | `from foundry_sdk.v2.ontologies.models import RollingAggregateWindowPoints` | **Ontologies** | [SdkPackageName](docs/v2/Ontologies/models/SdkPackageName.md) | `from foundry_sdk.v2.ontologies.models import SdkPackageName` | +**Ontologies** | [SdkPackageRid](docs/v2/Ontologies/models/SdkPackageRid.md) | `from foundry_sdk.v2.ontologies.models import SdkPackageRid` | +**Ontologies** | [SdkVersion](docs/v2/Ontologies/models/SdkVersion.md) | `from foundry_sdk.v2.ontologies.models import SdkVersion` | **Ontologies** | [SearchJsonQueryV2](docs/v2/Ontologies/models/SearchJsonQueryV2.md) | `from foundry_sdk.v2.ontologies.models import SearchJsonQueryV2` | **Ontologies** | [SearchObjectsResponseV2](docs/v2/Ontologies/models/SearchObjectsResponseV2.md) | `from foundry_sdk.v2.ontologies.models import SearchObjectsResponseV2` | **Ontologies** | [SearchOrderByType](docs/v2/Ontologies/models/SearchOrderByType.md) | `from foundry_sdk.v2.ontologies.models import SearchOrderByType` | @@ -1706,6 +1740,7 @@ Namespace | Name | Import | **Ontologies** | [PropertyApiName](docs/v1/Ontologies/models/PropertyApiName.md) | `from foundry_sdk.v1.ontologies.models import PropertyApiName` | **Ontologies** | [PropertyFilter](docs/v1/Ontologies/models/PropertyFilter.md) | `from foundry_sdk.v1.ontologies.models import PropertyFilter` | **Ontologies** | [PropertyId](docs/v1/Ontologies/models/PropertyId.md) | `from foundry_sdk.v1.ontologies.models import PropertyId` | +**Ontologies** | [PropertyTypeRid](docs/v1/Ontologies/models/PropertyTypeRid.md) | `from foundry_sdk.v1.ontologies.models import PropertyTypeRid` | **Ontologies** | [PropertyValue](docs/v1/Ontologies/models/PropertyValue.md) | `from foundry_sdk.v1.ontologies.models import PropertyValue` | **Ontologies** | [PropertyValueEscapedString](docs/v1/Ontologies/models/PropertyValueEscapedString.md) | `from foundry_sdk.v1.ontologies.models import PropertyValueEscapedString` | **Ontologies** | [QueryAggregationKeyType](docs/v1/Ontologies/models/QueryAggregationKeyType.md) | `from foundry_sdk.v1.ontologies.models import QueryAggregationKeyType` | @@ -1724,6 +1759,8 @@ Namespace | Name | Import | **Ontologies** | [RangeConstraint](docs/v1/Ontologies/models/RangeConstraint.md) | `from foundry_sdk.v1.ontologies.models import RangeConstraint` | **Ontologies** | [ReturnEditsMode](docs/v1/Ontologies/models/ReturnEditsMode.md) | `from foundry_sdk.v1.ontologies.models import ReturnEditsMode` | **Ontologies** | [SdkPackageName](docs/v1/Ontologies/models/SdkPackageName.md) | `from foundry_sdk.v1.ontologies.models import SdkPackageName` | +**Ontologies** | [SdkPackageRid](docs/v1/Ontologies/models/SdkPackageRid.md) | `from foundry_sdk.v1.ontologies.models import SdkPackageRid` | +**Ontologies** | [SdkVersion](docs/v1/Ontologies/models/SdkVersion.md) | `from foundry_sdk.v1.ontologies.models import SdkVersion` | **Ontologies** | [SearchJsonQuery](docs/v1/Ontologies/models/SearchJsonQuery.md) | `from foundry_sdk.v1.ontologies.models import SearchJsonQuery` | **Ontologies** | [SearchObjectsResponse](docs/v1/Ontologies/models/SearchObjectsResponse.md) | `from foundry_sdk.v1.ontologies.models import SearchObjectsResponse` | **Ontologies** | [SearchOrderBy](docs/v1/Ontologies/models/SearchOrderBy.md) | `from foundry_sdk.v1.ontologies.models import SearchOrderBy` | @@ -1754,6 +1791,7 @@ Namespace | Name | Import | **Admin** | AddGroupMembersPermissionDenied | `from foundry_sdk.v2.admin.errors import AddGroupMembersPermissionDenied` | **Admin** | AddMarkingMembersPermissionDenied | `from foundry_sdk.v2.admin.errors import AddMarkingMembersPermissionDenied` | **Admin** | AddMarkingRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import AddMarkingRoleAssignmentsPermissionDenied` | +**Admin** | AddOrganizationRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import AddOrganizationRoleAssignmentsPermissionDenied` | **Admin** | AuthenticationProviderNotFound | `from foundry_sdk.v2.admin.errors import AuthenticationProviderNotFound` | **Admin** | CannotReplaceProviderInfoForPrincipalInProtectedRealm | `from foundry_sdk.v2.admin.errors import CannotReplaceProviderInfoForPrincipalInProtectedRealm` | **Admin** | CreateGroupPermissionDenied | `from foundry_sdk.v2.admin.errors import CreateGroupPermissionDenied` | @@ -1778,9 +1816,11 @@ Namespace | Name | Import | **Admin** | InvalidGroupOrganizations | `from foundry_sdk.v2.admin.errors import InvalidGroupOrganizations` | **Admin** | InvalidHostName | `from foundry_sdk.v2.admin.errors import InvalidHostName` | **Admin** | InvalidProfilePicture | `from foundry_sdk.v2.admin.errors import InvalidProfilePicture` | +**Admin** | ListAvailableRolesOrganizationPermissionDenied | `from foundry_sdk.v2.admin.errors import ListAvailableRolesOrganizationPermissionDenied` | **Admin** | ListHostsPermissionDenied | `from foundry_sdk.v2.admin.errors import ListHostsPermissionDenied` | **Admin** | ListMarkingMembersPermissionDenied | `from foundry_sdk.v2.admin.errors import ListMarkingMembersPermissionDenied` | **Admin** | ListMarkingRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import ListMarkingRoleAssignmentsPermissionDenied` | +**Admin** | ListOrganizationRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import ListOrganizationRoleAssignmentsPermissionDenied` | **Admin** | MarkingCategoryNotFound | `from foundry_sdk.v2.admin.errors import MarkingCategoryNotFound` | **Admin** | MarkingNotFound | `from foundry_sdk.v2.admin.errors import MarkingNotFound` | **Admin** | OrganizationNotFound | `from foundry_sdk.v2.admin.errors import OrganizationNotFound` | @@ -1792,6 +1832,7 @@ Namespace | Name | Import | **Admin** | RemoveMarkingMembersPermissionDenied | `from foundry_sdk.v2.admin.errors import RemoveMarkingMembersPermissionDenied` | **Admin** | RemoveMarkingRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import RemoveMarkingRoleAssignmentsPermissionDenied` | **Admin** | RemoveMarkingRoleAssignmentsRemoveAllAdministratorsNotAllowed | `from foundry_sdk.v2.admin.errors import RemoveMarkingRoleAssignmentsRemoveAllAdministratorsNotAllowed` | +**Admin** | RemoveOrganizationRoleAssignmentsPermissionDenied | `from foundry_sdk.v2.admin.errors import RemoveOrganizationRoleAssignmentsPermissionDenied` | **Admin** | ReplaceGroupProviderInfoPermissionDenied | `from foundry_sdk.v2.admin.errors import ReplaceGroupProviderInfoPermissionDenied` | **Admin** | ReplaceOrganizationPermissionDenied | `from foundry_sdk.v2.admin.errors import ReplaceOrganizationPermissionDenied` | **Admin** | ReplaceUserProviderInfoPermissionDenied | `from foundry_sdk.v2.admin.errors import ReplaceUserProviderInfoPermissionDenied` | @@ -1823,11 +1864,11 @@ Namespace | Name | Import | **AipAgents** | RateLimitExceeded | `from foundry_sdk.v2.aip_agents.errors import RateLimitExceeded` | **AipAgents** | SessionExecutionFailed | `from foundry_sdk.v2.aip_agents.errors import SessionExecutionFailed` | **AipAgents** | SessionNotFound | `from foundry_sdk.v2.aip_agents.errors import SessionNotFound` | +**AipAgents** | SessionTraceIdAlreadyExists | `from foundry_sdk.v2.aip_agents.errors import SessionTraceIdAlreadyExists` | +**AipAgents** | SessionTraceNotFound | `from foundry_sdk.v2.aip_agents.errors import SessionTraceNotFound` | **AipAgents** | StreamingContinueSessionPermissionDenied | `from foundry_sdk.v2.aip_agents.errors import StreamingContinueSessionPermissionDenied` | **AipAgents** | UpdateSessionTitlePermissionDenied | `from foundry_sdk.v2.aip_agents.errors import UpdateSessionTitlePermissionDenied` | **Connectivity** | AdditionalSecretsMustBeSpecifiedAsPlaintextValueMap | `from foundry_sdk.v2.connectivity.errors import AdditionalSecretsMustBeSpecifiedAsPlaintextValueMap` | -**Connectivity** | ChangingBranchNameNotSupportedForImports | `from foundry_sdk.v2.connectivity.errors import ChangingBranchNameNotSupportedForImports` | -**Connectivity** | ChangingOutputDatasetNotSupportedForImports | `from foundry_sdk.v2.connectivity.errors import ChangingOutputDatasetNotSupportedForImports` | **Connectivity** | ConnectionDetailsNotDetermined | `from foundry_sdk.v2.connectivity.errors import ConnectionDetailsNotDetermined` | **Connectivity** | ConnectionNotFound | `from foundry_sdk.v2.connectivity.errors import ConnectionNotFound` | **Connectivity** | ConnectionTypeNotSupported | `from foundry_sdk.v2.connectivity.errors import ConnectionTypeNotSupported` | @@ -1973,6 +2014,7 @@ Namespace | Name | Import | **Filesystem** | TrashingSpaceNotSupported | `from foundry_sdk.v2.filesystem.errors import TrashingSpaceNotSupported` | **Functions** | ExecuteQueryPermissionDenied | `from foundry_sdk.v2.functions.errors import ExecuteQueryPermissionDenied` | **Functions** | GetByRidQueriesPermissionDenied | `from foundry_sdk.v2.functions.errors import GetByRidQueriesPermissionDenied` | +**Functions** | InvalidQueryOutputValue | `from foundry_sdk.v2.functions.errors import InvalidQueryOutputValue` | **Functions** | InvalidQueryParameterValue | `from foundry_sdk.v2.functions.errors import InvalidQueryParameterValue` | **Functions** | MissingParameter | `from foundry_sdk.v2.functions.errors import MissingParameter` | **Functions** | QueryEncounteredUserFacingError | `from foundry_sdk.v2.functions.errors import QueryEncounteredUserFacingError` | @@ -2031,6 +2073,7 @@ Namespace | Name | Import | **Ontologies** | InvalidPropertyFilterValue | `from foundry_sdk.v2.ontologies.errors import InvalidPropertyFilterValue` | **Ontologies** | InvalidPropertyType | `from foundry_sdk.v2.ontologies.errors import InvalidPropertyType` | **Ontologies** | InvalidPropertyValue | `from foundry_sdk.v2.ontologies.errors import InvalidPropertyValue` | +**Ontologies** | InvalidQueryOutputValue | `from foundry_sdk.v2.ontologies.errors import InvalidQueryOutputValue` | **Ontologies** | InvalidQueryParameterValue | `from foundry_sdk.v2.ontologies.errors import InvalidQueryParameterValue` | **Ontologies** | InvalidRangeQuery | `from foundry_sdk.v2.ontologies.errors import InvalidRangeQuery` | **Ontologies** | InvalidSortOrder | `from foundry_sdk.v2.ontologies.errors import InvalidSortOrder` | @@ -2046,6 +2089,12 @@ Namespace | Name | Import | **Ontologies** | MarketplaceLinkMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceLinkMappingNotFound` | **Ontologies** | MarketplaceObjectMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceObjectMappingNotFound` | **Ontologies** | MarketplaceQueryMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceQueryMappingNotFound` | +**Ontologies** | MarketplaceSdkActionMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkActionMappingNotFound` | +**Ontologies** | MarketplaceSdkInstallationNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkInstallationNotFound` | +**Ontologies** | MarketplaceSdkLinkMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkLinkMappingNotFound` | +**Ontologies** | MarketplaceSdkObjectMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkObjectMappingNotFound` | +**Ontologies** | MarketplaceSdkPropertyMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkPropertyMappingNotFound` | +**Ontologies** | MarketplaceSdkQueryMappingNotFound | `from foundry_sdk.v2.ontologies.errors import MarketplaceSdkQueryMappingNotFound` | **Ontologies** | MissingParameter | `from foundry_sdk.v2.ontologies.errors import MissingParameter` | **Ontologies** | MultipleGroupByOnFieldNotSupported | `from foundry_sdk.v2.ontologies.errors import MultipleGroupByOnFieldNotSupported` | **Ontologies** | MultiplePropertyValuesNotSupported | `from foundry_sdk.v2.ontologies.errors import MultiplePropertyValuesNotSupported` | @@ -2079,6 +2128,7 @@ Namespace | Name | Import | **Ontologies** | PropertyNotFound | `from foundry_sdk.v2.ontologies.errors import PropertyNotFound` | **Ontologies** | PropertyTypeDoesNotSupportNearestNeighbors | `from foundry_sdk.v2.ontologies.errors import PropertyTypeDoesNotSupportNearestNeighbors` | **Ontologies** | PropertyTypeNotFound | `from foundry_sdk.v2.ontologies.errors import PropertyTypeNotFound` | +**Ontologies** | PropertyTypeRidNotFound | `from foundry_sdk.v2.ontologies.errors import PropertyTypeRidNotFound` | **Ontologies** | PropertyTypesSearchNotSupported | `from foundry_sdk.v2.ontologies.errors import PropertyTypesSearchNotSupported` | **Ontologies** | QueryEncounteredUserFacingError | `from foundry_sdk.v2.ontologies.errors import QueryEncounteredUserFacingError` | **Ontologies** | QueryMemoryExceededLimit | `from foundry_sdk.v2.ontologies.errors import QueryMemoryExceededLimit` | @@ -2250,6 +2300,7 @@ Namespace | Name | Import | **Ontologies** | InvalidPropertyFilterValue | `from foundry_sdk.v1.ontologies.errors import InvalidPropertyFilterValue` | **Ontologies** | InvalidPropertyType | `from foundry_sdk.v1.ontologies.errors import InvalidPropertyType` | **Ontologies** | InvalidPropertyValue | `from foundry_sdk.v1.ontologies.errors import InvalidPropertyValue` | +**Ontologies** | InvalidQueryOutputValue | `from foundry_sdk.v1.ontologies.errors import InvalidQueryOutputValue` | **Ontologies** | InvalidQueryParameterValue | `from foundry_sdk.v1.ontologies.errors import InvalidQueryParameterValue` | **Ontologies** | InvalidRangeQuery | `from foundry_sdk.v1.ontologies.errors import InvalidRangeQuery` | **Ontologies** | InvalidSortOrder | `from foundry_sdk.v1.ontologies.errors import InvalidSortOrder` | @@ -2265,6 +2316,12 @@ Namespace | Name | Import | **Ontologies** | MarketplaceLinkMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceLinkMappingNotFound` | **Ontologies** | MarketplaceObjectMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceObjectMappingNotFound` | **Ontologies** | MarketplaceQueryMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceQueryMappingNotFound` | +**Ontologies** | MarketplaceSdkActionMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkActionMappingNotFound` | +**Ontologies** | MarketplaceSdkInstallationNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkInstallationNotFound` | +**Ontologies** | MarketplaceSdkLinkMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkLinkMappingNotFound` | +**Ontologies** | MarketplaceSdkObjectMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkObjectMappingNotFound` | +**Ontologies** | MarketplaceSdkPropertyMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkPropertyMappingNotFound` | +**Ontologies** | MarketplaceSdkQueryMappingNotFound | `from foundry_sdk.v1.ontologies.errors import MarketplaceSdkQueryMappingNotFound` | **Ontologies** | MissingParameter | `from foundry_sdk.v1.ontologies.errors import MissingParameter` | **Ontologies** | MultipleGroupByOnFieldNotSupported | `from foundry_sdk.v1.ontologies.errors import MultipleGroupByOnFieldNotSupported` | **Ontologies** | MultiplePropertyValuesNotSupported | `from foundry_sdk.v1.ontologies.errors import MultiplePropertyValuesNotSupported` | @@ -2298,6 +2355,7 @@ Namespace | Name | Import | **Ontologies** | PropertyNotFound | `from foundry_sdk.v1.ontologies.errors import PropertyNotFound` | **Ontologies** | PropertyTypeDoesNotSupportNearestNeighbors | `from foundry_sdk.v1.ontologies.errors import PropertyTypeDoesNotSupportNearestNeighbors` | **Ontologies** | PropertyTypeNotFound | `from foundry_sdk.v1.ontologies.errors import PropertyTypeNotFound` | +**Ontologies** | PropertyTypeRidNotFound | `from foundry_sdk.v1.ontologies.errors import PropertyTypeRidNotFound` | **Ontologies** | PropertyTypesSearchNotSupported | `from foundry_sdk.v1.ontologies.errors import PropertyTypesSearchNotSupported` | **Ontologies** | QueryEncounteredUserFacingError | `from foundry_sdk.v1.ontologies.errors import QueryEncounteredUserFacingError` | **Ontologies** | QueryMemoryExceededLimit | `from foundry_sdk.v1.ontologies.errors import QueryMemoryExceededLimit` | diff --git a/docs-snippets-npm/package.json b/docs-snippets-npm/package.json index 10c7e8594..a495a997f 100644 --- a/docs-snippets-npm/package.json +++ b/docs-snippets-npm/package.json @@ -18,13 +18,13 @@ "homepage": "https://github.com/palantir/foundry-platform-python#readme", "devDependencies": { "@osdk/docs-spec-core": "^0.5.0", - "@osdk/platform-docs-spec": "^0.6.0", + "@osdk/docs-spec-platform": "^0.8.0", "typescript": "^5.8.3" }, "sls": { "dependencies": { "com.palantir.foundry.api:api-gateway": { - "minVersion": "1.1163.0", + "minVersion": "1.1174.0", "maxVersion": "1.x.x", "optional": false } diff --git a/docs-snippets-npm/src/index.ts b/docs-snippets-npm/src/index.ts index 8f45d74cf..754717499 100644 --- a/docs-snippets-npm/src/index.ts +++ b/docs-snippets-npm/src/index.ts @@ -16,7 +16,7 @@ import type { SdkSnippets } from "@osdk/docs-spec-core"; -import type { PLATFORM_API_DOCS_SPEC } from "@osdk/platform-docs-spec"; +import type { PLATFORM_API_DOCS_SPEC } from "@osdk/docs-spec-platform"; export const PYTHON_PLATFORM_SNIPPETS: SdkSnippets = { "kind": "sdk", @@ -393,11 +393,31 @@ export const PYTHON_PLATFORM_SNIPPETS: SdkSnippets None: @@ -69,7 +69,7 @@ def __init__( client_secret, scopes=scopes, ) - super().__init__(hostname, config) + super().__init__(hostname=hostname, should_refresh=should_refresh, config=config) @property def scopes(self) -> List[str]: diff --git a/foundry_sdk/_core/oauth_utils.py b/foundry_sdk/_core/oauth_utils.py index 020a4a9ca..bc74890b4 100644 --- a/foundry_sdk/_core/oauth_utils.py +++ b/foundry_sdk/_core/oauth_utils.py @@ -119,13 +119,15 @@ class AuthorizeRequest(pydantic.BaseModel): class OAuth(Auth, ABC): def __init__( self, - hostname: Optional[str], - config: Optional[Config], + hostname: Optional[str] = None, + should_refresh: bool = True, + *, + config: Optional[Config] = None, ) -> None: self._config = config self._hostname = hostname - self._parameterized_directly = config is not None or hostname is not None self._client: Optional[HttpClient] = None + self._should_refresh = should_refresh @abstractmethod def sign_out(self) -> SignOutResponse: @@ -133,7 +135,10 @@ def sign_out(self) -> SignOutResponse: def execute_with_token(self, func: Callable[[OAuthToken], httpx.Response]) -> httpx.Response: try: - return self._run_with_attempted_refresh(func) + if self._should_refresh: + return self._run_with_attempted_refresh(func) + else: + return func(self.get_token()) except httpx.HTTPStatusError as e: if e.response.status_code == 401: self.sign_out() @@ -169,20 +174,34 @@ def _run_with_attempted_refresh( raise e def _parameterize(self, hostname: str, config: Optional[Config]) -> None: - if self._parameterized_directly: - warnings.warn( - f"When a {self.__class__.__name__} instance is given to a FoundryClient, its hostname " - "and config are automatically provided by the FoundryClient. Please remove these " - "parameters from the {self.__class__.__name__} initialization.", - UserWarning, - stacklevel=2, - ) - if self._client is not None: return - self._config = config - self._hostname = hostname + if self._config is None: + self._config = config + else: + if self._config == config: + warnings.warn( + f"When a {self.__class__.__name__} instance is given to a FoundryClient, if a config " + "is not set it will be provided by the FoundryClient. You are using the same config " + "here and in the FoundryClient. Please remove the config parameter from the " + "{self.__class__.__name__} initialization.", + UserWarning, + stacklevel=2, + ) + + if self._hostname is None: + self._hostname = hostname + else: + if self._hostname == hostname: + warnings.warn( + f"When a {self.__class__.__name__} instance is given to a FoundryClient, if a hostname " + "is not set it will be provided by the FoundryClient. You are using the same hostname " + "here and in the FoundryClient. Please remove the hostname parameter from the " + "{self.__class__.__name__} initialization.", + UserWarning, + stacklevel=2, + ) # Set here so that the next call to _parameterize() doesn't re-create another HttpClient # This method may be called many times dependening on how many different ApiClients diff --git a/foundry_sdk/_core/public_client_auth.py b/foundry_sdk/_core/public_client_auth.py index f0c01efe9..3e12349cc 100644 --- a/foundry_sdk/_core/public_client_auth.py +++ b/foundry_sdk/_core/public_client_auth.py @@ -45,7 +45,7 @@ def __init__( redirect_url: str, hostname: Optional[str] = None, scopes: Optional[List[str]] = None, - should_refresh: bool = False, + should_refresh: bool = True, *, config: Optional[Config] = None, ) -> None: @@ -62,7 +62,7 @@ def __init__( redirect_url=redirect_url, scopes=scopes, ) - super().__init__(hostname, config) + super().__init__(hostname=hostname, should_refresh=should_refresh, config=config) @property def scopes(self) -> List[str]: diff --git a/foundry_sdk/_versions.py b/foundry_sdk/_versions.py index 702b44583..79497babe 100644 --- a/foundry_sdk/_versions.py +++ b/foundry_sdk/_versions.py @@ -17,4 +17,4 @@ # using the autorelease bot __version__ = "0.0.0" -__openapi_document_version__ = "1.1163.0" +__openapi_document_version__ = "1.1174.0" diff --git a/foundry_sdk/v1/datasets/branch.py b/foundry_sdk/v1/datasets/branch.py index f8ac76213..52d626202 100644 --- a/foundry_sdk/v1/datasets/branch.py +++ b/foundry_sdk/v1/datasets/branch.py @@ -21,6 +21,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors from foundry_sdk.v1.core import models as core_models +from foundry_sdk.v1.datasets import errors as datasets_errors from foundry_sdk.v1.datasets import models as datasets_models @@ -74,6 +75,13 @@ def create( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Branch + + :raises BranchAlreadyExists: The branch cannot be created because a branch with that name already exists. + :raises CreateBranchPermissionDenied: The provided token does not have permission to create a branch of this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises TransactionNotCommitted: The given transaction has not been committed. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -101,7 +109,14 @@ def create( ), response_type=datasets_models.Branch, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchAlreadyExists": datasets_errors.BranchAlreadyExists, + "CreateBranchPermissionDenied": datasets_errors.CreateBranchPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "TransactionNotCommitted": datasets_errors.TransactionNotCommitted, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -130,6 +145,11 @@ def delete( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: None + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises DeleteBranchPermissionDenied: The provided token does not have permission to delete the given branch from this dataset. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. """ return self._api_client.call_api( @@ -146,7 +166,12 @@ def delete( body_type=None, response_type=None, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "DeleteBranchPermissionDenied": datasets_errors.DeleteBranchPermissionDenied, + "InvalidBranchId": datasets_errors.InvalidBranchId, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -175,6 +200,9 @@ def get( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Branch + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. """ return self._api_client.call_api( @@ -193,7 +221,10 @@ def get( body_type=None, response_type=datasets_models.Branch, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -225,6 +256,8 @@ def list( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: core.ResourceIterator[datasets_models.Branch] + + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. """ return self._api_client.call_api( @@ -245,7 +278,9 @@ def list( body_type=None, response_type=datasets_models.ListBranchesResponse, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "DatasetNotFound": datasets_errors.DatasetNotFound, + }, response_mode=_sdk_internal.get("response_mode", "ITERATOR"), ), ) diff --git a/foundry_sdk/v1/datasets/dataset.py b/foundry_sdk/v1/datasets/dataset.py index 0a9efa8e9..fe3416e91 100644 --- a/foundry_sdk/v1/datasets/dataset.py +++ b/foundry_sdk/v1/datasets/dataset.py @@ -21,7 +21,9 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v1.core import errors as core_errors from foundry_sdk.v1.core import models as core_models +from foundry_sdk.v1.datasets import errors as datasets_errors from foundry_sdk.v1.datasets import models as datasets_models @@ -102,6 +104,16 @@ def create( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Dataset + + :raises BranchAlreadyExists: The branch cannot be created because a branch with that name already exists. + :raises CreateBranchPermissionDenied: The provided token does not have permission to create a branch of this dataset. + :raises CreateDatasetPermissionDenied: The provided token does not have permission to create a dataset in this folder. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FolderNotFound: The requested folder could not be found, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises ResourceNameAlreadyExists: The provided resource name is already in use by another resource in the same folder. + :raises TransactionNotCommitted: The given transaction has not been committed. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -127,7 +139,17 @@ def create( ), response_type=datasets_models.Dataset, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchAlreadyExists": datasets_errors.BranchAlreadyExists, + "CreateBranchPermissionDenied": datasets_errors.CreateBranchPermissionDenied, + "CreateDatasetPermissionDenied": datasets_errors.CreateDatasetPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FolderNotFound": core_errors.FolderNotFound, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "ResourceNameAlreadyExists": core_errors.ResourceNameAlreadyExists, + "TransactionNotCommitted": datasets_errors.TransactionNotCommitted, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -160,6 +182,13 @@ def delete_schema( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: None + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises DeleteSchemaPermissionDenied: todo + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises SchemaNotFound: A schema could not be found for the given dataset and branch, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -179,7 +208,14 @@ def delete_schema( body_type=None, response_type=None, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "DeleteSchemaPermissionDenied": datasets_errors.DeleteSchemaPermissionDenied, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "SchemaNotFound": datasets_errors.SchemaNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -205,6 +241,8 @@ def get( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Dataset + + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. """ return self._api_client.call_api( @@ -222,7 +260,9 @@ def get( body_type=None, response_type=datasets_models.Dataset, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "DatasetNotFound": datasets_errors.DatasetNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -255,6 +295,11 @@ def get_schema( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: typing.Optional[typing.Any] + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -276,7 +321,12 @@ def get_schema( body_type=None, response_type=typing.Optional[typing.Any], request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -322,6 +372,12 @@ def read( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: bytes + + :raises ColumnTypesNotSupported: The dataset contains column types that are not supported. + :raises DatasetReadNotSupported: The dataset does not support being read. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises ReadTablePermissionDenied: The provided token does not have permission to read the given dataset as a table. + :raises SchemaNotFound: A schema could not be found for the given dataset and branch, or the client token does not have access to it. """ return self._api_client.call_api( @@ -346,7 +402,13 @@ def read( body_type=None, response_type=bytes, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "ColumnTypesNotSupported": datasets_errors.ColumnTypesNotSupported, + "DatasetReadNotSupported": datasets_errors.DatasetReadNotSupported, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "ReadTablePermissionDenied": datasets_errors.ReadTablePermissionDenied, + "SchemaNotFound": datasets_errors.SchemaNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -379,6 +441,19 @@ def replace_schema( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: None + + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidTransactionType: The given transaction type is not valid. Valid transaction types are `SNAPSHOT`, `UPDATE`, `APPEND`, and `DELETE`. + :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. + :raises PutSchemaPermissionDenied: todo + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -399,7 +474,20 @@ def replace_schema( body_type=typing.Any, response_type=None, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, + "BranchNotFound": datasets_errors.BranchNotFound, + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidTransactionType": datasets_errors.InvalidTransactionType, + "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + "PutSchemaPermissionDenied": datasets_errors.PutSchemaPermissionDenied, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, + }, response_mode=_sdk_internal.get("response_mode"), ), ) diff --git a/foundry_sdk/v1/datasets/file.py b/foundry_sdk/v1/datasets/file.py index 06a2971d9..a2e3fa3a7 100644 --- a/foundry_sdk/v1/datasets/file.py +++ b/foundry_sdk/v1/datasets/file.py @@ -20,7 +20,9 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v1.core import errors as core_errors from foundry_sdk.v1.core import models as core_models +from foundry_sdk.v1.datasets import errors as datasets_errors from foundry_sdk.v1.datasets import models as datasets_models @@ -90,6 +92,21 @@ def delete( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: None + + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises InvalidTransactionType: The given transaction type is not valid. Valid transaction types are `SNAPSHOT`, `UPDATE`, `APPEND`, and `DELETE`. + :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. + :raises PutSchemaPermissionDenied: todo + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -109,7 +126,22 @@ def delete( body_type=None, response_type=None, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, + "BranchNotFound": datasets_errors.BranchNotFound, + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "InvalidTransactionType": datasets_errors.InvalidTransactionType, + "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + "PutSchemaPermissionDenied": datasets_errors.PutSchemaPermissionDenied, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -168,6 +200,14 @@ def get( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.File + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -190,7 +230,15 @@ def get( body_type=None, response_type=datasets_models.File, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -254,6 +302,12 @@ def list( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: core.ResourceIterator[datasets_models.File] + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -277,7 +331,13 @@ def list( body_type=None, response_type=datasets_models.ListFilesResponse, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode", "ITERATOR"), ), ) @@ -337,6 +397,14 @@ def read( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: bytes + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -359,7 +427,15 @@ def read( body_type=None, response_type=bytes, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -417,6 +493,19 @@ def upload( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.File + + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FileAlreadyExists: The given file path already exists in the dataset and transaction. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. + :raises UploadFilePermissionDenied: The provided token does not have permission to upload the given file to the given dataset and transaction. """ return self._api_client.call_api( @@ -440,7 +529,20 @@ def upload( body_type=bytes, response_type=datasets_models.File, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, + "BranchNotFound": datasets_errors.BranchNotFound, + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FileAlreadyExists": datasets_errors.FileAlreadyExists, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, + "UploadFilePermissionDenied": datasets_errors.UploadFilePermissionDenied, + }, response_mode=_sdk_internal.get("response_mode"), ), ) diff --git a/foundry_sdk/v1/datasets/transaction.py b/foundry_sdk/v1/datasets/transaction.py index 1576322de..9b049493a 100644 --- a/foundry_sdk/v1/datasets/transaction.py +++ b/foundry_sdk/v1/datasets/transaction.py @@ -20,6 +20,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v1.datasets import errors as datasets_errors from foundry_sdk.v1.datasets import models as datasets_models @@ -71,6 +72,11 @@ def abort( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Transaction + + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -89,7 +95,12 @@ def abort( body_type=None, response_type=datasets_models.Transaction, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -119,6 +130,11 @@ def commit( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Transaction + + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -137,7 +153,12 @@ def commit( body_type=None, response_type=datasets_models.Transaction, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -169,6 +190,12 @@ def create( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Transaction + + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchId: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. """ return self._api_client.call_api( @@ -196,7 +223,13 @@ def create( ), response_type=datasets_models.Transaction, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchId": datasets_errors.InvalidBranchId, + "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + }, response_mode=_sdk_internal.get("response_mode"), ), ) @@ -225,6 +258,9 @@ def get( :type request_timeout: Optional[int] :return: Returns the result object. :rtype: datasets_models.Transaction + + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -243,7 +279,10 @@ def get( body_type=None, response_type=datasets_models.Transaction, request_timeout=request_timeout, - throwable_errors={}, + throwable_errors={ + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + }, response_mode=_sdk_internal.get("response_mode"), ), ) diff --git a/foundry_sdk/v1/ontologies/errors.py b/foundry_sdk/v1/ontologies/errors.py index 451e7bc51..c081294d4 100644 --- a/foundry_sdk/v1/ontologies/errors.py +++ b/foundry_sdk/v1/ontologies/errors.py @@ -763,6 +763,27 @@ class InvalidPropertyValue(errors.BadRequestError): error_instance_id: str +class InvalidQueryOutputValueParameters(typing_extensions.TypedDict): + """ + The value of the query's output is invalid. This may be because the return value did not match the specified + output type or constraints. + """ + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + outputDataType: ontologies_models.QueryDataType + outputValue: typing_extensions.NotRequired[ontologies_models.DataValue] + functionRid: ontologies_models.FunctionRid + functionVersion: ontologies_models.FunctionVersion + + +@dataclass +class InvalidQueryOutputValue(errors.BadRequestError): + name: typing.Literal["InvalidQueryOutputValue"] + parameters: InvalidQueryOutputValueParameters + error_instance_id: str + + class InvalidQueryParameterValueParameters(typing_extensions.TypedDict): """ The value of the given parameter is invalid. See the documentation of `DataValue` for details on @@ -1021,6 +1042,108 @@ class MarketplaceQueryMappingNotFound(errors.NotFoundError): error_instance_id: str +class MarketplaceSdkActionMappingNotFoundParameters(typing_extensions.TypedDict): + """The given action could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + actionType: ontologies_models.ActionTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkActionMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkActionMappingNotFound"] + parameters: MarketplaceSdkActionMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkInstallationNotFoundParameters(typing_extensions.TypedDict): + """The given marketplace installation could not be found or the user does not have access to it.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkInstallationNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkInstallationNotFound"] + parameters: MarketplaceSdkInstallationNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkLinkMappingNotFoundParameters(typing_extensions.TypedDict): + """The given link could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + linkType: ontologies_models.LinkTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkLinkMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkLinkMappingNotFound"] + parameters: MarketplaceSdkLinkMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkObjectMappingNotFoundParameters(typing_extensions.TypedDict): + """The given object could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + objectType: ontologies_models.ObjectTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkObjectMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkObjectMappingNotFound"] + parameters: MarketplaceSdkObjectMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkPropertyMappingNotFoundParameters(typing_extensions.TypedDict): + """The given property could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + propertyType: ontologies_models.PropertyApiName + objectType: ontologies_models.ObjectTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkPropertyMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkPropertyMappingNotFound"] + parameters: MarketplaceSdkPropertyMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkQueryMappingNotFoundParameters(typing_extensions.TypedDict): + """The given query could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + queryType: ontologies_models.QueryApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkQueryMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkQueryMappingNotFound"] + parameters: MarketplaceSdkQueryMappingNotFoundParameters + error_instance_id: str + + class MissingParameterParameters(typing_extensions.TypedDict): """ Required parameters are missing. Please look at the `parameters` field to see which required parameters are @@ -1575,6 +1698,21 @@ class PropertyTypeNotFound(errors.NotFoundError): error_instance_id: str +class PropertyTypeRidNotFoundParameters(typing_extensions.TypedDict): + """The requested property type RID is not found, or the client token does not have access to it.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + propertyTypeRid: typing_extensions.NotRequired[ontologies_models.PropertyTypeRid] + + +@dataclass +class PropertyTypeRidNotFound(errors.NotFoundError): + name: typing.Literal["PropertyTypeRidNotFound"] + parameters: PropertyTypeRidNotFoundParameters + error_instance_id: str + + class PropertyTypesSearchNotSupportedParameters(typing_extensions.TypedDict): """ The search on the property types are not supported. See the `Search Objects` documentation for @@ -1889,6 +2027,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "InvalidPropertyFiltersCombination", "InvalidPropertyType", "InvalidPropertyValue", + "InvalidQueryOutputValue", "InvalidQueryParameterValue", "InvalidRangeQuery", "InvalidSortOrder", @@ -1904,6 +2043,12 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "MarketplaceLinkMappingNotFound", "MarketplaceObjectMappingNotFound", "MarketplaceQueryMappingNotFound", + "MarketplaceSdkActionMappingNotFound", + "MarketplaceSdkInstallationNotFound", + "MarketplaceSdkLinkMappingNotFound", + "MarketplaceSdkObjectMappingNotFound", + "MarketplaceSdkPropertyMappingNotFound", + "MarketplaceSdkQueryMappingNotFound", "MissingParameter", "MultipleGroupByOnFieldNotSupported", "MultiplePropertyValuesNotSupported", @@ -1937,6 +2082,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "PropertyNotFound", "PropertyTypeDoesNotSupportNearestNeighbors", "PropertyTypeNotFound", + "PropertyTypeRidNotFound", "PropertyTypesSearchNotSupported", "QueryEncounteredUserFacingError", "QueryMemoryExceededLimit", diff --git a/foundry_sdk/v1/ontologies/models.py b/foundry_sdk/v1/ontologies/models.py index efd8dae2a..ada65252f 100644 --- a/foundry_sdk/v1/ontologies/models.py +++ b/foundry_sdk/v1/ontologies/models.py @@ -1304,6 +1304,10 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """ +PropertyTypeRid = core.RID +"""PropertyTypeRid""" + + PropertyValue = typing.Any """ Represents the value of a property in the following format. @@ -1529,6 +1533,14 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """SdkPackageName""" +SdkPackageRid = core.RID +"""SdkPackageRid""" + + +SdkVersion = str +"""SdkVersion""" + + SearchJsonQuery = typing_extensions.Annotated[ typing.Union[ OrQuery, @@ -1914,6 +1926,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "PropertyApiName", "PropertyFilter", "PropertyId", + "PropertyTypeRid", "PropertyValue", "PropertyValueEscapedString", "QueryAggregationKeyType", @@ -1932,6 +1945,8 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "RangeConstraint", "ReturnEditsMode", "SdkPackageName", + "SdkPackageRid", + "SdkVersion", "SearchJsonQuery", "SearchObjectsResponse", "SearchOrderBy", diff --git a/foundry_sdk/v2/admin/errors.py b/foundry_sdk/v2/admin/errors.py index 99043d8e4..39aa45fed 100644 --- a/foundry_sdk/v2/admin/errors.py +++ b/foundry_sdk/v2/admin/errors.py @@ -69,6 +69,21 @@ class AddMarkingRoleAssignmentsPermissionDenied(errors.PermissionDeniedError): error_instance_id: str +class AddOrganizationRoleAssignmentsPermissionDeniedParameters(typing_extensions.TypedDict): + """Could not add the OrganizationRoleAssignment.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + organizationRid: core_models.OrganizationRid + + +@dataclass +class AddOrganizationRoleAssignmentsPermissionDenied(errors.PermissionDeniedError): + name: typing.Literal["AddOrganizationRoleAssignmentsPermissionDenied"] + parameters: AddOrganizationRoleAssignmentsPermissionDeniedParameters + error_instance_id: str + + class AuthenticationProviderNotFoundParameters(typing_extensions.TypedDict): """The given AuthenticationProvider could not be found.""" @@ -423,6 +438,21 @@ class InvalidProfilePicture(errors.BadRequestError): error_instance_id: str +class ListAvailableRolesOrganizationPermissionDeniedParameters(typing_extensions.TypedDict): + """Could not listAvailableRoles the Organization.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + organizationRid: core_models.OrganizationRid + + +@dataclass +class ListAvailableRolesOrganizationPermissionDenied(errors.PermissionDeniedError): + name: typing.Literal["ListAvailableRolesOrganizationPermissionDenied"] + parameters: ListAvailableRolesOrganizationPermissionDeniedParameters + error_instance_id: str + + class ListHostsPermissionDeniedParameters(typing_extensions.TypedDict): """You do not have permission to list hosts for this enrollment""" @@ -468,6 +498,21 @@ class ListMarkingRoleAssignmentsPermissionDenied(errors.PermissionDeniedError): error_instance_id: str +class ListOrganizationRoleAssignmentsPermissionDeniedParameters(typing_extensions.TypedDict): + """The provided token does not have permission to list assigned roles for this organization.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + organizationRid: core_models.OrganizationRid + + +@dataclass +class ListOrganizationRoleAssignmentsPermissionDenied(errors.PermissionDeniedError): + name: typing.Literal["ListOrganizationRoleAssignmentsPermissionDenied"] + parameters: ListOrganizationRoleAssignmentsPermissionDeniedParameters + error_instance_id: str + + class MarkingCategoryNotFoundParameters(typing_extensions.TypedDict): """The given MarkingCategory could not be found.""" @@ -638,6 +683,21 @@ class RemoveMarkingRoleAssignmentsRemoveAllAdministratorsNotAllowed(errors.BadRe error_instance_id: str +class RemoveOrganizationRoleAssignmentsPermissionDeniedParameters(typing_extensions.TypedDict): + """Could not remove the OrganizationRoleAssignment.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + organizationRid: core_models.OrganizationRid + + +@dataclass +class RemoveOrganizationRoleAssignmentsPermissionDenied(errors.PermissionDeniedError): + name: typing.Literal["RemoveOrganizationRoleAssignmentsPermissionDenied"] + parameters: RemoveOrganizationRoleAssignmentsPermissionDeniedParameters + error_instance_id: str + + class ReplaceGroupProviderInfoPermissionDeniedParameters(typing_extensions.TypedDict): """Could not replace the GroupProviderInfo.""" @@ -773,6 +833,7 @@ class UserProviderInfoNotFound(errors.NotFoundError): "AddGroupMembersPermissionDenied", "AddMarkingMembersPermissionDenied", "AddMarkingRoleAssignmentsPermissionDenied", + "AddOrganizationRoleAssignmentsPermissionDenied", "AuthenticationProviderNotFound", "CannotReplaceProviderInfoForPrincipalInProtectedRealm", "CreateGroupPermissionDenied", @@ -797,9 +858,11 @@ class UserProviderInfoNotFound(errors.NotFoundError): "InvalidGroupOrganizations", "InvalidHostName", "InvalidProfilePicture", + "ListAvailableRolesOrganizationPermissionDenied", "ListHostsPermissionDenied", "ListMarkingMembersPermissionDenied", "ListMarkingRoleAssignmentsPermissionDenied", + "ListOrganizationRoleAssignmentsPermissionDenied", "MarkingCategoryNotFound", "MarkingNotFound", "OrganizationNotFound", @@ -811,6 +874,7 @@ class UserProviderInfoNotFound(errors.NotFoundError): "RemoveMarkingMembersPermissionDenied", "RemoveMarkingRoleAssignmentsPermissionDenied", "RemoveMarkingRoleAssignmentsRemoveAllAdministratorsNotAllowed", + "RemoveOrganizationRoleAssignmentsPermissionDenied", "ReplaceGroupProviderInfoPermissionDenied", "ReplaceOrganizationPermissionDenied", "ReplaceUserProviderInfoPermissionDenied", diff --git a/foundry_sdk/v2/admin/models.py b/foundry_sdk/v2/admin/models.py index a5e341ee3..e4f8eed11 100644 --- a/foundry_sdk/v2/admin/models.py +++ b/foundry_sdk/v2/admin/models.py @@ -328,6 +328,17 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: return self.model_dump(by_alias=True, exclude_none=True) +class ListAvailableOrganizationRolesResponse(pydantic.BaseModel): + """ListAvailableOrganizationRolesResponse""" + + data: typing.List[core_models.Role] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + class ListGroupMembersResponse(pydantic.BaseModel): """ListGroupMembersResponse""" @@ -424,6 +435,18 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: return self.model_dump(by_alias=True, exclude_none=True) +class ListOrganizationRoleAssignmentsResponse(pydantic.BaseModel): + """ListOrganizationRoleAssignmentsResponse""" + + data: typing.List[OrganizationRoleAssignment] + next_page_token: typing.Optional[core_models.PageToken] = pydantic.Field(alias=str("nextPageToken"), default=None) # type: ignore[literal-required] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + class ListUsersResponse(pydantic.BaseModel): """ListUsersResponse""" @@ -582,6 +605,19 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """OrganizationName""" +class OrganizationRoleAssignment(pydantic.BaseModel): + """OrganizationRoleAssignment""" + + principal_type: core_models.PrincipalType = pydantic.Field(alias=str("principalType")) # type: ignore[literal-required] + principal_id: core_models.PrincipalId = pydantic.Field(alias=str("principalId")) # type: ignore[literal-required] + role_id: core_models.RoleId = pydantic.Field(alias=str("roleId")) # type: ignore[literal-required] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + PrincipalFilterType = typing.Literal["queryString"] """PrincipalFilterType""" @@ -780,6 +816,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "Host", "HostName", "ListAuthenticationProvidersResponse", + "ListAvailableOrganizationRolesResponse", "ListGroupMembersResponse", "ListGroupMembershipsResponse", "ListGroupsResponse", @@ -788,6 +825,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "ListMarkingMembersResponse", "ListMarkingRoleAssignmentsResponse", "ListMarkingsResponse", + "ListOrganizationRoleAssignmentsResponse", "ListUsersResponse", "Marking", "MarkingCategory", @@ -803,6 +841,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "OidcAuthenticationProtocol", "Organization", "OrganizationName", + "OrganizationRoleAssignment", "PrincipalFilterType", "ProviderId", "Role", diff --git a/foundry_sdk/v2/admin/organization.py b/foundry_sdk/v2/admin/organization.py index 794f06c8c..48334cffd 100644 --- a/foundry_sdk/v2/admin/organization.py +++ b/foundry_sdk/v2/admin/organization.py @@ -14,6 +14,7 @@ import typing +from functools import cached_property import pydantic import typing_extensions @@ -48,6 +49,18 @@ def __init__( self.with_streaming_response = _OrganizationClientStreaming(self) self.with_raw_response = _OrganizationClientRaw(self) + @cached_property + def OrganizationRoleAssignment(self): + from foundry_sdk.v2.admin.organization_role_assignment import ( + OrganizationRoleAssignmentClient, + ) # NOQA + + return OrganizationRoleAssignmentClient( + auth=self._auth, + hostname=self._hostname, + config=self._config, + ) + @core.maybe_ignore_preview @pydantic.validate_call @errors.handle_unexpected @@ -97,6 +110,58 @@ def get( ), ) + @core.maybe_ignore_preview + @pydantic.validate_call + @errors.handle_unexpected + def list_available_roles( + self, + organization_rid: core_models.OrganizationRid, + *, + preview: typing.Optional[core_models.PreviewMode] = None, + request_timeout: typing.Optional[core.Timeout] = None, + _sdk_internal: core.SdkInternal = {}, + ) -> admin_models.ListAvailableOrganizationRolesResponse: + """ + List all roles that can be assigned to a principal for the given Organization. + + :param organization_rid: + :type organization_rid: OrganizationRid + :param preview: Enables the use of preview functionality. + :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: admin_models.ListAvailableOrganizationRolesResponse + + :raises ListAvailableRolesOrganizationPermissionDenied: Could not listAvailableRoles the Organization. + :raises OrganizationNotFound: The given Organization could not be found. + """ + + return self._api_client.call_api( + core.RequestInfo( + method="GET", + resource_path="/v2/admin/organizations/{organizationRid}/listAvailableRoles", + query_params={ + "preview": preview, + }, + path_params={ + "organizationRid": organization_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=admin_models.ListAvailableOrganizationRolesResponse, + request_timeout=request_timeout, + throwable_errors={ + "ListAvailableRolesOrganizationPermissionDenied": admin_errors.ListAvailableRolesOrganizationPermissionDenied, + "OrganizationNotFound": admin_errors.OrganizationNotFound, + }, + response_mode=_sdk_internal.get("response_mode"), + ), + ) + @core.maybe_ignore_preview @pydantic.validate_call @errors.handle_unexpected @@ -175,16 +240,24 @@ def replace( class _OrganizationClientRaw: def __init__(self, client: OrganizationClient) -> None: def get(_: admin_models.Organization): ... + def list_available_roles(_: admin_models.ListAvailableOrganizationRolesResponse): ... def replace(_: admin_models.Organization): ... self.get = core.with_raw_response(get, client.get) + self.list_available_roles = core.with_raw_response( + list_available_roles, client.list_available_roles + ) self.replace = core.with_raw_response(replace, client.replace) class _OrganizationClientStreaming: def __init__(self, client: OrganizationClient) -> None: def get(_: admin_models.Organization): ... + def list_available_roles(_: admin_models.ListAvailableOrganizationRolesResponse): ... def replace(_: admin_models.Organization): ... self.get = core.with_streaming_response(get, client.get) + self.list_available_roles = core.with_streaming_response( + list_available_roles, client.list_available_roles + ) self.replace = core.with_streaming_response(replace, client.replace) diff --git a/foundry_sdk/v2/admin/organization_role_assignment.py b/foundry_sdk/v2/admin/organization_role_assignment.py new file mode 100644 index 000000000..ce8497886 --- /dev/null +++ b/foundry_sdk/v2/admin/organization_role_assignment.py @@ -0,0 +1,247 @@ +# 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. + + +import typing + +import pydantic +import typing_extensions + +from foundry_sdk import _core as core +from foundry_sdk import _errors as errors +from foundry_sdk.v2.admin import errors as admin_errors +from foundry_sdk.v2.admin import models as admin_models +from foundry_sdk.v2.core import models as core_models + + +class OrganizationRoleAssignmentClient: + """ + The API client for the OrganizationRoleAssignment Resource. + + :param auth: Your auth configuration. + :param hostname: Your Foundry hostname (for example, "myfoundry.palantirfoundry.com"). This can also include your API gateway service URI. + :param config: Optionally specify the configuration for the HTTP session. + """ + + def __init__( + self, + auth: core.Auth, + hostname: str, + config: typing.Optional[core.Config] = None, + ): + self._auth = auth + self._hostname = hostname + self._config = config + self._api_client = core.ApiClient(auth=auth, hostname=hostname, config=config) + + self.with_streaming_response = _OrganizationRoleAssignmentClientStreaming(self) + self.with_raw_response = _OrganizationRoleAssignmentClientRaw(self) + + @core.maybe_ignore_preview + @pydantic.validate_call + @errors.handle_unexpected + def add( + self, + organization_rid: core_models.OrganizationRid, + *, + role_assignments: typing.List[core_models.RoleAssignmentUpdate], + preview: typing.Optional[core_models.PreviewMode] = None, + request_timeout: typing.Optional[core.Timeout] = None, + _sdk_internal: core.SdkInternal = {}, + ) -> None: + """ + Assign roles to principals for the given Organization. At most 100 role assignments can be added in a single request. + + :param organization_rid: + :type organization_rid: OrganizationRid + :param role_assignments: + :type role_assignments: List[RoleAssignmentUpdate] + :param preview: Enables the use of preview functionality. + :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 + + :raises AddOrganizationRoleAssignmentsPermissionDenied: Could not add the OrganizationRoleAssignment. + :raises OrganizationNotFound: The given Organization could not be found. + :raises PrincipalNotFound: A principal (User or Group) with the given PrincipalId could not be found + """ + + return self._api_client.call_api( + core.RequestInfo( + method="POST", + resource_path="/v2/admin/organizations/{organizationRid}/roleAssignments/add", + query_params={ + "preview": preview, + }, + path_params={ + "organizationRid": organization_rid, + }, + header_params={ + "Content-Type": "application/json", + }, + body={ + "roleAssignments": role_assignments, + }, + body_type=typing_extensions.TypedDict( + "Body", + { # type: ignore + "roleAssignments": typing.List[core_models.RoleAssignmentUpdate], + }, + ), + response_type=None, + request_timeout=request_timeout, + throwable_errors={ + "AddOrganizationRoleAssignmentsPermissionDenied": admin_errors.AddOrganizationRoleAssignmentsPermissionDenied, + "OrganizationNotFound": admin_errors.OrganizationNotFound, + "PrincipalNotFound": admin_errors.PrincipalNotFound, + }, + response_mode=_sdk_internal.get("response_mode"), + ), + ) + + @core.maybe_ignore_preview + @pydantic.validate_call + @errors.handle_unexpected + def list( + self, + organization_rid: core_models.OrganizationRid, + *, + preview: typing.Optional[core_models.PreviewMode] = None, + request_timeout: typing.Optional[core.Timeout] = None, + _sdk_internal: core.SdkInternal = {}, + ) -> admin_models.ListOrganizationRoleAssignmentsResponse: + """ + List all principals who are assigned a role for the given Organization. + + :param organization_rid: + :type organization_rid: OrganizationRid + :param preview: Enables the use of preview functionality. + :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: admin_models.ListOrganizationRoleAssignmentsResponse + + :raises ListOrganizationRoleAssignmentsPermissionDenied: The provided token does not have permission to list assigned roles for this organization. + :raises OrganizationNotFound: The given Organization could not be found. + """ + + return self._api_client.call_api( + core.RequestInfo( + method="GET", + resource_path="/v2/admin/organizations/{organizationRid}/roleAssignments", + query_params={ + "preview": preview, + }, + path_params={ + "organizationRid": organization_rid, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=admin_models.ListOrganizationRoleAssignmentsResponse, + request_timeout=request_timeout, + throwable_errors={ + "ListOrganizationRoleAssignmentsPermissionDenied": admin_errors.ListOrganizationRoleAssignmentsPermissionDenied, + "OrganizationNotFound": admin_errors.OrganizationNotFound, + }, + response_mode=_sdk_internal.get("response_mode"), + ), + ) + + @core.maybe_ignore_preview + @pydantic.validate_call + @errors.handle_unexpected + def remove( + self, + organization_rid: core_models.OrganizationRid, + *, + role_assignments: typing.List[core_models.RoleAssignmentUpdate], + preview: typing.Optional[core_models.PreviewMode] = None, + request_timeout: typing.Optional[core.Timeout] = None, + _sdk_internal: core.SdkInternal = {}, + ) -> None: + """ + Remove roles from principals for the given Organization. At most 100 role assignments can be removed in a single request. + + :param organization_rid: + :type organization_rid: OrganizationRid + :param role_assignments: + :type role_assignments: List[RoleAssignmentUpdate] + :param preview: Enables the use of preview functionality. + :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 + + :raises OrganizationNotFound: The given Organization could not be found. + :raises PrincipalNotFound: A principal (User or Group) with the given PrincipalId could not be found + :raises RemoveOrganizationRoleAssignmentsPermissionDenied: Could not remove the OrganizationRoleAssignment. + """ + + return self._api_client.call_api( + core.RequestInfo( + method="POST", + resource_path="/v2/admin/organizations/{organizationRid}/roleAssignments/remove", + query_params={ + "preview": preview, + }, + path_params={ + "organizationRid": organization_rid, + }, + header_params={ + "Content-Type": "application/json", + }, + body={ + "roleAssignments": role_assignments, + }, + body_type=typing_extensions.TypedDict( + "Body", + { # type: ignore + "roleAssignments": typing.List[core_models.RoleAssignmentUpdate], + }, + ), + response_type=None, + request_timeout=request_timeout, + throwable_errors={ + "OrganizationNotFound": admin_errors.OrganizationNotFound, + "PrincipalNotFound": admin_errors.PrincipalNotFound, + "RemoveOrganizationRoleAssignmentsPermissionDenied": admin_errors.RemoveOrganizationRoleAssignmentsPermissionDenied, + }, + response_mode=_sdk_internal.get("response_mode"), + ), + ) + + +class _OrganizationRoleAssignmentClientRaw: + def __init__(self, client: OrganizationRoleAssignmentClient) -> None: + def add(_: None): ... + def list(_: admin_models.ListOrganizationRoleAssignmentsResponse): ... + def remove(_: None): ... + + self.add = core.with_raw_response(add, client.add) + self.list = core.with_raw_response(list, client.list) + self.remove = core.with_raw_response(remove, client.remove) + + +class _OrganizationRoleAssignmentClientStreaming: + def __init__(self, client: OrganizationRoleAssignmentClient) -> None: + def list(_: admin_models.ListOrganizationRoleAssignmentsResponse): ... + + self.list = core.with_streaming_response(list, client.list) diff --git a/foundry_sdk/v2/aip_agents/errors.py b/foundry_sdk/v2/aip_agents/errors.py index ebb693a89..6c93c3805 100644 --- a/foundry_sdk/v2/aip_agents/errors.py +++ b/foundry_sdk/v2/aip_agents/errors.py @@ -457,6 +457,45 @@ class SessionNotFound(errors.NotFoundError): error_instance_id: str +class SessionTraceIdAlreadyExistsParameters(typing_extensions.TypedDict): + """The provided trace ID already exists for the session and cannot be reused.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + agentRid: aip_agents_models.AgentRid + sessionRid: aip_agents_models.SessionRid + sessionTraceId: aip_agents_models.SessionTraceId + + +@dataclass +class SessionTraceIdAlreadyExists(errors.BadRequestError): + name: typing.Literal["SessionTraceIdAlreadyExists"] + parameters: SessionTraceIdAlreadyExistsParameters + error_instance_id: str + + +class SessionTraceNotFoundParameters(typing_extensions.TypedDict): + """The given SessionTrace could not be found.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + sessionTraceId: aip_agents_models.SessionTraceId + """The unique identifier for the trace.""" + + agentRid: aip_agents_models.AgentRid + """An RID identifying an AIP Agent created in [AIP Agent Studio](https://palantir.com/docs/foundry/agent-studio/overview/).""" + + sessionRid: aip_agents_models.SessionRid + """The Resource Identifier (RID) of the conversation session.""" + + +@dataclass +class SessionTraceNotFound(errors.NotFoundError): + name: typing.Literal["SessionTraceNotFound"] + parameters: SessionTraceNotFoundParameters + error_instance_id: str + + class StreamingContinueSessionPermissionDeniedParameters(typing_extensions.TypedDict): """Could not streamingContinue the Session.""" @@ -518,6 +557,8 @@ class UpdateSessionTitlePermissionDenied(errors.PermissionDeniedError): "RateLimitExceeded", "SessionExecutionFailed", "SessionNotFound", + "SessionTraceIdAlreadyExists", + "SessionTraceNotFound", "StreamingContinueSessionPermissionDenied", "UpdateSessionTitlePermissionDenied", ] diff --git a/foundry_sdk/v2/aip_agents/models.py b/foundry_sdk/v2/aip_agents/models.py index 2ea24a746..8c5636263 100644 --- a/foundry_sdk/v2/aip_agents/models.py +++ b/foundry_sdk/v2/aip_agents/models.py @@ -180,6 +180,24 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: return self.model_dump(by_alias=True, exclude_none=True) +class FailureToolCallOutput(pydantic.BaseModel): + """The failed output of a tool call.""" + + correction_message: str = pydantic.Field(alias=str("correctionMessage")) # type: ignore[literal-required] + """ + The correction message returned by the tool if the tool call was not successful. + This is a message that the tool returned to the Agent, which may be used to correct the + Agent's input to the tool. + """ + + type: typing.Literal["failure"] = "failure" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + class FunctionRetrievedContext(pydantic.BaseModel): """Context retrieved from running a function to include as additional context in the prompt to the Agent.""" @@ -351,6 +369,30 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """ +class RidToolInputValue(pydantic.BaseModel): + """A Resource Identifier (RID) that was passed as input to a tool.""" + + rid: core.RID + type: typing.Literal["rid"] = "rid" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class RidToolOutputValue(pydantic.BaseModel): + """A Resource Identifier (RID) value that was returned from a tool.""" + + rid: core.RID + type: typing.Literal["rid"] = "rid" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + class Session(pydantic.BaseModel): """Session""" @@ -437,6 +479,12 @@ class SessionExchangeResult(pydantic.BaseModel): In that case, the response (if any) was provided by the client as part of the cancellation request rather than by the Agent. """ + session_trace_id: SessionTraceId = pydantic.Field(alias=str("sessionTraceId")) # type: ignore[literal-required] + """ + The unique identifier for the session trace. The session trace lists the sequence of steps that an Agent + takes to arrive at an answer. For example, a trace may include steps such as context retrieval and tool calls. + """ + model_config = {"extra": "allow", "populate_by_name": True} def to_dict(self) -> typing.Dict[str, typing.Any]: @@ -480,6 +528,51 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """The Resource Identifier (RID) of the conversation session.""" +class SessionTrace(pydantic.BaseModel): + """SessionTrace""" + + id: SessionTraceId + """The unique identifier for the trace.""" + + status: SessionTraceStatus + """ + This indicates whether the Agent has finished generating the final response. Clients should keep polling + the `getSessionTrace` endpoint until the status is `COMPLETE`. + """ + + contexts: typing.Optional[SessionExchangeContexts] = None + """ + Any additional context which was provided by the client or retrieved automatically by the agent, grouped + by context type. Empty if no additional context was provided or configured to be automatically + retrieved. A present SessionExchangeContexts object with empty lists indicates that context retrieval + was attempted but no context was found. + Note that this field will only be populated once the response generation has completed. + """ + + tool_call_groups: typing.List[ToolCallGroup] = pydantic.Field(alias=str("toolCallGroups")) # type: ignore[literal-required] + """ + List of tool call groups that were triggered at the same point in the trace for the agent response + generation. The groups are returned in the same order as they were triggered by the agent. + """ + + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +SessionTraceId = core.UUID +""" +The unique identifier for a trace. The trace lists the sequence of steps that an Agent took to arrive at an +answer. For example, a trace may include steps such as context retrieval and tool calls. +""" + + +SessionTraceStatus = typing.Literal["IN_PROGRESS", "COMPLETE"] +"""SessionTraceStatus""" + + class StringParameter(pydantic.BaseModel): """StringParameter""" @@ -506,6 +599,133 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: return self.model_dump(by_alias=True, exclude_none=True) +class StringToolInputValue(pydantic.BaseModel): + """A string value that was passed as input to a tool.""" + + value: str + type: typing.Literal["string"] = "string" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class StringToolOutputValue(pydantic.BaseModel): + """A string value that was returned from a tool.""" + + value: str + type: typing.Literal["string"] = "string" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class SuccessToolCallOutput(pydantic.BaseModel): + """The successful output of a tool call.""" + + output: ToolOutputValue + type: typing.Literal["success"] = "success" + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class ToolCall(pydantic.BaseModel): + """A tool call with its input and output.""" + + tool_metadata: ToolMetadata = pydantic.Field(alias=str("toolMetadata")) # type: ignore[literal-required] + """Details about the tool that was called, including the name and type of the tool.""" + + input: ToolCallInput + output: typing.Optional[ToolCallOutput] = None + """Empty if the tool call is in progress.""" + + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class ToolCallGroup(pydantic.BaseModel): + """List of tool calls that were triggered at the same point in the trace for the agent response generation.""" + + tool_calls: typing.List[ToolCall] = pydantic.Field(alias=str("toolCalls")) # type: ignore[literal-required] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class ToolCallInput(pydantic.BaseModel): + """Input parameters for a tool call.""" + + thought: typing.Optional[str] = None + """Any additional message content that the Agent provided for why it chose to call the tool.""" + + inputs: typing.Dict[ToolInputName, ToolInputValue] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +ToolCallOutput = typing_extensions.Annotated[ + typing.Union[SuccessToolCallOutput, FailureToolCallOutput], pydantic.Field(discriminator="type") +] +"""The output of a tool call.""" + + +ToolInputName = str +"""The name of a tool input parameter.""" + + +ToolInputValue = typing_extensions.Annotated[ + typing.Union[StringToolInputValue, RidToolInputValue], pydantic.Field(discriminator="type") +] +"""A tool input value, which can be either a string or a Resource Identifier (RID).""" + + +class ToolMetadata(pydantic.BaseModel): + """Details about the used tool.""" + + name: str + """The name of the tool that was called, as configured on the Agent.""" + + type: ToolType + """The type of the tool that was called.""" + + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +ToolOutputValue = typing_extensions.Annotated[ + typing.Union[StringToolOutputValue, RidToolOutputValue], pydantic.Field(discriminator="type") +] +"""A tool output value, which can be either a string or a Resource Identifier (RID).""" + + +ToolType = typing.Literal[ + "FUNCTION", + "ACTION", + "ONTOLOGY_SEMANTIC_SEARCH", + "OBJECT_QUERY", + "UPDATE_APPLICATION_VARIABLE", + "REQUEST_CLARIFICATION", +] +"""ToolType""" + + class UserTextInput(pydantic.BaseModel): """UserTextInput""" @@ -523,6 +743,9 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: core.resolve_forward_references(ParameterType, globalns=globals(), localns=locals()) core.resolve_forward_references(ParameterValue, globalns=globals(), localns=locals()) core.resolve_forward_references(ParameterValueUpdate, globalns=globals(), localns=locals()) +core.resolve_forward_references(ToolCallOutput, globalns=globals(), localns=locals()) +core.resolve_forward_references(ToolInputValue, globalns=globals(), localns=locals()) +core.resolve_forward_references(ToolOutputValue, globalns=globals(), localns=locals()) __all__ = [ "Agent", @@ -536,6 +759,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "AgentsSessionsPage", "CancelSessionResponse", "Content", + "FailureToolCallOutput", "FunctionRetrievedContext", "InputContext", "ListAgentVersionsResponse", @@ -551,13 +775,30 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "ParameterType", "ParameterValue", "ParameterValueUpdate", + "RidToolInputValue", + "RidToolOutputValue", "Session", "SessionExchange", "SessionExchangeContexts", "SessionExchangeResult", "SessionMetadata", "SessionRid", + "SessionTrace", + "SessionTraceId", + "SessionTraceStatus", "StringParameter", "StringParameterValue", + "StringToolInputValue", + "StringToolOutputValue", + "SuccessToolCallOutput", + "ToolCall", + "ToolCallGroup", + "ToolCallInput", + "ToolCallOutput", + "ToolInputName", + "ToolInputValue", + "ToolMetadata", + "ToolOutputValue", + "ToolType", "UserTextInput", ] diff --git a/foundry_sdk/v2/aip_agents/session.py b/foundry_sdk/v2/aip_agents/session.py index 6a51299c4..120f54a2a 100644 --- a/foundry_sdk/v2/aip_agents/session.py +++ b/foundry_sdk/v2/aip_agents/session.py @@ -59,6 +59,16 @@ def Content(self): config=self._config, ) + @cached_property + def SessionTrace(self): + from foundry_sdk.v2.aip_agents.session_trace import SessionTraceClient + + return SessionTraceClient( + auth=self._auth, + hostname=self._hostname, + config=self._config, + ) + @core.maybe_ignore_preview @pydantic.validate_call @errors.handle_unexpected @@ -73,6 +83,7 @@ def blocking_continue( user_input: aip_agents_models.UserTextInput, contexts_override: typing.Optional[typing.List[aip_agents_models.InputContext]] = None, preview: typing.Optional[core_models.PreviewMode] = None, + session_trace_id: typing.Optional[aip_agents_models.SessionTraceId] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, ) -> aip_agents_models.SessionExchangeResult: @@ -96,6 +107,8 @@ def blocking_continue( :type contexts_override: Optional[List[InputContext]] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] + :param session_trace_id: The unique identifier to use for this continue session trace. By generating and passing this ID to the `blockingContinue` endpoint, clients can use this trace ID to separately load details of the trace used to generate a result, while the result is in progress. If omitted, it will be generated automatically. Clients can check the generated ID by inspecting the `sessionTraceId` in the `SessionExchangeResult`. + :type session_trace_id: Optional[SessionTraceId] :param request_timeout: timeout setting for this request in seconds. :type request_timeout: Optional[int] :return: Returns the result object. @@ -113,6 +126,7 @@ def blocking_continue( :raises RateLimitExceeded: Failed to generate a response as the model rate limits were exceeded. Clients should wait and retry. :raises SessionExecutionFailed: Failed to generate a response for a session due to an unexpected error. :raises SessionNotFound: The given Session could not be found. + :raises SessionTraceIdAlreadyExists: The provided trace ID already exists for the session and cannot be reused. """ return self._api_client.call_api( @@ -134,6 +148,7 @@ def blocking_continue( "userInput": user_input, "parameterInputs": parameter_inputs, "contextsOverride": contexts_override, + "sessionTraceId": session_trace_id, }, body_type=typing_extensions.TypedDict( "Body", @@ -145,6 +160,7 @@ def blocking_continue( "contextsOverride": typing.Optional[ typing.List[aip_agents_models.InputContext] ], + "sessionTraceId": typing.Optional[aip_agents_models.SessionTraceId], }, ), response_type=aip_agents_models.SessionExchangeResult, @@ -162,6 +178,7 @@ def blocking_continue( "RateLimitExceeded": aip_agents_errors.RateLimitExceeded, "SessionExecutionFailed": aip_agents_errors.SessionExecutionFailed, "SessionNotFound": aip_agents_errors.SessionNotFound, + "SessionTraceIdAlreadyExists": aip_agents_errors.SessionTraceIdAlreadyExists, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -539,6 +556,7 @@ def streaming_continue( contexts_override: typing.Optional[typing.List[aip_agents_models.InputContext]] = None, message_id: typing.Optional[aip_agents_models.MessageId] = None, preview: typing.Optional[core_models.PreviewMode] = None, + session_trace_id: typing.Optional[aip_agents_models.SessionTraceId] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, ) -> bytes: @@ -565,6 +583,8 @@ def streaming_continue( :type message_id: Optional[MessageId] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] + :param session_trace_id: The unique identifier to use for this continue session trace. By generating and passing this ID to the `streamingContinue` endpoint, clients can use this trace ID to separately load details of the trace used to generate a result, while the result is in progress. If omitted, it will be generated automatically. Clients can check the generated ID by inspecting the `sessionTraceId` in the `SessionExchangeResult`, which can be loaded via the `getContent` endpoint. + :type session_trace_id: Optional[SessionTraceId] :param request_timeout: timeout setting for this request in seconds. :type request_timeout: Optional[int] :return: Returns the result object. @@ -577,6 +597,7 @@ def streaming_continue( :raises ObjectTypeIdsNotFound: Some object types are configured for use by the Agent but could not be found. The object types either do not exist or the client token does not have access. Object types can be checked by listing available object types through the API, or searching in [Ontology Manager](https://palantir.com/docs/foundry/ontology-manager/overview/). :raises ObjectTypeRidsNotFound: Some object types are configured for use by the Agent but could not be found. The object types either do not exist or the client token does not have access. Object types can be checked by listing available object types through the API, or searching in [Ontology Manager](https://palantir.com/docs/foundry/ontology-manager/overview/). :raises SessionNotFound: The given Session could not be found. + :raises SessionTraceIdAlreadyExists: The provided trace ID already exists for the session and cannot be reused. :raises StreamingContinueSessionPermissionDenied: Could not streamingContinue the Session. """ @@ -600,6 +621,7 @@ def streaming_continue( "parameterInputs": parameter_inputs, "contextsOverride": contexts_override, "messageId": message_id, + "sessionTraceId": session_trace_id, }, body_type=typing_extensions.TypedDict( "Body", @@ -612,6 +634,7 @@ def streaming_continue( typing.List[aip_agents_models.InputContext] ], "messageId": typing.Optional[aip_agents_models.MessageId], + "sessionTraceId": typing.Optional[aip_agents_models.SessionTraceId], }, ), response_type=bytes, @@ -624,6 +647,7 @@ def streaming_continue( "ObjectTypeIdsNotFound": aip_agents_errors.ObjectTypeIdsNotFound, "ObjectTypeRidsNotFound": aip_agents_errors.ObjectTypeRidsNotFound, "SessionNotFound": aip_agents_errors.SessionNotFound, + "SessionTraceIdAlreadyExists": aip_agents_errors.SessionTraceIdAlreadyExists, "StreamingContinueSessionPermissionDenied": aip_agents_errors.StreamingContinueSessionPermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), diff --git a/foundry_sdk/v2/aip_agents/session_trace.py b/foundry_sdk/v2/aip_agents/session_trace.py new file mode 100644 index 000000000..065c1506a --- /dev/null +++ b/foundry_sdk/v2/aip_agents/session_trace.py @@ -0,0 +1,127 @@ +# 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. + + +import typing + +import pydantic +import typing_extensions + +from foundry_sdk import _core as core +from foundry_sdk import _errors as errors +from foundry_sdk.v2.aip_agents import errors as aip_agents_errors +from foundry_sdk.v2.aip_agents import models as aip_agents_models +from foundry_sdk.v2.core import models as core_models + + +class SessionTraceClient: + """ + The API client for the SessionTrace Resource. + + :param auth: Your auth configuration. + :param hostname: Your Foundry hostname (for example, "myfoundry.palantirfoundry.com"). This can also include your API gateway service URI. + :param config: Optionally specify the configuration for the HTTP session. + """ + + def __init__( + self, + auth: core.Auth, + hostname: str, + config: typing.Optional[core.Config] = None, + ): + self._auth = auth + self._hostname = hostname + self._config = config + self._api_client = core.ApiClient(auth=auth, hostname=hostname, config=config) + + self.with_streaming_response = _SessionTraceClientStreaming(self) + self.with_raw_response = _SessionTraceClientRaw(self) + + @core.maybe_ignore_preview + @pydantic.validate_call + @errors.handle_unexpected + def get( + self, + agent_rid: aip_agents_models.AgentRid, + session_rid: aip_agents_models.SessionRid, + session_trace_id: aip_agents_models.SessionTraceId, + *, + preview: typing.Optional[core_models.PreviewMode] = None, + request_timeout: typing.Optional[core.Timeout] = None, + _sdk_internal: core.SdkInternal = {}, + ) -> aip_agents_models.SessionTrace: + """ + Get the trace of an Agent response. The trace lists the sequence of steps that an Agent took to arrive at + an answer. For example, a trace may include steps such as context retrieval and tool calls. Clients should + poll this endpoint to check the realtime progress of a response until the trace is completed. + + :param agent_rid: An RID identifying an AIP Agent created in [AIP Agent Studio](https://palantir.com/docs/foundry/agent-studio/overview/). + :type agent_rid: AgentRid + :param session_rid: The Resource Identifier (RID) of the conversation session. + :type session_rid: SessionRid + :param session_trace_id: The unique identifier for the trace. + :type session_trace_id: SessionTraceId + :param preview: Enables the use of preview functionality. + :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: aip_agents_models.SessionTrace + + :raises AgentNotFound: The given Agent could not be found. + :raises SessionNotFound: The given Session could not be found. + :raises SessionTraceNotFound: The given SessionTrace could not be found. + """ + + return self._api_client.call_api( + core.RequestInfo( + method="GET", + resource_path="/v2/aipAgents/agents/{agentRid}/sessions/{sessionRid}/sessionTraces/{sessionTraceId}", + query_params={ + "preview": preview, + }, + path_params={ + "agentRid": agent_rid, + "sessionRid": session_rid, + "sessionTraceId": session_trace_id, + }, + header_params={ + "Accept": "application/json", + }, + body=None, + body_type=None, + response_type=aip_agents_models.SessionTrace, + request_timeout=request_timeout, + throwable_errors={ + "AgentNotFound": aip_agents_errors.AgentNotFound, + "SessionNotFound": aip_agents_errors.SessionNotFound, + "SessionTraceNotFound": aip_agents_errors.SessionTraceNotFound, + }, + response_mode=_sdk_internal.get("response_mode"), + ), + ) + + +class _SessionTraceClientRaw: + def __init__(self, client: SessionTraceClient) -> None: + def get(_: aip_agents_models.SessionTrace): ... + + self.get = core.with_raw_response(get, client.get) + + +class _SessionTraceClientStreaming: + def __init__(self, client: SessionTraceClient) -> None: + def get(_: aip_agents_models.SessionTrace): ... + + self.get = core.with_streaming_response(get, client.get) diff --git a/foundry_sdk/v2/cli.py b/foundry_sdk/v2/cli.py index 70ebc8199..64fb7d8ba 100644 --- a/foundry_sdk/v2/cli.py +++ b/foundry_sdk/v2/cli.py @@ -424,6 +424,28 @@ def admin_organization_get( click.echo(repr(result)) +@admin_organization.command("list_available_roles") +@click.argument("organization_rid", type=str, required=True) +@click.option( + "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" +) +@click.pass_obj +def admin_organization_list_available_roles( + client: FoundryClient, + organization_rid: str, + preview: typing.Optional[bool], +): + """ + List all roles that can be assigned to a principal for the given Organization. + + """ + result = client.admin.Organization.list_available_roles( + organization_rid=organization_rid, + preview=preview, + ) + click.echo(repr(result)) + + @admin_organization.command("replace") @click.argument("organization_rid", type=str, required=True) @click.option("--name", type=str, required=True, help="""""") @@ -461,6 +483,83 @@ def admin_organization_replace( click.echo(repr(result)) +@admin_organization.group("organization_role_assignment") +def admin_organization_organization_role_assignment(): + pass + + +@admin_organization_organization_role_assignment.command("add") +@click.argument("organization_rid", type=str, required=True) +@click.option("--role_assignments", type=str, required=True, help="""""") +@click.option( + "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" +) +@click.pass_obj +def admin_organization_organization_role_assignment_add( + client: FoundryClient, + organization_rid: str, + role_assignments: str, + preview: typing.Optional[bool], +): + """ + Assign roles to principals for the given Organization. At most 100 role assignments can be added in a single request. + + """ + result = client.admin.Organization.OrganizationRoleAssignment.add( + organization_rid=organization_rid, + role_assignments=json.loads(role_assignments), + preview=preview, + ) + click.echo(repr(result)) + + +@admin_organization_organization_role_assignment.command("list") +@click.argument("organization_rid", type=str, required=True) +@click.option( + "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" +) +@click.pass_obj +def admin_organization_organization_role_assignment_list( + client: FoundryClient, + organization_rid: str, + preview: typing.Optional[bool], +): + """ + List all principals who are assigned a role for the given Organization. + + """ + result = client.admin.Organization.OrganizationRoleAssignment.list( + organization_rid=organization_rid, + preview=preview, + ) + click.echo(repr(result)) + + +@admin_organization_organization_role_assignment.command("remove") +@click.argument("organization_rid", type=str, required=True) +@click.option("--role_assignments", type=str, required=True, help="""""") +@click.option( + "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" +) +@click.pass_obj +def admin_organization_organization_role_assignment_remove( + client: FoundryClient, + organization_rid: str, + role_assignments: str, + preview: typing.Optional[bool], +): + """ + Remove roles from principals for the given Organization. At most 100 role assignments can be removed in a single request. + + """ + result = client.admin.Organization.OrganizationRoleAssignment.remove( + organization_rid=organization_rid, + role_assignments=json.loads(role_assignments), + preview=preview, + ) + click.echo(repr(result)) + + @admin.group("marking_category") def admin_marking_category(): pass @@ -1472,6 +1571,16 @@ def aip_agents_agent_session(): @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" ) +@click.option( + "--session_trace_id", + type=str, + required=False, + help="""The unique identifier to use for this continue session trace. By generating and passing this ID to the +`blockingContinue` endpoint, clients can use this trace ID to separately load details of the trace used +to generate a result, while the result is in progress. If omitted, it will be generated automatically. +Clients can check the generated ID by inspecting the `sessionTraceId` in the `SessionExchangeResult`. +""", +) @click.pass_obj def aip_agents_agent_session_blocking_continue( client: FoundryClient, @@ -1481,6 +1590,7 @@ def aip_agents_agent_session_blocking_continue( user_input: str, contexts_override: typing.Optional[str], preview: typing.Optional[bool], + session_trace_id: typing.Optional[str], ): """ Continue a conversation session with an Agent, or add the first exchange to a session after creation. @@ -1498,6 +1608,7 @@ def aip_agents_agent_session_blocking_continue( user_input=json.loads(user_input), contexts_override=None if contexts_override is None else json.loads(contexts_override), preview=preview, + session_trace_id=session_trace_id, ) click.echo(repr(result)) @@ -1724,6 +1835,17 @@ def aip_agents_agent_session_rag_context( @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" ) +@click.option( + "--session_trace_id", + type=str, + required=False, + help="""The unique identifier to use for this continue session trace. By generating and passing this ID to the +`streamingContinue` endpoint, clients can use this trace ID to separately load details of the trace used +to generate a result, while the result is in progress. If omitted, it will be generated automatically. +Clients can check the generated ID by inspecting the `sessionTraceId` in the `SessionExchangeResult`, +which can be loaded via the `getContent` endpoint. +""", +) @click.pass_obj def aip_agents_agent_session_streaming_continue( client: FoundryClient, @@ -1734,6 +1856,7 @@ def aip_agents_agent_session_streaming_continue( contexts_override: typing.Optional[str], message_id: typing.Optional[str], preview: typing.Optional[bool], + session_trace_id: typing.Optional[str], ): """ Continue a conversation session with an Agent, or add the first exchange to a session after creation. @@ -1753,6 +1876,7 @@ def aip_agents_agent_session_streaming_continue( contexts_override=None if contexts_override is None else json.loads(contexts_override), message_id=message_id, preview=preview, + session_trace_id=session_trace_id, ) click.echo(result) @@ -1793,6 +1917,41 @@ def aip_agents_agent_session_update_title( click.echo(repr(result)) +@aip_agents_agent_session.group("session_trace") +def aip_agents_agent_session_session_trace(): + pass + + +@aip_agents_agent_session_session_trace.command("get") +@click.argument("agent_rid", type=str, required=True) +@click.argument("session_rid", type=str, required=True) +@click.argument("session_trace_id", type=str, required=True) +@click.option( + "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" +) +@click.pass_obj +def aip_agents_agent_session_session_trace_get( + client: FoundryClient, + agent_rid: str, + session_rid: str, + session_trace_id: str, + preview: typing.Optional[bool], +): + """ + Get the trace of an Agent response. The trace lists the sequence of steps that an Agent took to arrive at + an answer. For example, a trace may include steps such as context retrieval and tool calls. Clients should + poll this endpoint to check the realtime progress of a response until the trace is completed. + + """ + result = client.aip_agents.Agent.Session.SessionTrace.get( + agent_rid=agent_rid, + session_rid=session_rid, + session_trace_id=session_trace_id, + preview=preview, + ) + click.echo(repr(result)) + + @aip_agents_agent_session.group("content") def aip_agents_agent_session_content(): pass @@ -2033,7 +2192,12 @@ def connectivity_connection_table_import(): @connectivity_connection_table_import.command("create") @click.argument("connection_rid", type=str, required=True) @click.option("--config", type=str, required=True, help="""""") -@click.option("--dataset_rid", type=str, required=True, help="""The RID of the output dataset.""") +@click.option( + "--dataset_rid", + type=str, + required=True, + help="""The RID of the output dataset. Can not be modified after the table import is created.""", +) @click.option("--display_name", type=str, required=True, help="""""") @click.option( "--import_mode", type=click.Choice(["SNAPSHOT", "APPEND"]), required=True, help="""""" @@ -2048,7 +2212,7 @@ def connectivity_connection_table_import(): "--branch_name", type=str, required=False, - help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""", + help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the table import is created.""", ) @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" @@ -2200,7 +2364,6 @@ def connectivity_connection_table_import_list( @click.argument("connection_rid", type=str, required=True) @click.argument("table_import_rid", type=str, required=True) @click.option("--config", type=str, required=True, help="""""") -@click.option("--dataset_rid", type=str, required=True, help="""The RID of the output dataset.""") @click.option("--display_name", type=str, required=True, help="""""") @click.option( "--import_mode", type=click.Choice(["SNAPSHOT", "APPEND"]), required=True, help="""""" @@ -2211,12 +2374,6 @@ def connectivity_connection_table_import_list( required=False, help="""Allow the TableImport to succeed if the schema of imported rows does not match the existing dataset's schema. Defaults to false for new table imports.""", ) -@click.option( - "--branch_name", - type=str, - required=False, - help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""", -) @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" ) @@ -2226,11 +2383,9 @@ def connectivity_connection_table_import_replace( connection_rid: str, table_import_rid: str, config: str, - dataset_rid: str, display_name: str, import_mode: typing.Literal["SNAPSHOT", "APPEND"], allow_schema_changes: typing.Optional[bool], - branch_name: typing.Optional[str], preview: typing.Optional[bool], ): """ @@ -2240,11 +2395,9 @@ def connectivity_connection_table_import_replace( connection_rid=connection_rid, table_import_rid=table_import_rid, config=json.loads(config), - dataset_rid=dataset_rid, display_name=display_name, import_mode=import_mode, allow_schema_changes=allow_schema_changes, - branch_name=branch_name, preview=preview, ) click.echo(repr(result)) @@ -2257,7 +2410,12 @@ def connectivity_connection_file_import(): @connectivity_connection_file_import.command("create") @click.argument("connection_rid", type=str, required=True) -@click.option("--dataset_rid", type=str, required=True, help="""The RID of the output dataset.""") +@click.option( + "--dataset_rid", + type=str, + required=True, + help="""The RID of the output dataset. Can not be modified after the file import is created.""", +) @click.option("--display_name", type=str, required=True, help="""""") @click.option( "--file_import_filters", @@ -2272,7 +2430,7 @@ def connectivity_connection_file_import(): "--branch_name", type=str, required=False, - help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""", + help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the file import is created.""", ) @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" @@ -2429,7 +2587,6 @@ def connectivity_connection_file_import_list( @connectivity_connection_file_import.command("replace") @click.argument("connection_rid", type=str, required=True) @click.argument("file_import_rid", type=str, required=True) -@click.option("--dataset_rid", type=str, required=True, help="""The RID of the output dataset.""") @click.option("--display_name", type=str, required=True, help="""""") @click.option( "--file_import_filters", @@ -2440,12 +2597,6 @@ def connectivity_connection_file_import_list( @click.option( "--import_mode", type=click.Choice(["SNAPSHOT", "APPEND", "UPDATE"]), required=True, help="""""" ) -@click.option( - "--branch_name", - type=str, - required=False, - help="""The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""", -) @click.option( "--preview", type=bool, required=False, help="""Enables the use of preview functionality.""" ) @@ -2460,11 +2611,9 @@ def connectivity_connection_file_import_replace( client: FoundryClient, connection_rid: str, file_import_rid: str, - dataset_rid: str, display_name: str, file_import_filters: str, import_mode: typing.Literal["SNAPSHOT", "APPEND", "UPDATE"], - branch_name: typing.Optional[str], preview: typing.Optional[bool], subfolder: typing.Optional[str], ): @@ -2474,11 +2623,9 @@ def connectivity_connection_file_import_replace( result = client.connectivity.Connection.FileImport.replace( connection_rid=connection_rid, file_import_rid=file_import_rid, - dataset_rid=dataset_rid, display_name=display_name, file_import_filters=json.loads(file_import_filters), import_mode=import_mode, - branch_name=branch_name, preview=preview, subfolder=subfolder, ) @@ -5120,13 +5267,6 @@ def ontologies_ontology_object_count( @click.argument("ontology", type=str, required=True) @click.argument("object_type", type=str, required=True) @click.argument("primary_key", type=str, required=True) -@click.option( - "--artifact_repository", - type=str, - required=False, - help="""The repository associated with a marketplace installation. -""", -) @click.option( "--exclude_rid", type=bool, @@ -5136,10 +5276,17 @@ def ontologies_ontology_object_count( """, ) @click.option( - "--package_name", + "--sdk_package_rid", type=str, required=False, - help="""The package name of the generated SDK. + help="""The package rid of the generated SDK. +""", +) +@click.option( + "--sdk_version", + type=str, + required=False, + help="""The version of the generated SDK. """, ) @click.option( @@ -5156,9 +5303,9 @@ def ontologies_ontology_object_get( ontology: str, object_type: str, primary_key: str, - artifact_repository: typing.Optional[str], exclude_rid: typing.Optional[bool], - package_name: typing.Optional[str], + sdk_package_rid: typing.Optional[str], + sdk_version: typing.Optional[str], select: typing.Optional[str], ): """ @@ -5171,9 +5318,9 @@ def ontologies_ontology_object_get( ontology=ontology, object_type=object_type, primary_key=primary_key, - artifact_repository=artifact_repository, exclude_rid=exclude_rid, - package_name=package_name, + sdk_package_rid=sdk_package_rid, + sdk_version=sdk_version, select=None if select is None else json.loads(select), ) click.echo(repr(result)) diff --git a/foundry_sdk/v2/connectivity/errors.py b/foundry_sdk/v2/connectivity/errors.py index 5f517b2d9..5004f6888 100644 --- a/foundry_sdk/v2/connectivity/errors.py +++ b/foundry_sdk/v2/connectivity/errors.py @@ -21,7 +21,6 @@ from foundry_sdk import _errors as errors from foundry_sdk.v2.connectivity import models as connectivity_models from foundry_sdk.v2.core import models as core_models -from foundry_sdk.v2.datasets import models as datasets_models class AdditionalSecretsMustBeSpecifiedAsPlaintextValueMapParameters(typing_extensions.TypedDict): @@ -37,38 +36,6 @@ class AdditionalSecretsMustBeSpecifiedAsPlaintextValueMap(errors.BadRequestError error_instance_id: str -class ChangingBranchNameNotSupportedForImportsParameters(typing_extensions.TypedDict): - """Changing of branch name is not supported for imports.""" - - __pydantic_config__ = {"extra": "allow"} # type: ignore - - existingBranchName: typing_extensions.NotRequired[datasets_models.BranchName] - newBranchName: typing_extensions.NotRequired[datasets_models.BranchName] - - -@dataclass -class ChangingBranchNameNotSupportedForImports(errors.BadRequestError): - name: typing.Literal["ChangingBranchNameNotSupportedForImports"] - parameters: ChangingBranchNameNotSupportedForImportsParameters - error_instance_id: str - - -class ChangingOutputDatasetNotSupportedForImportsParameters(typing_extensions.TypedDict): - """Changing of output dataset is not supported for imports.""" - - __pydantic_config__ = {"extra": "allow"} # type: ignore - - existingOutputDatasetRid: datasets_models.DatasetRid - newOutputDatasetRid: datasets_models.DatasetRid - - -@dataclass -class ChangingOutputDatasetNotSupportedForImports(errors.BadRequestError): - name: typing.Literal["ChangingOutputDatasetNotSupportedForImports"] - parameters: ChangingOutputDatasetNotSupportedForImportsParameters - error_instance_id: str - - class ConnectionDetailsNotDeterminedParameters(typing_extensions.TypedDict): """Details of the connection (such as which types of import it supports) could not be determined.""" @@ -568,8 +535,6 @@ class UpdateSecretsForConnectionPermissionDenied(errors.PermissionDeniedError): __all__ = [ "AdditionalSecretsMustBeSpecifiedAsPlaintextValueMap", - "ChangingBranchNameNotSupportedForImports", - "ChangingOutputDatasetNotSupportedForImports", "ConnectionDetailsNotDetermined", "ConnectionNotFound", "ConnectionTypeNotSupported", diff --git a/foundry_sdk/v2/connectivity/file_import.py b/foundry_sdk/v2/connectivity/file_import.py index 5b8bf0f75..fac18f496 100644 --- a/foundry_sdk/v2/connectivity/file_import.py +++ b/foundry_sdk/v2/connectivity/file_import.py @@ -71,7 +71,7 @@ def create( Creates a new FileImport. :param connection_rid: :type connection_rid: ConnectionRid - :param dataset_rid: The RID of the output dataset. + :param dataset_rid: The RID of the output dataset. Can not be modified after the file import is created. :type dataset_rid: DatasetRid :param display_name: :type display_name: FileImportDisplayName @@ -79,7 +79,7 @@ def create( :type file_import_filters: List[FileImportFilter] :param import_mode: :type import_mode: FileImportMode - :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. + :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the file import is created. :type branch_name: Optional[BranchName] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] @@ -380,11 +380,9 @@ def replace( connection_rid: connectivity_models.ConnectionRid, file_import_rid: connectivity_models.FileImportRid, *, - dataset_rid: datasets_models.DatasetRid, display_name: connectivity_models.FileImportDisplayName, file_import_filters: typing.List[connectivity_models.FileImportFilter], import_mode: connectivity_models.FileImportMode, - branch_name: typing.Optional[datasets_models.BranchName] = None, preview: typing.Optional[core_models.PreviewMode] = None, subfolder: typing.Optional[str] = None, request_timeout: typing.Optional[core.Timeout] = None, @@ -396,16 +394,12 @@ def replace( :type connection_rid: ConnectionRid :param file_import_rid: :type file_import_rid: FileImportRid - :param dataset_rid: The RID of the output dataset. - :type dataset_rid: DatasetRid :param display_name: :type display_name: FileImportDisplayName :param file_import_filters: Use filters to limit which files should be imported. Filters are applied in the order they are defined. A different ordering of filters may lead to a more optimized import. [Learn more about optimizing file imports.](https://palantir.com/docs/foundry/data-connection/file-based-syncs/#optimize-file-based-syncs) :type file_import_filters: List[FileImportFilter] :param import_mode: :type import_mode: FileImportMode - :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. - :type branch_name: Optional[BranchName] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] :param subfolder: A subfolder in the external system that will be imported. If not specified, defaults to the root folder of the external system. @@ -440,20 +434,16 @@ def replace( "Accept": "application/json", }, body={ - "datasetRid": dataset_rid, "importMode": import_mode, "displayName": display_name, - "branchName": branch_name, "subfolder": subfolder, "fileImportFilters": file_import_filters, }, body_type=typing_extensions.TypedDict( "Body", { # type: ignore - "datasetRid": datasets_models.DatasetRid, "importMode": connectivity_models.FileImportMode, "displayName": connectivity_models.FileImportDisplayName, - "branchName": typing.Optional[datasets_models.BranchName], "subfolder": typing.Optional[str], "fileImportFilters": typing.List[connectivity_models.FileImportFilter], }, diff --git a/foundry_sdk/v2/connectivity/models.py b/foundry_sdk/v2/connectivity/models.py index d57956b7e..5eee7eae4 100644 --- a/foundry_sdk/v2/connectivity/models.py +++ b/foundry_sdk/v2/connectivity/models.py @@ -732,10 +732,10 @@ class FileImport(pydantic.BaseModel): """The RID of the Connection (also known as a source) that the File Import uses to import data.""" dataset_rid: datasets_models.DatasetRid = pydantic.Field(alias=str("datasetRid")) # type: ignore[literal-required] - """The RID of the output dataset.""" + """The RID of the output dataset. Can not be modified after the file import is created.""" branch_name: typing.Optional[datasets_models.BranchName] = pydantic.Field(alias=str("branchName"), default=None) # type: ignore[literal-required] - """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""" + """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the file import is created.""" display_name: FileImportDisplayName = pydantic.Field(alias=str("displayName")) # type: ignore[literal-required] file_import_filters: typing.List[FileImportFilter] = pydantic.Field(alias=str("fileImportFilters")) # type: ignore[literal-required] @@ -1646,10 +1646,10 @@ class TableImport(pydantic.BaseModel): """The RID of the Connection (also known as a source) that the Table Import uses to import data.""" dataset_rid: datasets_models.DatasetRid = pydantic.Field(alias=str("datasetRid")) # type: ignore[literal-required] - """The RID of the output dataset.""" + """The RID of the output dataset. Can not be modified after the table import is created.""" branch_name: typing.Optional[datasets_models.BranchName] = pydantic.Field(alias=str("branchName"), default=None) # type: ignore[literal-required] - """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments.""" + """The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the table import is created.""" display_name: TableImportDisplayName = pydantic.Field(alias=str("displayName")) # type: ignore[literal-required] import_mode: TableImportMode = pydantic.Field(alias=str("importMode")) # type: ignore[literal-required] diff --git a/foundry_sdk/v2/connectivity/table_import.py b/foundry_sdk/v2/connectivity/table_import.py index 85585275e..36dc64dbc 100644 --- a/foundry_sdk/v2/connectivity/table_import.py +++ b/foundry_sdk/v2/connectivity/table_import.py @@ -75,7 +75,7 @@ def create( :type connection_rid: ConnectionRid :param config: :type config: CreateTableImportRequestTableImportConfig - :param dataset_rid: The RID of the output dataset. + :param dataset_rid: The RID of the output dataset. Can not be modified after the table import is created. :type dataset_rid: DatasetRid :param display_name: :type display_name: TableImportDisplayName @@ -83,7 +83,7 @@ def create( :type import_mode: TableImportMode :param allow_schema_changes: Allow the TableImport to succeed if the schema of imported rows does not match the existing dataset's schema. Defaults to false for new table imports. :type allow_schema_changes: Optional[TableImportAllowSchemaChanges] - :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. + :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. Can not be modified after the table import is created. :type branch_name: Optional[BranchName] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] @@ -381,13 +381,11 @@ def replace( table_import_rid: connectivity_models.TableImportRid, *, config: connectivity_models.ReplaceTableImportRequestTableImportConfig, - dataset_rid: datasets_models.DatasetRid, display_name: connectivity_models.TableImportDisplayName, import_mode: connectivity_models.TableImportMode, allow_schema_changes: typing.Optional[ connectivity_models.TableImportAllowSchemaChanges ] = None, - branch_name: typing.Optional[datasets_models.BranchName] = None, preview: typing.Optional[core_models.PreviewMode] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, @@ -400,16 +398,12 @@ def replace( :type table_import_rid: TableImportRid :param config: :type config: ReplaceTableImportRequestTableImportConfig - :param dataset_rid: The RID of the output dataset. - :type dataset_rid: DatasetRid :param display_name: :type display_name: TableImportDisplayName :param import_mode: :type import_mode: TableImportMode :param allow_schema_changes: Allow the TableImport to succeed if the schema of imported rows does not match the existing dataset's schema. Defaults to false for new table imports. :type allow_schema_changes: Optional[TableImportAllowSchemaChanges] - :param branch_name: The branch name in the output dataset that will contain the imported data. Defaults to `master` for most enrollments. - :type branch_name: Optional[BranchName] :param preview: Enables the use of preview functionality. :type preview: Optional[PreviewMode] :param request_timeout: timeout setting for this request in seconds. @@ -417,8 +411,6 @@ def replace( :return: Returns the result object. :rtype: connectivity_models.TableImport - :raises ChangingBranchNameNotSupportedForImports: Changing of branch name is not supported for imports. - :raises ChangingOutputDatasetNotSupportedForImports: Changing of output dataset is not supported for imports. :raises ConnectionDetailsNotDetermined: Details of the connection (such as which types of import it supports) could not be determined. :raises ReplaceTableImportPermissionDenied: Could not replace the TableImport. :raises TableImportNotFound: The given TableImport could not be found. @@ -442,31 +434,25 @@ def replace( "Accept": "application/json", }, body={ - "datasetRid": dataset_rid, "importMode": import_mode, "displayName": display_name, "allowSchemaChanges": allow_schema_changes, - "branchName": branch_name, "config": config, }, body_type=typing_extensions.TypedDict( "Body", { # type: ignore - "datasetRid": datasets_models.DatasetRid, "importMode": connectivity_models.TableImportMode, "displayName": connectivity_models.TableImportDisplayName, "allowSchemaChanges": typing.Optional[ connectivity_models.TableImportAllowSchemaChanges ], - "branchName": typing.Optional[datasets_models.BranchName], "config": connectivity_models.ReplaceTableImportRequestTableImportConfig, }, ), response_type=connectivity_models.TableImport, request_timeout=request_timeout, throwable_errors={ - "ChangingBranchNameNotSupportedForImports": connectivity_errors.ChangingBranchNameNotSupportedForImports, - "ChangingOutputDatasetNotSupportedForImports": connectivity_errors.ChangingOutputDatasetNotSupportedForImports, "ConnectionDetailsNotDetermined": connectivity_errors.ConnectionDetailsNotDetermined, "ReplaceTableImportPermissionDenied": connectivity_errors.ReplaceTableImportPermissionDenied, "TableImportNotFound": connectivity_errors.TableImportNotFound, diff --git a/foundry_sdk/v2/core/models.py b/foundry_sdk/v2/core/models.py index 73ec7b4af..58c26148b 100644 --- a/foundry_sdk/v2/core/models.py +++ b/foundry_sdk/v2/core/models.py @@ -725,6 +725,13 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: return self.model_dump(by_alias=True, exclude_none=True) +Operation = str +""" +An operation that can be performed on a resource. Operations are used to define the permissions that a Role has. +Operations are typically in the format `service:action`, where `service` is related to the type of resource and `action` is the action being performed. +""" + + OperationScope = str """OperationScope""" @@ -772,6 +779,45 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """The release status of the entity.""" +class Role(pydantic.BaseModel): + """A set of permissions that can be assigned to a principal for a specific resource type.""" + + id: RoleId + role_set_id: RoleSetId = pydantic.Field(alias=str("roleSetId")) # type: ignore[literal-required] + name: str + description: str + is_default: bool = pydantic.Field(alias=str("isDefault")) # type: ignore[literal-required] + """Default roles are provided by Palantir and cannot be edited or modified by administrators.""" + + type: RoleContext + """The type of resource that is valid for this role.""" + + operations: typing.List[Operation] + """The operations that a principal can perform with this role on the assigned resource.""" + + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +class RoleAssignmentUpdate(pydantic.BaseModel): + """RoleAssignmentUpdate""" + + role_id: RoleId = pydantic.Field(alias=str("roleId")) # type: ignore[literal-required] + principal_id: PrincipalId = pydantic.Field(alias=str("principalId")) # type: ignore[literal-required] + model_config = {"extra": "allow", "populate_by_name": True} + + def to_dict(self) -> typing.Dict[str, typing.Any]: + """Return the dictionary representation of the model using the field aliases.""" + return self.model_dump(by_alias=True, exclude_none=True) + + +RoleContext = typing.Literal["ORGANIZATION"] +"""RoleContext""" + + RoleId = str """ The unique ID for a Role. Roles are sets of permissions that grant different levels of access to resources. @@ -780,6 +826,10 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """ +RoleSetId = str +"""RoleSetId""" + + ScheduleRid = core.RID """The RID of a Schedule.""" @@ -1059,6 +1109,7 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "MediaSetViewRid", "MediaType", "NullType", + "Operation", "OperationScope", "OrderByDirection", "OrganizationRid", @@ -1070,7 +1121,11 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "Realm", "Reference", "ReleaseStatus", + "Role", + "RoleAssignmentUpdate", + "RoleContext", "RoleId", + "RoleSetId", "ScheduleRid", "ShortType", "SizeBytes", diff --git a/foundry_sdk/v2/datasets/branch.py b/foundry_sdk/v2/datasets/branch.py index d3d788a0d..aa6fa0f3e 100644 --- a/foundry_sdk/v2/datasets/branch.py +++ b/foundry_sdk/v2/datasets/branch.py @@ -20,6 +20,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v2.core import errors as core_errors from foundry_sdk.v2.core import models as core_models from foundry_sdk.v2.datasets import errors as datasets_errors from foundry_sdk.v2.datasets import models as datasets_models @@ -74,9 +75,13 @@ def create( :return: Returns the result object. :rtype: datasets_models.Branch + :raises BranchAlreadyExists: The branch cannot be created because a branch with that name already exists. :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises CreateBranchPermissionDenied: The provided token does not have permission to create a branch of this dataset. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises TransactionNotCommitted: The given transaction has not been committed. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -105,9 +110,13 @@ def create( response_type=datasets_models.Branch, request_timeout=request_timeout, throwable_errors={ + "BranchAlreadyExists": datasets_errors.BranchAlreadyExists, "BranchNotFound": datasets_errors.BranchNotFound, "CreateBranchPermissionDenied": datasets_errors.CreateBranchPermissionDenied, "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "TransactionNotCommitted": datasets_errors.TransactionNotCommitted, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -139,6 +148,7 @@ def delete( :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises DeleteBranchPermissionDenied: The provided token does not have permission to delete the given branch from this dataset. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. """ return self._api_client.call_api( @@ -159,6 +169,7 @@ def delete( "BranchNotFound": datasets_errors.BranchNotFound, "DatasetNotFound": datasets_errors.DatasetNotFound, "DeleteBranchPermissionDenied": datasets_errors.DeleteBranchPermissionDenied, + "InvalidBranchName": datasets_errors.InvalidBranchName, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -243,6 +254,7 @@ def list( :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidPageSize: The provided page size was zero or negative. Page sizes must be greater than zero. """ return self._api_client.call_api( @@ -266,6 +278,7 @@ def list( throwable_errors={ "BranchNotFound": datasets_errors.BranchNotFound, "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidPageSize": core_errors.InvalidPageSize, }, response_mode=_sdk_internal.get("response_mode", "ITERATOR"), ), diff --git a/foundry_sdk/v2/datasets/dataset.py b/foundry_sdk/v2/datasets/dataset.py index 5204257c9..562ccd487 100644 --- a/foundry_sdk/v2/datasets/dataset.py +++ b/foundry_sdk/v2/datasets/dataset.py @@ -21,6 +21,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v2.core import errors as core_errors from foundry_sdk.v2.core import models as core_models from foundry_sdk.v2.datasets import errors as datasets_errors from foundry_sdk.v2.datasets import models as datasets_models @@ -104,7 +105,15 @@ def create( :return: Returns the result object. :rtype: datasets_models.Dataset + :raises BranchAlreadyExists: The branch cannot be created because a branch with that name already exists. + :raises CreateBranchPermissionDenied: The provided token does not have permission to create a branch of this dataset. :raises CreateDatasetPermissionDenied: The provided token does not have permission to create a dataset in this folder. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises FolderNotFound: The given Folder could not be found. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises ResourceNameAlreadyExists: The provided resource name is already in use by another resource in the same folder. + :raises TransactionNotCommitted: The given transaction has not been committed. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -131,7 +140,15 @@ def create( response_type=datasets_models.Dataset, request_timeout=request_timeout, throwable_errors={ + "BranchAlreadyExists": datasets_errors.BranchAlreadyExists, + "CreateBranchPermissionDenied": datasets_errors.CreateBranchPermissionDenied, "CreateDatasetPermissionDenied": datasets_errors.CreateDatasetPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "FolderNotFound": filesystem_errors.FolderNotFound, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "ResourceNameAlreadyExists": filesystem_errors.ResourceNameAlreadyExists, + "TransactionNotCommitted": datasets_errors.TransactionNotCommitted, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -215,6 +232,8 @@ def get_schedules( :return: Returns the result object. :rtype: core.ResourceIterator[core_models.ScheduleRid] + :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises GetDatasetSchedulesPermissionDenied: Could not getSchedules the Dataset. """ @@ -239,6 +258,8 @@ def get_schedules( response_type=datasets_models.ListSchedulesResponse, request_timeout=request_timeout, throwable_errors={ + "BranchNotFound": datasets_errors.BranchNotFound, + "DatasetNotFound": datasets_errors.DatasetNotFound, "GetDatasetSchedulesPermissionDenied": datasets_errors.GetDatasetSchedulesPermissionDenied, }, response_mode=_sdk_internal.get("response_mode", "ITERATOR"), @@ -286,6 +307,8 @@ def read_table( :rtype: bytes :raises ColumnTypesNotSupported: The dataset contains column types that are not supported. + :raises DatasetReadNotSupported: The dataset does not support being read. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. :raises ReadTableDatasetPermissionDenied: The provided token does not have permission to read the given dataset as a table. :raises ReadTableError: An error occurred while reading the table. Refer to the message for more details. :raises ReadTableRowLimitExceeded: The request to read the table generates a result that exceeds the allowed number of rows. For datasets not stored as Parquet there is a limit of 1 million rows. For datasets stored as Parquet there is no limit. @@ -317,6 +340,8 @@ def read_table( request_timeout=request_timeout, throwable_errors={ "ColumnTypesNotSupported": datasets_errors.ColumnTypesNotSupported, + "DatasetReadNotSupported": datasets_errors.DatasetReadNotSupported, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, "ReadTableDatasetPermissionDenied": datasets_errors.ReadTableDatasetPermissionDenied, "ReadTableError": datasets_errors.ReadTableError, "ReadTableRowLimitExceeded": datasets_errors.ReadTableRowLimitExceeded, diff --git a/foundry_sdk/v2/datasets/file.py b/foundry_sdk/v2/datasets/file.py index 17776ae9d..cd56635b6 100644 --- a/foundry_sdk/v2/datasets/file.py +++ b/foundry_sdk/v2/datasets/file.py @@ -20,6 +20,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v2.core import errors as core_errors from foundry_sdk.v2.core import models as core_models from foundry_sdk.v2.datasets import errors as datasets_errors from foundry_sdk.v2.datasets import models as datasets_models @@ -99,7 +100,11 @@ def content( :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. :raises GetFileContentPermissionDenied: Could not content the File. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -126,7 +131,11 @@ def content( "BranchNotFound": datasets_errors.BranchNotFound, "DatasetNotFound": datasets_errors.DatasetNotFound, "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, "GetFileContentPermissionDenied": datasets_errors.GetFileContentPermissionDenied, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -170,10 +179,21 @@ def delete( :return: Returns the result object. :rtype: None + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises DeleteFilePermissionDenied: Could not delete the File. :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises InvalidTransactionType: The given transaction type is not valid. Valid transaction types are `SNAPSHOT`, `UPDATE`, `APPEND`, and `DELETE`. + :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -194,10 +214,21 @@ def delete( response_type=None, request_timeout=request_timeout, throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, "BranchNotFound": datasets_errors.BranchNotFound, + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, "DeleteFilePermissionDenied": datasets_errors.DeleteFilePermissionDenied, "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "InvalidTransactionType": datasets_errors.InvalidTransactionType, + "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -254,6 +285,10 @@ def get( :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises FileNotFound: The given File could not be found. :raises FileNotFoundOnBranch: The requested file could not be found on the given branch, or the client token does not have access to it. + :raises FileNotFoundOnTransactionRange: The requested file could not be found on the given transaction range, or the client token does not have access to it. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -281,6 +316,10 @@ def get( "DatasetNotFound": datasets_errors.DatasetNotFound, "FileNotFound": datasets_errors.FileNotFound, "FileNotFoundOnBranch": datasets_errors.FileNotFoundOnBranch, + "FileNotFoundOnTransactionRange": datasets_errors.FileNotFoundOnTransactionRange, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -340,6 +379,10 @@ def list( :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidPageSize: The provided page size was zero or negative. Page sizes must be greater than zero. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -366,6 +409,10 @@ def list( throwable_errors={ "BranchNotFound": datasets_errors.BranchNotFound, "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "InvalidPageSize": core_errors.InvalidPageSize, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode", "ITERATOR"), ), @@ -418,10 +465,17 @@ def upload( :return: Returns the result object. :rtype: datasets_models.File + :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. + :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises FileAlreadyExists: The given file path already exists in the dataset and transaction. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. + :raises InvalidParameterCombination: The given parameters are individually valid but cannot be used in the given combination. :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. :raises UploadFilePermissionDenied: The provided token does not have permission to upload the given file to the given dataset and transaction. """ @@ -447,10 +501,17 @@ def upload( response_type=datasets_models.File, request_timeout=request_timeout, throwable_errors={ + "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, "BranchNotFound": datasets_errors.BranchNotFound, + "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, "DatasetNotFound": datasets_errors.DatasetNotFound, "FileAlreadyExists": datasets_errors.FileAlreadyExists, + "InvalidBranchName": datasets_errors.InvalidBranchName, + "InvalidParameterCombination": core_errors.InvalidParameterCombination, "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, "UploadFilePermissionDenied": datasets_errors.UploadFilePermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), diff --git a/foundry_sdk/v2/datasets/transaction.py b/foundry_sdk/v2/datasets/transaction.py index ff5e6c76a..e8cfbbdd2 100644 --- a/foundry_sdk/v2/datasets/transaction.py +++ b/foundry_sdk/v2/datasets/transaction.py @@ -73,6 +73,9 @@ def abort( :rtype: datasets_models.Transaction :raises AbortTransactionPermissionDenied: The provided token does not have permission to abort the given transaction on the given dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -93,6 +96,9 @@ def abort( request_timeout=request_timeout, throwable_errors={ "AbortTransactionPermissionDenied": datasets_errors.AbortTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -127,6 +133,8 @@ def build( :rtype: typing.Optional[core_models.BuildRid] :raises BuildTransactionPermissionDenied: Could not build the Transaction. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -149,6 +157,8 @@ def build( request_timeout=request_timeout, throwable_errors={ "BuildTransactionPermissionDenied": datasets_errors.BuildTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -179,6 +189,9 @@ def commit( :rtype: datasets_models.Transaction :raises CommitTransactionPermissionDenied: The provided token does not have permission to commit the given transaction on the given dataset. + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. + :raises TransactionNotOpen: The given transaction is not open. """ return self._api_client.call_api( @@ -199,6 +212,9 @@ def commit( request_timeout=request_timeout, throwable_errors={ "CommitTransactionPermissionDenied": datasets_errors.CommitTransactionPermissionDenied, + "DatasetNotFound": datasets_errors.DatasetNotFound, + "TransactionNotFound": datasets_errors.TransactionNotFound, + "TransactionNotOpen": datasets_errors.TransactionNotOpen, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -233,6 +249,7 @@ def create( :raises BranchNotFound: The requested branch could not be found, or the client token does not have access to it. :raises CreateTransactionPermissionDenied: The provided token does not have permission to create a transaction on this dataset. :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. + :raises InvalidBranchName: The requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs. :raises OpenTransactionAlreadyExists: A transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time. """ @@ -265,6 +282,7 @@ def create( "BranchNotFound": datasets_errors.BranchNotFound, "CreateTransactionPermissionDenied": datasets_errors.CreateTransactionPermissionDenied, "DatasetNotFound": datasets_errors.DatasetNotFound, + "InvalidBranchName": datasets_errors.InvalidBranchName, "OpenTransactionAlreadyExists": datasets_errors.OpenTransactionAlreadyExists, }, response_mode=_sdk_internal.get("response_mode"), @@ -294,6 +312,7 @@ def get( :return: Returns the result object. :rtype: datasets_models.Transaction + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ @@ -314,6 +333,7 @@ def get( response_type=datasets_models.Transaction, request_timeout=request_timeout, throwable_errors={ + "DatasetNotFound": datasets_errors.DatasetNotFound, "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), @@ -348,7 +368,9 @@ def job( :return: Returns the result object. :rtype: typing.Optional[core_models.JobRid] + :raises DatasetNotFound: The requested dataset could not be found, or the client token does not have access to it. :raises JobTransactionPermissionDenied: Could not job the Transaction. + :raises TransactionNotFound: The requested transaction could not be found on the dataset, or the client token does not have access to it. """ return self._api_client.call_api( @@ -370,7 +392,9 @@ def job( response_type=typing.Optional[core_models.JobRid], request_timeout=request_timeout, throwable_errors={ + "DatasetNotFound": datasets_errors.DatasetNotFound, "JobTransactionPermissionDenied": datasets_errors.JobTransactionPermissionDenied, + "TransactionNotFound": datasets_errors.TransactionNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), diff --git a/foundry_sdk/v2/functions/errors.py b/foundry_sdk/v2/functions/errors.py index 353146886..1e47325ac 100644 --- a/foundry_sdk/v2/functions/errors.py +++ b/foundry_sdk/v2/functions/errors.py @@ -50,6 +50,27 @@ class GetByRidQueriesPermissionDenied(errors.PermissionDeniedError): error_instance_id: str +class InvalidQueryOutputValueParameters(typing_extensions.TypedDict): + """ + The value of the query's output is invalid. This may be because the return value did not match the specified + output type or constraints. + """ + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + outputDataType: functions_models.QueryDataType + outputValue: typing_extensions.NotRequired[functions_models.DataValue] + functionRid: functions_models.FunctionRid + functionVersion: functions_models.FunctionVersion + + +@dataclass +class InvalidQueryOutputValue(errors.BadRequestError): + name: typing.Literal["InvalidQueryOutputValue"] + parameters: InvalidQueryOutputValueParameters + error_instance_id: str + + class InvalidQueryParameterValueParameters(typing_extensions.TypedDict): """ The value of the given parameter is invalid. See the documentation of `DataValue` for details on @@ -243,6 +264,7 @@ class VersionIdNotFound(errors.NotFoundError): __all__ = [ "ExecuteQueryPermissionDenied", "GetByRidQueriesPermissionDenied", + "InvalidQueryOutputValue", "InvalidQueryParameterValue", "MissingParameter", "QueryEncounteredUserFacingError", diff --git a/foundry_sdk/v2/ontologies/errors.py b/foundry_sdk/v2/ontologies/errors.py index 0581fadb7..ae86b293a 100644 --- a/foundry_sdk/v2/ontologies/errors.py +++ b/foundry_sdk/v2/ontologies/errors.py @@ -763,6 +763,27 @@ class InvalidPropertyValue(errors.BadRequestError): error_instance_id: str +class InvalidQueryOutputValueParameters(typing_extensions.TypedDict): + """ + The value of the query's output is invalid. This may be because the return value did not match the specified + output type or constraints. + """ + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + outputDataType: ontologies_models.QueryDataType + outputValue: typing_extensions.NotRequired[ontologies_models.DataValue] + functionRid: ontologies_models.FunctionRid + functionVersion: ontologies_models.FunctionVersion + + +@dataclass +class InvalidQueryOutputValue(errors.BadRequestError): + name: typing.Literal["InvalidQueryOutputValue"] + parameters: InvalidQueryOutputValueParameters + error_instance_id: str + + class InvalidQueryParameterValueParameters(typing_extensions.TypedDict): """ The value of the given parameter is invalid. See the documentation of `DataValue` for details on @@ -1021,6 +1042,108 @@ class MarketplaceQueryMappingNotFound(errors.NotFoundError): error_instance_id: str +class MarketplaceSdkActionMappingNotFoundParameters(typing_extensions.TypedDict): + """The given action could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + actionType: ontologies_models.ActionTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkActionMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkActionMappingNotFound"] + parameters: MarketplaceSdkActionMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkInstallationNotFoundParameters(typing_extensions.TypedDict): + """The given marketplace installation could not be found or the user does not have access to it.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkInstallationNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkInstallationNotFound"] + parameters: MarketplaceSdkInstallationNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkLinkMappingNotFoundParameters(typing_extensions.TypedDict): + """The given link could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + linkType: ontologies_models.LinkTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkLinkMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkLinkMappingNotFound"] + parameters: MarketplaceSdkLinkMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkObjectMappingNotFoundParameters(typing_extensions.TypedDict): + """The given object could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + objectType: ontologies_models.ObjectTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkObjectMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkObjectMappingNotFound"] + parameters: MarketplaceSdkObjectMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkPropertyMappingNotFoundParameters(typing_extensions.TypedDict): + """The given property could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + propertyType: ontologies_models.PropertyApiName + objectType: ontologies_models.ObjectTypeApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkPropertyMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkPropertyMappingNotFound"] + parameters: MarketplaceSdkPropertyMappingNotFoundParameters + error_instance_id: str + + +class MarketplaceSdkQueryMappingNotFoundParameters(typing_extensions.TypedDict): + """The given query could not be mapped to a Marketplace installation.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + queryType: ontologies_models.QueryApiName + sdkPackageRid: ontologies_models.SdkPackageRid + sdkVersion: ontologies_models.SdkVersion + + +@dataclass +class MarketplaceSdkQueryMappingNotFound(errors.NotFoundError): + name: typing.Literal["MarketplaceSdkQueryMappingNotFound"] + parameters: MarketplaceSdkQueryMappingNotFoundParameters + error_instance_id: str + + class MissingParameterParameters(typing_extensions.TypedDict): """ Required parameters are missing. Please look at the `parameters` field to see which required parameters are @@ -1575,6 +1698,21 @@ class PropertyTypeNotFound(errors.NotFoundError): error_instance_id: str +class PropertyTypeRidNotFoundParameters(typing_extensions.TypedDict): + """The requested property type RID is not found, or the client token does not have access to it.""" + + __pydantic_config__ = {"extra": "allow"} # type: ignore + + propertyTypeRid: typing_extensions.NotRequired[ontologies_models.PropertyTypeRid] + + +@dataclass +class PropertyTypeRidNotFound(errors.NotFoundError): + name: typing.Literal["PropertyTypeRidNotFound"] + parameters: PropertyTypeRidNotFoundParameters + error_instance_id: str + + class PropertyTypesSearchNotSupportedParameters(typing_extensions.TypedDict): """ The search on the property types are not supported. See the `Search Objects` documentation for @@ -1889,6 +2027,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "InvalidPropertyFiltersCombination", "InvalidPropertyType", "InvalidPropertyValue", + "InvalidQueryOutputValue", "InvalidQueryParameterValue", "InvalidRangeQuery", "InvalidSortOrder", @@ -1904,6 +2043,12 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "MarketplaceLinkMappingNotFound", "MarketplaceObjectMappingNotFound", "MarketplaceQueryMappingNotFound", + "MarketplaceSdkActionMappingNotFound", + "MarketplaceSdkInstallationNotFound", + "MarketplaceSdkLinkMappingNotFound", + "MarketplaceSdkObjectMappingNotFound", + "MarketplaceSdkPropertyMappingNotFound", + "MarketplaceSdkQueryMappingNotFound", "MissingParameter", "MultipleGroupByOnFieldNotSupported", "MultiplePropertyValuesNotSupported", @@ -1937,6 +2082,7 @@ class ViewObjectPermissionDenied(errors.PermissionDeniedError): "PropertyNotFound", "PropertyTypeDoesNotSupportNearestNeighbors", "PropertyTypeNotFound", + "PropertyTypeRidNotFound", "PropertyTypesSearchNotSupported", "QueryEncounteredUserFacingError", "QueryMemoryExceededLimit", diff --git a/foundry_sdk/v2/ontologies/models.py b/foundry_sdk/v2/ontologies/models.py index d8bfe1171..b6fe92b35 100644 --- a/foundry_sdk/v2/ontologies/models.py +++ b/foundry_sdk/v2/ontologies/models.py @@ -2980,6 +2980,14 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: """SdkPackageName""" +SdkPackageRid = core.RID +"""SdkPackageRid""" + + +SdkVersion = str +"""SdkVersion""" + + SearchJsonQueryV2 = typing_extensions.Annotated[ typing.Union[ OrQueryV2, @@ -4054,6 +4062,8 @@ def to_dict(self) -> typing.Dict[str, typing.Any]: "ReturnEditsMode", "RollingAggregateWindowPoints", "SdkPackageName", + "SdkPackageRid", + "SdkVersion", "SearchJsonQueryV2", "SearchObjectsResponseV2", "SearchOrderByType", diff --git a/foundry_sdk/v2/ontologies/ontology_object.py b/foundry_sdk/v2/ontologies/ontology_object.py index 604afccff..d5ca56744 100644 --- a/foundry_sdk/v2/ontologies/ontology_object.py +++ b/foundry_sdk/v2/ontologies/ontology_object.py @@ -194,9 +194,9 @@ def get( object_type: ontologies_models.ObjectTypeApiName, primary_key: ontologies_models.PropertyValueEscapedString, *, - artifact_repository: typing.Optional[ontologies_models.ArtifactRepositoryRid] = None, exclude_rid: typing.Optional[bool] = None, - package_name: typing.Optional[ontologies_models.SdkPackageName] = None, + sdk_package_rid: typing.Optional[ontologies_models.SdkPackageRid] = None, + sdk_version: typing.Optional[ontologies_models.SdkVersion] = None, select: typing.Optional[typing.List[ontologies_models.SelectedPropertyApiName]] = None, request_timeout: typing.Optional[core.Timeout] = None, _sdk_internal: core.SdkInternal = {}, @@ -212,12 +212,12 @@ def get( :type object_type: ObjectTypeApiName :param primary_key: The primary key of the requested object. To look up the expected primary key for your object type, use the `Get object type` endpoint or the **Ontology Manager**. :type primary_key: PropertyValueEscapedString - :param artifact_repository: The repository associated with a marketplace installation. - :type artifact_repository: Optional[ArtifactRepositoryRid] :param exclude_rid: A flag to exclude the retrieval of the `__rid` property. Setting this to true may improve performance of this endpoint for object types in OSV2. :type exclude_rid: Optional[bool] - :param package_name: The package name of the generated SDK. - :type package_name: Optional[SdkPackageName] + :param sdk_package_rid: The package rid of the generated SDK. + :type sdk_package_rid: Optional[SdkPackageRid] + :param sdk_version: The version of the generated SDK. + :type sdk_version: Optional[SdkVersion] :param select: The properties of the object type that should be included in the response. Omit this parameter to get all the properties. :type select: Optional[List[SelectedPropertyApiName]] :param request_timeout: timeout setting for this request in seconds. @@ -231,9 +231,9 @@ def get( method="GET", resource_path="/v2/ontologies/{ontology}/objects/{objectType}/{primaryKey}", query_params={ - "artifactRepository": artifact_repository, "excludeRid": exclude_rid, - "packageName": package_name, + "sdkPackageRid": sdk_package_rid, + "sdkVersion": sdk_version, "select": select, }, path_params={ diff --git a/foundry_sdk/v2/sql_queries/sql_query.py b/foundry_sdk/v2/sql_queries/sql_query.py index 334c524ea..7f3ee8b48 100644 --- a/foundry_sdk/v2/sql_queries/sql_query.py +++ b/foundry_sdk/v2/sql_queries/sql_query.py @@ -73,7 +73,12 @@ def cancel( :rtype: None :raises CancelSqlQueryPermissionDenied: Could not cancel the SqlQuery. + :raises QueryCanceled: The query was canceled. + :raises QueryFailed: The query failed. + :raises QueryParseError: The query cannot be parsed. :raises QueryPermissionDenied: The provided token does not have permission to access the given query. + :raises QueryRunning: The query is running. + :raises ReadQueryInputsPermissionDenied: The provided token does not have permission to access the inputs to the query. """ return self._api_client.call_api( @@ -93,7 +98,12 @@ def cancel( request_timeout=request_timeout, throwable_errors={ "CancelSqlQueryPermissionDenied": sql_queries_errors.CancelSqlQueryPermissionDenied, + "QueryCanceled": sql_queries_errors.QueryCanceled, + "QueryFailed": sql_queries_errors.QueryFailed, + "QueryParseError": sql_queries_errors.QueryParseError, "QueryPermissionDenied": sql_queries_errors.QueryPermissionDenied, + "QueryRunning": sql_queries_errors.QueryRunning, + "ReadQueryInputsPermissionDenied": sql_queries_errors.ReadQueryInputsPermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -126,7 +136,11 @@ def execute( :rtype: sql_queries_models.QueryStatus :raises ExecuteSqlQueryPermissionDenied: Could not execute the SqlQuery. + :raises QueryCanceled: The query was canceled. + :raises QueryFailed: The query failed. :raises QueryParseError: The query cannot be parsed. + :raises QueryPermissionDenied: The provided token does not have permission to access the given query. + :raises QueryRunning: The query is running. :raises ReadQueryInputsPermissionDenied: The provided token does not have permission to access the inputs to the query. """ @@ -159,7 +173,11 @@ def execute( request_timeout=request_timeout, throwable_errors={ "ExecuteSqlQueryPermissionDenied": sql_queries_errors.ExecuteSqlQueryPermissionDenied, + "QueryCanceled": sql_queries_errors.QueryCanceled, + "QueryFailed": sql_queries_errors.QueryFailed, "QueryParseError": sql_queries_errors.QueryParseError, + "QueryPermissionDenied": sql_queries_errors.QueryPermissionDenied, + "QueryRunning": sql_queries_errors.QueryRunning, "ReadQueryInputsPermissionDenied": sql_queries_errors.ReadQueryInputsPermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), @@ -193,7 +211,10 @@ def get_results( :raises GetResultsSqlQueryPermissionDenied: Could not getResults the SqlQuery. :raises QueryCanceled: The query was canceled. :raises QueryFailed: The query failed. + :raises QueryParseError: The query cannot be parsed. :raises QueryPermissionDenied: The provided token does not have permission to access the given query. + :raises QueryRunning: The query is running. + :raises ReadQueryInputsPermissionDenied: The provided token does not have permission to access the inputs to the query. """ return self._api_client.call_api( @@ -217,7 +238,10 @@ def get_results( "GetResultsSqlQueryPermissionDenied": sql_queries_errors.GetResultsSqlQueryPermissionDenied, "QueryCanceled": sql_queries_errors.QueryCanceled, "QueryFailed": sql_queries_errors.QueryFailed, + "QueryParseError": sql_queries_errors.QueryParseError, "QueryPermissionDenied": sql_queries_errors.QueryPermissionDenied, + "QueryRunning": sql_queries_errors.QueryRunning, + "ReadQueryInputsPermissionDenied": sql_queries_errors.ReadQueryInputsPermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -247,7 +271,12 @@ def get_status( :rtype: sql_queries_models.QueryStatus :raises GetStatusSqlQueryPermissionDenied: Could not getStatus the SqlQuery. + :raises QueryCanceled: The query was canceled. + :raises QueryFailed: The query failed. + :raises QueryParseError: The query cannot be parsed. :raises QueryPermissionDenied: The provided token does not have permission to access the given query. + :raises QueryRunning: The query is running. + :raises ReadQueryInputsPermissionDenied: The provided token does not have permission to access the inputs to the query. """ return self._api_client.call_api( @@ -269,7 +298,12 @@ def get_status( request_timeout=request_timeout, throwable_errors={ "GetStatusSqlQueryPermissionDenied": sql_queries_errors.GetStatusSqlQueryPermissionDenied, + "QueryCanceled": sql_queries_errors.QueryCanceled, + "QueryFailed": sql_queries_errors.QueryFailed, + "QueryParseError": sql_queries_errors.QueryParseError, "QueryPermissionDenied": sql_queries_errors.QueryPermissionDenied, + "QueryRunning": sql_queries_errors.QueryRunning, + "ReadQueryInputsPermissionDenied": sql_queries_errors.ReadQueryInputsPermissionDenied, }, response_mode=_sdk_internal.get("response_mode"), ), diff --git a/foundry_sdk/v2/streams/dataset.py b/foundry_sdk/v2/streams/dataset.py index dc4573e5b..b057a19af 100644 --- a/foundry_sdk/v2/streams/dataset.py +++ b/foundry_sdk/v2/streams/dataset.py @@ -21,6 +21,7 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v2.core import errors as core_errors from foundry_sdk.v2.core import models as core_models from foundry_sdk.v2.datasets import models as datasets_models from foundry_sdk.v2.filesystem import errors as filesystem_errors @@ -105,7 +106,11 @@ def create( :return: Returns the result object. :rtype: streams_models.Dataset + :raises CannotCreateStreamingDatasetInUserFolder: Cannot create a streaming dataset in a user folder. :raises CreateStreamingDatasetPermissionDenied: Could not create the Dataset. + :raises InvalidFieldSchema: The field schema failed validations + :raises InvalidSchema: The schema failed validations + :raises InvalidStreamType: The stream type is invalid. :raises ResourceNameAlreadyExists: The provided resource name is already in use by another resource in the same folder. """ @@ -145,7 +150,11 @@ def create( response_type=streams_models.Dataset, request_timeout=request_timeout, throwable_errors={ + "CannotCreateStreamingDatasetInUserFolder": streams_errors.CannotCreateStreamingDatasetInUserFolder, "CreateStreamingDatasetPermissionDenied": streams_errors.CreateStreamingDatasetPermissionDenied, + "InvalidFieldSchema": core_errors.InvalidFieldSchema, + "InvalidSchema": core_errors.InvalidSchema, + "InvalidStreamType": streams_errors.InvalidStreamType, "ResourceNameAlreadyExists": filesystem_errors.ResourceNameAlreadyExists, }, response_mode=_sdk_internal.get("response_mode"), diff --git a/foundry_sdk/v2/streams/stream.py b/foundry_sdk/v2/streams/stream.py index dca747ef0..6f1e2d7ba 100644 --- a/foundry_sdk/v2/streams/stream.py +++ b/foundry_sdk/v2/streams/stream.py @@ -20,7 +20,9 @@ from foundry_sdk import _core as core from foundry_sdk import _errors as errors +from foundry_sdk.v2.core import errors as core_errors from foundry_sdk.v2.core import models as core_models +from foundry_sdk.v2.datasets import errors as datasets_errors from foundry_sdk.v2.datasets import models as datasets_models from foundry_sdk.v2.streams import errors as streams_errors from foundry_sdk.v2.streams import models as streams_models @@ -87,7 +89,11 @@ def create( :return: Returns the result object. :rtype: streams_models.Stream + :raises BranchAlreadyExists: The branch cannot be created because a branch with that name already exists. :raises CreateStreamPermissionDenied: Could not create the Stream. + :raises InvalidFieldSchema: The field schema failed validations + :raises InvalidSchema: The schema failed validations + :raises InvalidStreamType: The stream type is invalid. """ return self._api_client.call_api( @@ -124,7 +130,11 @@ def create( response_type=streams_models.Stream, request_timeout=request_timeout, throwable_errors={ + "BranchAlreadyExists": datasets_errors.BranchAlreadyExists, "CreateStreamPermissionDenied": streams_errors.CreateStreamPermissionDenied, + "InvalidFieldSchema": core_errors.InvalidFieldSchema, + "InvalidSchema": core_errors.InvalidSchema, + "InvalidStreamType": streams_errors.InvalidStreamType, }, response_mode=_sdk_internal.get("response_mode"), ), @@ -157,6 +167,9 @@ def get( :return: Returns the result object. :rtype: streams_models.Stream + :raises InvalidFieldSchema: The field schema failed validations + :raises InvalidStreamNoSchema: The requested stream exists but is invalid, as it does not have a schema. + :raises InvalidStreamType: The stream type is invalid. :raises StreamNotFound: The given Stream could not be found. """ @@ -179,6 +192,9 @@ def get( response_type=streams_models.Stream, request_timeout=request_timeout, throwable_errors={ + "InvalidFieldSchema": core_errors.InvalidFieldSchema, + "InvalidStreamNoSchema": streams_errors.InvalidStreamNoSchema, + "InvalidStreamType": streams_errors.InvalidStreamType, "StreamNotFound": streams_errors.StreamNotFound, }, response_mode=_sdk_internal.get("response_mode"), @@ -430,7 +446,12 @@ def reset( :return: Returns the result object. :rtype: streams_models.Stream + :raises InvalidFieldSchema: The field schema failed validations + :raises InvalidSchema: The schema failed validations + :raises InvalidStreamNoSchema: The requested stream exists but is invalid, as it does not have a schema. + :raises InvalidStreamType: The stream type is invalid. :raises ResetStreamPermissionDenied: Could not reset the Stream. + :raises StreamNotFound: The given Stream could not be found. """ return self._api_client.call_api( @@ -466,7 +487,12 @@ def reset( response_type=streams_models.Stream, request_timeout=request_timeout, throwable_errors={ + "InvalidFieldSchema": core_errors.InvalidFieldSchema, + "InvalidSchema": core_errors.InvalidSchema, + "InvalidStreamNoSchema": streams_errors.InvalidStreamNoSchema, + "InvalidStreamType": streams_errors.InvalidStreamType, "ResetStreamPermissionDenied": streams_errors.ResetStreamPermissionDenied, + "StreamNotFound": streams_errors.StreamNotFound, }, response_mode=_sdk_internal.get("response_mode"), ), diff --git a/tests/test_api_client.py b/tests/test_api_client.py index 9af04392f..cd600013b 100644 --- a/tests/test_api_client.py +++ b/tests/test_api_client.py @@ -389,18 +389,37 @@ def test_config_shared_with_auth(): assert auth._config == config -def test_client_hostname_prioritized(): - config = Config(timeout=1) - auth = ConfidentialClientAuth(client_id="foo", client_secret="bar", hostname="localhost:9876") +def test_auth_config_prioritized(): + auth_config = Config(timeout=1) + auth = ConfidentialClientAuth( + client_id="foo", client_secret="bar", hostname="localhost:9876", config=auth_config + ) with warnings.catch_warnings(record=True) as w: - ApiClient(auth=auth, hostname="localhost:1234", config=config) + ApiClient(auth=auth, hostname="localhost:1234", config=Config(timeout=2)) + # No warning because the hostnames are different + assert len(w) == 0 + + # Make sure the ApiClient hostname is prioritized + assert auth._hostname == "localhost:9876" + assert auth._config == auth_config - # Make sure the ApiClient hostname is prioritized - assert auth._hostname == "localhost:1234" - # And make sure the user receives a warning - assert len(w) == 1 +def test_duplicate_auth_config_warns(): + hostname = "localhost:1234" + config = Config(timeout=1) + auth = ConfidentialClientAuth( + client_id="foo", client_secret="bar", hostname=hostname, config=config + ) + + with warnings.catch_warnings(record=True) as w: + ApiClient(auth=auth, hostname=hostname, config=config) + # Two warnings because both the hostname and config are the same + assert len(w) == 2 + + # Make sure the ApiClient hostname is prioritized + assert auth._hostname == hostname + assert auth._config == config def test_empty_404_error(): diff --git a/tests/test_resorce_import.py b/tests/test_resorce_import.py index 34ed62e8d..f641be389 100644 --- a/tests/test_resorce_import.py +++ b/tests/test_resorce_import.py @@ -142,6 +142,14 @@ def test_admin_v2_organization_import(): assert OrganizationClient is not None +def test_admin_v2_organization_role_assignment_import(): + from foundry_sdk.v2.admin.organization_role_assignment import ( + OrganizationRoleAssignmentClient, + ) # NOQA + + assert OrganizationRoleAssignmentClient is not None + + def test_admin_v2_role_import(): from foundry_sdk.v2.admin.role import RoleClient @@ -184,6 +192,12 @@ def test_aip_agents_v2_session_import(): assert SessionClient is not None +def test_aip_agents_v2_session_trace_import(): + from foundry_sdk.v2.aip_agents.session_trace import SessionTraceClient + + assert SessionTraceClient is not None + + def test_connectivity_v2_connection_import(): from foundry_sdk.v2.connectivity.connection import ConnectionClient