Skip to content

get_parameter_history async

get_parameter_history(
    name: PSParameterName,
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    with_decryption: Optional[Boolean] = None,
    max_results: Optional[MaxResults] = None,
    next_token: Optional[NextToken] = None,
) -> GetParameterHistoryResult

Retrieves the history of all changes to a parameter.

Parameter names can't contain spaces. The service removes any spaces specified for the beginning or end of a parameter name. If the specified name for a parameter contains spaces between characters, the request fails with a ValidationException error.

If you change the KMS key alias for the KMS key used to encrypt a parameter, then you must also update the key alias the parameter uses to reference KMS. Otherwise, GetParameterHistory retrieves whatever the original key alias was referencing.

Parameters:

  • name (PSParameterName) –

    The name or Amazon Resource Name (ARN) of the parameter for which you want to review history. For parameters shared with you from another account, you must use the full ARN.

  • with_decryption (Optional[Boolean], default: None ) –

    Return decrypted values for secure string parameters. This flag is ignored for String and StringList parameter types.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

Raises:

  • InternalServerError –

    An error occurred on the server side.

  • InvalidKeyId –

    The query key ID isn't valid.

  • InvalidNextToken –

    The specified token isn't valid.

  • ParameterNotFound –

    The parameter couldn't be found. Verify the name and try again.

    For the DeleteParameter and GetParameter actions, if the specified parameter doesn't exist, the ParameterNotFound exception is not recorded in CloudTrail event logs.

  • UnknownServiceError –

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

Source code in docs_src/capo_ssm/_services/async_ssm.py
async def get_parameter_history(
    self,
    name: "capo_ssm.types.ps_parameter_name.PSParameterName",
    *,
    config_overrides: Optional[AsyncSSMClientConfig] = None,
    with_decryption: Optional["capo_ssm.types.boolean.Boolean"] = None,
    max_results: Optional["capo_ssm.types.max_results.MaxResults"] = None,
    next_token: Optional["capo_ssm.types.next_token.NextToken"] = None,
) -> "capo_ssm.types.get_parameter_history_result.GetParameterHistoryResult":
    """<p>Retrieves the history of all changes to a parameter.</p> <p>Parameter names can't contain spaces. The service removes any spaces specified for the beginning or end of a parameter name. If the specified name for a parameter contains spaces between characters, the request fails with a <code>ValidationException</code> error.</p> <important> <p>If you change the KMS key alias for the KMS key used to encrypt a parameter, then you must also update the key alias the parameter uses to reference KMS. Otherwise, <code>GetParameterHistory</code> retrieves whatever the original key alias was referencing.</p> </important>

    Args:
        name: <p>The name or Amazon Resource Name (ARN) of the parameter for which you want to review history. For parameters shared with you from another account, you must use the full ARN.</p>
        with_decryption: <p>Return decrypted values for secure string parameters. This flag is ignored for <code>String</code> and <code>StringList</code> parameter types.</p>
        max_results: <p>The maximum number of items to return for this call. The call also returns a token that you can specify in a subsequent call to get the next set of results.</p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>

    Raises:
        capo_ssm.errors.internal_server_error.InternalServerError: <p>An error occurred on the server side.</p>
        capo_ssm.errors.invalid_key_id.InvalidKeyId: <p>The query key ID isn't valid.</p>
        capo_ssm.errors.invalid_next_token.InvalidNextToken: <p>The specified token isn't valid.</p>
        capo_ssm.errors.parameter_not_found.ParameterNotFound: <p>The parameter couldn't be found. Verify the name and try again.</p> <note> <p>For the <code>DeleteParameter</code> and <code>GetParameter</code> actions, if the specified parameter doesn't exist, the <code>ParameterNotFound</code> exception is <i>not</i> recorded in CloudTrail event logs.</p> </note>
        capo_ssm.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ssm.types.get_parameter_history_request.GetParameterHistoryRequest]",
    ) -> AsyncOperationResponse[
        "capo_ssm.types.get_parameter_history_result.GetParameterHistoryResult"
    ]:
        import capo_ssm._operations.amazon_ssm.get_parameter_history

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

    def _redact_output(
        output: "capo_ssm.types.get_parameter_history_result.GetParameterHistoryResult",
    ) -> dict[str, Any]:
        import capo_ssm.types.get_parameter_history_result

        return capo_ssm.types.get_parameter_history_result.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetParameterHistory", redact_output=_redact_output),
    )
    input_: capo_ssm.types.get_parameter_history_request.GetParameterHistoryRequest = {
        "name": name
    }
    if with_decryption is not None:
        input_["with_decryption"] = with_decryption
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token

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