Creates a 2048-bit RSA key pair and issues an X.509 certificate using the issued public key. You can also call CreateKeysAndCertificate over MQTT from a device, for more information, see Provisioning MQTT API.
Note This is the only time IoT issues the private key for this certificate, so it is important to keep it in a secure location.
Requires permission to access the CreateKeysAndCertificate action.
Parameters:
-
set_as_active
(Optional[SetAsActive], default:
None
)
–
Specifies whether the certificate is active.
Raises:
Source code in docs_src/capo_iot/_services/async_io_t.py
| async def create_keys_and_certificate(
self,
*,
config_overrides: Optional[AsyncIoTClientConfig] = None,
set_as_active: Optional["capo_iot.types.set_as_active.SetAsActive"] = None,
) -> "capo_iot.types.create_keys_and_certificate_response.CreateKeysAndCertificateResponse":
"""<p>Creates a 2048-bit RSA key pair and issues an X.509 certificate using the issued public key. You can also call <code>CreateKeysAndCertificate</code> over MQTT from a device, for more information, see <a href="https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html#provision-mqtt-api">Provisioning MQTT API</a>.</p> <p> <b>Note</b> This is the only time IoT issues the private key for this certificate, so it is important to keep it in a secure location.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateKeysAndCertificate</a> action.</p>
Args:
set_as_active: <p>Specifies whether the certificate is active.</p>
Raises:
capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_iot.types.create_keys_and_certificate_request.CreateKeysAndCertificateRequest]",
) -> AsyncOperationResponse[
"capo_iot.types.create_keys_and_certificate_response.CreateKeysAndCertificateResponse"
]:
import capo_iot._operations.aws_iot_service.create_keys_and_certificate
(
output,
http_response,
) = await capo_iot._operations.aws_iot_service.create_keys_and_certificate.async_create_keys_and_certificate(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_iot.types.create_keys_and_certificate_response.CreateKeysAndCertificateResponse",
) -> dict[str, Any]:
import capo_iot.types.create_keys_and_certificate_response
return capo_iot.types.create_keys_and_certificate_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("CreateKeysAndCertificate", redact_output=_redact_output),
)
input_: capo_iot.types.create_keys_and_certificate_request.CreateKeysAndCertificateRequest = {}
if set_as_active is not None:
input_["set_as_active"] = set_as_active
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|