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

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 static IP configuration.
--
-- /See:/ 'newStaticIpConnectionInfo' smart constructor.
data StaticIpConnectionInfo = StaticIpConnectionInfo'
  { -- | The connection\'s default gateway.
    StaticIpConnectionInfo -> Text
defaultGateway :: Prelude.Text,
    -- | The connection\'s DNS address.
    StaticIpConnectionInfo -> [Text]
dns :: [Prelude.Text],
    -- | The connection\'s IP address.
    StaticIpConnectionInfo -> Text
ipAddress :: Prelude.Text,
    -- | The connection\'s DNS mask.
    StaticIpConnectionInfo -> Text
mask :: Prelude.Text
  }
  deriving (StaticIpConnectionInfo -> StaticIpConnectionInfo -> Bool
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]
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
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. 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:
--
-- 'defaultGateway', 'staticIpConnectionInfo_defaultGateway' - The connection\'s default gateway.
--
-- 'dns', 'staticIpConnectionInfo_dns' - The connection\'s DNS address.
--
-- 'ipAddress', 'staticIpConnectionInfo_ipAddress' - The connection\'s IP address.
--
-- 'mask', 'staticIpConnectionInfo_mask' - The connection\'s DNS mask.
newStaticIpConnectionInfo ::
  -- | 'defaultGateway'
  Prelude.Text ->
  -- | 'ipAddress'
  Prelude.Text ->
  -- | 'mask'
  Prelude.Text ->
  StaticIpConnectionInfo
newStaticIpConnectionInfo :: Text -> Text -> Text -> StaticIpConnectionInfo
newStaticIpConnectionInfo
  Text
pDefaultGateway_
  Text
pIpAddress_
  Text
pMask_ =
    StaticIpConnectionInfo'
      { $sel:defaultGateway:StaticIpConnectionInfo' :: Text
defaultGateway =
          Text
pDefaultGateway_,
        $sel:dns:StaticIpConnectionInfo' :: [Text]
dns = forall a. Monoid a => a
Prelude.mempty,
        $sel:ipAddress:StaticIpConnectionInfo' :: Text
ipAddress = Text
pIpAddress_,
        $sel:mask:StaticIpConnectionInfo' :: Text
mask = Text
pMask_
      }

-- | The connection\'s default gateway.
staticIpConnectionInfo_defaultGateway :: Lens.Lens' StaticIpConnectionInfo Prelude.Text
staticIpConnectionInfo_defaultGateway :: Lens' StaticIpConnectionInfo Text
staticIpConnectionInfo_defaultGateway = 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)

-- | The connection\'s DNS address.
staticIpConnectionInfo_dns :: Lens.Lens' StaticIpConnectionInfo [Prelude.Text]
staticIpConnectionInfo_dns :: Lens' StaticIpConnectionInfo [Text]
staticIpConnectionInfo_dns = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The connection\'s IP address.
staticIpConnectionInfo_ipAddress :: Lens.Lens' StaticIpConnectionInfo Prelude.Text
staticIpConnectionInfo_ipAddress :: Lens' StaticIpConnectionInfo Text
staticIpConnectionInfo_ipAddress = 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 :: Lens' StaticIpConnectionInfo Text
staticIpConnectionInfo_mask = 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)

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

instance Prelude.Hashable StaticIpConnectionInfo where
  hashWithSalt :: Int -> StaticIpConnectionInfo -> Int
hashWithSalt Int
_salt StaticIpConnectionInfo' {[Text]
Text
mask :: Text
ipAddress :: Text
dns :: [Text]
defaultGateway :: Text
$sel:mask:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:ipAddress:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:dns:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> [Text]
$sel:defaultGateway:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
defaultGateway
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
dns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ipAddress
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
mask

instance Prelude.NFData StaticIpConnectionInfo where
  rnf :: StaticIpConnectionInfo -> ()
rnf StaticIpConnectionInfo' {[Text]
Text
mask :: Text
ipAddress :: Text
dns :: [Text]
defaultGateway :: Text
$sel:mask:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:ipAddress:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
$sel:dns:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> [Text]
$sel:defaultGateway:StaticIpConnectionInfo' :: StaticIpConnectionInfo -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
defaultGateway
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
dns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
ipAddress
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
mask

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