Skip to content

get_document async

get_document(
    name: DocumentARN,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    version_name: Optional[DocumentVersionName] = None,
    document_version: Optional[DocumentVersion] = None,
    document_format: Optional[DocumentFormat] = None,
) -> GetDocumentResult

Gets the contents of the specified Amazon Web Services Systems Manager document (SSM document).

Parameters:

  • name (DocumentARN) –

    The name of the SSM document.

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

    An optional field specifying the version of the artifact associated 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 document version for which you want information.

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

    Returns the document in the specified format. The document format can be either JSON or YAML. JSON is the default format.

Raises:

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def get_document(
    self,
    name: "capo_ssm.types.document_arn.DocumentARN",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = 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,
) -> "capo_ssm.types.get_document_result.GetDocumentResult":
    """<p>Gets the contents of the specified Amazon Web Services Systems Manager document (SSM document).</p>

    Args:
        name: <p>The name of the SSM document.</p>
        version_name: <p>An optional field specifying the version of the artifact associated 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 document version for which you want information.</p>
        document_format: <p>Returns the document in the specified format. The document format can be either JSON or YAML. JSON is the default format.</p>

    Raises:
        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_version.InvalidDocumentVersion: <p>The document version isn't valid or doesn't exist.</p>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.get_document_request.GetDocumentRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.get_document_result.GetDocumentResult"
    ]:
        import capo_ssm._operations.amazon_ssm.get_document

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetDocument")
    )
    input_: capo_ssm.types.get_document_request.GetDocumentRequest = {"name": 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

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