Skip to content

preview_agents

preview_agents(
    preview_agents_arn: Arn,
    *,
    config_overrides: Optional[InspectorClientConfig] = None,
    next_token: Optional[PaginationToken] = None,
    max_results: Optional[PreviewAgentsMaxResults] = None,
) -> PreviewAgentsResponse

Previews the agents installed on the EC2 instances that are part of the specified assessment target.

Parameters:

  • preview_agents_arn (Arn) –

    The ARN of the assessment target whose agents you want to preview.

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

    You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the PreviewAgents action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

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

    You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Raises:

  • AccessDeniedException –

    You do not have required permissions to access the requested resource.

  • InternalException –

    Internal server error.

  • InvalidCrossAccountRoleException –

    Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the assessment run.

  • InvalidInputException –

    The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

  • NoSuchEntityException –

    The request was rejected because it referenced an entity that does not exist. The error code describes the entity.

  • UnknownServiceError –

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

Examples:

Preview agents Previews the agents installed on the EC2 instances that are part of the specified assessment target.

>>> client.preview_agents(preview_agents_arn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq', max_results=123)
Source code in docs_src/capo_inspector/_services/inspector.py
def preview_agents(
    self,
    preview_agents_arn: "capo_inspector.types.arn.Arn",
    *,
    config_overrides: Optional[InspectorClientConfig] = None,
    next_token: Optional[
        "capo_inspector.types.pagination_token.PaginationToken"
    ] = None,
    max_results: Optional[
        "capo_inspector.types.preview_agents_max_results.PreviewAgentsMaxResults"
    ] = None,
) -> "capo_inspector.types.preview_agents_response.PreviewAgentsResponse":
    """<p>Previews the agents installed on the EC2 instances that are part of the specified assessment target.</p>

    Args:
        preview_agents_arn: <p>The ARN of the assessment target whose agents you want to preview.</p>
        next_token: <p>You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the <b>PreviewAgents</b> action. Subsequent calls to the action fill <b>nextToken</b> in the request with the value of <b>NextToken</b> from the previous response to continue listing data.</p>
        max_results: <p>You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.</p>

    Raises:
        capo_inspector.errors.access_denied_exception.AccessDeniedException: <p>You do not have required permissions to access the requested resource.</p>
        capo_inspector.errors.internal_exception.InternalException: <p>Internal server error.</p>
        capo_inspector.errors.invalid_cross_account_role_exception.InvalidCrossAccountRoleException: <p>Amazon Inspector cannot assume the cross-account role that it needs to list your EC2 instances during the assessment run.</p>
        capo_inspector.errors.invalid_input_exception.InvalidInputException: <p>The request was rejected because an invalid or out-of-range value was supplied for an input parameter.</p>
        capo_inspector.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced an entity that does not exist. The error code describes the entity.</p>
        capo_inspector.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Preview agents
        Previews the agents installed on the EC2 instances that are part of the specified assessment target.

        >>> client.preview_agents(preview_agents_arn='arn:aws:inspector:us-west-2:123456789012:target/0-0kFIPusq', max_results=123)
    """

    def _handler(
        req: "OperationRequest[capo_inspector.types.preview_agents_request.PreviewAgentsRequest]",
    ) -> OperationResponse[
        "capo_inspector.types.preview_agents_response.PreviewAgentsResponse"
    ]:
        import capo_inspector._operations.inspector_service.preview_agents

        output, http_response = (
            capo_inspector._operations.inspector_service.preview_agents.preview_agents(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PreviewAgents")
    )
    input_: capo_inspector.types.preview_agents_request.PreviewAgentsRequest = {
        "preview_agents_arn": preview_agents_arn
    }
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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