test_authorization
¶
test_authorization(
auth_infos: AuthInfos,
*,
config_overrides: Optional[IoTClientConfig] = None,
principal: Optional[Principal] = None,
cognito_identity_pool_id: Optional[CognitoIdentityPoolId] = None,
client_id: Optional[ClientId] = None,
policy_names_to_add: Optional[PolicyNames] = None,
policy_names_to_skip: Optional[PolicyNames] = None,
) -> TestAuthorizationResponse
Tests if a specified principal is authorized to perform an IoT action on a specified resource. Use this to test and debug the authorization behavior of devices that connect to the IoT device gateway.
Requires permission to access the TestAuthorization action.
Parameters:
-
principal(Optional[Principal], default:None) –The principal. Valid principals are CertificateArn (arn:aws:iot:region:accountId:cert/certificateId) and CognitoId (region:id).
-
cognito_identity_pool_id(Optional[CognitoIdentityPoolId], default:None) –The Cognito identity pool ID.
-
auth_infos(AuthInfos) –A list of authorization info objects. Simulating authorization will create a response for each
authInfoobject in the list. -
client_id(Optional[ClientId], default:None) –The MQTT client ID.
-
policy_names_to_add(Optional[PolicyNames], default:None) –When testing custom authorization, the policies specified here are treated as if they are attached to the principal being authorized.
-
policy_names_to_skip(Optional[PolicyNames], default:None) –When testing custom authorization, the policies specified here are treated as if they are not attached to the principal being authorized.
Raises:
-
InternalFailureException–An unexpected error has occurred.
-
InvalidRequestException–The request is not valid.
-
LimitExceededException–A limit has been exceeded.
-
ResourceNotFoundException–The specified resource does not exist.
-
ServiceUnavailableException–The service is temporarily unavailable.
-
ThrottlingException–The rate exceeds the limit.
-
UnauthorizedException–You are not authorized to perform this operation.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_iot/_services/io_t.py
16486 16487 16488 16489 16490 16491 16492 16493 16494 16495 16496 16497 16498 16499 16500 16501 16502 16503 16504 16505 16506 16507 16508 16509 16510 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 16527 16528 16529 16530 16531 16532 16533 16534 16535 16536 16537 16538 16539 16540 16541 16542 16543 16544 16545 16546 16547 16548 16549 16550 16551 16552 16553 16554 16555 16556 16557 16558 16559 | |