{-# 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.Panorama.Types.StaticIpConnectionInfo
-- 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.Panorama.Types.StaticIpConnectionInfo where

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

-- | A static IP configuration.
--
-- /See:/ 'newStaticIpConnectionInfo' smart constructor.
data StaticIpConnectionInfo = StaticIpConnectionInfo'
  { -- | The connection\'s IP address.
    StaticIpConnectionInfo -> Text
ipAddress :: Prelude.Text,
    -- | The connection\'s DNS mask.
    StaticIpConnectionInfo -> Text
mask :: Prelude.Text,
    -- | The connection\'s DNS address.
    StaticIpConnectionInfo -> [Text]
dns :: [Prelude.Text],
    -- | The connection\'s default gateway.
    StaticIpConnectionInfo -> Text
defaultGateway :: Prelude.Text
  }
  deriving (StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
(StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool)
-> (StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool)
-> Eq StaticIpConnectionInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
$c/= :: StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
== :: StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
$c== :: StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
Prelude.Eq, ReadPrec [StaticIpConnectionInfo]
ReadPrec StaticIpConnectionInfo
Int -> ReadS StaticIpConnectionInfo
ReadS [StaticIpConnectionInfo]
(Int -> ReadS StaticIpConnectionInfo)
-> ReadS [StaticIpConnectionInfo]
-> ReadPrec StaticIpConnectionInfo
-> ReadPrec [StaticIpConnectionInfo]
-> Read StaticIpConnectionInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StaticIpConnectionInfo]
$creadListPrec :: ReadPrec [StaticIpConnectionInfo]
readPrec :: ReadPrec StaticIpConnectionInfo
$creadPrec :: ReadPrec StaticIpConnectionInfo
readList :: ReadS [StaticIpConnectionInfo]
$creadList :: ReadS [StaticIpConnectionInfo]
readsPrec :: Int -> ReadS StaticIpConnectionInfo
$creadsPrec :: Int -> ReadS StaticIpConnectionInfo
Prelude.Read, Int -> StaticIpConnectionInfo -> ShowS
[StaticIpConnectionInfo] -> ShowS
StaticIpConnectionInfo -> String
(Int -> StaticIpConnectionInfo -> ShowS)
-> (StaticIpConnectionInfo -> String)
-> ([StaticIpConnectionInfo] -> ShowS)
-> Show StaticIpConnectionInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StaticIpConnectionInfo] -> ShowS
$cshowList :: [StaticIpConnectionInfo] -> ShowS
show :: StaticIpConnectionInfo -> String
$cshow :: StaticIpConnectionInfo -> String
showsPrec :: Int -> StaticIpConnectionInfo -> ShowS
$cshowsPrec :: Int -> StaticIpConnectionInfo -> ShowS
Prelude.Show, (forall x. StaticIpConnectionInfo -> Rep StaticIpConnectionInfo x)
-> (forall x.
    Rep StaticIpConnectionInfo x -> StaticIpConnectionInfo)
-> Generic StaticIpConnectionInfo
forall x. Rep StaticIpConnectionInfo x -> StaticIpConnectionInfo
forall x. StaticIpConnectionInfo -> Rep StaticIpConnectionInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StaticIpConnectionInfo x -> StaticIpConnectionInfo
$cfrom :: forall x. StaticIpConnectionInfo -> Rep StaticIpConnectionInfo x
Prelude.Generic)

-- |
-- Create a value of 'StaticIpConnectionInfo' 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:
--
-- 'ipAddress', 'staticIpConnectionInfo_ipAddress' - The connection\'s IP address.
--
-- 'mask', 'staticIpConnectionInfo_mask' - The connection\'s DNS mask.
--
-- 'dns', 'staticIpConnectionInfo_dns' - The connection\'s DNS address.
--
-- 'defaultGateway', 'staticIpConnectionInfo_defaultGateway' - The connection\'s default gateway.
newStaticIpConnectionInfo ::
  -- | 'ipAddress'
  Prelude.Text ->
  -- | 'mask'
  Prelude.Text ->
  -- | 'defaultGateway'
  Prelude.Text ->
  StaticIpConnectionInfo
newStaticIpConnectionInfo :: Text -> Text -> Text -> StaticIpConnectionInfo
newStaticIpConnectionInfo
  Text
pIpAddress_
  Text
pMask_
  Text
pDefaultGateway_ =
    StaticIpConnectionInfo' :: Text -> Text -> [Text] -> Text -> StaticIpConnectionInfo
StaticIpConnectionInfo'
      { $sel:ipAddress:StaticIpConnectionInfo' :: Text
ipAddress = Text
pIpAddress_,
        $sel:mask:StaticIpConnectionInfo' :: Text
mask = Text
pMask_,
        $sel:dns:StaticIpConnectionInfo' :: [Text]
dns = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:defaultGateway:StaticIpConnectionInfo' :: Text
defaultGateway = Text
pDefaultGateway_
      }

-- | The connection\'s IP address.
staticIpConnectionInfo_ipAddress :: Lens.Lens' StaticIpConnectionInfo Prelude.Text
staticIpConnectionInfo_ipAddress :: (Text -> f Text)
-> StaticIpConnectionInfo -> f StaticIpConnectionInfo
staticIpConnectionInfo_ipAddress = (StaticIpConnectionInfo -> Text)
-> (StaticIpConnectionInfo -> Text -> StaticIpConnectionInfo)
-> Lens StaticIpConnectionInfo StaticIpConnectionInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIpConnectionInfo' {Text
ipAddress :: Text
$sel:ipAddress:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
ipAddress} -> Text
ipAddress) (\s :: StaticIpConnectionInfo
s@StaticIpConnectionInfo' {} Text
a -> StaticIpConnectionInfo
s {$sel:ipAddress:StaticIpConnectionInfo' :: Text
ipAddress = Text
a} :: StaticIpConnectionInfo)

-- | The connection\'s DNS mask.
staticIpConnectionInfo_mask :: Lens.Lens' StaticIpConnectionInfo Prelude.Text
staticIpConnectionInfo_mask :: (Text -> f Text)
-> StaticIpConnectionInfo -> f StaticIpConnectionInfo
staticIpConnectionInfo_mask = (StaticIpConnectionInfo -> Text)
-> (StaticIpConnectionInfo -> Text -> StaticIpConnectionInfo)
-> Lens StaticIpConnectionInfo StaticIpConnectionInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIpConnectionInfo' {Text
mask :: Text
$sel:mask:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
mask} -> Text
mask) (\s :: StaticIpConnectionInfo
s@StaticIpConnectionInfo' {} Text
a -> StaticIpConnectionInfo
s {$sel:mask:StaticIpConnectionInfo' :: Text
mask = Text
a} :: StaticIpConnectionInfo)

-- | The connection\'s DNS address.
staticIpConnectionInfo_dns :: Lens.Lens' StaticIpConnectionInfo [Prelude.Text]
staticIpConnectionInfo_dns :: ([Text] -> f [Text])
-> StaticIpConnectionInfo -> f StaticIpConnectionInfo
staticIpConnectionInfo_dns = (StaticIpConnectionInfo -> [Text])
-> (StaticIpConnectionInfo -> [Text] -> StaticIpConnectionInfo)
-> Lens StaticIpConnectionInfo StaticIpConnectionInfo [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIpConnectionInfo' {[Text]
dns :: [Text]
$sel:dns:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> [Text]
dns} -> [Text]
dns) (\s :: StaticIpConnectionInfo
s@StaticIpConnectionInfo' {} [Text]
a -> StaticIpConnectionInfo
s {$sel:dns:StaticIpConnectionInfo' :: [Text]
dns = [Text]
a} :: StaticIpConnectionInfo) (([Text] -> f [Text])
 -> StaticIpConnectionInfo -> f StaticIpConnectionInfo)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> StaticIpConnectionInfo
-> f StaticIpConnectionInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The connection\'s default gateway.
staticIpConnectionInfo_defaultGateway :: Lens.Lens' StaticIpConnectionInfo Prelude.Text
staticIpConnectionInfo_defaultGateway :: (Text -> f Text)
-> StaticIpConnectionInfo -> f StaticIpConnectionInfo
staticIpConnectionInfo_defaultGateway = (StaticIpConnectionInfo -> Text)
-> (StaticIpConnectionInfo -> Text -> StaticIpConnectionInfo)
-> Lens StaticIpConnectionInfo StaticIpConnectionInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StaticIpConnectionInfo' {Text
defaultGateway :: Text
$sel:defaultGateway:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
defaultGateway} -> Text
defaultGateway) (\s :: StaticIpConnectionInfo
s@StaticIpConnectionInfo' {} Text
a -> StaticIpConnectionInfo
s {$sel:defaultGateway:StaticIpConnectionInfo' :: Text
defaultGateway = Text
a} :: StaticIpConnectionInfo)

instance Core.FromJSON StaticIpConnectionInfo where
  parseJSON :: Value -> Parser StaticIpConnectionInfo
parseJSON =
    String
-> (Object -> Parser StaticIpConnectionInfo)
-> Value
-> Parser StaticIpConnectionInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StaticIpConnectionInfo"
      ( \Object
x ->
          Text -> Text -> [Text] -> Text -> StaticIpConnectionInfo
StaticIpConnectionInfo'
            (Text -> Text -> [Text] -> Text -> StaticIpConnectionInfo)
-> Parser Text
-> Parser (Text -> [Text] -> Text -> StaticIpConnectionInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"IpAddress")
            Parser (Text -> [Text] -> Text -> StaticIpConnectionInfo)
-> Parser Text -> Parser ([Text] -> Text -> StaticIpConnectionInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Mask")
            Parser ([Text] -> Text -> StaticIpConnectionInfo)
-> Parser [Text] -> Parser (Text -> StaticIpConnectionInfo)
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
"Dns" Parser (Maybe [Text]) -> [Text] -> Parser [Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> StaticIpConnectionInfo)
-> Parser Text -> Parser StaticIpConnectionInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DefaultGateway")
      )

instance Prelude.Hashable StaticIpConnectionInfo

instance Prelude.NFData StaticIpConnectionInfo

instance Core.ToJSON StaticIpConnectionInfo where
  toJSON :: StaticIpConnectionInfo -> Value
toJSON StaticIpConnectionInfo' {[Text]
Text
defaultGateway :: Text
dns :: [Text]
mask :: Text
ipAddress :: Text
$sel:defaultGateway:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:dns:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> [Text]
$sel:mask:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:ipAddress:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IpAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ipAddress),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Mask" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
mask),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Dns" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
dns),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DefaultGateway" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
defaultGateway)
          ]
      )