original_docstring: Get the resource based policy for this resource and store it
docstring: Get the resource based policy for this resource and store it
docstring_tokens: Get the resource based policy for this resource and store it
code: def _get_rbp(self) -> ResponseGetRbp:
          """Get the resource based policy for this resource and store it"""
          logger.debug("Getting resource policy for %s" % self.arn)
          # When there is no policy, let's return an empty policy to avoid breaking things
          policy = constants.get_empty_policy()
          try:
              # https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glacier.html#Glacier.Client.get_vault_access_policy
              response = self.client.get_vault_access_policy(vaultName=self.name)
              policy = json.loads(response.get("policy").get("Policy"))
              success = True
          # This is silly. If there is no access policy set on the vault, then it returns the same error as if the vault didn't exist.
          except self.client.exceptions.ResourceNotFoundException as error:
              logger.debug(error)
              success = True
          except botocore.exceptions.ClientError:
              success = False
          policy_document = PolicyDocument(
              policy=policy,
              service=self.service,
              override_action=self.override_action,
              include_resource_block=self.include_resource_block,
              override_resource_block=self.override_resource_block,
              override_account_id_instead_of_principal=self.override_account_id_instead_of_principal,
          )
          response = ResponseGetRbp(policy_document=policy_document, success=success)
          return response
code_tokens: def _get_rbp ( self ) -> ResponseGetRbp : logger . debug ( "Getting resource policy for %s" % self . arn ) policy = constants . get_empty_policy ( ) try : response = self . client . get_vault_access_policy ( vaultName = self . name ) policy = json . loads ( response . get ( "policy" ) . get ( "Policy" ) ) success = True except self . client . exceptions . ResourceNotFoundException as error : logger . debug ( error ) success = True except botocore . exceptions . ClientError : success = False policy_document = PolicyDocument ( policy = policy , service = self . service , override_action = self . override_action , include_resource_block = self . include_resource_block , override_resource_block = self . override_resource_block , override_account_id_instead_of_principal = self . override_account_id_instead_of_principal , ) response = ResponseGetRbp ( policy_document = policy_document , success = success ) return response
short_docstring: Get the resource based policy for this resource and store it
short_docstring_tokens: Get the resource based policy for this resource and store it
comment: """Get the resource based policy for this resource and store it"""$SEP$# When there is no policy, let's return an empty policy to avoid breaking things$SEP$# https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/glacier.html#Glacier.Client.get_vault_access_policy$SEP$# This is silly. If there is no access policy set on the vault, then it returns the same error as if the vault didn't exist.