Skip to content

update_protection_group

update_protection_group(
    protection_group_id: ProtectionGroupId,
    aggregation: ProtectionGroupAggregation,
    pattern: ProtectionGroupPattern,
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
    resource_type: Optional[ProtectedResourceType] = None,
    members: Optional[ProtectionGroupMembers] = None,
) -> UpdateProtectionGroupResponse

Updates an existing protection group. A protection group is a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives.

Parameters:

  • protection_group_id (ProtectionGroupId) –

    The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it.

  • aggregation (ProtectionGroupAggregation) –

    Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.

    • Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.

    • Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.

    • Max - Use the highest traffic from each resource. This is useful for resources that don't share traffic and for resources that share that traffic in a non-uniform way. Examples include Amazon CloudFront distributions and origin resources for CloudFront distributions.

  • pattern (ProtectionGroupPattern) –

    The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.

  • resource_type (Optional[ProtectedResourceType], default: None ) –

    The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set Pattern to BY_RESOURCE_TYPE and you must not set it for any other Pattern setting.

  • members (Optional[ProtectionGroupMembers], default: None ) –

    The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set Pattern to ARBITRARY and you must not set it for any other Pattern setting.

Raises:

  • InternalErrorException –

    Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.

  • InvalidParameterException –

    Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties.

  • OptimisticLockException –

    Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.

  • ResourceNotFoundException –

    Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_shield/_services/shield.py
def update_protection_group(
    self,
    protection_group_id: "capo_shield.types.protection_group_id.ProtectionGroupId",
    aggregation: "capo_shield.types.protection_group_aggregation.ProtectionGroupAggregation",
    pattern: "capo_shield.types.protection_group_pattern.ProtectionGroupPattern",
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
    resource_type: Optional[
        "capo_shield.types.protected_resource_type.ProtectedResourceType"
    ] = None,
    members: Optional[
        "capo_shield.types.protection_group_members.ProtectionGroupMembers"
    ] = None,
) -> "capo_shield.types.update_protection_group_response.UpdateProtectionGroupResponse":
    """<p>Updates an existing protection group. A protection group is a grouping of protected resources so they can be handled as a collective. This resource grouping improves the accuracy of detection and reduces false positives. </p>

    Args:
        protection_group_id: <p>The name of the protection group. You use this to identify the protection group in lists and to manage the protection group, for example to update, delete, or describe it. </p>
        aggregation: <p>Defines how Shield combines resource data for the group in order to detect, mitigate, and report events.</p> <ul> <li> <p>Sum - Use the total traffic across the group. This is a good choice for most cases. Examples include Elastic IP addresses for EC2 instances that scale manually or automatically.</p> </li> <li> <p>Mean - Use the average of the traffic across the group. This is a good choice for resources that share traffic uniformly. Examples include accelerators and load balancers.</p> </li> <li> <p>Max - Use the highest traffic from each resource. This is useful for resources that don't share traffic and for resources that share that traffic in a non-uniform way. Examples include Amazon CloudFront distributions and origin resources for CloudFront distributions.</p> </li> </ul>
        pattern: <p>The criteria to use to choose the protected resources for inclusion in the group. You can include all resources that have protections, provide a list of resource Amazon Resource Names (ARNs), or include all resources of a specified resource type.</p>
        resource_type: <p>The resource type to include in the protection group. All protected resources of this type are included in the protection group. You must set this when you set <code>Pattern</code> to <code>BY_RESOURCE_TYPE</code> and you must not set it for any other <code>Pattern</code> setting. </p>
        members: <p>The Amazon Resource Names (ARNs) of the resources to include in the protection group. You must set this when you set <code>Pattern</code> to <code>ARBITRARY</code> and you must not set it for any other <code>Pattern</code> setting. </p>

    Raises:
        capo_shield.errors.internal_error_exception.InternalErrorException: <p>Exception that indicates that a problem occurred with the service infrastructure. You can retry the request.</p>
        capo_shield.errors.invalid_parameter_exception.InvalidParameterException: <p>Exception that indicates that the parameters passed to the API are invalid. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.optimistic_lock_exception.OptimisticLockException: <p>Exception that indicates that the resource state has been modified by another client. Retrieve the resource and then retry your request.</p>
        capo_shield.errors.resource_not_found_exception.ResourceNotFoundException: <p>Exception indicating the specified resource does not exist. If available, this exception includes details in additional properties. </p>
        capo_shield.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_shield.types.update_protection_group_request.UpdateProtectionGroupRequest]",
    ) -> OperationResponse[
        "capo_shield.types.update_protection_group_response.UpdateProtectionGroupResponse"
    ]:
        import capo_shield._operations.aws_shield_20160616.update_protection_group

        output, http_response = (
            capo_shield._operations.aws_shield_20160616.update_protection_group.update_protection_group(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateProtectionGroup")
    )
    input_: capo_shield.types.update_protection_group_request.UpdateProtectionGroupRequest = {
        "protection_group_id": protection_group_id,
        "aggregation": aggregation,
        "pattern": pattern,
    }
    if resource_type is not None:
        input_["resource_type"] = resource_type
    if members is not None:
        input_["members"] = members

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