Skip to content

import_lens

import_lens(
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    lens_alias: Optional[LensAlias] = None,
    json_string: Optional[LensJSON] = None,
    client_request_token: Optional[ClientRequestToken] = None,
    tags: Optional[TagMap] = None,
) -> ImportLensOutput

Import a new custom lens or update an existing custom lens.

To update an existing custom lens, specify its ARN as the LensAlias. If no ARN is specified, a new custom lens is created.

The new or updated lens will have a status of DRAFT. The lens cannot be applied to workloads or shared with other Amazon Web Services accounts until it's published with CreateLensVersion.

Lenses are defined in JSON. For more information, see JSON format specification in the Well-Architected Tool User Guide.

A custom lens cannot exceed 500 KB in size.

Disclaimer

Do not include or gather personal identifiable information (PII) of end users or other identifiable individuals in or via your custom lenses. If your custom lens or those shared with you and used in your account do include or collect PII you are responsible for: ensuring that the included PII is processed in accordance with applicable law, providing adequate privacy notices, and obtaining necessary consents for processing such data.

Parameters:

  • json_string (Optional[LensJSON], default: None ) –

    The JSON representation of a lens.

  • tags (Optional[TagMap], default: None ) –

    Tags to associate to a lens.

Raises:

Source code in docs_src/capo_wellarchitected/_services/well_architected.py
def import_lens(
    self,
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    lens_alias: Optional["capo_wellarchitected.types.lens_alias.LensAlias"] = None,
    json_string: Optional["capo_wellarchitected.types.lens_json.LensJSON"] = None,
    client_request_token: Optional[
        "capo_wellarchitected.types.client_request_token.ClientRequestToken"
    ] = None,
    tags: Optional["capo_wellarchitected.types.tag_map.TagMap"] = None,
) -> "capo_wellarchitected.types.import_lens_output.ImportLensOutput":
    """<p>Import a new custom lens or update an existing custom lens.</p> <p>To update an existing custom lens, specify its ARN as the <code>LensAlias</code>. If no ARN is specified, a new custom lens is created.</p> <p>The new or updated lens will have a status of <code>DRAFT</code>. The lens cannot be applied to workloads or shared with other Amazon Web Services accounts until it's published with <a>CreateLensVersion</a>.</p> <p>Lenses are defined in JSON. For more information, see <a href="https://docs.aws.amazon.com/wellarchitected/latest/userguide/lenses-format-specification.html">JSON format specification</a> in the <i>Well-Architected Tool User Guide</i>.</p> <p>A custom lens cannot exceed 500 KB in size.</p> <note> <p> <b>Disclaimer</b> </p> <p>Do not include or gather personal identifiable information (PII) of end users or other identifiable individuals in or via your custom lenses. If your custom lens or those shared with you and used in your account do include or collect PII you are responsible for: ensuring that the included PII is processed in accordance with applicable law, providing adequate privacy notices, and obtaining necessary consents for processing such data.</p> </note>

    Args:
        json_string: <p>The JSON representation of a lens.</p>
        tags: <p>Tags to associate to a lens.</p>

    Raises:
        capo_wellarchitected.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_wellarchitected.errors.conflict_exception.ConflictException: <p>The resource has already been processed, was deleted, or is too large.</p>
        capo_wellarchitected.errors.internal_server_exception.InternalServerException: <p>There is a problem with the Well-Architected Tool API service.</p>
        capo_wellarchitected.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_wellarchitected.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The user has reached their resource quota.</p>
        capo_wellarchitected.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_wellarchitected.errors.validation_exception.ValidationException: <p>The user input is not valid.</p>
        capo_wellarchitected.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_wellarchitected.types.import_lens_input.ImportLensInput]",
    ) -> OperationResponse[
        "capo_wellarchitected.types.import_lens_output.ImportLensOutput"
    ]:
        import capo_wellarchitected._operations.well_architected_api_service_lambda.import_lens

        output, http_response = (
            capo_wellarchitected._operations.well_architected_api_service_lambda.import_lens.import_lens(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ImportLens")
    )
    input_: capo_wellarchitected.types.import_lens_input.ImportLensInput = {}
    if lens_alias is not None:
        input_["lens_alias"] = lens_alias
    if json_string is not None:
        input_["json_string"] = json_string
    if client_request_token is None:
        client_request_token = str(uuid.uuid4())
    input_["client_request_token"] = client_request_token
    if tags is not None:
        input_["tags"] = tags

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