Skip to content

get_document

get_document(
    name: DocumentARN,
    *,
    config_overrides: Optional[SSMClientConfig] = 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/ssm.py
def get_document(
    self,
    name: "capo_ssm.types.document_arn.DocumentARN",
    *,
    config_overrides: Optional[SSMClientConfig] = 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.
    """

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

        output, http_response = (
            capo_ssm._operations.amazon_ssm.get_document.get_document(
                req.options, req.input
            )
        )
        return OperationResponse(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 = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output