Retrieves the specified SSH public key, including metadata about the key.
The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see Set up CodeCommit for SSH connections in the CodeCommit User Guide.
Parameters:
-
user_name
(userNameType)
–
The name of the IAM user associated with the SSH public key.
This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-
-
ssh_public_key_id
(publicKeyIdType)
–
The unique identifier for the SSH public key.
This parameter allows (through its regex pattern) a string of characters that can consist of any upper or lowercased letter or digit.
-
encoding
(encodingType)
–
Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use SSH. To retrieve the public key in PEM format, use PEM.
Raises:
Source code in docs_src/capo_iam/_services/async_iam.py
| async def get_ssh_public_key(
self,
user_name: "capo_iam.types.user_name_type.userNameType",
ssh_public_key_id: "capo_iam.types.public_key_id_type.publicKeyIdType",
encoding: "capo_iam.types.encoding_type.encodingType",
*,
config_overrides: Optional[AsyncIAMClientConfig] = None,
) -> "capo_iam.types.get_ssh_public_key_response.GetSSHPublicKeyResponse":
"""<p>Retrieves the specified SSH public key, including metadata about the key.</p> <p>The SSH public key retrieved by this operation is used only for authenticating the associated IAM user to an CodeCommit repository. For more information about using SSH keys to authenticate to an CodeCommit repository, see <a href="https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-credentials-ssh.html">Set up CodeCommit for SSH connections</a> in the <i>CodeCommit User Guide</i>.</p>
Args:
user_name: <p>The name of the IAM user associated with the SSH public key.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-</p>
ssh_public_key_id: <p>The unique identifier for the SSH public key.</p> <p>This parameter allows (through its <a href="http://wikipedia.org/wiki/regex">regex pattern</a>) a string of characters that can consist of any upper or lowercased letter or digit.</p>
encoding: <p>Specifies the public key encoding format to use in the response. To retrieve the public key in ssh-rsa format, use <code>SSH</code>. To retrieve the public key in PEM format, use <code>PEM</code>.</p>
Raises:
capo_iam.errors.no_such_entity_exception.NoSuchEntityException: <p>The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.</p>
capo_iam.errors.unrecognized_public_key_encoding_exception.UnrecognizedPublicKeyEncodingException: <p>The request was rejected because the public key encoding format is unsupported or unrecognized.</p>
capo_iam.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_iam.types.get_ssh_public_key_request.GetSSHPublicKeyRequest]",
) -> AsyncOperationResponse[
"capo_iam.types.get_ssh_public_key_response.GetSSHPublicKeyResponse"
]:
import capo_iam._operations.aws_identity_management_v20100508.get_ssh_public_key
(
output,
http_response,
) = await capo_iam._operations.aws_identity_management_v20100508.get_ssh_public_key.async_get_ssh_public_key(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("GetSSHPublicKey")
)
input_: capo_iam.types.get_ssh_public_key_request.GetSSHPublicKeyRequest = {
"user_name": user_name,
"ssh_public_key_id": ssh_public_key_id,
"encoding": encoding,
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|