{-# 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.StorageGateway.Types.GatewayInfo
-- 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.StorageGateway.Types.GatewayInfo where

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

-- | Describes a gateway object.
--
-- /See:/ 'newGatewayInfo' smart constructor.
data GatewayInfo = GatewayInfo'
  { -- | The Amazon Web Services Region where the Amazon EC2 instance is located.
    GatewayInfo -> Maybe Text
ec2InstanceRegion :: Prelude.Maybe Prelude.Text,
    -- | 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.
    GatewayInfo -> Maybe Text
gatewayARN :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon EC2 instance that was used to launch the gateway.
    GatewayInfo -> Maybe Text
ec2InstanceId :: Prelude.Maybe Prelude.Text,
    -- | The state of the gateway.
    --
    -- Valid Values: @DISABLED@ | @ACTIVE@
    GatewayInfo -> Maybe Text
gatewayOperationalState :: Prelude.Maybe Prelude.Text,
    -- | The name of the gateway.
    GatewayInfo -> Maybe Text
gatewayName :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier assigned to your gateway during activation. This
    -- ID becomes part of the gateway Amazon Resource Name (ARN), which you use
    -- as input for other operations.
    GatewayInfo -> Maybe Text
gatewayId :: Prelude.Maybe Prelude.Text,
    -- | The type of the gateway.
    GatewayInfo -> Maybe Text
gatewayType :: Prelude.Maybe Prelude.Text
  }
  deriving (GatewayInfo -> GatewayInfo -> Bool
(GatewayInfo -> GatewayInfo -> Bool)
-> (GatewayInfo -> GatewayInfo -> Bool) -> Eq GatewayInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GatewayInfo -> GatewayInfo -> Bool
$c/= :: GatewayInfo -> GatewayInfo -> Bool
== :: GatewayInfo -> GatewayInfo -> Bool
$c== :: GatewayInfo -> GatewayInfo -> Bool
Prelude.Eq, ReadPrec [GatewayInfo]
ReadPrec GatewayInfo
Int -> ReadS GatewayInfo
ReadS [GatewayInfo]
(Int -> ReadS GatewayInfo)
-> ReadS [GatewayInfo]
-> ReadPrec GatewayInfo
-> ReadPrec [GatewayInfo]
-> Read GatewayInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GatewayInfo]
$creadListPrec :: ReadPrec [GatewayInfo]
readPrec :: ReadPrec GatewayInfo
$creadPrec :: ReadPrec GatewayInfo
readList :: ReadS [GatewayInfo]
$creadList :: ReadS [GatewayInfo]
readsPrec :: Int -> ReadS GatewayInfo
$creadsPrec :: Int -> ReadS GatewayInfo
Prelude.Read, Int -> GatewayInfo -> ShowS
[GatewayInfo] -> ShowS
GatewayInfo -> String
(Int -> GatewayInfo -> ShowS)
-> (GatewayInfo -> String)
-> ([GatewayInfo] -> ShowS)
-> Show GatewayInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GatewayInfo] -> ShowS
$cshowList :: [GatewayInfo] -> ShowS
show :: GatewayInfo -> String
$cshow :: GatewayInfo -> String
showsPrec :: Int -> GatewayInfo -> ShowS
$cshowsPrec :: Int -> GatewayInfo -> ShowS
Prelude.Show, (forall x. GatewayInfo -> Rep GatewayInfo x)
-> (forall x. Rep GatewayInfo x -> GatewayInfo)
-> Generic GatewayInfo
forall x. Rep GatewayInfo x -> GatewayInfo
forall x. GatewayInfo -> Rep GatewayInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GatewayInfo x -> GatewayInfo
$cfrom :: forall x. GatewayInfo -> Rep GatewayInfo x
Prelude.Generic)

-- |
-- Create a value of 'GatewayInfo' 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:
--
-- 'ec2InstanceRegion', 'gatewayInfo_ec2InstanceRegion' - The Amazon Web Services Region where the Amazon EC2 instance is located.
--
-- 'gatewayARN', 'gatewayInfo_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.
--
-- 'ec2InstanceId', 'gatewayInfo_ec2InstanceId' - The ID of the Amazon EC2 instance that was used to launch the gateway.
--
-- 'gatewayOperationalState', 'gatewayInfo_gatewayOperationalState' - The state of the gateway.
--
-- Valid Values: @DISABLED@ | @ACTIVE@
--
-- 'gatewayName', 'gatewayInfo_gatewayName' - The name of the gateway.
--
-- 'gatewayId', 'gatewayInfo_gatewayId' - The unique identifier assigned to your gateway during activation. This
-- ID becomes part of the gateway Amazon Resource Name (ARN), which you use
-- as input for other operations.
--
-- 'gatewayType', 'gatewayInfo_gatewayType' - The type of the gateway.
newGatewayInfo ::
  GatewayInfo
newGatewayInfo :: GatewayInfo
newGatewayInfo =
  GatewayInfo' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GatewayInfo
GatewayInfo'
    { $sel:ec2InstanceRegion:GatewayInfo' :: Maybe Text
ec2InstanceRegion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayARN:GatewayInfo' :: Maybe Text
gatewayARN = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ec2InstanceId:GatewayInfo' :: Maybe Text
ec2InstanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayOperationalState:GatewayInfo' :: Maybe Text
gatewayOperationalState = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayName:GatewayInfo' :: Maybe Text
gatewayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayId:GatewayInfo' :: Maybe Text
gatewayId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:gatewayType:GatewayInfo' :: Maybe Text
gatewayType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Web Services Region where the Amazon EC2 instance is located.
gatewayInfo_ec2InstanceRegion :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_ec2InstanceRegion :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_ec2InstanceRegion = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
ec2InstanceRegion :: Maybe Text
$sel:ec2InstanceRegion:GatewayInfo' :: GatewayInfo -> Maybe Text
ec2InstanceRegion} -> Maybe Text
ec2InstanceRegion) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:ec2InstanceRegion:GatewayInfo' :: Maybe Text
ec2InstanceRegion = Maybe Text
a} :: GatewayInfo)

-- | 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.
gatewayInfo_gatewayARN :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_gatewayARN :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_gatewayARN = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
gatewayARN :: Maybe Text
$sel:gatewayARN:GatewayInfo' :: GatewayInfo -> Maybe Text
gatewayARN} -> Maybe Text
gatewayARN) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:gatewayARN:GatewayInfo' :: Maybe Text
gatewayARN = Maybe Text
a} :: GatewayInfo)

-- | The ID of the Amazon EC2 instance that was used to launch the gateway.
gatewayInfo_ec2InstanceId :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_ec2InstanceId :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_ec2InstanceId = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
ec2InstanceId :: Maybe Text
$sel:ec2InstanceId:GatewayInfo' :: GatewayInfo -> Maybe Text
ec2InstanceId} -> Maybe Text
ec2InstanceId) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:ec2InstanceId:GatewayInfo' :: Maybe Text
ec2InstanceId = Maybe Text
a} :: GatewayInfo)

-- | The state of the gateway.
--
-- Valid Values: @DISABLED@ | @ACTIVE@
gatewayInfo_gatewayOperationalState :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_gatewayOperationalState :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_gatewayOperationalState = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
gatewayOperationalState :: Maybe Text
$sel:gatewayOperationalState:GatewayInfo' :: GatewayInfo -> Maybe Text
gatewayOperationalState} -> Maybe Text
gatewayOperationalState) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:gatewayOperationalState:GatewayInfo' :: Maybe Text
gatewayOperationalState = Maybe Text
a} :: GatewayInfo)

-- | The name of the gateway.
gatewayInfo_gatewayName :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_gatewayName :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_gatewayName = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
gatewayName :: Maybe Text
$sel:gatewayName:GatewayInfo' :: GatewayInfo -> Maybe Text
gatewayName} -> Maybe Text
gatewayName) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:gatewayName:GatewayInfo' :: Maybe Text
gatewayName = Maybe Text
a} :: GatewayInfo)

-- | The unique identifier assigned to your gateway during activation. This
-- ID becomes part of the gateway Amazon Resource Name (ARN), which you use
-- as input for other operations.
gatewayInfo_gatewayId :: Lens.Lens' GatewayInfo (Prelude.Maybe Prelude.Text)
gatewayInfo_gatewayId :: (Maybe Text -> f (Maybe Text)) -> GatewayInfo -> f GatewayInfo
gatewayInfo_gatewayId = (GatewayInfo -> Maybe Text)
-> (GatewayInfo -> Maybe Text -> GatewayInfo)
-> Lens GatewayInfo GatewayInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GatewayInfo' {Maybe Text
gatewayId :: Maybe Text
$sel:gatewayId:GatewayInfo' :: GatewayInfo -> Maybe Text
gatewayId} -> Maybe Text
gatewayId) (\s :: GatewayInfo
s@GatewayInfo' {} Maybe Text
a -> GatewayInfo
s {$sel:gatewayId:GatewayInfo' :: Maybe Text
gatewayId = Maybe Text
a} :: GatewayInfo)

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

instance Core.FromJSON GatewayInfo where
  parseJSON :: Value -> Parser GatewayInfo
parseJSON =
    String
-> (Object -> Parser GatewayInfo) -> Value -> Parser GatewayInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"GatewayInfo"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> GatewayInfo
GatewayInfo'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> GatewayInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> GatewayInfo)
forall (f :: * -> *) a b. Functor 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
"Ec2InstanceRegion")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> GatewayInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> GatewayInfo)
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
"GatewayARN")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> GatewayInfo)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> GatewayInfo)
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
"Ec2InstanceId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> GatewayInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> GatewayInfo)
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
"GatewayOperationalState")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> GatewayInfo)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> GatewayInfo)
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
"GatewayName")
            Parser (Maybe Text -> Maybe Text -> GatewayInfo)
-> Parser (Maybe Text) -> Parser (Maybe Text -> GatewayInfo)
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
"GatewayId")
            Parser (Maybe Text -> GatewayInfo)
-> Parser (Maybe Text) -> Parser GatewayInfo
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
"GatewayType")
      )

instance Prelude.Hashable GatewayInfo

instance Prelude.NFData GatewayInfo