{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.OutgoingCertificate where

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

-- | A certificate that has been transferred but not yet accepted.
--
-- /See:/ 'newOutgoingCertificate' smart constructor.
data OutgoingCertificate = OutgoingCertificate'
  { -- | The date the transfer was initiated.
    OutgoingCertificate -> Maybe POSIX
transferDate :: Prelude.Maybe Core.POSIX,
    -- | The certificate ARN.
    OutgoingCertificate -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | The certificate ID.
    OutgoingCertificate -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account to which the transfer was made.
    OutgoingCertificate -> Maybe Text
transferredTo :: Prelude.Maybe Prelude.Text,
    -- | The certificate creation date.
    OutgoingCertificate -> Maybe POSIX
creationDate :: Prelude.Maybe Core.POSIX,
    -- | The transfer message.
    OutgoingCertificate -> Maybe Text
transferMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (OutgoingCertificate -> OutgoingCertificate -> Bool
(OutgoingCertificate -> OutgoingCertificate -> Bool)
-> (OutgoingCertificate -> OutgoingCertificate -> Bool)
-> Eq OutgoingCertificate
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]
(Int -> ReadS OutgoingCertificate)
-> ReadS [OutgoingCertificate]
-> ReadPrec OutgoingCertificate
-> ReadPrec [OutgoingCertificate]
-> Read 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
(Int -> OutgoingCertificate -> ShowS)
-> (OutgoingCertificate -> String)
-> ([OutgoingCertificate] -> ShowS)
-> Show OutgoingCertificate
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. OutgoingCertificate -> Rep OutgoingCertificate x)
-> (forall x. Rep OutgoingCertificate x -> OutgoingCertificate)
-> Generic OutgoingCertificate
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:
--
-- 'transferDate', 'outgoingCertificate_transferDate' - The date the transfer was initiated.
--
-- 'certificateArn', 'outgoingCertificate_certificateArn' - The certificate ARN.
--
-- 'certificateId', 'outgoingCertificate_certificateId' - The certificate ID.
--
-- 'transferredTo', 'outgoingCertificate_transferredTo' - The Amazon Web Services account to which the transfer was made.
--
-- 'creationDate', 'outgoingCertificate_creationDate' - The certificate creation date.
--
-- 'transferMessage', 'outgoingCertificate_transferMessage' - The transfer message.
newOutgoingCertificate ::
  OutgoingCertificate
newOutgoingCertificate :: OutgoingCertificate
newOutgoingCertificate =
  OutgoingCertificate' :: Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> OutgoingCertificate
OutgoingCertificate'
    { $sel:transferDate:OutgoingCertificate' :: Maybe POSIX
transferDate =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:certificateArn:OutgoingCertificate' :: Maybe Text
certificateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:certificateId:OutgoingCertificate' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:transferredTo:OutgoingCertificate' :: Maybe Text
transferredTo = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationDate:OutgoingCertificate' :: Maybe POSIX
creationDate = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:transferMessage:OutgoingCertificate' :: Maybe Text
transferMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The date the transfer was initiated.
outgoingCertificate_transferDate :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.UTCTime)
outgoingCertificate_transferDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_transferDate = (OutgoingCertificate -> Maybe POSIX)
-> (OutgoingCertificate -> Maybe POSIX -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> OutgoingCertificate -> f OutgoingCertificate)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OutgoingCertificate
-> f OutgoingCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The certificate ARN.
outgoingCertificate_certificateArn :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_certificateArn :: (Maybe Text -> f (Maybe Text))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_certificateArn = (OutgoingCertificate -> Maybe Text)
-> (OutgoingCertificate -> Maybe Text -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_certificateId = (OutgoingCertificate -> Maybe Text)
-> (OutgoingCertificate -> Maybe Text -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe Text) (Maybe Text)
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 Amazon Web Services account to which the transfer was made.
outgoingCertificate_transferredTo :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_transferredTo :: (Maybe Text -> f (Maybe Text))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_transferredTo = (OutgoingCertificate -> Maybe Text)
-> (OutgoingCertificate -> Maybe Text -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe Text) (Maybe Text)
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)

-- | The certificate creation date.
outgoingCertificate_creationDate :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.UTCTime)
outgoingCertificate_creationDate :: (Maybe UTCTime -> f (Maybe UTCTime))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_creationDate = (OutgoingCertificate -> Maybe POSIX)
-> (OutgoingCertificate -> Maybe POSIX -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe POSIX) (Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
 -> OutgoingCertificate -> f OutgoingCertificate)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> OutgoingCertificate
-> f OutgoingCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The transfer message.
outgoingCertificate_transferMessage :: Lens.Lens' OutgoingCertificate (Prelude.Maybe Prelude.Text)
outgoingCertificate_transferMessage :: (Maybe Text -> f (Maybe Text))
-> OutgoingCertificate -> f OutgoingCertificate
outgoingCertificate_transferMessage = (OutgoingCertificate -> Maybe Text)
-> (OutgoingCertificate -> Maybe Text -> OutgoingCertificate)
-> Lens
     OutgoingCertificate OutgoingCertificate (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable OutgoingCertificate

instance Prelude.NFData OutgoingCertificate