{-# 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.AppStream.Types.NetworkAccessConfiguration
-- 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.AppStream.Types.NetworkAccessConfiguration where

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

-- | Describes the network details of the fleet or image builder instance.
--
-- /See:/ 'newNetworkAccessConfiguration' smart constructor.
data NetworkAccessConfiguration = NetworkAccessConfiguration'
  { -- | The resource identifier of the elastic network interface that is
    -- attached to instances in your VPC. All network interfaces have the
    -- eni-xxxxxxxx resource identifier.
    NetworkAccessConfiguration -> Maybe Text
eniId :: Prelude.Maybe Prelude.Text,
    -- | The private IP address of the elastic network interface that is attached
    -- to instances in your VPC.
    NetworkAccessConfiguration -> Maybe Text
eniPrivateIpAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool
(NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool)
-> (NetworkAccessConfiguration
    -> NetworkAccessConfiguration -> Bool)
-> Eq NetworkAccessConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool
$c/= :: NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool
== :: NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool
$c== :: NetworkAccessConfiguration -> NetworkAccessConfiguration -> Bool
Prelude.Eq, ReadPrec [NetworkAccessConfiguration]
ReadPrec NetworkAccessConfiguration
Int -> ReadS NetworkAccessConfiguration
ReadS [NetworkAccessConfiguration]
(Int -> ReadS NetworkAccessConfiguration)
-> ReadS [NetworkAccessConfiguration]
-> ReadPrec NetworkAccessConfiguration
-> ReadPrec [NetworkAccessConfiguration]
-> Read NetworkAccessConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NetworkAccessConfiguration]
$creadListPrec :: ReadPrec [NetworkAccessConfiguration]
readPrec :: ReadPrec NetworkAccessConfiguration
$creadPrec :: ReadPrec NetworkAccessConfiguration
readList :: ReadS [NetworkAccessConfiguration]
$creadList :: ReadS [NetworkAccessConfiguration]
readsPrec :: Int -> ReadS NetworkAccessConfiguration
$creadsPrec :: Int -> ReadS NetworkAccessConfiguration
Prelude.Read, Int -> NetworkAccessConfiguration -> ShowS
[NetworkAccessConfiguration] -> ShowS
NetworkAccessConfiguration -> String
(Int -> NetworkAccessConfiguration -> ShowS)
-> (NetworkAccessConfiguration -> String)
-> ([NetworkAccessConfiguration] -> ShowS)
-> Show NetworkAccessConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NetworkAccessConfiguration] -> ShowS
$cshowList :: [NetworkAccessConfiguration] -> ShowS
show :: NetworkAccessConfiguration -> String
$cshow :: NetworkAccessConfiguration -> String
showsPrec :: Int -> NetworkAccessConfiguration -> ShowS
$cshowsPrec :: Int -> NetworkAccessConfiguration -> ShowS
Prelude.Show, (forall x.
 NetworkAccessConfiguration -> Rep NetworkAccessConfiguration x)
-> (forall x.
    Rep NetworkAccessConfiguration x -> NetworkAccessConfiguration)
-> Generic NetworkAccessConfiguration
forall x.
Rep NetworkAccessConfiguration x -> NetworkAccessConfiguration
forall x.
NetworkAccessConfiguration -> Rep NetworkAccessConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NetworkAccessConfiguration x -> NetworkAccessConfiguration
$cfrom :: forall x.
NetworkAccessConfiguration -> Rep NetworkAccessConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'NetworkAccessConfiguration' 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:
--
-- 'eniId', 'networkAccessConfiguration_eniId' - The resource identifier of the elastic network interface that is
-- attached to instances in your VPC. All network interfaces have the
-- eni-xxxxxxxx resource identifier.
--
-- 'eniPrivateIpAddress', 'networkAccessConfiguration_eniPrivateIpAddress' - The private IP address of the elastic network interface that is attached
-- to instances in your VPC.
newNetworkAccessConfiguration ::
  NetworkAccessConfiguration
newNetworkAccessConfiguration :: NetworkAccessConfiguration
newNetworkAccessConfiguration =
  NetworkAccessConfiguration' :: Maybe Text -> Maybe Text -> NetworkAccessConfiguration
NetworkAccessConfiguration'
    { $sel:eniId:NetworkAccessConfiguration' :: Maybe Text
eniId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:eniPrivateIpAddress:NetworkAccessConfiguration' :: Maybe Text
eniPrivateIpAddress = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The resource identifier of the elastic network interface that is
-- attached to instances in your VPC. All network interfaces have the
-- eni-xxxxxxxx resource identifier.
networkAccessConfiguration_eniId :: Lens.Lens' NetworkAccessConfiguration (Prelude.Maybe Prelude.Text)
networkAccessConfiguration_eniId :: (Maybe Text -> f (Maybe Text))
-> NetworkAccessConfiguration -> f NetworkAccessConfiguration
networkAccessConfiguration_eniId = (NetworkAccessConfiguration -> Maybe Text)
-> (NetworkAccessConfiguration
    -> Maybe Text -> NetworkAccessConfiguration)
-> Lens
     NetworkAccessConfiguration
     NetworkAccessConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkAccessConfiguration' {Maybe Text
eniId :: Maybe Text
$sel:eniId:NetworkAccessConfiguration' :: NetworkAccessConfiguration -> Maybe Text
eniId} -> Maybe Text
eniId) (\s :: NetworkAccessConfiguration
s@NetworkAccessConfiguration' {} Maybe Text
a -> NetworkAccessConfiguration
s {$sel:eniId:NetworkAccessConfiguration' :: Maybe Text
eniId = Maybe Text
a} :: NetworkAccessConfiguration)

-- | The private IP address of the elastic network interface that is attached
-- to instances in your VPC.
networkAccessConfiguration_eniPrivateIpAddress :: Lens.Lens' NetworkAccessConfiguration (Prelude.Maybe Prelude.Text)
networkAccessConfiguration_eniPrivateIpAddress :: (Maybe Text -> f (Maybe Text))
-> NetworkAccessConfiguration -> f NetworkAccessConfiguration
networkAccessConfiguration_eniPrivateIpAddress = (NetworkAccessConfiguration -> Maybe Text)
-> (NetworkAccessConfiguration
    -> Maybe Text -> NetworkAccessConfiguration)
-> Lens
     NetworkAccessConfiguration
     NetworkAccessConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NetworkAccessConfiguration' {Maybe Text
eniPrivateIpAddress :: Maybe Text
$sel:eniPrivateIpAddress:NetworkAccessConfiguration' :: NetworkAccessConfiguration -> Maybe Text
eniPrivateIpAddress} -> Maybe Text
eniPrivateIpAddress) (\s :: NetworkAccessConfiguration
s@NetworkAccessConfiguration' {} Maybe Text
a -> NetworkAccessConfiguration
s {$sel:eniPrivateIpAddress:NetworkAccessConfiguration' :: Maybe Text
eniPrivateIpAddress = Maybe Text
a} :: NetworkAccessConfiguration)

instance Core.FromJSON NetworkAccessConfiguration where
  parseJSON :: Value -> Parser NetworkAccessConfiguration
parseJSON =
    String
-> (Object -> Parser NetworkAccessConfiguration)
-> Value
-> Parser NetworkAccessConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NetworkAccessConfiguration"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> NetworkAccessConfiguration
NetworkAccessConfiguration'
            (Maybe Text -> Maybe Text -> NetworkAccessConfiguration)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> NetworkAccessConfiguration)
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
"EniId")
            Parser (Maybe Text -> NetworkAccessConfiguration)
-> Parser (Maybe Text) -> Parser NetworkAccessConfiguration
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
"EniPrivateIpAddress")
      )

instance Prelude.Hashable NetworkAccessConfiguration

instance Prelude.NFData NetworkAccessConfiguration