Skip to content

list_components

list_components(
    *,
    config_overrides: Optional[imagebuilderClientConfig] = None,
    owner: Optional[Ownership] = None,
    filters: Optional[FilterList] = None,
    by_name: Optional[Boolean] = None,
    max_results: Optional[RestrictedInteger] = None,
    next_token: Optional[PaginationToken] = None,
) -> ListComponentsResponse

Returns the list of components that you have access to. By default, the response doesn't include components in the DEPRECATED state. To list deprecated components, use the status filter with the value DEPRECATED.

The semantic version has four nodes: ../. You can assign values for the first three, and can filter on all of them.

Filtering: You can use wildcards (x) to specify the most recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in any node, all nodes to the right of the first wildcard must also be wildcards.

Parameters:

  • owner (Optional[Ownership], default: None ) –

    Filters results based on the type of owner for the component. By default, this request returns a list of components that your account owns. To see results for other types of owners, you can specify components that Amazon manages, components from the Amazon Web Services Marketplace, third party components, or components that other accounts have shared with you.

  • filters (Optional[FilterList], default: None ) –

    Use the following filters to streamline results:

    • description

    • name

    • platform

    • productCodes

    • status

    • supportedOsVersion

    • type

    • version

  • by_name (Optional[Boolean], default: None ) –

    Specifies whether to return one entry per component name, with all versions of each component aggregated. Defaults to false, which returns one entry per component version. You can't combine this option with the version filter.

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

    The maximum number of items to return in a single request.

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

    A token to specify where to start paginating. Use the nextToken value from a previously truncated response.

Raises:

  • CallRateLimitExceededException –

    You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.

  • ClientException –

    A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.

  • ForbiddenException –

    You are not authorized to perform the requested operation.

  • InvalidPaginationTokenException –

    You have provided an invalid pagination token in your request.

  • InvalidRequestException –

    The request is malformed or otherwise invalid. Verify the request and try again.

  • ServiceException –

    An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.

  • ServiceUnavailableException –

    The service is unable to process your request at this time.

  • UnknownServiceError –

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

Examples:

List components that you own The following example lists the component versions that your account owns, filtered to components for the Linux platform.

>>> client.list_components(owner='Self', filters=[{'name': 'platform', 'values': ['Linux']}])
Source code in docs_src/capo_imagebuilder/_services/imagebuilder.py
def list_components(
    self,
    *,
    config_overrides: Optional[imagebuilderClientConfig] = None,
    owner: Optional["capo_imagebuilder.types.ownership.Ownership"] = None,
    filters: Optional["capo_imagebuilder.types.filter_list.FilterList"] = None,
    by_name: Optional["capo_imagebuilder.types.boolean.Boolean"] = None,
    max_results: Optional[
        "capo_imagebuilder.types.restricted_integer.RestrictedInteger"
    ] = None,
    next_token: Optional[
        "capo_imagebuilder.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_imagebuilder.types.list_components_response.ListComponentsResponse":
    """<p>Returns the list of components that you have access to. By default, the response doesn't include components in the <code>DEPRECATED</code> state. To list deprecated components, use the <code>status</code> filter with the value <code>DEPRECATED</code>.</p> <note> <p>The semantic version has four nodes: <major>.<minor>.<patch>/<build>. You can assign values for the first three, and can filter on all of them.</p> <p> <b>Filtering:</b> You can use wildcards (x) to specify the most recent versions or nodes when selecting the base image or components for your recipe. When you use a wildcard in any node, all nodes to the right of the first wildcard must also be wildcards.</p> </note>

    Args:
        owner: <p>Filters results based on the type of owner for the component. By default, this request returns a list of components that your account owns. To see results for other types of owners, you can specify components that Amazon manages, components from the Amazon Web Services Marketplace, third party components, or components that other accounts have shared with you.</p>
        filters: <p>Use the following filters to streamline results:</p> <ul> <li> <p> <code>description</code> </p> </li> <li> <p> <code>name</code> </p> </li> <li> <p> <code>platform</code> </p> </li> <li> <p> <code>productCodes</code> </p> </li> <li> <p> <code>status</code> </p> </li> <li> <p> <code>supportedOsVersion</code> </p> </li> <li> <p> <code>type</code> </p> </li> <li> <p> <code>version</code> </p> </li> </ul>
        by_name: <p>Specifies whether to return one entry per component name, with all versions of each component aggregated. Defaults to <code>false</code>, which returns one entry per component version. You can't combine this option with the <code>version</code> filter.</p>
        max_results: <p>The maximum number of items to return in a single request.</p>
        next_token: <p>A token to specify where to start paginating. Use the <code>nextToken</code> value from a previously truncated response.</p>

    Raises:
        capo_imagebuilder.errors.call_rate_limit_exceeded_exception.CallRateLimitExceededException: <p>You have exceeded the permitted request rate for the Amazon EC2 APIs that Image Builder calls on your behalf. Retry with an increasing or variable delay between requests.</p>
        capo_imagebuilder.errors.client_exception.ClientException: <p>A generic client error. This error usually indicates that the request failed a validation check, such as when a downstream service rejects a configured value.</p>
        capo_imagebuilder.errors.forbidden_exception.ForbiddenException: <p>You are not authorized to perform the requested operation.</p>
        capo_imagebuilder.errors.invalid_pagination_token_exception.InvalidPaginationTokenException: <p>You have provided an invalid pagination token in your request.</p>
        capo_imagebuilder.errors.invalid_request_exception.InvalidRequestException: <p>The request is malformed or otherwise invalid. Verify the request and try again.</p>
        capo_imagebuilder.errors.service_exception.ServiceException: <p>An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.</p>
        capo_imagebuilder.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unable to process your request at this time.</p>
        capo_imagebuilder.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        List components that you own
        The following example lists the component versions that your account owns, filtered to components for the Linux platform.

        >>> client.list_components(owner='Self', filters=[{'name': 'platform', 'values': ['Linux']}])
    """

    def _handler(
        req: "OperationRequest[capo_imagebuilder.types.list_components_request.ListComponentsRequest]",
    ) -> OperationResponse[
        "capo_imagebuilder.types.list_components_response.ListComponentsResponse"
    ]:
        import capo_imagebuilder._operations.imagebuilder.list_components

        output, http_response = (
            capo_imagebuilder._operations.imagebuilder.list_components.list_components(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListComponents")
    )
    input_: capo_imagebuilder.types.list_components_request.ListComponentsRequest = {}
    if owner is not None:
        input_["owner"] = owner
    if filters is not None:
        input_["filters"] = filters
    if by_name is not None:
        input_["by_name"] = by_name
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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