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

-- | Specifies network configuration information for the gateway associated
-- with the Amazon FSx file system.
--
-- /See:/ 'newEndpointNetworkConfiguration' smart constructor.
data EndpointNetworkConfiguration = EndpointNetworkConfiguration'
  { -- | A list of gateway IP addresses on which the associated Amazon FSx file
    -- system is available.
    --
    -- If multiple file systems are associated with this gateway, this field is
    -- required.
    EndpointNetworkConfiguration -> Maybe [Text]
ipAddresses :: Prelude.Maybe [Prelude.Text]
  }
  deriving (EndpointNetworkConfiguration
-> EndpointNetworkConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointNetworkConfiguration
-> EndpointNetworkConfiguration -> Bool
$c/= :: EndpointNetworkConfiguration
-> EndpointNetworkConfiguration -> Bool
== :: EndpointNetworkConfiguration
-> EndpointNetworkConfiguration -> Bool
$c== :: EndpointNetworkConfiguration
-> EndpointNetworkConfiguration -> Bool
Prelude.Eq, ReadPrec [EndpointNetworkConfiguration]
ReadPrec EndpointNetworkConfiguration
Int -> ReadS EndpointNetworkConfiguration
ReadS [EndpointNetworkConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointNetworkConfiguration]
$creadListPrec :: ReadPrec [EndpointNetworkConfiguration]
readPrec :: ReadPrec EndpointNetworkConfiguration
$creadPrec :: ReadPrec EndpointNetworkConfiguration
readList :: ReadS [EndpointNetworkConfiguration]
$creadList :: ReadS [EndpointNetworkConfiguration]
readsPrec :: Int -> ReadS EndpointNetworkConfiguration
$creadsPrec :: Int -> ReadS EndpointNetworkConfiguration
Prelude.Read, Int -> EndpointNetworkConfiguration -> ShowS
[EndpointNetworkConfiguration] -> ShowS
EndpointNetworkConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointNetworkConfiguration] -> ShowS
$cshowList :: [EndpointNetworkConfiguration] -> ShowS
show :: EndpointNetworkConfiguration -> String
$cshow :: EndpointNetworkConfiguration -> String
showsPrec :: Int -> EndpointNetworkConfiguration -> ShowS
$cshowsPrec :: Int -> EndpointNetworkConfiguration -> ShowS
Prelude.Show, forall x.
Rep EndpointNetworkConfiguration x -> EndpointNetworkConfiguration
forall x.
EndpointNetworkConfiguration -> Rep EndpointNetworkConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EndpointNetworkConfiguration x -> EndpointNetworkConfiguration
$cfrom :: forall x.
EndpointNetworkConfiguration -> Rep EndpointNetworkConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'EndpointNetworkConfiguration' 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:
--
-- 'ipAddresses', 'endpointNetworkConfiguration_ipAddresses' - A list of gateway IP addresses on which the associated Amazon FSx file
-- system is available.
--
-- If multiple file systems are associated with this gateway, this field is
-- required.
newEndpointNetworkConfiguration ::
  EndpointNetworkConfiguration
newEndpointNetworkConfiguration :: EndpointNetworkConfiguration
newEndpointNetworkConfiguration =
  EndpointNetworkConfiguration'
    { $sel:ipAddresses:EndpointNetworkConfiguration' :: Maybe [Text]
ipAddresses =
        forall a. Maybe a
Prelude.Nothing
    }

-- | A list of gateway IP addresses on which the associated Amazon FSx file
-- system is available.
--
-- If multiple file systems are associated with this gateway, this field is
-- required.
endpointNetworkConfiguration_ipAddresses :: Lens.Lens' EndpointNetworkConfiguration (Prelude.Maybe [Prelude.Text])
endpointNetworkConfiguration_ipAddresses :: Lens' EndpointNetworkConfiguration (Maybe [Text])
endpointNetworkConfiguration_ipAddresses = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointNetworkConfiguration' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:EndpointNetworkConfiguration' :: EndpointNetworkConfiguration -> Maybe [Text]
ipAddresses} -> Maybe [Text]
ipAddresses) (\s :: EndpointNetworkConfiguration
s@EndpointNetworkConfiguration' {} Maybe [Text]
a -> EndpointNetworkConfiguration
s {$sel:ipAddresses:EndpointNetworkConfiguration' :: Maybe [Text]
ipAddresses = Maybe [Text]
a} :: EndpointNetworkConfiguration) 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 s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON EndpointNetworkConfiguration where
  parseJSON :: Value -> Parser EndpointNetworkConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndpointNetworkConfiguration"
      ( \Object
x ->
          Maybe [Text] -> EndpointNetworkConfiguration
EndpointNetworkConfiguration'
            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
"IpAddresses" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    EndpointNetworkConfiguration
  where
  hashWithSalt :: Int -> EndpointNetworkConfiguration -> Int
hashWithSalt Int
_salt EndpointNetworkConfiguration' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:EndpointNetworkConfiguration' :: EndpointNetworkConfiguration -> Maybe [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
ipAddresses

instance Prelude.NFData EndpointNetworkConfiguration where
  rnf :: EndpointNetworkConfiguration -> ()
rnf EndpointNetworkConfiguration' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:EndpointNetworkConfiguration' :: EndpointNetworkConfiguration -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
ipAddresses

instance Data.ToJSON EndpointNetworkConfiguration where
  toJSON :: EndpointNetworkConfiguration -> Value
toJSON EndpointNetworkConfiguration' {Maybe [Text]
ipAddresses :: Maybe [Text]
$sel:ipAddresses:EndpointNetworkConfiguration' :: EndpointNetworkConfiguration -> Maybe [Text]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"IpAddresses" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
ipAddresses]
      )