Skip to content

modify_traffic_mirror_session

modify_traffic_mirror_session(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    traffic_mirror_session_id: Optional[TrafficMirrorSessionId] = None,
    traffic_mirror_target_id: Optional[TrafficMirrorTargetId] = None,
    traffic_mirror_filter_id: Optional[TrafficMirrorFilterId] = None,
    packet_length: Optional[Integer] = None,
    session_number: Optional[Integer] = None,
    virtual_network_id: Optional[Integer] = None,
    description: Optional[String] = None,
    remove_fields: Optional[TrafficMirrorSessionFieldList] = None,
    dry_run: Optional[Boolean] = None,
) -> ModifyTrafficMirrorSessionResult

Modifies a Traffic Mirror session.

Parameters:

  • traffic_mirror_session_id (Optional[TrafficMirrorSessionId], default: None ) –

    The ID of the Traffic Mirror session.

  • traffic_mirror_target_id (Optional[TrafficMirrorTargetId], default: None ) –

    The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.

  • traffic_mirror_filter_id (Optional[TrafficMirrorFilterId], default: None ) –

    The ID of the Traffic Mirror filter.

  • packet_length (Optional[Integer], default: None ) –

    The number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet.

    For sessions with Network Load Balancer (NLB) traffic mirror targets, the default PacketLength will be set to 8500. Valid values are 1-8500. Setting a PacketLength greater than 8500 will result in an error response.

  • session_number (Optional[Integer], default: None ) –

    The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.

    Valid values are 1-32766.

  • virtual_network_id (Optional[Integer], default: None ) –

    The virtual network ID of the Traffic Mirror session.

  • description (Optional[String], default: None ) –

    The description to assign to the Traffic Mirror session.

  • remove_fields (Optional[TrafficMirrorSessionFieldList], default: None ) –

    The properties that you want to remove from the Traffic Mirror session.

    When you remove a property from a Traffic Mirror session, the property is set to the default.

  • 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.

Raises:

Source code in docs_src/capo_ec2/_services/ec2.py
def modify_traffic_mirror_session(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    traffic_mirror_session_id: Optional[
        "capo_ec2.types.traffic_mirror_session_id.TrafficMirrorSessionId"
    ] = None,
    traffic_mirror_target_id: Optional[
        "capo_ec2.types.traffic_mirror_target_id.TrafficMirrorTargetId"
    ] = None,
    traffic_mirror_filter_id: Optional[
        "capo_ec2.types.traffic_mirror_filter_id.TrafficMirrorFilterId"
    ] = None,
    packet_length: Optional["capo_ec2.types.integer.Integer"] = None,
    session_number: Optional["capo_ec2.types.integer.Integer"] = None,
    virtual_network_id: Optional["capo_ec2.types.integer.Integer"] = None,
    description: Optional["capo_ec2.types.string.String"] = None,
    remove_fields: Optional[
        "capo_ec2.types.traffic_mirror_session_field_list.TrafficMirrorSessionFieldList"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
) -> "capo_ec2.types.modify_traffic_mirror_session_result.ModifyTrafficMirrorSessionResult":
    """<p>Modifies a Traffic Mirror session.</p>

    Args:
        traffic_mirror_session_id: <p>The ID of the Traffic Mirror session.</p>
        traffic_mirror_target_id: <p>The Traffic Mirror target. The target must be in the same VPC as the source, or have a VPC peering connection with the source.</p>
        traffic_mirror_filter_id: <p>The ID of the Traffic Mirror filter.</p>
        packet_length: <p>The number of bytes in each packet to mirror. These are bytes after the VXLAN header. To mirror a subset, set this to the length (in bytes) to mirror. For example, if you set this value to 100, then the first 100 bytes that meet the filter criteria are copied to the target. Do not specify this parameter when you want to mirror the entire packet.</p> <p>For sessions with Network Load Balancer (NLB) traffic mirror targets, the default <code>PacketLength</code> will be set to 8500. Valid values are 1-8500. Setting a <code>PacketLength</code> greater than 8500 will result in an error response.</p>
        session_number: <p>The session number determines the order in which sessions are evaluated when an interface is used by multiple sessions. The first session with a matching filter is the one that mirrors the packets.</p> <p>Valid values are 1-32766.</p>
        virtual_network_id: <p>The virtual network ID of the Traffic Mirror session.</p>
        description: <p>The description to assign to the Traffic Mirror session.</p>
        remove_fields: <p>The properties that you want to remove from the Traffic Mirror session.</p> <p>When you remove a property from a Traffic Mirror session, the property is set to the default.</p>
        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>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.modify_traffic_mirror_session_request.ModifyTrafficMirrorSessionRequest]",
    ) -> OperationResponse[
        "capo_ec2.types.modify_traffic_mirror_session_result.ModifyTrafficMirrorSessionResult"
    ]:
        import capo_ec2._operations.amazon_ec2.modify_traffic_mirror_session

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyTrafficMirrorSession")
    )
    input_: capo_ec2.types.modify_traffic_mirror_session_request.ModifyTrafficMirrorSessionRequest = {}
    if traffic_mirror_session_id is not None:
        input_["traffic_mirror_session_id"] = traffic_mirror_session_id
    if traffic_mirror_target_id is not None:
        input_["traffic_mirror_target_id"] = traffic_mirror_target_id
    if traffic_mirror_filter_id is not None:
        input_["traffic_mirror_filter_id"] = traffic_mirror_filter_id
    if packet_length is not None:
        input_["packet_length"] = packet_length
    if session_number is not None:
        input_["session_number"] = session_number
    if virtual_network_id is not None:
        input_["virtual_network_id"] = virtual_network_id
    if description is not None:
        input_["description"] = description
    if remove_fields is not None:
        input_["remove_fields"] = remove_fields
    if dry_run is not None:
        input_["dry_run"] = dry_run

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output