import { Command as $Command } from "@smithy/core/client"; import type { MetadataBearer as __MetadataBearer } from "@smithy/types"; import type { BatchIsAuthorizedInput, BatchIsAuthorizedOutput } from "../models/models_0"; import type { ServiceInputTypes, ServiceOutputTypes, VerifiedPermissionsClientResolvedConfig } from "../VerifiedPermissionsClient"; /** * @public */ export type { __MetadataBearer }; export { $Command }; /** * @public * * The input for {@link BatchIsAuthorizedCommand}. */ export interface BatchIsAuthorizedCommandInput extends BatchIsAuthorizedInput { } /** * @public * * The output of {@link BatchIsAuthorizedCommand}. */ export interface BatchIsAuthorizedCommandOutput extends BatchIsAuthorizedOutput, __MetadataBearer { } declare const BatchIsAuthorizedCommand_base: { new (input: BatchIsAuthorizedCommandInput): import("@smithy/core/client").CommandImpl; new (input: BatchIsAuthorizedCommandInput): import("@smithy/core/client").CommandImpl; getEndpointParameterInstructions(): { [x: string]: unknown; }; }; /** *

Makes a series of decisions about multiple authorization requests for one principal or resource. Each request contains the equivalent content of an IsAuthorized request: principal, action, resource, and context. Either the principal or the resource parameter must be identical across all requests. For example, Verified Permissions won't evaluate a pair of requests where bob views photo1 and alice views photo2. Authorization of bob to view photo1 and photo2, or bob and alice to view photo1, are valid batches.

The request is evaluated against all policies in the specified policy store that match the entities that you declare. The result of the decisions is a series of Allow or Deny responses, along with the IDs of the policies that produced each decision.

The entities of a BatchIsAuthorized API request can contain up to 100 principals and up to 100 resources. The requests of a BatchIsAuthorized API request can contain up to 30 requests.

The BatchIsAuthorized operation doesn't have its own IAM permission. To authorize this operation for Amazon Web Services principals, include the permission verifiedpermissions:IsAuthorized in their IAM policies.

* @example * Use a bare-bones client and the command you need to make an API call. * ```javascript * import { VerifiedPermissionsClient, BatchIsAuthorizedCommand } from "@aws-sdk/client-verifiedpermissions"; // ES Modules import * // const { VerifiedPermissionsClient, BatchIsAuthorizedCommand } = require("@aws-sdk/client-verifiedpermissions"); // CommonJS import * // import type { VerifiedPermissionsClientConfig } from "@aws-sdk/client-verifiedpermissions"; * const config = {}; // type is VerifiedPermissionsClientConfig * const client = new VerifiedPermissionsClient(config); * const input = { // BatchIsAuthorizedInput * policyStoreId: "STRING_VALUE", // required * entities: { // EntitiesDefinition Union: only one key present * entityList: [ // EntityList * { // EntityItem * identifier: { // EntityIdentifier * entityType: "STRING_VALUE", // required * entityId: "STRING_VALUE", // required * }, * attributes: { // EntityAttributes * "": { // AttributeValue Union: only one key present * boolean: true || false, * entityIdentifier: { * entityType: "STRING_VALUE", // required * entityId: "STRING_VALUE", // required * }, * long: Number("long"), * string: "STRING_VALUE", * set: [ // SetAttribute * {// Union: only one key present * boolean: true || false, * entityIdentifier: "", * long: Number("long"), * string: "STRING_VALUE", * set: [ * "", * ], * record: { // RecordAttribute * "": "", * }, * ipaddr: "STRING_VALUE", * decimal: "STRING_VALUE", * datetime: "STRING_VALUE", * duration: "STRING_VALUE", * }, * ], * record: { * "": "", * }, * ipaddr: "STRING_VALUE", * decimal: "STRING_VALUE", * datetime: "STRING_VALUE", * duration: "STRING_VALUE", * }, * }, * parents: [ // ParentList * "", * ], * tags: { // EntityCedarTags * "": { // CedarTagValue Union: only one key present * boolean: true || false, * entityIdentifier: "", * long: Number("long"), * string: "STRING_VALUE", * set: [ // CedarTagSetAttribute * {// Union: only one key present * boolean: true || false, * entityIdentifier: "", * long: Number("long"), * string: "STRING_VALUE", * set: [ * "", * ], * record: { // CedarTagRecordAttribute * "": "", * }, * ipaddr: "STRING_VALUE", * decimal: "STRING_VALUE", * datetime: "STRING_VALUE", * duration: "STRING_VALUE", * }, * ], * record: { * "": "", * }, * ipaddr: "STRING_VALUE", * decimal: "STRING_VALUE", * datetime: "STRING_VALUE", * duration: "STRING_VALUE", * }, * }, * }, * ], * cedarJson: "STRING_VALUE", * }, * requests: [ // BatchIsAuthorizedInputList // required * { // BatchIsAuthorizedInputItem * principal: "", * action: { // ActionIdentifier * actionType: "STRING_VALUE", // required * actionId: "STRING_VALUE", // required * }, * resource: "", * context: { // ContextDefinition Union: only one key present * contextMap: { // ContextMap * "": "", * }, * cedarJson: "STRING_VALUE", * }, * }, * ], * }; * const command = new BatchIsAuthorizedCommand(input); * const response = await client.send(command); * // { // BatchIsAuthorizedOutput * // results: [ // BatchIsAuthorizedOutputList // required * // { // BatchIsAuthorizedOutputItem * // request: { // BatchIsAuthorizedInputItem * // principal: { // EntityIdentifier * // entityType: "STRING_VALUE", // required * // entityId: "STRING_VALUE", // required * // }, * // action: { // ActionIdentifier * // actionType: "STRING_VALUE", // required * // actionId: "STRING_VALUE", // required * // }, * // resource: { * // entityType: "STRING_VALUE", // required * // entityId: "STRING_VALUE", // required * // }, * // context: { // ContextDefinition Union: only one key present * // contextMap: { // ContextMap * // "": { // AttributeValue Union: only one key present * // boolean: true || false, * // entityIdentifier: { * // entityType: "STRING_VALUE", // required * // entityId: "STRING_VALUE", // required * // }, * // long: Number("long"), * // string: "STRING_VALUE", * // set: [ // SetAttribute * // {// Union: only one key present * // boolean: true || false, * // entityIdentifier: "", * // long: Number("long"), * // string: "STRING_VALUE", * // set: [ * // "", * // ], * // record: { // RecordAttribute * // "": "", * // }, * // ipaddr: "STRING_VALUE", * // decimal: "STRING_VALUE", * // datetime: "STRING_VALUE", * // duration: "STRING_VALUE", * // }, * // ], * // record: { * // "": "", * // }, * // ipaddr: "STRING_VALUE", * // decimal: "STRING_VALUE", * // datetime: "STRING_VALUE", * // duration: "STRING_VALUE", * // }, * // }, * // cedarJson: "STRING_VALUE", * // }, * // }, * // decision: "ALLOW" || "DENY", // required * // determiningPolicies: [ // DeterminingPolicyList // required * // { // DeterminingPolicyItem * // policyId: "STRING_VALUE", // required * // }, * // ], * // errors: [ // EvaluationErrorList // required * // { // EvaluationErrorItem * // errorDescription: "STRING_VALUE", // required * // }, * // ], * // }, * // ], * // }; * * ``` * * @param BatchIsAuthorizedCommandInput - {@link BatchIsAuthorizedCommandInput} * @returns {@link BatchIsAuthorizedCommandOutput} * @see {@link BatchIsAuthorizedCommandInput} for command's `input` shape. * @see {@link BatchIsAuthorizedCommandOutput} for command's `response` shape. * @see {@link VerifiedPermissionsClientResolvedConfig | config} for VerifiedPermissionsClient's `config` shape. * * @throws {@link ResourceNotFoundException} (client fault) *

The request failed because it references a resource that doesn't exist.

* * @throws {@link AccessDeniedException} (client fault) *

You don't have sufficient access to perform this action.

* * @throws {@link InternalServerException} (server fault) *

The request failed because of an internal error. Try your request again later

* * @throws {@link ThrottlingException} (client fault) *

The request failed because it exceeded a throttling quota.

* * @throws {@link ValidationException} (client fault) *

The request failed because one or more input parameters don't satisfy their constraint requirements. The output is provided as a list of fields and a reason for each field that isn't valid.

The possible reasons include the following:

  • UnrecognizedEntityType

    The policy includes an entity type that isn't found in the schema.

  • UnrecognizedActionId

    The policy includes an action id that isn't found in the schema.

  • InvalidActionApplication

    The policy includes an action that, according to the schema, doesn't support the specified principal and resource.

  • UnexpectedType

    The policy included an operand that isn't a valid type for the specified operation.

  • IncompatibleTypes

    The types of elements included in a set, or the types of expressions used in an if...then...else clause aren't compatible in this context.

  • MissingAttribute

    The policy attempts to access a record or entity attribute that isn't specified in the schema. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

  • UnsafeOptionalAttributeAccess

    The policy attempts to access a record or entity attribute that is optional and isn't guaranteed to be present. Test for the existence of the attribute first before attempting to access its value. For more information, see the has (presence of attribute test) operator in the Cedar Policy Language Guide.

  • ImpossiblePolicy

    Cedar has determined that a policy condition always evaluates to false. If the policy is always false, it can never apply to any query, and so it can never affect an authorization decision.

  • WrongNumberArguments

    The policy references an extension type with the wrong number of arguments.

  • FunctionArgumentValidationError

    Cedar couldn't parse the argument passed to an extension type. For example, a string that is to be parsed as an IPv4 address can contain only digits and the period character.

* * @throws {@link VerifiedPermissionsServiceException} *

Base exception class for all service exceptions from VerifiedPermissions service.

* * * @example Batch - Example 1 * ```javascript * // The following example requests two authorization decisions for two principals of type Usernamed Alice and Annalisa. * const input = { * entities: { * entityList: [ * { * attributes: { * Account: { * entityIdentifier: { * entityId: "1234", * entityType: "PhotoFlash::Account" * } * }, * Email: { * string: "" * } * }, * identifier: { * entityId: "Alice", * entityType: "PhotoFlash::User" * }, * parents: [] * }, * { * attributes: { * Account: { * entityIdentifier: { * entityId: "5678", * entityType: "PhotoFlash::Account" * } * }, * Email: { * string: "" * } * }, * identifier: { * entityId: "Annalisa", * entityType: "PhotoFlash::User" * }, * parents: [] * }, * { * attributes: { * IsPrivate: { * boolean: false * }, * Name: { * string: "" * } * }, * identifier: { * entityId: "VacationPhoto94.jpg", * entityType: "PhotoFlash::Photo" * }, * parents: [ * { * entityId: "1234", * entityType: "PhotoFlash::Account" * } * ] * }, * { * attributes: { * Name: { * string: "" * } * }, * identifier: { * entityId: "1234", * entityType: "PhotoFlash::Account" * }, * parents: [] * } * ] * }, * policyStoreId: "C7v5xMplfFH3i3e4Jrzb1a", * requests: [ * { * action: { * actionId: "ViewPhoto", * actionType: "PhotoFlash::Action" * }, * principal: { * entityId: "Alice", * entityType: "PhotoFlash::User" * }, * resource: { * entityId: "VacationPhoto94.jpg", * entityType: "PhotoFlash::Photo" * } * }, * { * action: { * actionId: "DeletePhoto", * actionType: "PhotoFlash::Action" * }, * principal: { * entityId: "Annalisa", * entityType: "PhotoFlash::User" * }, * resource: { * entityId: "VacationPhoto94.jpg", * entityType: "PhotoFlash::Photo" * } * } * ] * }; * const command = new BatchIsAuthorizedCommand(input); * const response = await client.send(command); * /* response is * { * results: [ * { * decision: "ALLOW", * determiningPolicies: [ * { * policyId: "9wYxMpljbbZQb5fcZHyJhY" * } * ], * errors: [], * request: { * action: { * actionId: "ViewPhoto", * actionType: "PhotoFlash::Action" * }, * principal: { * entityId: "alice", * entityType: "PhotoFlash::User" * }, * resource: { * entityId: "VacationPhoto94.jpg", * entityType: "PhotoFlash::Photo" * } * } * }, * { * decision: "DENY", * determiningPolicies: [], * errors: [], * request: { * action: { * actionId: "DeletePhoto", * actionType: "PhotoFlash::Action" * }, * principal: { * entityId: "annalisa", * entityType: "PhotoFlash::User" * }, * resource: { * entityId: "VacationPhoto94.jpg", * entityType: "PhotoFlash::Photo" * } * } * } * ] * } * *\/ * ``` * * @public */ export declare class BatchIsAuthorizedCommand extends BatchIsAuthorizedCommand_base { /** @internal type navigation helper, not in runtime. */ protected static __types: { api: { input: BatchIsAuthorizedInput; output: BatchIsAuthorizedOutput; }; sdk: { input: BatchIsAuthorizedCommandInput; output: BatchIsAuthorizedCommandOutput; }; }; }