Skip to content

list_protection_groups

list_protection_groups(
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
    next_token: Optional[Token] = None,
    max_results: Optional[MaxResults] = None,
    inclusion_filters: Optional[InclusionProtectionGroupFilters] = None,
) -> ListProtectionGroupsResponse

Retrieves ProtectionGroup objects for the account. You can retrieve all protection groups or you can provide filtering criteria and retrieve just the subset of protection groups that match the criteria.

Parameters:

  • next_token (Optional[Token], default: None ) –

    When you request a list of objects from Shield Advanced, if the response does not include all of the remaining available objects, Shield Advanced includes a NextToken value in the response. You can retrieve the next batch of objects by requesting the list again and providing the token that was returned by the prior call in your request.

    You can indicate the maximum number of objects that you want Shield Advanced to return for a single call with the MaxResults setting. Shield Advanced will not return more than MaxResults objects, but may return fewer, even if more objects are still available.

    Whenever more objects remain that Shield Advanced has not yet returned to you, the response will include a NextToken value.

    On your first call to a list operation, leave this setting empty.

  • max_results (Optional[MaxResults], default: None ) –

    The greatest number of objects that you want Shield Advanced to return to the list request. Shield Advanced might return fewer objects than you indicate in this setting, even if more objects are available. If there are more objects remaining, Shield Advanced will always also return a NextToken value in the response.

    The default setting is 20.

  • inclusion_filters (Optional[InclusionProtectionGroupFilters], default: None ) –

    Narrows the set of protection groups that the call retrieves. You can retrieve a single protection group by its name and you can retrieve all protection groups that are configured with specific pattern or aggregation settings. You can provide up to one criteria per filter type. Shield Advanced returns the protection groups that exactly match all of the search criteria that you provide.

Raises:

  • InternalErrorException –

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

  • InvalidPaginationTokenException –

    Exception that indicates that the NextToken specified in the request is invalid. Submit the request using the NextToken value that was returned in the prior response.

  • 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 list_protection_groups(
    self,
    *,
    config_overrides: Optional[ShieldClientConfig] = None,
    next_token: Optional["capo_shield.types.token.Token"] = None,
    max_results: Optional["capo_shield.types.max_results.MaxResults"] = None,
    inclusion_filters: Optional[
        "capo_shield.types.inclusion_protection_group_filters.InclusionProtectionGroupFilters"
    ] = None,
) -> (
    "capo_shield.types.list_protection_groups_response.ListProtectionGroupsResponse"
):
    """<p>Retrieves <a>ProtectionGroup</a> objects for the account. You can retrieve all protection groups or you can provide filtering criteria and retrieve just the subset of protection groups that match the criteria. </p>

    Args:
        next_token: <p>When you request a list of objects from Shield Advanced, if the response does not include all of the remaining available objects, Shield Advanced includes a <code>NextToken</code> value in the response. You can retrieve the next batch of objects by requesting the list again and providing the token that was returned by the prior call in your request. </p> <p>You can indicate the maximum number of objects that you want Shield Advanced to return for a single call with the <code>MaxResults</code> setting. Shield Advanced will not return more than <code>MaxResults</code> objects, but may return fewer, even if more objects are still available.</p> <p>Whenever more objects remain that Shield Advanced has not yet returned to you, the response will include a <code>NextToken</code> value.</p> <p>On your first call to a list operation, leave this setting empty.</p>
        max_results: <p>The greatest number of objects that you want Shield Advanced to return to the list request. Shield Advanced might return fewer objects than you indicate in this setting, even if more objects are available. If there are more objects remaining, Shield Advanced will always also return a <code>NextToken</code> value in the response.</p> <p>The default setting is 20.</p>
        inclusion_filters: <p>Narrows the set of protection groups that the call retrieves. You can retrieve a single protection group by its name and you can retrieve all protection groups that are configured with specific pattern or aggregation settings. You can provide up to one criteria per filter type. Shield Advanced returns the protection groups that exactly match all of the search criteria that you provide.</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_pagination_token_exception.InvalidPaginationTokenException: <p>Exception that indicates that the <code>NextToken</code> specified in the request is invalid. Submit the request using the <code>NextToken</code> value that was returned in the prior response.</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.list_protection_groups_request.ListProtectionGroupsRequest]",
    ) -> OperationResponse[
        "capo_shield.types.list_protection_groups_response.ListProtectionGroupsResponse"
    ]:
        import capo_shield._operations.aws_shield_20160616.list_protection_groups

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListProtectionGroups")
    )
    input_: capo_shield.types.list_protection_groups_request.ListProtectionGroupsRequest = {}
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results
    if inclusion_filters is not None:
        input_["inclusion_filters"] = inclusion_filters

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