Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the accepter VPC can delete the VPC peering connection if it's in the active state. The owner of the requester VPC can delete a VPC peering connection in the pending-acceptance state. You cannot delete a VPC peering connection that's in the failed or rejected state.
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[VpcPeeringConnectionId], default:
None
)
–
The ID of the VPC peering connection.
Raises:
Source code in docs_src/capo_ec2/_services/ec2.py
| def delete_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.VpcPeeringConnectionId"
] = None,
) -> "capo_ec2.types.delete_vpc_peering_connection_result.DeleteVpcPeeringConnectionResult":
"""<p>Deletes a VPC peering connection. Either the owner of the requester VPC or the owner of the accepter VPC can delete the VPC peering connection if it's in the <code>active</code> state. The owner of the requester VPC can delete a VPC peering connection in the <code>pending-acceptance</code> state. You cannot delete a VPC peering connection that's in the <code>failed</code> or <code>rejected</code> state.</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.</p>
Raises:
capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_ec2.types.delete_vpc_peering_connection_request.DeleteVpcPeeringConnectionRequest]",
) -> OperationResponse[
"capo_ec2.types.delete_vpc_peering_connection_result.DeleteVpcPeeringConnectionResult"
]:
import capo_ec2._operations.amazon_ec2.delete_vpc_peering_connection
output, http_response = (
capo_ec2._operations.amazon_ec2.delete_vpc_peering_connection.delete_vpc_peering_connection(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteVpcPeeringConnection")
)
input_: capo_ec2.types.delete_vpc_peering_connection_request.DeleteVpcPeeringConnectionRequest = {}
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
|