Class SshKey


  • public class SshKey
    extends com.pulumi.resources.CustomResource
    Uploads an SSH public key and associates it with the specified IAM user. ## Example Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.iam.User;
     import com.pulumi.aws.iam.UserArgs;
     import com.pulumi.aws.iam.SshKey;
     import com.pulumi.aws.iam.SshKeyArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var user = new User("user", UserArgs.builder()
                 .name("test-user")
                 .path("/")
                 .build());
     
             var userSshKey = new SshKey("userSshKey", SshKeyArgs.builder()
                 .username(user.name())
                 .encoding("SSH")
                 .publicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 mytest@mydomain.com")
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import SSH public keys using the `username`, `sshPublicKeyId`, and `encoding`. For example: ```sh $ pulumi import aws:iam/sshKey:SshKey user user:APKAJNCNNJICVN7CFKCA:SSH ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      SshKey​(java.lang.String name)  
      SshKey​(java.lang.String name, SshKeyArgs args)  
      SshKey​(java.lang.String name, SshKeyArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> encoding()  
      com.pulumi.core.Output<java.lang.String> fingerprint()  
      static SshKey get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SshKeyState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> publicKey()  
      com.pulumi.core.Output<java.lang.String> sshPublicKeyId()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.lang.String> username()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SshKey

        public SshKey​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • SshKey

        public SshKey​(java.lang.String name,
                      SshKeyArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • SshKey

        public SshKey​(java.lang.String name,
                      SshKeyArgs args,
                      @Nullable
                      com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • encoding

        public com.pulumi.core.Output<java.lang.String> encoding()
        Returns:
        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`.
      • fingerprint

        public com.pulumi.core.Output<java.lang.String> fingerprint()
        Returns:
        The MD5 message digest of the SSH public key.
      • publicKey

        public com.pulumi.core.Output<java.lang.String> publicKey()
        Returns:
        The SSH public key. The public key must be encoded in ssh-rsa format or PEM format.
      • sshPublicKeyId

        public com.pulumi.core.Output<java.lang.String> sshPublicKeyId()
        Returns:
        The unique identifier for the SSH public key.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        The status to assign to the SSH public key. Active means the key can be used for authentication with an AWS CodeCommit repository. Inactive means the key cannot be used. Default is `active`.
      • username

        public com.pulumi.core.Output<java.lang.String> username()
        Returns:
        The name of the IAM user to associate the SSH public key with.
      • get

        public static SshKey get​(java.lang.String name,
                                 com.pulumi.core.Output<java.lang.String> id,
                                 @Nullable
                                 SshKeyState state,
                                 @Nullable
                                 com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.