Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the pending-acceptance state, and you must be the owner of the peer VPC. Use DescribeVpcPeeringConnections to view your outstanding VPC peering connection requests.
For an inter-Region VPC peering connection request, you must accept the VPC peering connection in the Region of the accepter VPC.
Parameters:
-
dry_run
(Optional[Boolean], default:
None
)
–
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.
-
vpc_peering_connection_id
(Optional[VpcPeeringConnectionIdWithResolver], default:
None
)
–
The ID of the VPC peering connection. You must specify this parameter in the request.
Raises:
Source code in docs_src/capo_ec2/_services/ec2.py
| def accept_vpc_peering_connection(
self,
*,
config_overrides: Optional[EC2ClientConfig] = None,
dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
vpc_peering_connection_id: Optional[
"capo_ec2.types.vpc_peering_connection_id_with_resolver.VpcPeeringConnectionIdWithResolver"
] = None,
) -> "capo_ec2.types.accept_vpc_peering_connection_result.AcceptVpcPeeringConnectionResult":
"""<p>Accept a VPC peering connection request. To accept a request, the VPC peering connection must be in the <code>pending-acceptance</code> state, and you must be the owner of the peer VPC. Use <a>DescribeVpcPeeringConnections</a> to view your outstanding VPC peering connection requests.</p> <p>For an inter-Region VPC peering connection request, you must accept the VPC peering connection in the Region of the accepter VPC.</p>
Args:
dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
vpc_peering_connection_id: <p>The ID of the VPC peering connection. You must specify this parameter in the request.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ec2.types.accept_vpc_peering_connection_request.AcceptVpcPeeringConnectionRequest]",
) -> OperationResponse[
"capo_ec2.types.accept_vpc_peering_connection_result.AcceptVpcPeeringConnectionResult"
]:
import capo_ec2._operations.amazon_ec2.accept_vpc_peering_connection
output, http_response = (
capo_ec2._operations.amazon_ec2.accept_vpc_peering_connection.accept_vpc_peering_connection(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("AcceptVpcPeeringConnection")
)
input_: capo_ec2.types.accept_vpc_peering_connection_request.AcceptVpcPeeringConnectionRequest = {}
if dry_run is not None:
input_["dry_run"] = dry_run
if vpc_peering_connection_id is not None:
input_["vpc_peering_connection_id"] = vpc_peering_connection_id
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|