1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
/// All possible error types for this service.
#[non_exhaustive]
#[derive(::std::fmt::Debug)]
pub enum Error {
    /// <p>Either your AWS credentials are not valid or you do not have access to the EC2 instance.</p>
    AuthException(crate::types::error::AuthException),
    /// <p>The specified instance was not found.</p>
    Ec2InstanceNotFoundException(crate::types::error::Ec2InstanceNotFoundException),
    /// <p>Unable to connect because the instance is not in a valid state. Connecting to a stopped or terminated instance is not supported. If the instance is stopped, start your instance, and try to connect again.</p>
    Ec2InstanceStateInvalidException(crate::types::error::Ec2InstanceStateInvalidException),
    /// <p>The instance type is not supported for connecting via the serial console. Only Nitro instance types are currently supported.</p>
    Ec2InstanceTypeInvalidException(crate::types::error::Ec2InstanceTypeInvalidException),
    /// <p>The instance is currently unavailable. Wait a few minutes and try again.</p>
    Ec2InstanceUnavailableException(crate::types::error::Ec2InstanceUnavailableException),
    /// <p>One of the parameters is not valid.</p>
    InvalidArgsException(crate::types::error::InvalidArgsException),
    /// <p>Your account is not authorized to use the EC2 Serial Console. To authorize your account, run the EnableSerialConsoleAccess API. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_EnableSerialConsoleAccess.html">EnableSerialConsoleAccess</a> in the <i>Amazon EC2 API Reference</i>.</p>
    SerialConsoleAccessDisabledException(crate::types::error::SerialConsoleAccessDisabledException),
    /// <p>The instance currently has 1 active serial console session. Only 1 session is supported at a time.</p>
    SerialConsoleSessionLimitExceededException(crate::types::error::SerialConsoleSessionLimitExceededException),
    /// <p>Unable to start a serial console session. Please try again.</p>
    SerialConsoleSessionUnavailableException(crate::types::error::SerialConsoleSessionUnavailableException),
    /// <p>Your instance's BIOS version is unsupported for serial console connection. Reboot your instance to update its BIOS, and then try again to connect.</p>
    SerialConsoleSessionUnsupportedException(crate::types::error::SerialConsoleSessionUnsupportedException),
    /// <p>The service encountered an error. Follow the instructions in the error message and try again.</p>
    ServiceException(crate::types::error::ServiceException),
    /// <p>The requests were made too frequently and have been throttled. Wait a while and try again. To increase the limit on your request frequency, contact AWS Support.</p>
    ThrottlingException(crate::types::error::ThrottlingException),
    /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code).
    #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \
    variable wildcard pattern and check `.code()`:
     \
    &nbsp;&nbsp;&nbsp;`err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }`
     \
    See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")]
    Unhandled(crate::error::sealed_unhandled::Unhandled),
}
impl ::std::fmt::Display for Error {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            Error::AuthException(inner) => inner.fmt(f),
            Error::Ec2InstanceNotFoundException(inner) => inner.fmt(f),
            Error::Ec2InstanceStateInvalidException(inner) => inner.fmt(f),
            Error::Ec2InstanceTypeInvalidException(inner) => inner.fmt(f),
            Error::Ec2InstanceUnavailableException(inner) => inner.fmt(f),
            Error::InvalidArgsException(inner) => inner.fmt(f),
            Error::SerialConsoleAccessDisabledException(inner) => inner.fmt(f),
            Error::SerialConsoleSessionLimitExceededException(inner) => inner.fmt(f),
            Error::SerialConsoleSessionUnavailableException(inner) => inner.fmt(f),
            Error::SerialConsoleSessionUnsupportedException(inner) => inner.fmt(f),
            Error::ServiceException(inner) => inner.fmt(f),
            Error::ThrottlingException(inner) => inner.fmt(f),
            Error::Unhandled(_) => {
                if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) {
                    write!(f, "unhandled error ({code})")
                } else {
                    f.write_str("unhandled error")
                }
            }
        }
    }
}
impl From<::aws_smithy_types::error::operation::BuildError> for Error {
    fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self {
        Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
            source: value.into(),
            meta: ::std::default::Default::default(),
        })
    }
}
impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error {
    fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata {
        match self {
            Self::AuthException(inner) => inner.meta(),
            Self::Ec2InstanceNotFoundException(inner) => inner.meta(),
            Self::Ec2InstanceStateInvalidException(inner) => inner.meta(),
            Self::Ec2InstanceTypeInvalidException(inner) => inner.meta(),
            Self::Ec2InstanceUnavailableException(inner) => inner.meta(),
            Self::InvalidArgsException(inner) => inner.meta(),
            Self::SerialConsoleAccessDisabledException(inner) => inner.meta(),
            Self::SerialConsoleSessionLimitExceededException(inner) => inner.meta(),
            Self::SerialConsoleSessionUnavailableException(inner) => inner.meta(),
            Self::SerialConsoleSessionUnsupportedException(inner) => inner.meta(),
            Self::ServiceException(inner) => inner.meta(),
            Self::ThrottlingException(inner) => inner.meta(),
            Self::Unhandled(inner) => &inner.meta,
        }
    }
}
impl<R>
    From<
        ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError,
            R,
        >,
    > for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(
        err: ::aws_smithy_runtime_api::client::result::SdkError<
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError,
            R,
        >,
    ) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError> for Error {
    fn from(err: crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError) -> Self {
        match err {
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::AuthException(inner) => {
                Error::AuthException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::Ec2InstanceNotFoundException(inner) => {
                Error::Ec2InstanceNotFoundException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::Ec2InstanceStateInvalidException(inner) => {
                Error::Ec2InstanceStateInvalidException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::Ec2InstanceTypeInvalidException(inner) => {
                Error::Ec2InstanceTypeInvalidException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::Ec2InstanceUnavailableException(inner) => {
                Error::Ec2InstanceUnavailableException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::InvalidArgsException(inner) => {
                Error::InvalidArgsException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::SerialConsoleAccessDisabledException(inner) => {
                Error::SerialConsoleAccessDisabledException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::SerialConsoleSessionLimitExceededException(
                inner,
            ) => Error::SerialConsoleSessionLimitExceededException(inner),
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::SerialConsoleSessionUnavailableException(
                inner,
            ) => Error::SerialConsoleSessionUnavailableException(inner),
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::SerialConsoleSessionUnsupportedException(
                inner,
            ) => Error::SerialConsoleSessionUnsupportedException(inner),
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::ServiceException(inner) => {
                Error::ServiceException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::ThrottlingException(inner) => {
                Error::ThrottlingException(inner)
            }
            crate::operation::send_serial_console_ssh_public_key::SendSerialConsoleSSHPublicKeyError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl<R> From<::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_ssh_public_key::SendSSHPublicKeyError, R>> for Error
where
    R: Send + Sync + std::fmt::Debug + 'static,
{
    fn from(err: ::aws_smithy_runtime_api::client::result::SdkError<crate::operation::send_ssh_public_key::SendSSHPublicKeyError, R>) -> Self {
        match err {
            ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()),
            _ => Error::Unhandled(crate::error::sealed_unhandled::Unhandled {
                meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(),
                source: err.into(),
            }),
        }
    }
}
impl From<crate::operation::send_ssh_public_key::SendSSHPublicKeyError> for Error {
    fn from(err: crate::operation::send_ssh_public_key::SendSSHPublicKeyError) -> Self {
        match err {
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::AuthException(inner) => Error::AuthException(inner),
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::Ec2InstanceNotFoundException(inner) => {
                Error::Ec2InstanceNotFoundException(inner)
            }
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::Ec2InstanceStateInvalidException(inner) => {
                Error::Ec2InstanceStateInvalidException(inner)
            }
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::Ec2InstanceUnavailableException(inner) => {
                Error::Ec2InstanceUnavailableException(inner)
            }
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::InvalidArgsException(inner) => Error::InvalidArgsException(inner),
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::ServiceException(inner) => Error::ServiceException(inner),
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::ThrottlingException(inner) => Error::ThrottlingException(inner),
            crate::operation::send_ssh_public_key::SendSSHPublicKeyError::Unhandled(inner) => Error::Unhandled(inner),
        }
    }
}
impl ::std::error::Error for Error {
    fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> {
        match self {
            Error::AuthException(inner) => inner.source(),
            Error::Ec2InstanceNotFoundException(inner) => inner.source(),
            Error::Ec2InstanceStateInvalidException(inner) => inner.source(),
            Error::Ec2InstanceTypeInvalidException(inner) => inner.source(),
            Error::Ec2InstanceUnavailableException(inner) => inner.source(),
            Error::InvalidArgsException(inner) => inner.source(),
            Error::SerialConsoleAccessDisabledException(inner) => inner.source(),
            Error::SerialConsoleSessionLimitExceededException(inner) => inner.source(),
            Error::SerialConsoleSessionUnavailableException(inner) => inner.source(),
            Error::SerialConsoleSessionUnsupportedException(inner) => inner.source(),
            Error::ServiceException(inner) => inner.source(),
            Error::ThrottlingException(inner) => inner.source(),
            Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source),
        }
    }
}
impl ::aws_types::request_id::RequestId for Error {
    fn request_id(&self) -> Option<&str> {
        match self {
            Self::AuthException(e) => e.request_id(),
            Self::Ec2InstanceNotFoundException(e) => e.request_id(),
            Self::Ec2InstanceStateInvalidException(e) => e.request_id(),
            Self::Ec2InstanceTypeInvalidException(e) => e.request_id(),
            Self::Ec2InstanceUnavailableException(e) => e.request_id(),
            Self::InvalidArgsException(e) => e.request_id(),
            Self::SerialConsoleAccessDisabledException(e) => e.request_id(),
            Self::SerialConsoleSessionLimitExceededException(e) => e.request_id(),
            Self::SerialConsoleSessionUnavailableException(e) => e.request_id(),
            Self::SerialConsoleSessionUnsupportedException(e) => e.request_id(),
            Self::ServiceException(e) => e.request_id(),
            Self::ThrottlingException(e) => e.request_id(),
            Self::Unhandled(e) => e.meta.request_id(),
        }
    }
}