{-# 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.BackupGateway.Types.Gateway
-- 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.BackupGateway.Types.Gateway where

import Amazonka.BackupGateway.Types.GatewayType
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 gateway is an Backup Gateway appliance that runs on the customer\'s
-- network to provide seamless connectivity to backup storage in the Amazon
-- Web Services Cloud.
--
-- /See:/ 'newGateway' smart constructor.
data Gateway = Gateway'
  { -- | The Amazon Resource Name (ARN) of the gateway. Use the @ListGateways@
    -- operation to return a list of gateways for your account and Amazon Web
    -- Services Region.
    Gateway -> Maybe Text
gatewayArn :: Prelude.Maybe Prelude.Text,
    -- | The display name of the gateway.
    Gateway -> Maybe Text
gatewayDisplayName :: Prelude.Maybe Prelude.Text,
    -- | The type of the gateway.
    Gateway -> Maybe GatewayType
gatewayType :: Prelude.Maybe GatewayType,
    -- | The hypervisor ID of the gateway.
    Gateway -> Maybe Text
hypervisorId :: Prelude.Maybe Prelude.Text,
    -- | The last time Backup gateway communicated with the gateway, in Unix
    -- format and UTC time.
    Gateway -> Maybe POSIX
lastSeenTime :: Prelude.Maybe Data.POSIX
  }
  deriving (Gateway -> Gateway -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Gateway -> Gateway -> Bool
$c/= :: Gateway -> Gateway -> Bool
== :: Gateway -> Gateway -> Bool
$c== :: Gateway -> Gateway -> Bool
Prelude.Eq, ReadPrec [Gateway]
ReadPrec Gateway
Int -> ReadS Gateway
ReadS [Gateway]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Gateway]
$creadListPrec :: ReadPrec [Gateway]
readPrec :: ReadPrec Gateway
$creadPrec :: ReadPrec Gateway
readList :: ReadS [Gateway]
$creadList :: ReadS [Gateway]
readsPrec :: Int -> ReadS Gateway
$creadsPrec :: Int -> ReadS Gateway
Prelude.Read, Int -> Gateway -> ShowS
[Gateway] -> ShowS
Gateway -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Gateway] -> ShowS
$cshowList :: [Gateway] -> ShowS
show :: Gateway -> String
$cshow :: Gateway -> String
showsPrec :: Int -> Gateway -> ShowS
$cshowsPrec :: Int -> Gateway -> ShowS
Prelude.Show, forall x. Rep Gateway x -> Gateway
forall x. Gateway -> Rep Gateway x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Gateway x -> Gateway
$cfrom :: forall x. Gateway -> Rep Gateway x
Prelude.Generic)

-- |
-- Create a value of 'Gateway' 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:
--
-- 'gatewayArn', 'gateway_gatewayArn' - The Amazon Resource Name (ARN) of the gateway. Use the @ListGateways@
-- operation to return a list of gateways for your account and Amazon Web
-- Services Region.
--
-- 'gatewayDisplayName', 'gateway_gatewayDisplayName' - The display name of the gateway.
--
-- 'gatewayType', 'gateway_gatewayType' - The type of the gateway.
--
-- 'hypervisorId', 'gateway_hypervisorId' - The hypervisor ID of the gateway.
--
-- 'lastSeenTime', 'gateway_lastSeenTime' - The last time Backup gateway communicated with the gateway, in Unix
-- format and UTC time.
newGateway ::
  Gateway
newGateway :: Gateway
newGateway =
  Gateway'
    { $sel:gatewayArn:Gateway' :: Maybe Text
gatewayArn = forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayDisplayName:Gateway' :: Maybe Text
gatewayDisplayName = forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayType:Gateway' :: Maybe GatewayType
gatewayType = forall a. Maybe a
Prelude.Nothing,
      $sel:hypervisorId:Gateway' :: Maybe Text
hypervisorId = forall a. Maybe a
Prelude.Nothing,
      $sel:lastSeenTime:Gateway' :: Maybe POSIX
lastSeenTime = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the gateway. Use the @ListGateways@
-- operation to return a list of gateways for your account and Amazon Web
-- Services Region.
gateway_gatewayArn :: Lens.Lens' Gateway (Prelude.Maybe Prelude.Text)
gateway_gatewayArn :: Lens' Gateway (Maybe Text)
gateway_gatewayArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Gateway' {Maybe Text
gatewayArn :: Maybe Text
$sel:gatewayArn:Gateway' :: Gateway -> Maybe Text
gatewayArn} -> Maybe Text
gatewayArn) (\s :: Gateway
s@Gateway' {} Maybe Text
a -> Gateway
s {$sel:gatewayArn:Gateway' :: Maybe Text
gatewayArn = Maybe Text
a} :: Gateway)

-- | The display name of the gateway.
gateway_gatewayDisplayName :: Lens.Lens' Gateway (Prelude.Maybe Prelude.Text)
gateway_gatewayDisplayName :: Lens' Gateway (Maybe Text)
gateway_gatewayDisplayName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Gateway' {Maybe Text
gatewayDisplayName :: Maybe Text
$sel:gatewayDisplayName:Gateway' :: Gateway -> Maybe Text
gatewayDisplayName} -> Maybe Text
gatewayDisplayName) (\s :: Gateway
s@Gateway' {} Maybe Text
a -> Gateway
s {$sel:gatewayDisplayName:Gateway' :: Maybe Text
gatewayDisplayName = Maybe Text
a} :: Gateway)

-- | The type of the gateway.
gateway_gatewayType :: Lens.Lens' Gateway (Prelude.Maybe GatewayType)
gateway_gatewayType :: Lens' Gateway (Maybe GatewayType)
gateway_gatewayType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Gateway' {Maybe GatewayType
gatewayType :: Maybe GatewayType
$sel:gatewayType:Gateway' :: Gateway -> Maybe GatewayType
gatewayType} -> Maybe GatewayType
gatewayType) (\s :: Gateway
s@Gateway' {} Maybe GatewayType
a -> Gateway
s {$sel:gatewayType:Gateway' :: Maybe GatewayType
gatewayType = Maybe GatewayType
a} :: Gateway)

-- | The hypervisor ID of the gateway.
gateway_hypervisorId :: Lens.Lens' Gateway (Prelude.Maybe Prelude.Text)
gateway_hypervisorId :: Lens' Gateway (Maybe Text)
gateway_hypervisorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Gateway' {Maybe Text
hypervisorId :: Maybe Text
$sel:hypervisorId:Gateway' :: Gateway -> Maybe Text
hypervisorId} -> Maybe Text
hypervisorId) (\s :: Gateway
s@Gateway' {} Maybe Text
a -> Gateway
s {$sel:hypervisorId:Gateway' :: Maybe Text
hypervisorId = Maybe Text
a} :: Gateway)

-- | The last time Backup gateway communicated with the gateway, in Unix
-- format and UTC time.
gateway_lastSeenTime :: Lens.Lens' Gateway (Prelude.Maybe Prelude.UTCTime)
gateway_lastSeenTime :: Lens' Gateway (Maybe UTCTime)
gateway_lastSeenTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Gateway' {Maybe POSIX
lastSeenTime :: Maybe POSIX
$sel:lastSeenTime:Gateway' :: Gateway -> Maybe POSIX
lastSeenTime} -> Maybe POSIX
lastSeenTime) (\s :: Gateway
s@Gateway' {} Maybe POSIX
a -> Gateway
s {$sel:lastSeenTime:Gateway' :: Maybe POSIX
lastSeenTime = Maybe POSIX
a} :: Gateway) 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

instance Data.FromJSON Gateway where
  parseJSON :: Value -> Parser Gateway
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Gateway"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe GatewayType
-> Maybe Text
-> Maybe POSIX
-> Gateway
Gateway'
            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
"GatewayArn")
            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
"GatewayDisplayName")
            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
"GatewayType")
            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
"HypervisorId")
            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
"LastSeenTime")
      )

instance Prelude.Hashable Gateway where
  hashWithSalt :: Int -> Gateway -> Int
hashWithSalt Int
_salt Gateway' {Maybe Text
Maybe POSIX
Maybe GatewayType
lastSeenTime :: Maybe POSIX
hypervisorId :: Maybe Text
gatewayType :: Maybe GatewayType
gatewayDisplayName :: Maybe Text
gatewayArn :: Maybe Text
$sel:lastSeenTime:Gateway' :: Gateway -> Maybe POSIX
$sel:hypervisorId:Gateway' :: Gateway -> Maybe Text
$sel:gatewayType:Gateway' :: Gateway -> Maybe GatewayType
$sel:gatewayDisplayName:Gateway' :: Gateway -> Maybe Text
$sel:gatewayArn:Gateway' :: Gateway -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gatewayArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
gatewayDisplayName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe GatewayType
gatewayType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hypervisorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastSeenTime

instance Prelude.NFData Gateway where
  rnf :: Gateway -> ()
rnf Gateway' {Maybe Text
Maybe POSIX
Maybe GatewayType
lastSeenTime :: Maybe POSIX
hypervisorId :: Maybe Text
gatewayType :: Maybe GatewayType
gatewayDisplayName :: Maybe Text
gatewayArn :: Maybe Text
$sel:lastSeenTime:Gateway' :: Gateway -> Maybe POSIX
$sel:hypervisorId:Gateway' :: Gateway -> Maybe Text
$sel:gatewayType:Gateway' :: Gateway -> Maybe GatewayType
$sel:gatewayDisplayName:Gateway' :: Gateway -> Maybe Text
$sel:gatewayArn:Gateway' :: Gateway -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gatewayArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
gatewayDisplayName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe GatewayType
gatewayType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hypervisorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastSeenTime