Skip to content

reject_vpc_peering_connection

reject_vpc_peering_connection(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    vpc_peering_connection_id: Optional[VpcPeeringConnectionId] = None,
) -> RejectVpcPeeringConnectionResult

Rejects a VPC peering connection request. The VPC peering connection must be in the pending-acceptance state. Use the DescribeVpcPeeringConnections request to view your outstanding VPC peering connection requests. To delete an active VPC peering connection, or to delete a VPC peering connection request that you initiated, use DeleteVpcPeeringConnection.

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 reject_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.reject_vpc_peering_connection_result.RejectVpcPeeringConnectionResult":
    """<p>Rejects a VPC peering connection request. The VPC peering connection must be in the <code>pending-acceptance</code> state. Use the <a>DescribeVpcPeeringConnections</a> request to view your outstanding VPC peering connection requests. To delete an active VPC peering connection, or to delete a VPC peering connection request that you initiated, use <a>DeleteVpcPeeringConnection</a>.</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.reject_vpc_peering_connection_request.RejectVpcPeeringConnectionRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.reject_vpc_peering_connection_result.RejectVpcPeeringConnectionResult"
    ]:
        import capo_ec2._operations.amazon_ec2.reject_vpc_peering_connection

        output, http_response = (
            capo_ec2._operations.amazon_ec2.reject_vpc_peering_connection.reject_vpc_peering_connection(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RejectVpcPeeringConnection")
    )
    input_: capo_ec2.types.reject_vpc_peering_connection_request.RejectVpcPeeringConnectionRequest = {}
    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