aws-sdk-ec2 1.222.0

AWS SDK for Amazon Elastic Compute Cloud
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Describes a key pair.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq)]
pub struct CreateKeyPairOutput {
    /// <p>The ID of the key pair.</p>
    pub key_pair_id: ::std::option::Option<::std::string::String>,
    /// <p>Any tags applied to the key pair.</p>
    pub tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    /// <p>The name of the key pair.</p>
    pub key_name: ::std::option::Option<::std::string::String>,
    /// <ul>
    /// <li>
    /// <p>For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.</p></li>
    /// <li>
    /// <p>For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.</p></li>
    /// </ul>
    pub key_fingerprint: ::std::option::Option<::std::string::String>,
    /// <p>An unencrypted PEM encoded RSA or ED25519 private key.</p>
    pub key_material: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl CreateKeyPairOutput {
    /// <p>The ID of the key pair.</p>
    pub fn key_pair_id(&self) -> ::std::option::Option<&str> {
        self.key_pair_id.as_deref()
    }
    /// <p>Any tags applied to the key pair.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.tags.is_none()`.
    pub fn tags(&self) -> &[crate::types::Tag] {
        self.tags.as_deref().unwrap_or_default()
    }
    /// <p>The name of the key pair.</p>
    pub fn key_name(&self) -> ::std::option::Option<&str> {
        self.key_name.as_deref()
    }
    /// <ul>
    /// <li>
    /// <p>For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.</p></li>
    /// <li>
    /// <p>For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.</p></li>
    /// </ul>
    pub fn key_fingerprint(&self) -> ::std::option::Option<&str> {
        self.key_fingerprint.as_deref()
    }
    /// <p>An unencrypted PEM encoded RSA or ED25519 private key.</p>
    pub fn key_material(&self) -> ::std::option::Option<&str> {
        self.key_material.as_deref()
    }
}
impl ::std::fmt::Debug for CreateKeyPairOutput {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CreateKeyPairOutput");
        formatter.field("key_pair_id", &self.key_pair_id);
        formatter.field("tags", &self.tags);
        formatter.field("key_name", &self.key_name);
        formatter.field("key_fingerprint", &self.key_fingerprint);
        formatter.field("key_material", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}
impl ::aws_types::request_id::RequestId for CreateKeyPairOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl CreateKeyPairOutput {
    /// Creates a new builder-style object to manufacture [`CreateKeyPairOutput`](crate::operation::create_key_pair::CreateKeyPairOutput).
    pub fn builder() -> crate::operation::create_key_pair::builders::CreateKeyPairOutputBuilder {
        crate::operation::create_key_pair::builders::CreateKeyPairOutputBuilder::default()
    }
}

/// A builder for [`CreateKeyPairOutput`](crate::operation::create_key_pair::CreateKeyPairOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default)]
#[non_exhaustive]
pub struct CreateKeyPairOutputBuilder {
    pub(crate) key_pair_id: ::std::option::Option<::std::string::String>,
    pub(crate) tags: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>,
    pub(crate) key_name: ::std::option::Option<::std::string::String>,
    pub(crate) key_fingerprint: ::std::option::Option<::std::string::String>,
    pub(crate) key_material: ::std::option::Option<::std::string::String>,
    _request_id: Option<String>,
}
impl CreateKeyPairOutputBuilder {
    /// <p>The ID of the key pair.</p>
    pub fn key_pair_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_pair_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The ID of the key pair.</p>
    pub fn set_key_pair_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_pair_id = input;
        self
    }
    /// <p>The ID of the key pair.</p>
    pub fn get_key_pair_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_pair_id
    }
    /// Appends an item to `tags`.
    ///
    /// To override the contents of this collection use [`set_tags`](Self::set_tags).
    ///
    /// <p>Any tags applied to the key pair.</p>
    pub fn tags(mut self, input: crate::types::Tag) -> Self {
        let mut v = self.tags.unwrap_or_default();
        v.push(input);
        self.tags = ::std::option::Option::Some(v);
        self
    }
    /// <p>Any tags applied to the key pair.</p>
    pub fn set_tags(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Tag>>) -> Self {
        self.tags = input;
        self
    }
    /// <p>Any tags applied to the key pair.</p>
    pub fn get_tags(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Tag>> {
        &self.tags
    }
    /// <p>The name of the key pair.</p>
    pub fn key_name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_name = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The name of the key pair.</p>
    pub fn set_key_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_name = input;
        self
    }
    /// <p>The name of the key pair.</p>
    pub fn get_key_name(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_name
    }
    /// <ul>
    /// <li>
    /// <p>For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.</p></li>
    /// <li>
    /// <p>For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.</p></li>
    /// </ul>
    pub fn key_fingerprint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_fingerprint = ::std::option::Option::Some(input.into());
        self
    }
    /// <ul>
    /// <li>
    /// <p>For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.</p></li>
    /// <li>
    /// <p>For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.</p></li>
    /// </ul>
    pub fn set_key_fingerprint(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_fingerprint = input;
        self
    }
    /// <ul>
    /// <li>
    /// <p>For RSA key pairs, the key fingerprint is the SHA-1 digest of the DER encoded private key.</p></li>
    /// <li>
    /// <p>For ED25519 key pairs, the key fingerprint is the base64-encoded SHA-256 digest, which is the default for OpenSSH, starting with OpenSSH 6.8.</p></li>
    /// </ul>
    pub fn get_key_fingerprint(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_fingerprint
    }
    /// <p>An unencrypted PEM encoded RSA or ED25519 private key.</p>
    pub fn key_material(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.key_material = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>An unencrypted PEM encoded RSA or ED25519 private key.</p>
    pub fn set_key_material(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.key_material = input;
        self
    }
    /// <p>An unencrypted PEM encoded RSA or ED25519 private key.</p>
    pub fn get_key_material(&self) -> &::std::option::Option<::std::string::String> {
        &self.key_material
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`CreateKeyPairOutput`](crate::operation::create_key_pair::CreateKeyPairOutput).
    pub fn build(self) -> crate::operation::create_key_pair::CreateKeyPairOutput {
        crate::operation::create_key_pair::CreateKeyPairOutput {
            key_pair_id: self.key_pair_id,
            tags: self.tags,
            key_name: self.key_name,
            key_fingerprint: self.key_fingerprint,
            key_material: self.key_material,
            _request_id: self._request_id,
        }
    }
}
impl ::std::fmt::Debug for CreateKeyPairOutputBuilder {
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
        let mut formatter = f.debug_struct("CreateKeyPairOutputBuilder");
        formatter.field("key_pair_id", &self.key_pair_id);
        formatter.field("tags", &self.tags);
        formatter.field("key_name", &self.key_name);
        formatter.field("key_fingerprint", &self.key_fingerprint);
        formatter.field("key_material", &"*** Sensitive Data Redacted ***");
        formatter.field("_request_id", &self._request_id);
        formatter.finish()
    }
}