{-# 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.IoTSecureTunneling.Types.TunnelSummary
-- 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.IoTSecureTunneling.Types.TunnelSummary where

import qualified Amazonka.Core as Core
import Amazonka.IoTSecureTunneling.Types.TunnelStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the tunnel.
--
-- /See:/ 'newTunnelSummary' smart constructor.
data TunnelSummary = TunnelSummary'
  { -- | The status of a tunnel. Valid values are: Open and Closed.
    TunnelSummary -> Maybe TunnelStatus
status :: Prelude.Maybe TunnelStatus,
    -- | The time the tunnel was last updated.
    TunnelSummary -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Core.POSIX,
    -- | The time the tunnel was created.
    TunnelSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The Amazon Resource Name of the tunnel. The tunnel ARN format is
    -- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
    TunnelSummary -> Maybe Text
tunnelArn :: Prelude.Maybe Prelude.Text,
    -- | The unique alpha-numeric identifier for the tunnel.
    TunnelSummary -> Maybe Text
tunnelId :: Prelude.Maybe Prelude.Text,
    -- | A description of the tunnel.
    TunnelSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (TunnelSummary -> TunnelSummary -> Bool
(TunnelSummary -> TunnelSummary -> Bool)
-> (TunnelSummary -> TunnelSummary -> Bool) -> Eq TunnelSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TunnelSummary -> TunnelSummary -> Bool
$c/= :: TunnelSummary -> TunnelSummary -> Bool
== :: TunnelSummary -> TunnelSummary -> Bool
$c== :: TunnelSummary -> TunnelSummary -> Bool
Prelude.Eq, ReadPrec [TunnelSummary]
ReadPrec TunnelSummary
Int -> ReadS TunnelSummary
ReadS [TunnelSummary]
(Int -> ReadS TunnelSummary)
-> ReadS [TunnelSummary]
-> ReadPrec TunnelSummary
-> ReadPrec [TunnelSummary]
-> Read TunnelSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TunnelSummary]
$creadListPrec :: ReadPrec [TunnelSummary]
readPrec :: ReadPrec TunnelSummary
$creadPrec :: ReadPrec TunnelSummary
readList :: ReadS [TunnelSummary]
$creadList :: ReadS [TunnelSummary]
readsPrec :: Int -> ReadS TunnelSummary
$creadsPrec :: Int -> ReadS TunnelSummary
Prelude.Read, Int -> TunnelSummary -> ShowS
[TunnelSummary] -> ShowS
TunnelSummary -> String
(Int -> TunnelSummary -> ShowS)
-> (TunnelSummary -> String)
-> ([TunnelSummary] -> ShowS)
-> Show TunnelSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TunnelSummary] -> ShowS
$cshowList :: [TunnelSummary] -> ShowS
show :: TunnelSummary -> String
$cshow :: TunnelSummary -> String
showsPrec :: Int -> TunnelSummary -> ShowS
$cshowsPrec :: Int -> TunnelSummary -> ShowS
Prelude.Show, (forall x. TunnelSummary -> Rep TunnelSummary x)
-> (forall x. Rep TunnelSummary x -> TunnelSummary)
-> Generic TunnelSummary
forall x. Rep TunnelSummary x -> TunnelSummary
forall x. TunnelSummary -> Rep TunnelSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TunnelSummary x -> TunnelSummary
$cfrom :: forall x. TunnelSummary -> Rep TunnelSummary x
Prelude.Generic)

-- |
-- Create a value of 'TunnelSummary' 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:
--
-- 'status', 'tunnelSummary_status' - The status of a tunnel. Valid values are: Open and Closed.
--
-- 'lastUpdatedAt', 'tunnelSummary_lastUpdatedAt' - The time the tunnel was last updated.
--
-- 'createdAt', 'tunnelSummary_createdAt' - The time the tunnel was created.
--
-- 'tunnelArn', 'tunnelSummary_tunnelArn' - The Amazon Resource Name of the tunnel. The tunnel ARN format is
-- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
--
-- 'tunnelId', 'tunnelSummary_tunnelId' - The unique alpha-numeric identifier for the tunnel.
--
-- 'description', 'tunnelSummary_description' - A description of the tunnel.
newTunnelSummary ::
  TunnelSummary
newTunnelSummary :: TunnelSummary
newTunnelSummary =
  TunnelSummary' :: Maybe TunnelStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> TunnelSummary
TunnelSummary'
    { $sel:status:TunnelSummary' :: Maybe TunnelStatus
status = Maybe TunnelStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:TunnelSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:TunnelSummary' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelArn:TunnelSummary' :: Maybe Text
tunnelArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelId:TunnelSummary' :: Maybe Text
tunnelId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:TunnelSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of a tunnel. Valid values are: Open and Closed.
tunnelSummary_status :: Lens.Lens' TunnelSummary (Prelude.Maybe TunnelStatus)
tunnelSummary_status :: (Maybe TunnelStatus -> f (Maybe TunnelStatus))
-> TunnelSummary -> f TunnelSummary
tunnelSummary_status = (TunnelSummary -> Maybe TunnelStatus)
-> (TunnelSummary -> Maybe TunnelStatus -> TunnelSummary)
-> Lens
     TunnelSummary
     TunnelSummary
     (Maybe TunnelStatus)
     (Maybe TunnelStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe TunnelStatus
status :: Maybe TunnelStatus
$sel:status:TunnelSummary' :: TunnelSummary -> Maybe TunnelStatus
status} -> Maybe TunnelStatus
status) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe TunnelStatus
a -> TunnelSummary
s {$sel:status:TunnelSummary' :: Maybe TunnelStatus
status = Maybe TunnelStatus
a} :: TunnelSummary)

-- | The time the tunnel was last updated.
tunnelSummary_lastUpdatedAt :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.UTCTime)
tunnelSummary_lastUpdatedAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TunnelSummary -> f TunnelSummary
tunnelSummary_lastUpdatedAt = (TunnelSummary -> Maybe POSIX)
-> (TunnelSummary -> Maybe POSIX -> TunnelSummary)
-> Lens TunnelSummary TunnelSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe POSIX
lastUpdatedAt :: Maybe POSIX
$sel:lastUpdatedAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
lastUpdatedAt} -> Maybe POSIX
lastUpdatedAt) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe POSIX
a -> TunnelSummary
s {$sel:lastUpdatedAt:TunnelSummary' :: Maybe POSIX
lastUpdatedAt = Maybe POSIX
a} :: TunnelSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TunnelSummary -> f TunnelSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TunnelSummary
-> f TunnelSummary
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 time the tunnel was created.
tunnelSummary_createdAt :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.UTCTime)
tunnelSummary_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime))
-> TunnelSummary -> f TunnelSummary
tunnelSummary_createdAt = (TunnelSummary -> Maybe POSIX)
-> (TunnelSummary -> Maybe POSIX -> TunnelSummary)
-> Lens TunnelSummary TunnelSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe POSIX
a -> TunnelSummary
s {$sel:createdAt:TunnelSummary' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: TunnelSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> TunnelSummary -> f TunnelSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> TunnelSummary
-> f TunnelSummary
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 Amazon Resource Name of the tunnel. The tunnel ARN format is
-- @arn:aws:tunnel:\<region>:\<account-id>:tunnel\/\<tunnel-id>@
tunnelSummary_tunnelArn :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.Text)
tunnelSummary_tunnelArn :: (Maybe Text -> f (Maybe Text)) -> TunnelSummary -> f TunnelSummary
tunnelSummary_tunnelArn = (TunnelSummary -> Maybe Text)
-> (TunnelSummary -> Maybe Text -> TunnelSummary)
-> Lens TunnelSummary TunnelSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe Text
tunnelArn :: Maybe Text
$sel:tunnelArn:TunnelSummary' :: TunnelSummary -> Maybe Text
tunnelArn} -> Maybe Text
tunnelArn) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe Text
a -> TunnelSummary
s {$sel:tunnelArn:TunnelSummary' :: Maybe Text
tunnelArn = Maybe Text
a} :: TunnelSummary)

-- | The unique alpha-numeric identifier for the tunnel.
tunnelSummary_tunnelId :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.Text)
tunnelSummary_tunnelId :: (Maybe Text -> f (Maybe Text)) -> TunnelSummary -> f TunnelSummary
tunnelSummary_tunnelId = (TunnelSummary -> Maybe Text)
-> (TunnelSummary -> Maybe Text -> TunnelSummary)
-> Lens TunnelSummary TunnelSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe Text
tunnelId :: Maybe Text
$sel:tunnelId:TunnelSummary' :: TunnelSummary -> Maybe Text
tunnelId} -> Maybe Text
tunnelId) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe Text
a -> TunnelSummary
s {$sel:tunnelId:TunnelSummary' :: Maybe Text
tunnelId = Maybe Text
a} :: TunnelSummary)

-- | A description of the tunnel.
tunnelSummary_description :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.Text)
tunnelSummary_description :: (Maybe Text -> f (Maybe Text)) -> TunnelSummary -> f TunnelSummary
tunnelSummary_description = (TunnelSummary -> Maybe Text)
-> (TunnelSummary -> Maybe Text -> TunnelSummary)
-> Lens TunnelSummary TunnelSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TunnelSummary' {Maybe Text
description :: Maybe Text
$sel:description:TunnelSummary' :: TunnelSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: TunnelSummary
s@TunnelSummary' {} Maybe Text
a -> TunnelSummary
s {$sel:description:TunnelSummary' :: Maybe Text
description = Maybe Text
a} :: TunnelSummary)

instance Core.FromJSON TunnelSummary where
  parseJSON :: Value -> Parser TunnelSummary
parseJSON =
    String
-> (Object -> Parser TunnelSummary)
-> Value
-> Parser TunnelSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TunnelSummary"
      ( \Object
x ->
          Maybe TunnelStatus
-> Maybe POSIX
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> TunnelSummary
TunnelSummary'
            (Maybe TunnelStatus
 -> Maybe POSIX
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> TunnelSummary)
-> Parser (Maybe TunnelStatus)
-> Parser
     (Maybe POSIX
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> TunnelSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TunnelStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe POSIX
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> TunnelSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> TunnelSummary)
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
"lastUpdatedAt")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> TunnelSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> TunnelSummary)
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
"createdAt")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> TunnelSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> TunnelSummary)
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
"tunnelArn")
            Parser (Maybe Text -> Maybe Text -> TunnelSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> TunnelSummary)
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
"tunnelId")
            Parser (Maybe Text -> TunnelSummary)
-> Parser (Maybe Text) -> Parser TunnelSummary
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
"description")
      )

instance Prelude.Hashable TunnelSummary

instance Prelude.NFData TunnelSummary