Skip to content

associate_permission

associate_permission(
    application_id: ApplicationId,
    statement_id: StatementId,
    actions: QIamActions,
    principal: PrincipalRoleArn,
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    conditions: Optional[PermissionConditions] = None,
) -> AssociatePermissionResponse

Adds or updates a permission policy for a Amazon Q Business application, allowing cross-account access for an ISV. This operation creates a new policy statement for the specified Amazon Q Business application. The policy statement defines the IAM actions that the ISV is allowed to perform on the Amazon Q Business application's resources.

Parameters:

  • application_id (ApplicationId) –

    The unique identifier of the Amazon Q Business application.

  • statement_id (StatementId) –

    A unique identifier for the policy statement.

  • actions (QIamActions) –

    The list of Amazon Q Business actions that the ISV is allowed to perform.

  • conditions (Optional[PermissionConditions], default: None ) –

    The conditions that restrict when the permission is effective. These conditions can be used to limit the permission based on specific attributes of the request.

  • principal (PrincipalRoleArn) –

    The Amazon Resource Name of the IAM role for the ISV that is being granted permission.

Raises:

  • AccessDeniedException –

    You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.

  • ConflictException –

    You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.

  • InternalServerException –

    An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact Support for help.

  • ResourceNotFoundException –

    The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.

  • ServiceQuotaExceededException –

    You have exceeded the set limits for your Amazon Q Business service.

  • ThrottlingException –

    The request was denied due to throttling. Reduce the number of requests and try again.

  • ValidationException –

    The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_qbusiness/_services/q_business.py
def associate_permission(
    self,
    application_id: "capo_qbusiness.types.application_id.ApplicationId",
    statement_id: "capo_qbusiness.types.statement_id.StatementId",
    actions: "capo_qbusiness.types.q_iam_actions.QIamActions",
    principal: "capo_qbusiness.types.principal_role_arn.PrincipalRoleArn",
    *,
    config_overrides: Optional[QBusinessClientConfig] = None,
    conditions: Optional[
        "capo_qbusiness.types.permission_conditions.PermissionConditions"
    ] = None,
) -> (
    "capo_qbusiness.types.associate_permission_response.AssociatePermissionResponse"
):
    """<p>Adds or updates a permission policy for a Amazon Q Business application, allowing cross-account access for an ISV. This operation creates a new policy statement for the specified Amazon Q Business application. The policy statement defines the IAM actions that the ISV is allowed to perform on the Amazon Q Business application's resources.</p>

    Args:
        application_id: <p>The unique identifier of the Amazon Q Business application.</p>
        statement_id: <p>A unique identifier for the policy statement.</p>
        actions: <p>The list of Amazon Q Business actions that the ISV is allowed to perform.</p>
        conditions: <p>The conditions that restrict when the permission is effective. These conditions can be used to limit the permission based on specific attributes of the request.</p>
        principal: <p>The Amazon Resource Name of the IAM role for the ISV that is being granted permission.</p>

    Raises:
        capo_qbusiness.errors.access_denied_exception.AccessDeniedException: <p> You don't have access to perform this action. Make sure you have the required permission policies and user accounts and try again.</p>
        capo_qbusiness.errors.conflict_exception.ConflictException: <p>You are trying to perform an action that conflicts with the current status of your resource. Fix any inconsistencies with your resources and try again.</p>
        capo_qbusiness.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Q Business service. Wait some minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
        capo_qbusiness.errors.resource_not_found_exception.ResourceNotFoundException: <p>The application or plugin resource you want to use doesn’t exist. Make sure you have provided the correct resource and try again.</p>
        capo_qbusiness.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded the set limits for your Amazon Q Business service. </p>
        capo_qbusiness.errors.throttling_exception.ThrottlingException: <p>The request was denied due to throttling. Reduce the number of requests and try again.</p>
        capo_qbusiness.errors.validation_exception.ValidationException: <p>The input doesn't meet the constraints set by the Amazon Q Business service. Provide the correct input and try again.</p>
        capo_qbusiness.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_qbusiness.types.associate_permission_request.AssociatePermissionRequest]",
    ) -> OperationResponse[
        "capo_qbusiness.types.associate_permission_response.AssociatePermissionResponse"
    ]:
        import capo_qbusiness._operations.expert_q.associate_permission

        output, http_response = (
            capo_qbusiness._operations.expert_q.associate_permission.associate_permission(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("AssociatePermission")
    )
    input_: capo_qbusiness.types.associate_permission_request.AssociatePermissionRequest = {
        "application_id": application_id,
        "statement_id": statement_id,
        "actions": actions,
        "principal": principal,
    }
    if conditions is not None:
        input_["conditions"] = conditions

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output