|
| 1 | +// smithy-typescript generated code |
| 2 | +import { getEndpointPlugin } from "@smithy/middleware-endpoint"; |
| 3 | +import { getSerdePlugin } from "@smithy/middleware-serde"; |
| 4 | +import { Command as $Command } from "@smithy/smithy-client"; |
| 5 | +import { MetadataBearer as __MetadataBearer } from "@smithy/types"; |
| 6 | + |
| 7 | +import { commonParams } from "../endpoint/EndpointParameters"; |
| 8 | +import { BatchGetPolicyInput, BatchGetPolicyOutput, BatchGetPolicyOutputFilterSensitiveLog } from "../models/models_0"; |
| 9 | +import { de_BatchGetPolicyCommand, se_BatchGetPolicyCommand } from "../protocols/Aws_json1_0"; |
| 10 | +import { |
| 11 | + ServiceInputTypes, |
| 12 | + ServiceOutputTypes, |
| 13 | + VerifiedPermissionsClientResolvedConfig, |
| 14 | +} from "../VerifiedPermissionsClient"; |
| 15 | + |
| 16 | +/** |
| 17 | + * @public |
| 18 | + */ |
| 19 | +export type { __MetadataBearer }; |
| 20 | +export { $Command }; |
| 21 | +/** |
| 22 | + * @public |
| 23 | + * |
| 24 | + * The input for {@link BatchGetPolicyCommand}. |
| 25 | + */ |
| 26 | +export interface BatchGetPolicyCommandInput extends BatchGetPolicyInput {} |
| 27 | +/** |
| 28 | + * @public |
| 29 | + * |
| 30 | + * The output of {@link BatchGetPolicyCommand}. |
| 31 | + */ |
| 32 | +export interface BatchGetPolicyCommandOutput extends BatchGetPolicyOutput, __MetadataBearer {} |
| 33 | + |
| 34 | +/** |
| 35 | + * <p>Retrieves information about a group (batch) of policies.</p> |
| 36 | + * <note> |
| 37 | + * <p>The <code>BatchGetPolicy</code> operation doesn't have its own IAM |
| 38 | + * permission. To authorize this operation for Amazon Web Services principals, include the permission |
| 39 | + * <code>verifiedpermissions:GetPolicy</code> in their IAM policies.</p> |
| 40 | + * </note> |
| 41 | + * @example |
| 42 | + * Use a bare-bones client and the command you need to make an API call. |
| 43 | + * ```javascript |
| 44 | + * import { VerifiedPermissionsClient, BatchGetPolicyCommand } from "@aws-sdk/client-verifiedpermissions"; // ES Modules import |
| 45 | + * // const { VerifiedPermissionsClient, BatchGetPolicyCommand } = require("@aws-sdk/client-verifiedpermissions"); // CommonJS import |
| 46 | + * const client = new VerifiedPermissionsClient(config); |
| 47 | + * const input = { // BatchGetPolicyInput |
| 48 | + * requests: [ // BatchGetPolicyInputList // required |
| 49 | + * { // BatchGetPolicyInputItem |
| 50 | + * policyStoreId: "STRING_VALUE", // required |
| 51 | + * policyId: "STRING_VALUE", // required |
| 52 | + * }, |
| 53 | + * ], |
| 54 | + * }; |
| 55 | + * const command = new BatchGetPolicyCommand(input); |
| 56 | + * const response = await client.send(command); |
| 57 | + * // { // BatchGetPolicyOutput |
| 58 | + * // results: [ // BatchGetPolicyOutputList // required |
| 59 | + * // { // BatchGetPolicyOutputItem |
| 60 | + * // policyStoreId: "STRING_VALUE", // required |
| 61 | + * // policyId: "STRING_VALUE", // required |
| 62 | + * // policyType: "STATIC" || "TEMPLATE_LINKED", // required |
| 63 | + * // definition: { // PolicyDefinitionDetail Union: only one key present |
| 64 | + * // static: { // StaticPolicyDefinitionDetail |
| 65 | + * // description: "STRING_VALUE", |
| 66 | + * // statement: "STRING_VALUE", // required |
| 67 | + * // }, |
| 68 | + * // templateLinked: { // TemplateLinkedPolicyDefinitionDetail |
| 69 | + * // policyTemplateId: "STRING_VALUE", // required |
| 70 | + * // principal: { // EntityIdentifier |
| 71 | + * // entityType: "STRING_VALUE", // required |
| 72 | + * // entityId: "STRING_VALUE", // required |
| 73 | + * // }, |
| 74 | + * // resource: { |
| 75 | + * // entityType: "STRING_VALUE", // required |
| 76 | + * // entityId: "STRING_VALUE", // required |
| 77 | + * // }, |
| 78 | + * // }, |
| 79 | + * // }, |
| 80 | + * // createdDate: new Date("TIMESTAMP"), // required |
| 81 | + * // lastUpdatedDate: new Date("TIMESTAMP"), // required |
| 82 | + * // }, |
| 83 | + * // ], |
| 84 | + * // errors: [ // BatchGetPolicyErrorList // required |
| 85 | + * // { // BatchGetPolicyErrorItem |
| 86 | + * // code: "POLICY_STORE_NOT_FOUND" || "POLICY_NOT_FOUND", // required |
| 87 | + * // policyStoreId: "STRING_VALUE", // required |
| 88 | + * // policyId: "STRING_VALUE", // required |
| 89 | + * // message: "STRING_VALUE", // required |
| 90 | + * // }, |
| 91 | + * // ], |
| 92 | + * // }; |
| 93 | + * |
| 94 | + * ``` |
| 95 | + * |
| 96 | + * @param BatchGetPolicyCommandInput - {@link BatchGetPolicyCommandInput} |
| 97 | + * @returns {@link BatchGetPolicyCommandOutput} |
| 98 | + * @see {@link BatchGetPolicyCommandInput} for command's `input` shape. |
| 99 | + * @see {@link BatchGetPolicyCommandOutput} for command's `response` shape. |
| 100 | + * @see {@link VerifiedPermissionsClientResolvedConfig | config} for VerifiedPermissionsClient's `config` shape. |
| 101 | + * |
| 102 | + * @throws {@link AccessDeniedException} (client fault) |
| 103 | + * <p>You don't have sufficient access to perform this action.</p> |
| 104 | + * |
| 105 | + * @throws {@link InternalServerException} (server fault) |
| 106 | + * <p>The request failed because of an internal error. Try your request again later</p> |
| 107 | + * |
| 108 | + * @throws {@link ThrottlingException} (client fault) |
| 109 | + * <p>The request failed because it exceeded a throttling quota.</p> |
| 110 | + * |
| 111 | + * @throws {@link ValidationException} (client fault) |
| 112 | + * <p>The request failed because one or more input parameters don't satisfy their constraint |
| 113 | + * requirements. The output is provided as a list of fields and a reason for each field that |
| 114 | + * isn't valid.</p> |
| 115 | + * <p>The possible reasons include the following:</p> |
| 116 | + * <ul> |
| 117 | + * <li> |
| 118 | + * <p> |
| 119 | + * <b>UnrecognizedEntityType</b> |
| 120 | + * </p> |
| 121 | + * <p>The policy includes an entity type that isn't found in the schema.</p> |
| 122 | + * </li> |
| 123 | + * <li> |
| 124 | + * <p> |
| 125 | + * <b>UnrecognizedActionId</b> |
| 126 | + * </p> |
| 127 | + * <p>The policy includes an action id that isn't found in the schema.</p> |
| 128 | + * </li> |
| 129 | + * <li> |
| 130 | + * <p> |
| 131 | + * <b>InvalidActionApplication</b> |
| 132 | + * </p> |
| 133 | + * <p>The policy includes an action that, according to the schema, doesn't support |
| 134 | + * the specified principal and resource.</p> |
| 135 | + * </li> |
| 136 | + * <li> |
| 137 | + * <p> |
| 138 | + * <b>UnexpectedType</b> |
| 139 | + * </p> |
| 140 | + * <p>The policy included an operand that isn't a valid type for the specified |
| 141 | + * operation.</p> |
| 142 | + * </li> |
| 143 | + * <li> |
| 144 | + * <p> |
| 145 | + * <b>IncompatibleTypes</b> |
| 146 | + * </p> |
| 147 | + * <p>The types of elements included in a <code>set</code>, or the types of |
| 148 | + * expressions used in an <code>if...then...else</code> clause aren't compatible in |
| 149 | + * this context.</p> |
| 150 | + * </li> |
| 151 | + * <li> |
| 152 | + * <p> |
| 153 | + * <b>MissingAttribute</b> |
| 154 | + * </p> |
| 155 | + * <p>The policy attempts to access a record or entity attribute that isn't |
| 156 | + * specified in the schema. Test for the existence of the attribute first before |
| 157 | + * attempting to access its value. For more information, see the <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the |
| 158 | + * <i>Cedar Policy Language Guide</i>.</p> |
| 159 | + * </li> |
| 160 | + * <li> |
| 161 | + * <p> |
| 162 | + * <b>UnsafeOptionalAttributeAccess</b> |
| 163 | + * </p> |
| 164 | + * <p>The policy attempts to access a record or entity attribute that is optional |
| 165 | + * and isn't guaranteed to be present. Test for the existence of the attribute |
| 166 | + * first before attempting to access its value. For more information, see the |
| 167 | + * <a href="https://docs.cedarpolicy.com/policies/syntax-operators.html#has-presence-of-attribute-test">has (presence of attribute test) operator</a> in the |
| 168 | + * <i>Cedar Policy Language Guide</i>.</p> |
| 169 | + * </li> |
| 170 | + * <li> |
| 171 | + * <p> |
| 172 | + * <b>ImpossiblePolicy</b> |
| 173 | + * </p> |
| 174 | + * <p>Cedar has determined that a policy condition always evaluates to false. If |
| 175 | + * the policy is always false, it can never apply to any query, and so it can never |
| 176 | + * affect an authorization decision.</p> |
| 177 | + * </li> |
| 178 | + * <li> |
| 179 | + * <p> |
| 180 | + * <b>WrongNumberArguments</b> |
| 181 | + * </p> |
| 182 | + * <p>The policy references an extension type with the wrong number of |
| 183 | + * arguments.</p> |
| 184 | + * </li> |
| 185 | + * <li> |
| 186 | + * <p> |
| 187 | + * <b>FunctionArgumentValidationError</b> |
| 188 | + * </p> |
| 189 | + * <p>Cedar couldn't parse the argument passed to an extension type. For example, |
| 190 | + * a string that is to be parsed as an IPv4 address can contain only digits and the |
| 191 | + * period character.</p> |
| 192 | + * </li> |
| 193 | + * </ul> |
| 194 | + * |
| 195 | + * @throws {@link VerifiedPermissionsServiceException} |
| 196 | + * <p>Base exception class for all service exceptions from VerifiedPermissions service.</p> |
| 197 | + * |
| 198 | + * @public |
| 199 | + * @example To retrieve details about a policy |
| 200 | + * ```javascript |
| 201 | + * // The following example retrieves information about the specified policy contained in the specified policy store. In this example, the requested policy is a template-linked policy, so it returns the ID of the policy template, and the specific principal and resource used by this policy. |
| 202 | + * const input = { |
| 203 | + * "requests": [ |
| 204 | + * { |
| 205 | + * "policyId": "PWv5M6d5HePx3gVVLKY1nK", |
| 206 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC" |
| 207 | + * }, |
| 208 | + * { |
| 209 | + * "policyId": "LzFn6KgLWvv4Mbegus35jn", |
| 210 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC" |
| 211 | + * }, |
| 212 | + * { |
| 213 | + * "policyId": "77gLjer8H5o3mvrnMGrSL5", |
| 214 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC" |
| 215 | + * } |
| 216 | + * ] |
| 217 | + * }; |
| 218 | + * const command = new BatchGetPolicyCommand(input); |
| 219 | + * const response = await client.send(command); |
| 220 | + * /* response == |
| 221 | + * { |
| 222 | + * "errors": [], |
| 223 | + * "results": [ |
| 224 | + * { |
| 225 | + * "createdDate": "2024-10-18T18:53:39.258153Z", |
| 226 | + * "definition": { |
| 227 | + * "static": { |
| 228 | + * "description": "Users can manage account resources in any account they own", |
| 229 | + * "statement": "permit (principal, action in PhotoFlash::Action::\"ManageAccount\",resource) when { resource in principal.Account };" |
| 230 | + * } |
| 231 | + * }, |
| 232 | + * "lastUpdatedDate": "2024-10-18T18:53:39.258153Z", |
| 233 | + * "policyId": "PWv5M6d5HePx3gVVLKY1nK", |
| 234 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC", |
| 235 | + * "policyType": "STATIC" |
| 236 | + * }, |
| 237 | + * { |
| 238 | + * "createdDate": "2024-10-18T18:57:03.305027Z", |
| 239 | + * "definition": { |
| 240 | + * "static": { |
| 241 | + * "description": "User alice can't delete any photos.", |
| 242 | + * "statement": "forbid (principal == PhotoFlash::User::\"alice\", action in [PhotoFlash::Action::\"DeletePhoto\"], resource);" |
| 243 | + * } |
| 244 | + * }, |
| 245 | + * "lastUpdatedDate": "2024-10-18T18:57:03.305027Z", |
| 246 | + * "policyId": "LzFn6KgLWvv4Mbegus35jn", |
| 247 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC", |
| 248 | + * "policyType": "STATIC" |
| 249 | + * }, |
| 250 | + * { |
| 251 | + * "createdDate": "2024-10-18T18:57:48.005343Z", |
| 252 | + * "definition": { |
| 253 | + * "static": { |
| 254 | + * "description": "User alice can view and delete photos.", |
| 255 | + * "statement": "permit (principal == PhotoFlash::User::\"alice\", action in [PhotoFlash::Action::\"DeletePhoto\", PhotoFlash::Action::\"ViewPhoto\"], resource);" |
| 256 | + * } |
| 257 | + * }, |
| 258 | + * "lastUpdatedDate": "2024-10-18T18:57:48.005343Z", |
| 259 | + * "policyId": "77gLjer8H5o3mvrnMGrSL5", |
| 260 | + * "policyStoreId": "ERZeDpRc34dkYZeb6FZRVC", |
| 261 | + * "policyType": "STATIC" |
| 262 | + * } |
| 263 | + * ] |
| 264 | + * } |
| 265 | + * *\/ |
| 266 | + * // example id: example-1 |
| 267 | + * ``` |
| 268 | + * |
| 269 | + */ |
| 270 | +export class BatchGetPolicyCommand extends $Command |
| 271 | + .classBuilder< |
| 272 | + BatchGetPolicyCommandInput, |
| 273 | + BatchGetPolicyCommandOutput, |
| 274 | + VerifiedPermissionsClientResolvedConfig, |
| 275 | + ServiceInputTypes, |
| 276 | + ServiceOutputTypes |
| 277 | + >() |
| 278 | + .ep(commonParams) |
| 279 | + .m(function (this: any, Command: any, cs: any, config: VerifiedPermissionsClientResolvedConfig, o: any) { |
| 280 | + return [ |
| 281 | + getSerdePlugin(config, this.serialize, this.deserialize), |
| 282 | + getEndpointPlugin(config, Command.getEndpointParameterInstructions()), |
| 283 | + ]; |
| 284 | + }) |
| 285 | + .s("VerifiedPermissions", "BatchGetPolicy", {}) |
| 286 | + .n("VerifiedPermissionsClient", "BatchGetPolicyCommand") |
| 287 | + .f(void 0, BatchGetPolicyOutputFilterSensitiveLog) |
| 288 | + .ser(se_BatchGetPolicyCommand) |
| 289 | + .de(de_BatchGetPolicyCommand) |
| 290 | + .build() { |
| 291 | + /** @internal type navigation helper, not in runtime. */ |
| 292 | + protected declare static __types: { |
| 293 | + api: { |
| 294 | + input: BatchGetPolicyInput; |
| 295 | + output: BatchGetPolicyOutput; |
| 296 | + }; |
| 297 | + sdk: { |
| 298 | + input: BatchGetPolicyCommandInput; |
| 299 | + output: BatchGetPolicyCommandOutput; |
| 300 | + }; |
| 301 | + }; |
| 302 | +} |
0 commit comments