Returns the named resource policy attached to an event bus. Fails with ResourceNotFoundException when the event bus or the named policy does not exist.
Parameters:
-
resource_arn
(EventBusArn)
–
The Amazon Resource Name (ARN) that uniquely identifies an event bus.
-
policy_name
(Optional[PolicyName], default:
None
)
–
Which named policy to read. Defaults to "default" when omitted (a read AWS Resource Access Manager makes on the owner's behalf resolves to "AWS_RAM" instead). Unlike writing, neither name is reserved on a read: the bus owner can read both. There is no fallback between the two, so a bus shared only through Resource Access Manager fails with ResourceNotFoundException until "AWS_RAM" is named explicitly. A well-formed name that is neither of the two fails with InvalidInputException.
Raises:
-
AccessDeniedException
–
The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.
-
InternalException
–
The request failed because of an internal service error. Retry the request.
-
InvalidInputException
–
A request parameter is missing or not valid.
-
ThrottlingException
–
The request was throttled because it exceeds a request rate limit. Retry the request with backoff.
-
ResourceNotFoundException
–
The resource does not exist.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_eventbridgev2/_services/async_event_bridge_v2.py
| async def get_resource_policy(
self,
resource_arn: "capo_eventbridgev2.types.event_bus_arn.EventBusArn",
*,
config_overrides: Optional[AsyncEventBridgeV2ClientConfig] = None,
policy_name: Optional["capo_eventbridgev2.types.policy_name.PolicyName"] = None,
) -> "capo_eventbridgev2.types.get_resource_policy_response.GetResourcePolicyResponse":
"""<p>Returns the named resource policy attached to an event bus. Fails with ResourceNotFoundException when the event bus or the named policy does not exist.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) that uniquely identifies an event bus.</p>
policy_name: <p>Which named policy to read. Defaults to "default" when omitted (a read AWS Resource Access Manager makes on the owner's behalf resolves to "AWS_RAM" instead). Unlike writing, neither name is reserved on a read: the bus owner can read both. There is no fallback between the two, so a bus shared only through Resource Access Manager fails with ResourceNotFoundException until "AWS_RAM" is named explicitly. A well-formed name that is neither of the two fails with InvalidInputException.</p>
Raises:
capo_eventbridgev2.errors.access_denied_exception.AccessDeniedException: <p>The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.</p>
capo_eventbridgev2.errors.internal_exception.InternalException: <p>The request failed because of an internal service error. Retry the request.</p>
capo_eventbridgev2.errors.invalid_input_exception.InvalidInputException: <p>A request parameter is missing or not valid.</p>
capo_eventbridgev2.errors.throttling_exception.ThrottlingException: <p>The request was throttled because it exceeds a request rate limit. Retry the request with backoff.</p>
capo_eventbridgev2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource does not exist.</p>
capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_eventbridgev2.types.get_resource_policy_request.GetResourcePolicyRequest]",
) -> AsyncOperationResponse[
"capo_eventbridgev2.types.get_resource_policy_response.GetResourcePolicyResponse"
]:
import capo_eventbridgev2._operations.aws_events_v2.get_resource_policy
(
output,
http_response,
) = await capo_eventbridgev2._operations.aws_events_v2.get_resource_policy.async_get_resource_policy(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetResourcePolicy")
)
input_: capo_eventbridgev2.types.get_resource_policy_request.GetResourcePolicyRequest = {
"resource_arn": resource_arn
}
if policy_name is not None:
input_["policy_name"] = policy_name
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|