|
| 1 | +# Copyright 2024 Palantir Technologies, Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +import typing |
| 17 | +from dataclasses import dataclass |
| 18 | + |
| 19 | +import typing_extensions |
| 20 | + |
| 21 | +from foundry import _errors as errors |
| 22 | +from foundry.v1.core import models as core_models |
| 23 | + |
| 24 | + |
| 25 | +class ApiFeaturePreviewUsageOnlyParameters(typing_extensions.TypedDict): |
| 26 | + """ |
| 27 | + This feature is only supported in preview mode. Please use `preview=true` in the query |
| 28 | + parameters to call this endpoint. |
| 29 | + """ |
| 30 | + |
| 31 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 32 | + |
| 33 | + |
| 34 | +@dataclass |
| 35 | +class ApiFeaturePreviewUsageOnly(errors.BadRequestError): |
| 36 | + name: typing.Literal["ApiFeaturePreviewUsageOnly"] |
| 37 | + parameters: ApiFeaturePreviewUsageOnlyParameters |
| 38 | + error_instance_id: str |
| 39 | + |
| 40 | + |
| 41 | +class ApiUsageDeniedParameters(typing_extensions.TypedDict): |
| 42 | + """You are not allowed to use Palantir APIs.""" |
| 43 | + |
| 44 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 45 | + |
| 46 | + missingScope: typing_extensions.NotRequired[core_models.OperationScope] |
| 47 | + |
| 48 | + |
| 49 | +@dataclass |
| 50 | +class ApiUsageDenied(errors.PermissionDeniedError): |
| 51 | + name: typing.Literal["ApiUsageDenied"] |
| 52 | + parameters: ApiUsageDeniedParameters |
| 53 | + error_instance_id: str |
| 54 | + |
| 55 | + |
| 56 | +class FolderNotFoundParameters(typing_extensions.TypedDict): |
| 57 | + """The requested folder could not be found, or the client token does not have access to it.""" |
| 58 | + |
| 59 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 60 | + |
| 61 | + folderRid: core_models.FolderRid |
| 62 | + |
| 63 | + |
| 64 | +@dataclass |
| 65 | +class FolderNotFound(errors.NotFoundError): |
| 66 | + name: typing.Literal["FolderNotFound"] |
| 67 | + parameters: FolderNotFoundParameters |
| 68 | + error_instance_id: str |
| 69 | + |
| 70 | + |
| 71 | +class InvalidPageSizeParameters(typing_extensions.TypedDict): |
| 72 | + """The provided page size was zero or negative. Page sizes must be greater than zero.""" |
| 73 | + |
| 74 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 75 | + |
| 76 | + pageSize: core_models.PageSize |
| 77 | + |
| 78 | + |
| 79 | +@dataclass |
| 80 | +class InvalidPageSize(errors.BadRequestError): |
| 81 | + name: typing.Literal["InvalidPageSize"] |
| 82 | + parameters: InvalidPageSizeParameters |
| 83 | + error_instance_id: str |
| 84 | + |
| 85 | + |
| 86 | +class InvalidPageTokenParameters(typing_extensions.TypedDict): |
| 87 | + """The provided page token could not be used to retrieve the next page of results.""" |
| 88 | + |
| 89 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 90 | + |
| 91 | + pageToken: core_models.PageToken |
| 92 | + |
| 93 | + |
| 94 | +@dataclass |
| 95 | +class InvalidPageToken(errors.BadRequestError): |
| 96 | + name: typing.Literal["InvalidPageToken"] |
| 97 | + parameters: InvalidPageTokenParameters |
| 98 | + error_instance_id: str |
| 99 | + |
| 100 | + |
| 101 | +class InvalidParameterCombinationParameters(typing_extensions.TypedDict): |
| 102 | + """The given parameters are individually valid but cannot be used in the given combination.""" |
| 103 | + |
| 104 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 105 | + |
| 106 | + validCombinations: typing.List[typing.List[str]] |
| 107 | + providedParameters: typing.List[str] |
| 108 | + |
| 109 | + |
| 110 | +@dataclass |
| 111 | +class InvalidParameterCombination(errors.BadRequestError): |
| 112 | + name: typing.Literal["InvalidParameterCombination"] |
| 113 | + parameters: InvalidParameterCombinationParameters |
| 114 | + error_instance_id: str |
| 115 | + |
| 116 | + |
| 117 | +class MissingPostBodyParameters(typing_extensions.TypedDict): |
| 118 | + """A post body is required for this endpoint, but was not found in the request.""" |
| 119 | + |
| 120 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 121 | + |
| 122 | + |
| 123 | +@dataclass |
| 124 | +class MissingPostBody(errors.BadRequestError): |
| 125 | + name: typing.Literal["MissingPostBody"] |
| 126 | + parameters: MissingPostBodyParameters |
| 127 | + error_instance_id: str |
| 128 | + |
| 129 | + |
| 130 | +class ResourceNameAlreadyExistsParameters(typing_extensions.TypedDict): |
| 131 | + """The provided resource name is already in use by another resource in the same folder.""" |
| 132 | + |
| 133 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 134 | + |
| 135 | + parentFolderRid: core_models.FolderRid |
| 136 | + resourceName: str |
| 137 | + |
| 138 | + |
| 139 | +@dataclass |
| 140 | +class ResourceNameAlreadyExists(errors.ConflictError): |
| 141 | + name: typing.Literal["ResourceNameAlreadyExists"] |
| 142 | + parameters: ResourceNameAlreadyExistsParameters |
| 143 | + error_instance_id: str |
| 144 | + |
| 145 | + |
| 146 | +class UnknownDistanceUnitParameters(typing_extensions.TypedDict): |
| 147 | + """An unknown distance unit was provided.""" |
| 148 | + |
| 149 | + __pydantic_config__ = {"extra": "allow"} # type: ignore |
| 150 | + |
| 151 | + unknownUnit: str |
| 152 | + knownUnits: typing.List[core_models.DistanceUnit] |
| 153 | + |
| 154 | + |
| 155 | +@dataclass |
| 156 | +class UnknownDistanceUnit(errors.BadRequestError): |
| 157 | + name: typing.Literal["UnknownDistanceUnit"] |
| 158 | + parameters: UnknownDistanceUnitParameters |
| 159 | + error_instance_id: str |
| 160 | + |
| 161 | + |
| 162 | +__all__ = [ |
| 163 | + "ApiFeaturePreviewUsageOnly", |
| 164 | + "ApiUsageDenied", |
| 165 | + "FolderNotFound", |
| 166 | + "InvalidPageSize", |
| 167 | + "InvalidPageToken", |
| 168 | + "InvalidParameterCombination", |
| 169 | + "MissingPostBody", |
| 170 | + "ResourceNameAlreadyExists", |
| 171 | + "UnknownDistanceUnit", |
| 172 | +] |
0 commit comments