class_docstr: Facade for Amazon Verified Permissions.
  
  Used as an intermediate layer between AWS auth manager and Amazon Verified Permissions.
class_docstr_tok: ["Facade","for","Amazon","Verified","Permissions",".","Used","as","an","intermediate","layer","between","AWS","auth","manager","and","Amazon","Verified","Permissions","."]
docstr: Make an authorization decision against Amazon Verified Permissions.
  
  Check whether the user has permissions to access given resource.
  
  :param method: the method to perform
  :param entity_type: the entity type the user accesses
  :param user: the user
  :param entity_id: the entity ID the user accesses. If not provided, all entities of the type will be
      considered.
  :param context: optional additional context to pass to Amazon Verified Permissions.
docstr_tok: ["Make","an","authorization","decision","against","Amazon","Verified","Permissions",".","Check","whether","the","user","has","permissions","to","access","given","resource",".",":","param","method",":","the","method","to","perform",":","param","entity_type",":","the","entity","type","the","user","accesses",":","param","user",":","the","user",":","param","entity_id",":","the","entity","ID","the","user","accesses",".","If","not","provided",",","all","entities","of","the","type","will","be","considered",".",":","param","context",":","optional","additional","context","to","pass","to","Amazon","Verified","Permissions","."]
code: def is_authorized(
      self,
      *,
      method: ResourceMethod,
      entity_type: AvpEntities,
      user: AwsAuthManagerUser | None,
      entity_id: str | None = None,
      context: dict | None = None,
  ) -> bool:
      """
      Make an authorization decision against Amazon Verified Permissions.
  
      Check whether the user has permissions to access given resource.
  
      :param method: the method to perform
      :param entity_type: the entity type the user accesses
      :param user: the user
      :param entity_id: the entity ID the user accesses. If not provided, all entities of the type will be
          considered.
      :param context: optional additional context to pass to Amazon Verified Permissions.
      """
      if user is None:
          return False
  
      entity_list = self._get_user_role_entities(user)
  
      self.log.debug(
          "Making authorization request for user=%s, method=%s, entity_type=%s, entity_id=%s",
          user.get_id(),
          method,
          entity_type,
          entity_id,
      )
  
      request_params = prune_dict(
          {
              "policyStoreId": self.avp_policy_store_id,
              "principal": {
                  "entityType": get_entity_type(AvpEntities.USER),
                  "entityId": user.get_id(),
              },
              "action": {
                  "actionType": get_entity_type(AvpEntities.ACTION),
                  "actionId": get_action_id(entity_type, method),
              },
              "resource": {
                  "entityType": get_entity_type(entity_type),
                  "entityId": entity_id or "*",
              },
              "entities": {"entityList": entity_list},
              "context": self._build_context(context),
          }
      )
  
      resp = self.avp_client.is_authorized(**request_params)
  
      self.log.debug("Authorization response: %s", resp)
  
      if len(resp.get("errors", [])) > 0:
          self.log.error(
              "Error occurred while making an authorization decision. Errors: %s",
              resp["errors"],
          )
          raise AirflowException(
              "Error occurred while making an authorization decision."
          )
  
      return resp["decision"] == "ALLOW"
  
file_path: airflow/airflow/providers/amazon/aws/auth_manager/avp/facade.py
imports: from __future__ import annotations
  from functools import cached_property
  from typing import TYPE_CHECKING
  from airflow.configuration import conf
  from airflow.exceptions import AirflowException
  from airflow.providers.amazon.aws.auth_manager.avp.entities import AvpEntities, get_action_id, get_entity_type
  from airflow.providers.amazon.aws.auth_manager.constants import CONF_AVP_POLICY_STORE_ID_KEY, CONF_CONN_ID_KEY, CONF_REGION_NAME_KEY, CONF_SECTION_NAME
  from airflow.providers.amazon.aws.hooks.verified_permissions import VerifiedPermissionsHook
  from airflow.utils.helpers import prune_dict
  from airflow.utils.log.logging_mixin import LoggingMixin
label_desc: Use image node_id 3 for calling the AwsAuthManagerAmazonVerifiedPermissionsFacade obj's underlying member method code with example usage: obj.is_authorized() and returns: unknown, False