{-# 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.Inspector2.Types.FreeTrialInfoError
-- 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.Inspector2.Types.FreeTrialInfoError where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Inspector2.Types.FreeTrialInfoErrorCode
import qualified Amazonka.Prelude as Prelude

-- | Information about an error received while accessing free trail data for
-- an account.
--
-- /See:/ 'newFreeTrialInfoError' smart constructor.
data FreeTrialInfoError = FreeTrialInfoError'
  { -- | The account associated with the Amazon Inspector free trial information.
    FreeTrialInfoError -> Text
accountId :: Prelude.Text,
    -- | The error code.
    FreeTrialInfoError -> FreeTrialInfoErrorCode
code :: FreeTrialInfoErrorCode,
    -- | The error message returned.
    FreeTrialInfoError -> Text
message :: Prelude.Text
  }
  deriving (FreeTrialInfoError -> FreeTrialInfoError -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FreeTrialInfoError -> FreeTrialInfoError -> Bool
$c/= :: FreeTrialInfoError -> FreeTrialInfoError -> Bool
== :: FreeTrialInfoError -> FreeTrialInfoError -> Bool
$c== :: FreeTrialInfoError -> FreeTrialInfoError -> Bool
Prelude.Eq, ReadPrec [FreeTrialInfoError]
ReadPrec FreeTrialInfoError
Int -> ReadS FreeTrialInfoError
ReadS [FreeTrialInfoError]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FreeTrialInfoError]
$creadListPrec :: ReadPrec [FreeTrialInfoError]
readPrec :: ReadPrec FreeTrialInfoError
$creadPrec :: ReadPrec FreeTrialInfoError
readList :: ReadS [FreeTrialInfoError]
$creadList :: ReadS [FreeTrialInfoError]
readsPrec :: Int -> ReadS FreeTrialInfoError
$creadsPrec :: Int -> ReadS FreeTrialInfoError
Prelude.Read, Int -> FreeTrialInfoError -> ShowS
[FreeTrialInfoError] -> ShowS
FreeTrialInfoError -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FreeTrialInfoError] -> ShowS
$cshowList :: [FreeTrialInfoError] -> ShowS
show :: FreeTrialInfoError -> String
$cshow :: FreeTrialInfoError -> String
showsPrec :: Int -> FreeTrialInfoError -> ShowS
$cshowsPrec :: Int -> FreeTrialInfoError -> ShowS
Prelude.Show, forall x. Rep FreeTrialInfoError x -> FreeTrialInfoError
forall x. FreeTrialInfoError -> Rep FreeTrialInfoError x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FreeTrialInfoError x -> FreeTrialInfoError
$cfrom :: forall x. FreeTrialInfoError -> Rep FreeTrialInfoError x
Prelude.Generic)

-- |
-- Create a value of 'FreeTrialInfoError' 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:
--
-- 'accountId', 'freeTrialInfoError_accountId' - The account associated with the Amazon Inspector free trial information.
--
-- 'code', 'freeTrialInfoError_code' - The error code.
--
-- 'message', 'freeTrialInfoError_message' - The error message returned.
newFreeTrialInfoError ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'code'
  FreeTrialInfoErrorCode ->
  -- | 'message'
  Prelude.Text ->
  FreeTrialInfoError
newFreeTrialInfoError :: Text -> FreeTrialInfoErrorCode -> Text -> FreeTrialInfoError
newFreeTrialInfoError Text
pAccountId_ FreeTrialInfoErrorCode
pCode_ Text
pMessage_ =
  FreeTrialInfoError'
    { $sel:accountId:FreeTrialInfoError' :: Text
accountId = Text
pAccountId_,
      $sel:code:FreeTrialInfoError' :: FreeTrialInfoErrorCode
code = FreeTrialInfoErrorCode
pCode_,
      $sel:message:FreeTrialInfoError' :: Text
message = Text
pMessage_
    }

-- | The account associated with the Amazon Inspector free trial information.
freeTrialInfoError_accountId :: Lens.Lens' FreeTrialInfoError Prelude.Text
freeTrialInfoError_accountId :: Lens' FreeTrialInfoError Text
freeTrialInfoError_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeTrialInfoError' {Text
accountId :: Text
$sel:accountId:FreeTrialInfoError' :: FreeTrialInfoError -> Text
accountId} -> Text
accountId) (\s :: FreeTrialInfoError
s@FreeTrialInfoError' {} Text
a -> FreeTrialInfoError
s {$sel:accountId:FreeTrialInfoError' :: Text
accountId = Text
a} :: FreeTrialInfoError)

-- | The error code.
freeTrialInfoError_code :: Lens.Lens' FreeTrialInfoError FreeTrialInfoErrorCode
freeTrialInfoError_code :: Lens' FreeTrialInfoError FreeTrialInfoErrorCode
freeTrialInfoError_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeTrialInfoError' {FreeTrialInfoErrorCode
code :: FreeTrialInfoErrorCode
$sel:code:FreeTrialInfoError' :: FreeTrialInfoError -> FreeTrialInfoErrorCode
code} -> FreeTrialInfoErrorCode
code) (\s :: FreeTrialInfoError
s@FreeTrialInfoError' {} FreeTrialInfoErrorCode
a -> FreeTrialInfoError
s {$sel:code:FreeTrialInfoError' :: FreeTrialInfoErrorCode
code = FreeTrialInfoErrorCode
a} :: FreeTrialInfoError)

-- | The error message returned.
freeTrialInfoError_message :: Lens.Lens' FreeTrialInfoError Prelude.Text
freeTrialInfoError_message :: Lens' FreeTrialInfoError Text
freeTrialInfoError_message = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FreeTrialInfoError' {Text
message :: Text
$sel:message:FreeTrialInfoError' :: FreeTrialInfoError -> Text
message} -> Text
message) (\s :: FreeTrialInfoError
s@FreeTrialInfoError' {} Text
a -> FreeTrialInfoError
s {$sel:message:FreeTrialInfoError' :: Text
message = Text
a} :: FreeTrialInfoError)

instance Data.FromJSON FreeTrialInfoError where
  parseJSON :: Value -> Parser FreeTrialInfoError
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"FreeTrialInfoError"
      ( \Object
x ->
          Text -> FreeTrialInfoErrorCode -> Text -> FreeTrialInfoError
FreeTrialInfoError'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"accountId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"code")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"message")
      )

instance Prelude.Hashable FreeTrialInfoError where
  hashWithSalt :: Int -> FreeTrialInfoError -> Int
hashWithSalt Int
_salt FreeTrialInfoError' {Text
FreeTrialInfoErrorCode
message :: Text
code :: FreeTrialInfoErrorCode
accountId :: Text
$sel:message:FreeTrialInfoError' :: FreeTrialInfoError -> Text
$sel:code:FreeTrialInfoError' :: FreeTrialInfoError -> FreeTrialInfoErrorCode
$sel:accountId:FreeTrialInfoError' :: FreeTrialInfoError -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` FreeTrialInfoErrorCode
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
message

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