{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTSecureTunneling.Types.TunnelSummary where

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

-- | Information about the tunnel.
--
-- /See:/ 'newTunnelSummary' smart constructor.
data TunnelSummary = TunnelSummary'
  { -- | The time the tunnel was created.
    TunnelSummary -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | A description of the tunnel.
    TunnelSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The time the tunnel was last updated.
    TunnelSummary -> Maybe POSIX
lastUpdatedAt :: Prelude.Maybe Data.POSIX,
    -- | The status of a tunnel. Valid values are: Open and Closed.
    TunnelSummary -> Maybe TunnelStatus
status :: Prelude.Maybe TunnelStatus,
    -- | The Amazon Resource Name of the tunnel.
    TunnelSummary -> Maybe Text
tunnelArn :: Prelude.Maybe Prelude.Text,
    -- | The unique alpha-numeric identifier for the tunnel.
    TunnelSummary -> Maybe Text
tunnelId :: Prelude.Maybe Prelude.Text
  }
  deriving (TunnelSummary -> TunnelSummary -> Bool
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]
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
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. 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:
--
-- 'createdAt', 'tunnelSummary_createdAt' - The time the tunnel was created.
--
-- 'description', 'tunnelSummary_description' - A description of the tunnel.
--
-- 'lastUpdatedAt', 'tunnelSummary_lastUpdatedAt' - The time the tunnel was last updated.
--
-- 'status', 'tunnelSummary_status' - The status of a tunnel. Valid values are: Open and Closed.
--
-- 'tunnelArn', 'tunnelSummary_tunnelArn' - The Amazon Resource Name of the tunnel.
--
-- 'tunnelId', 'tunnelSummary_tunnelId' - The unique alpha-numeric identifier for the tunnel.
newTunnelSummary ::
  TunnelSummary
newTunnelSummary :: TunnelSummary
newTunnelSummary =
  TunnelSummary'
    { $sel:createdAt:TunnelSummary' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:description:TunnelSummary' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedAt:TunnelSummary' :: Maybe POSIX
lastUpdatedAt = forall a. Maybe a
Prelude.Nothing,
      $sel:status:TunnelSummary' :: Maybe TunnelStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelArn:TunnelSummary' :: Maybe Text
tunnelArn = forall a. Maybe a
Prelude.Nothing,
      $sel:tunnelId:TunnelSummary' :: Maybe Text
tunnelId = forall a. Maybe a
Prelude.Nothing
    }

-- | The time the tunnel was created.
tunnelSummary_createdAt :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.UTCTime)
tunnelSummary_createdAt :: Lens' TunnelSummary (Maybe UTCTime)
tunnelSummary_createdAt = 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) 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

-- | A description of the tunnel.
tunnelSummary_description :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.Text)
tunnelSummary_description :: Lens' TunnelSummary (Maybe Text)
tunnelSummary_description = 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)

-- | The time the tunnel was last updated.
tunnelSummary_lastUpdatedAt :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.UTCTime)
tunnelSummary_lastUpdatedAt :: Lens' TunnelSummary (Maybe UTCTime)
tunnelSummary_lastUpdatedAt = 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) 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 status of a tunnel. Valid values are: Open and Closed.
tunnelSummary_status :: Lens.Lens' TunnelSummary (Prelude.Maybe TunnelStatus)
tunnelSummary_status :: Lens' TunnelSummary (Maybe TunnelStatus)
tunnelSummary_status = 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 Amazon Resource Name of the tunnel.
tunnelSummary_tunnelArn :: Lens.Lens' TunnelSummary (Prelude.Maybe Prelude.Text)
tunnelSummary_tunnelArn :: Lens' TunnelSummary (Maybe Text)
tunnelSummary_tunnelArn = 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 :: Lens' TunnelSummary (Maybe Text)
tunnelSummary_tunnelId = 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)

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

instance Prelude.Hashable TunnelSummary where
  hashWithSalt :: Int -> TunnelSummary -> Int
hashWithSalt Int
_salt TunnelSummary' {Maybe Text
Maybe POSIX
Maybe TunnelStatus
tunnelId :: Maybe Text
tunnelArn :: Maybe Text
status :: Maybe TunnelStatus
lastUpdatedAt :: Maybe POSIX
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tunnelId:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:tunnelArn:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:status:TunnelSummary' :: TunnelSummary -> Maybe TunnelStatus
$sel:lastUpdatedAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
$sel:description:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:createdAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TunnelStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tunnelArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
tunnelId

instance Prelude.NFData TunnelSummary where
  rnf :: TunnelSummary -> ()
rnf TunnelSummary' {Maybe Text
Maybe POSIX
Maybe TunnelStatus
tunnelId :: Maybe Text
tunnelArn :: Maybe Text
status :: Maybe TunnelStatus
lastUpdatedAt :: Maybe POSIX
description :: Maybe Text
createdAt :: Maybe POSIX
$sel:tunnelId:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:tunnelArn:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:status:TunnelSummary' :: TunnelSummary -> Maybe TunnelStatus
$sel:lastUpdatedAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
$sel:description:TunnelSummary' :: TunnelSummary -> Maybe Text
$sel:createdAt:TunnelSummary' :: TunnelSummary -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TunnelStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tunnelArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
tunnelId