Skip to content

update_document async

update_document(
    content: DocumentContent,
    name: DocumentName,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    attachments: Optional[AttachmentsSourceList] = None,
    display_name: Optional[DocumentDisplayName] = None,
    version_name: Optional[DocumentVersionName] = None,
    document_version: Optional[DocumentVersion] = None,
    document_format: Optional[DocumentFormat] = None,
    target_type: Optional[TargetType] = None,
) -> UpdateDocumentResult

Updates one or more values for an SSM document.

Parameters:

  • content (DocumentContent) –

    A valid JSON or YAML string.

  • attachments (Optional[AttachmentsSourceList], default: None ) –

    A list of key-value pairs that describe attachments to a version of a document.

  • name (DocumentName) –

    The name of the SSM document that you want to update.

  • display_name (Optional[DocumentDisplayName], default: None ) –

    The friendly name of the SSM document that you want to update. This value can differ for each version of the document. If you don't specify a value for this parameter in your request, the existing value is applied to the new document version.

  • version_name (Optional[DocumentVersionName], default: None ) –

    An optional field specifying the version of the artifact you are updating with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.

  • document_version (Optional[DocumentVersion], default: None ) –

    The version of the document that you want to update. Currently, Systems Manager supports updating only the latest version of the document. You can specify the version number of the latest version or use the $LATEST variable.

    If you change a document version for a State Manager association, Systems Manager immediately runs the association unless you previously specifed the apply-only-at-cron-interval parameter.

  • document_format (Optional[DocumentFormat], default: None ) –

    Specify the document format for the new document version. The document format can be JSON, YAML, or TEXT. JSON is the default format.

  • target_type (Optional[TargetType], default: None ) –

    Specify a new target type for the document.

Raises:

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def update_document(
    self,
    content: "capo_ssm.types.document_content.DocumentContent",
    name: "capo_ssm.types.document_name.DocumentName",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    attachments: Optional[
        "capo_ssm.types.attachments_source_list.AttachmentsSourceList"
    ] = None,
    display_name: Optional[
        "capo_ssm.types.document_display_name.DocumentDisplayName"
    ] = None,
    version_name: Optional[
        "capo_ssm.types.document_version_name.DocumentVersionName"
    ] = None,
    document_version: Optional[
        "capo_ssm.types.document_version.DocumentVersion"
    ] = None,
    document_format: Optional[
        "capo_ssm.types.document_format.DocumentFormat"
    ] = None,
    target_type: Optional["capo_ssm.types.target_type.TargetType"] = None,
) -> "capo_ssm.types.update_document_result.UpdateDocumentResult":
    """<p>Updates one or more values for an SSM document.</p>

    Args:
        content: <p>A valid JSON or YAML string.</p>
        attachments: <p>A list of key-value pairs that describe attachments to a version of a document.</p>
        name: <p>The name of the SSM document that you want to update.</p>
        display_name: <p>The friendly name of the SSM document that you want to update. This value can differ for each version of the document. If you don't specify a value for this parameter in your request, the existing value is applied to the new document version.</p>
        version_name: <p>An optional field specifying the version of the artifact you are updating with the document. For example, 12.6. This value is unique across all versions of a document, and can't be changed.</p>
        document_version: <p>The version of the document that you want to update. Currently, Systems Manager supports updating only the latest version of the document. You can specify the version number of the latest version or use the <code>$LATEST</code> variable.</p> <note> <p>If you change a document version for a State Manager association, Systems Manager immediately runs the association unless you previously specifed the <code>apply-only-at-cron-interval</code> parameter.</p> </note>
        document_format: <p>Specify the document format for the new document version. The document format can be JSON, YAML, or TEXT. JSON is the default format.</p>
        target_type: <p>Specify a new target type for the document.</p>

    Raises:
        capo_ssm.errors.document_version_limit_exceeded.DocumentVersionLimitExceeded: <p>The document has too many versions. Delete one or more document versions and try again.</p>
        capo_ssm.errors.duplicate_document_content.DuplicateDocumentContent: <p>The content of the association document matches another document. Change the content of the document and try again.</p>
        capo_ssm.errors.duplicate_document_version_name.DuplicateDocumentVersionName: <p>The version name has already been used in this document. Specify a different version name, and then try again.</p>
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_document.InvalidDocument: <p>The specified SSM document doesn't exist.</p>
        capo_ssm.errors.invalid_document_content.InvalidDocumentContent: <p>The content for the document isn't valid.</p>
        capo_ssm.errors.invalid_document_operation.InvalidDocumentOperation: <p>You attempted to delete a document while it is still shared. You must stop sharing the document before you can delete it.</p>
        capo_ssm.errors.invalid_document_schema_version.InvalidDocumentSchemaVersion: <p>The version of the document schema isn't supported.</p>
        capo_ssm.errors.invalid_document_version.InvalidDocumentVersion: <p>The document version isn't valid or doesn't exist.</p>
        capo_ssm.errors.max_document_size_exceeded.MaxDocumentSizeExceeded: <p>The size limit of a document is 64 KB.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.update_document_request.UpdateDocumentRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.update_document_result.UpdateDocumentResult"
    ]:
        import capo_ssm._operations.amazon_ssm.update_document

        (
            output,
            http_response,
        ) = await capo_ssm._operations.amazon_ssm.update_document.async_update_document(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateDocument")
    )
    input_: capo_ssm.types.update_document_request.UpdateDocumentRequest = {
        "content": content,
        "name": name,
    }
    if attachments is not None:
        input_["attachments"] = attachments
    if display_name is not None:
        input_["display_name"] = display_name
    if version_name is not None:
        input_["version_name"] = version_name
    if document_version is not None:
        input_["document_version"] = document_version
    if document_format is not None:
        input_["document_format"] = document_format
    if target_type is not None:
        input_["target_type"] = target_type

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output