Skip to content

create_template_snapshot

create_template_snapshot(
    template_identifier: TemplateIdentifier,
    *,
    config_overrides: Optional[NetworkSecurityManagerClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    tags: Optional[TagMap] = None,
) -> CreateTemplateSnapshotOutput

Creates a snapshot of the current published version of the specified template.

Parameters:

  • template_identifier (TemplateIdentifier) –

    The identifier of the template. This is the template's Amazon Resource Name (ARN).

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

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

    The tags to add to the snapshot when it is created.

Raises:

  • AccessDeniedException –

    You do not have sufficient permissions to perform this action.

  • ConflictException –

    The request conflicts with the current state of the resource. For example, the resource was modified concurrently, or it is in a state that does not allow the requested operation.

  • InternalServerException –

    The request processing failed because of an internal error in the service. This is a retryable error.

  • ResourceNotFoundException –

    The specified resource was not found. Verify that the resource identifier is correct and that the resource exists, then try your request again.

  • ServiceQuotaExceededException –

    The request would exceed a service quota.

  • ThrottlingException –

    The request was denied because of request throttling. Reduce your request rate and try again.

  • ValidationException –

    The request failed validation. For details, see the reason and fieldList members of the response.

  • UnknownServiceError –

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

Examples:

Create a template snapshot Creates an immutable snapshot of the current published version of a template. The snapshot is addressable by a version-qualified ARN.

>>> client.create_template_snapshot(template_identifier='arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789', client_token='550e8400-e29b-41d4-a716-446655440012')
Source code in docs_src/capo_network_security_manager/_services/network_security_manager.py
def create_template_snapshot(
    self,
    template_identifier: "capo_network_security_manager.types.template_identifier.TemplateIdentifier",
    *,
    config_overrides: Optional[NetworkSecurityManagerClientConfig] = None,
    client_token: Optional[
        "capo_network_security_manager.types.idempotency_token.IdempotencyToken"
    ] = None,
    tags: Optional["capo_network_security_manager.types.tag_map.TagMap"] = None,
) -> "capo_network_security_manager.types.create_template_snapshot_output.CreateTemplateSnapshotOutput":
    """<p>Creates a snapshot of the current published version of the specified template.</p>

    Args:
        template_identifier: <p>The identifier of the template. This is the template's Amazon Resource Name (ARN).</p>
        client_token: <p>A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.</p>
        tags: <p>The tags to add to the snapshot when it is created.</p>

    Raises:
        capo_network_security_manager.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_network_security_manager.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of the resource. For example, the resource was modified concurrently, or it is in a state that does not allow the requested operation.</p>
        capo_network_security_manager.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an internal error in the service. This is a retryable error.</p>
        capo_network_security_manager.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found. Verify that the resource identifier is correct and that the resource exists, then try your request again.</p>
        capo_network_security_manager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota.</p>
        capo_network_security_manager.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Reduce your request rate and try again.</p>
        capo_network_security_manager.errors.validation_exception.ValidationException: <p>The request failed validation. For details, see the <code>reason</code> and <code>fieldList</code> members of the response.</p>
        capo_network_security_manager.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create a template snapshot
        Creates an immutable snapshot of the current published version of a template. The snapshot is addressable by a version-qualified ARN.

        >>> client.create_template_snapshot(template_identifier='arn:aws:network-security-manager:us-east-1:123456789012:template:xyz789', client_token='550e8400-e29b-41d4-a716-446655440012')
    """

    def _handler(
        req: "OperationRequest[capo_network_security_manager.types.create_template_snapshot_input.CreateTemplateSnapshotInput]",
    ) -> OperationResponse[
        "capo_network_security_manager.types.create_template_snapshot_output.CreateTemplateSnapshotOutput"
    ]:
        import capo_network_security_manager._operations.piccolo_customer_api_service.create_template_snapshot

        output, http_response = (
            capo_network_security_manager._operations.piccolo_customer_api_service.create_template_snapshot.create_template_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTemplateSnapshot")
    )
    input_: capo_network_security_manager.types.create_template_snapshot_input.CreateTemplateSnapshotInput = {
        "template_identifier": template_identifier
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_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