{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EC2.Types.UnsuccessfulInstanceCreditSpecificationItemError
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.UnsuccessfulInstanceCreditSpecificationItemError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.UnsuccessfulInstanceCreditSpecificationErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Information about the error for the burstable performance instance whose
-- credit option for CPU usage was not modified.
--
-- /See:/ 'newUnsuccessfulInstanceCreditSpecificationItemError' smart constructor.
data UnsuccessfulInstanceCreditSpecificationItemError = UnsuccessfulInstanceCreditSpecificationItemError'
  { -- | The error code.
    UnsuccessfulInstanceCreditSpecificationItemError
-> Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code :: Prelude.Maybe UnsuccessfulInstanceCreditSpecificationErrorCode,
    -- | The applicable error message.
    UnsuccessfulInstanceCreditSpecificationItemError -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (UnsuccessfulInstanceCreditSpecificationItemError
-> UnsuccessfulInstanceCreditSpecificationItemError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UnsuccessfulInstanceCreditSpecificationItemError
-> UnsuccessfulInstanceCreditSpecificationItemError -> Bool
$c/= :: UnsuccessfulInstanceCreditSpecificationItemError
-> UnsuccessfulInstanceCreditSpecificationItemError -> Bool
== :: UnsuccessfulInstanceCreditSpecificationItemError
-> UnsuccessfulInstanceCreditSpecificationItemError -> Bool
$c== :: UnsuccessfulInstanceCreditSpecificationItemError
-> UnsuccessfulInstanceCreditSpecificationItemError -> Bool
Prelude.Eq, ReadPrec [UnsuccessfulInstanceCreditSpecificationItemError]
ReadPrec UnsuccessfulInstanceCreditSpecificationItemError
Int -> ReadS UnsuccessfulInstanceCreditSpecificationItemError
ReadS [UnsuccessfulInstanceCreditSpecificationItemError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UnsuccessfulInstanceCreditSpecificationItemError]
$creadListPrec :: ReadPrec [UnsuccessfulInstanceCreditSpecificationItemError]
readPrec :: ReadPrec UnsuccessfulInstanceCreditSpecificationItemError
$creadPrec :: ReadPrec UnsuccessfulInstanceCreditSpecificationItemError
readList :: ReadS [UnsuccessfulInstanceCreditSpecificationItemError]
$creadList :: ReadS [UnsuccessfulInstanceCreditSpecificationItemError]
readsPrec :: Int -> ReadS UnsuccessfulInstanceCreditSpecificationItemError
$creadsPrec :: Int -> ReadS UnsuccessfulInstanceCreditSpecificationItemError
Prelude.Read, Int -> UnsuccessfulInstanceCreditSpecificationItemError -> ShowS
[UnsuccessfulInstanceCreditSpecificationItemError] -> ShowS
UnsuccessfulInstanceCreditSpecificationItemError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UnsuccessfulInstanceCreditSpecificationItemError] -> ShowS
$cshowList :: [UnsuccessfulInstanceCreditSpecificationItemError] -> ShowS
show :: UnsuccessfulInstanceCreditSpecificationItemError -> String
$cshow :: UnsuccessfulInstanceCreditSpecificationItemError -> String
showsPrec :: Int -> UnsuccessfulInstanceCreditSpecificationItemError -> ShowS
$cshowsPrec :: Int -> UnsuccessfulInstanceCreditSpecificationItemError -> ShowS
Prelude.Show, forall x.
Rep UnsuccessfulInstanceCreditSpecificationItemError x
-> UnsuccessfulInstanceCreditSpecificationItemError
forall x.
UnsuccessfulInstanceCreditSpecificationItemError
-> Rep UnsuccessfulInstanceCreditSpecificationItemError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UnsuccessfulInstanceCreditSpecificationItemError x
-> UnsuccessfulInstanceCreditSpecificationItemError
$cfrom :: forall x.
UnsuccessfulInstanceCreditSpecificationItemError
-> Rep UnsuccessfulInstanceCreditSpecificationItemError x
Prelude.Generic)

-- |
-- Create a value of 'UnsuccessfulInstanceCreditSpecificationItemError' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'code', 'unsuccessfulInstanceCreditSpecificationItemError_code' - The error code.
--
-- 'message', 'unsuccessfulInstanceCreditSpecificationItemError_message' - The applicable error message.
newUnsuccessfulInstanceCreditSpecificationItemError ::
  UnsuccessfulInstanceCreditSpecificationItemError
newUnsuccessfulInstanceCreditSpecificationItemError :: UnsuccessfulInstanceCreditSpecificationItemError
newUnsuccessfulInstanceCreditSpecificationItemError =
  UnsuccessfulInstanceCreditSpecificationItemError'
    { $sel:code:UnsuccessfulInstanceCreditSpecificationItemError' :: Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code =
        forall a. Maybe a
Prelude.Nothing,
      $sel:message:UnsuccessfulInstanceCreditSpecificationItemError' :: Maybe Text
message = forall a. Maybe a
Prelude.Nothing
    }

-- | The error code.
unsuccessfulInstanceCreditSpecificationItemError_code :: Lens.Lens' UnsuccessfulInstanceCreditSpecificationItemError (Prelude.Maybe UnsuccessfulInstanceCreditSpecificationErrorCode)
unsuccessfulInstanceCreditSpecificationItemError_code :: Lens'
  UnsuccessfulInstanceCreditSpecificationItemError
  (Maybe UnsuccessfulInstanceCreditSpecificationErrorCode)
unsuccessfulInstanceCreditSpecificationItemError_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnsuccessfulInstanceCreditSpecificationItemError' {Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code :: Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
$sel:code:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError
-> Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code} -> Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code) (\s :: UnsuccessfulInstanceCreditSpecificationItemError
s@UnsuccessfulInstanceCreditSpecificationItemError' {} Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
a -> UnsuccessfulInstanceCreditSpecificationItemError
s {$sel:code:UnsuccessfulInstanceCreditSpecificationItemError' :: Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code = Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
a} :: UnsuccessfulInstanceCreditSpecificationItemError)

-- | The applicable error message.
unsuccessfulInstanceCreditSpecificationItemError_message :: Lens.Lens' UnsuccessfulInstanceCreditSpecificationItemError (Prelude.Maybe Prelude.Text)
unsuccessfulInstanceCreditSpecificationItemError_message :: Lens' UnsuccessfulInstanceCreditSpecificationItemError (Maybe Text)
unsuccessfulInstanceCreditSpecificationItemError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UnsuccessfulInstanceCreditSpecificationItemError' {Maybe Text
message :: Maybe Text
$sel:message:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError -> Maybe Text
message} -> Maybe Text
message) (\s :: UnsuccessfulInstanceCreditSpecificationItemError
s@UnsuccessfulInstanceCreditSpecificationItemError' {} Maybe Text
a -> UnsuccessfulInstanceCreditSpecificationItemError
s {$sel:message:UnsuccessfulInstanceCreditSpecificationItemError' :: Maybe Text
message = Maybe Text
a} :: UnsuccessfulInstanceCreditSpecificationItemError)

instance
  Data.FromXML
    UnsuccessfulInstanceCreditSpecificationItemError
  where
  parseXML :: [Node]
-> Either String UnsuccessfulInstanceCreditSpecificationItemError
parseXML [Node]
x =
    Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
-> Maybe Text -> UnsuccessfulInstanceCreditSpecificationItemError
UnsuccessfulInstanceCreditSpecificationItemError'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"code")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"message")

instance
  Prelude.Hashable
    UnsuccessfulInstanceCreditSpecificationItemError
  where
  hashWithSalt :: Int -> UnsuccessfulInstanceCreditSpecificationItemError -> Int
hashWithSalt
    Int
_salt
    UnsuccessfulInstanceCreditSpecificationItemError' {Maybe Text
Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
message :: Maybe Text
code :: Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
$sel:message:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError -> Maybe Text
$sel:code:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError
-> Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
message

instance
  Prelude.NFData
    UnsuccessfulInstanceCreditSpecificationItemError
  where
  rnf :: UnsuccessfulInstanceCreditSpecificationItemError -> ()
rnf
    UnsuccessfulInstanceCreditSpecificationItemError' {Maybe Text
Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
message :: Maybe Text
code :: Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
$sel:message:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError -> Maybe Text
$sel:code:UnsuccessfulInstanceCreditSpecificationItemError' :: UnsuccessfulInstanceCreditSpecificationItemError
-> Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
..} =
      forall a. NFData a => a -> ()
Prelude.rnf Maybe UnsuccessfulInstanceCreditSpecificationErrorCode
code seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
message