{-# 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.IoT.Types.OutgoingCertificate
-- 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.IoT.Types.OutgoingCertificate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A certificate that has been transferred but not yet accepted.
--
-- /See:/ 'newOutgoingCertificate' smart constructor.
data OutgoingCertificate = OutgoingCertificate'
  { -- | The certificate ARN.
    OutgoingCertificate -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | The certificate ID.
    OutgoingCertificate -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
    -- | The certificate creation date.
    OutgoingCertificate -> Maybe POSIX
creationDate :: Prelude.Maybe Data.POSIX,
    -- | The date the transfer was initiated.
    OutgoingCertificate -> Maybe POSIX
transferDate :: Prelude.Maybe Data.POSIX,
    -- | The transfer message.
    OutgoingCertificate -> Maybe Text
transferMessage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account to which the transfer was made.
    OutgoingCertificate -> Maybe Text
transferredTo :: Prelude.Maybe Prelude.Text
  }
  deriving (OutgoingCertificate -> OutgoingCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutgoingCertificate -> OutgoingCertificate -> Bool
$c/= :: OutgoingCertificate -> OutgoingCertificate -> Bool
== :: OutgoingCertificate -> OutgoingCertificate -> Bool
$c== :: OutgoingCertificate -> OutgoingCertificate -> Bool
Prelude.Eq, ReadPrec [OutgoingCertificate]
ReadPrec OutgoingCertificate
Int -> ReadS OutgoingCertificate
ReadS [OutgoingCertificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutgoingCertificate]
$creadListPrec :: ReadPrec [OutgoingCertificate]
readPrec :: ReadPrec OutgoingCertificate
$creadPrec :: ReadPrec OutgoingCertificate
readList :: ReadS [OutgoingCertificate]
$creadList :: ReadS [OutgoingCertificate]
readsPrec :: Int -> ReadS OutgoingCertificate
$creadsPrec :: Int -> ReadS OutgoingCertificate
Prelude.Read, Int -> OutgoingCertificate -> ShowS
[OutgoingCertificate] -> ShowS
OutgoingCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutgoingCertificate] -> ShowS
$cshowList :: [OutgoingCertificate] -> ShowS
show :: OutgoingCertificate -> String
$cshow :: OutgoingCertificate -> String
showsPrec :: Int -> OutgoingCertificate -> ShowS
$cshowsPrec :: Int -> OutgoingCertificate -> ShowS
Prelude.Show, forall x. Rep OutgoingCertificate x -> OutgoingCertificate
forall x. OutgoingCertificate -> Rep OutgoingCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutgoingCertificate x -> OutgoingCertificate
$cfrom :: forall x. OutgoingCertificate -> Rep OutgoingCertificate x
Prelude.Generic)

-- |
-- Create a value of 'OutgoingCertificate' 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:
--
-- 'certificateArn', 'outgoingCertificate_certificateArn' - The certificate ARN.
--
-- 'certificateId', 'outgoingCertificate_certificateId' - The certificate ID.
--
-- 'creationDate', 'outgoingCertificate_creationDate' - The certificate creation date.
--
-- 'transferDate', 'outgoingCertificate_transferDate' - The date the transfer was initiated.
--
-- 'transferMessage', 'outgoingCertificate_transferMessage' - The transfer message.
--
-- 'transferredTo', 'outgoingCertificate_transferredTo' - The Amazon Web Services account to which the transfer was made.
newOutgoingCertificate ::
  OutgoingCertificate
newOutgoingCertificate :: OutgoingCertificate
newOutgoingCertificate =
  OutgoingCertificate'
    { $sel:certificateArn:OutgoingCertificate' :: Maybe Text
certificateArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:certificateId:OutgoingCertificate' :: Maybe Text
certificateId = forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OutgoingCertificate' :: Maybe POSIX
creationDate = forall a. Maybe a
Prelude.Nothing,
      $sel:transferDate:OutgoingCertificate' :: Maybe POSIX
transferDate = forall a. Maybe a
Prelude.Nothing,
      $sel:transferMessage:OutgoingCertificate' :: Maybe Text
transferMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:transferredTo:OutgoingCertificate' :: Maybe Text
transferredTo = forall a. Maybe a
Prelude.Nothing
    }

-- | The certificate ARN.
outgoingCertificate_certificateArn :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_certificateArn :: Lens' OutgoingCertificate (Maybe Text)
outgoingCertificate_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe Text
a -> OutgoingCertificate
s {$sel:certificateArn:OutgoingCertificate' :: Maybe Text
certificateArn = Maybe Text
a} :: OutgoingCertificate)

-- | The certificate ID.
outgoingCertificate_certificateId :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_certificateId :: Lens' OutgoingCertificate (Maybe Text)
outgoingCertificate_certificateId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe Text
a -> OutgoingCertificate
s {$sel:certificateId:OutgoingCertificate' :: Maybe Text
certificateId = Maybe Text
a} :: OutgoingCertificate)

-- | The certificate creation date.
outgoingCertificate_creationDate :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.UTCTime)
outgoingCertificate_creationDate :: Lens' OutgoingCertificate (Maybe UTCTime)
outgoingCertificate_creationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe POSIX
creationDate :: Maybe POSIX
$sel:creationDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
creationDate} -> Maybe POSIX
creationDate) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe POSIX
a -> OutgoingCertificate
s {$sel:creationDate:OutgoingCertificate' :: Maybe POSIX
creationDate = Maybe POSIX
a} :: OutgoingCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The date the transfer was initiated.
outgoingCertificate_transferDate :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.UTCTime)
outgoingCertificate_transferDate :: Lens' OutgoingCertificate (Maybe UTCTime)
outgoingCertificate_transferDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe POSIX
transferDate :: Maybe POSIX
$sel:transferDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
transferDate} -> Maybe POSIX
transferDate) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe POSIX
a -> OutgoingCertificate
s {$sel:transferDate:OutgoingCertificate' :: Maybe POSIX
transferDate = Maybe POSIX
a} :: OutgoingCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The transfer message.
outgoingCertificate_transferMessage :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_transferMessage :: Lens' OutgoingCertificate (Maybe Text)
outgoingCertificate_transferMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe Text
transferMessage :: Maybe Text
$sel:transferMessage:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
transferMessage} -> Maybe Text
transferMessage) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe Text
a -> OutgoingCertificate
s {$sel:transferMessage:OutgoingCertificate' :: Maybe Text
transferMessage = Maybe Text
a} :: OutgoingCertificate)

-- | The Amazon Web Services account to which the transfer was made.
outgoingCertificate_transferredTo :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_transferredTo :: Lens' OutgoingCertificate (Maybe Text)
outgoingCertificate_transferredTo = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutgoingCertificate' {Maybe Text
transferredTo :: Maybe Text
$sel:transferredTo:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
transferredTo} -> Maybe Text
transferredTo) (\s :: OutgoingCertificate
s@OutgoingCertificate' {} Maybe Text
a -> OutgoingCertificate
s {$sel:transferredTo:OutgoingCertificate' :: Maybe Text
transferredTo = Maybe Text
a} :: OutgoingCertificate)

instance Data.FromJSON OutgoingCertificate where
  parseJSON :: Value -> Parser OutgoingCertificate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"OutgoingCertificate"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> OutgoingCertificate
OutgoingCertificate'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"certificateArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"certificateId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"creationDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"transferDate")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"transferMessage")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"transferredTo")
      )

instance Prelude.Hashable OutgoingCertificate where
  hashWithSalt :: Int -> OutgoingCertificate -> Int
hashWithSalt Int
_salt OutgoingCertificate' {Maybe Text
Maybe POSIX
transferredTo :: Maybe Text
transferMessage :: Maybe Text
transferDate :: Maybe POSIX
creationDate :: Maybe POSIX
certificateId :: Maybe Text
certificateArn :: Maybe Text
$sel:transferredTo:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:transferMessage:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:transferDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
$sel:creationDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
$sel:certificateId:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:certificateArn:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
creationDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
transferDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transferMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transferredTo

instance Prelude.NFData OutgoingCertificate where
  rnf :: OutgoingCertificate -> ()
rnf OutgoingCertificate' {Maybe Text
Maybe POSIX
transferredTo :: Maybe Text
transferMessage :: Maybe Text
transferDate :: Maybe POSIX
creationDate :: Maybe POSIX
certificateId :: Maybe Text
certificateArn :: Maybe Text
$sel:transferredTo:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:transferMessage:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:transferDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
$sel:creationDate:OutgoingCertificate' :: OutgoingCertificate -> Maybe POSIX
$sel:certificateId:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
$sel:certificateArn:OutgoingCertificate' :: OutgoingCertificate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
creationDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
transferDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transferMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transferredTo