Skip to content

update_public_key async

update_public_key(
    public_key_config: PublicKeyConfig,
    id: string,
    *,
    config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
    if_match: Optional[string] = None,
) -> UpdatePublicKeyResult

Update public key information. Note that the only value you can change is the comment.

Parameters:

  • public_key_config (PublicKeyConfig) –

    A public key configuration.

  • id (string) –

    The identifier of the public key that you are updating.

  • if_match (Optional[string], default: None ) –

    The value of the ETag header that you received when retrieving the public key to update. For example: E2QWRUHAPOMQZL.

Raises:

Source code in docs_src/capo_cloudfront/_services/async_cloud_front.py
async def update_public_key(
    self,
    public_key_config: "capo_cloudfront.types.public_key_config.PublicKeyConfig",
    id: "capo_cloudfront.types.string.string",
    *,
    config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
    if_match: Optional["capo_cloudfront.types.string.string"] = None,
) -> "capo_cloudfront.types.update_public_key_result.UpdatePublicKeyResult":
    """<p>Update public key information. Note that the only value you can change is the comment.</p>

    Args:
        public_key_config: <p>A public key configuration.</p>
        id: <p>The identifier of the public key that you are updating.</p>
        if_match: <p>The value of the <code>ETag</code> header that you received when retrieving the public key to update. For example: <code>E2QWRUHAPOMQZL</code>.</p>

    Raises:
        capo_cloudfront.errors.access_denied.AccessDenied: <p>Access denied.</p>
        capo_cloudfront.errors.cannot_change_immutable_public_key_fields.CannotChangeImmutablePublicKeyFields: <p>You can't change the value of a public key.</p>
        capo_cloudfront.errors.illegal_update.IllegalUpdate: <p>The update contains modifications that are not allowed.</p>
        capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
        capo_cloudfront.errors.invalid_if_match_version.InvalidIfMatchVersion: <p>The <code>If-Match</code> version is missing or not valid.</p>
        capo_cloudfront.errors.no_such_public_key.NoSuchPublicKey: <p>The specified public key doesn't exist.</p>
        capo_cloudfront.errors.precondition_failed.PreconditionFailed: <p>The precondition in one or more of the request fields evaluated to <code>false</code>.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudfront.types.update_public_key_request.UpdatePublicKeyRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudfront.types.update_public_key_result.UpdatePublicKeyResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.update_public_key

        (
            output,
            http_response,
        ) = await capo_cloudfront._operations.cloudfront2020_05_31.update_public_key.async_update_public_key(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdatePublicKey")
    )
    input_: capo_cloudfront.types.update_public_key_request.UpdatePublicKeyRequest = {
        "public_key_config": public_key_config,
        "id": id,
    }
    if if_match is not None:
        input_["if_match"] = if_match

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