{-# 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.AppRunner.Types.IngressConfiguration
-- 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.AppRunner.Types.IngressConfiguration 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

-- | Network configuration settings for inbound network traffic.
--
-- /See:/ 'newIngressConfiguration' smart constructor.
data IngressConfiguration = IngressConfiguration'
  { -- | Specifies whether your App Runner service is publicly accessible. To
    -- make the service publicly accessible set it to @True@. To make the
    -- service privately accessible, from only within an Amazon VPC set it to
    -- @False@.
    IngressConfiguration -> Maybe Bool
isPubliclyAccessible :: Prelude.Maybe Prelude.Bool
  }
  deriving (IngressConfiguration -> IngressConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IngressConfiguration -> IngressConfiguration -> Bool
$c/= :: IngressConfiguration -> IngressConfiguration -> Bool
== :: IngressConfiguration -> IngressConfiguration -> Bool
$c== :: IngressConfiguration -> IngressConfiguration -> Bool
Prelude.Eq, ReadPrec [IngressConfiguration]
ReadPrec IngressConfiguration
Int -> ReadS IngressConfiguration
ReadS [IngressConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IngressConfiguration]
$creadListPrec :: ReadPrec [IngressConfiguration]
readPrec :: ReadPrec IngressConfiguration
$creadPrec :: ReadPrec IngressConfiguration
readList :: ReadS [IngressConfiguration]
$creadList :: ReadS [IngressConfiguration]
readsPrec :: Int -> ReadS IngressConfiguration
$creadsPrec :: Int -> ReadS IngressConfiguration
Prelude.Read, Int -> IngressConfiguration -> ShowS
[IngressConfiguration] -> ShowS
IngressConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IngressConfiguration] -> ShowS
$cshowList :: [IngressConfiguration] -> ShowS
show :: IngressConfiguration -> String
$cshow :: IngressConfiguration -> String
showsPrec :: Int -> IngressConfiguration -> ShowS
$cshowsPrec :: Int -> IngressConfiguration -> ShowS
Prelude.Show, forall x. Rep IngressConfiguration x -> IngressConfiguration
forall x. IngressConfiguration -> Rep IngressConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IngressConfiguration x -> IngressConfiguration
$cfrom :: forall x. IngressConfiguration -> Rep IngressConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'IngressConfiguration' 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:
--
-- 'isPubliclyAccessible', 'ingressConfiguration_isPubliclyAccessible' - Specifies whether your App Runner service is publicly accessible. To
-- make the service publicly accessible set it to @True@. To make the
-- service privately accessible, from only within an Amazon VPC set it to
-- @False@.
newIngressConfiguration ::
  IngressConfiguration
newIngressConfiguration :: IngressConfiguration
newIngressConfiguration =
  IngressConfiguration'
    { $sel:isPubliclyAccessible:IngressConfiguration' :: Maybe Bool
isPubliclyAccessible =
        forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies whether your App Runner service is publicly accessible. To
-- make the service publicly accessible set it to @True@. To make the
-- service privately accessible, from only within an Amazon VPC set it to
-- @False@.
ingressConfiguration_isPubliclyAccessible :: Lens.Lens' IngressConfiguration (Prelude.Maybe Prelude.Bool)
ingressConfiguration_isPubliclyAccessible :: Lens' IngressConfiguration (Maybe Bool)
ingressConfiguration_isPubliclyAccessible = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IngressConfiguration' {Maybe Bool
isPubliclyAccessible :: Maybe Bool
$sel:isPubliclyAccessible:IngressConfiguration' :: IngressConfiguration -> Maybe Bool
isPubliclyAccessible} -> Maybe Bool
isPubliclyAccessible) (\s :: IngressConfiguration
s@IngressConfiguration' {} Maybe Bool
a -> IngressConfiguration
s {$sel:isPubliclyAccessible:IngressConfiguration' :: Maybe Bool
isPubliclyAccessible = Maybe Bool
a} :: IngressConfiguration)

instance Data.FromJSON IngressConfiguration where
  parseJSON :: Value -> Parser IngressConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IngressConfiguration"
      ( \Object
x ->
          Maybe Bool -> IngressConfiguration
IngressConfiguration'
            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
"IsPubliclyAccessible")
      )

instance Prelude.Hashable IngressConfiguration where
  hashWithSalt :: Int -> IngressConfiguration -> Int
hashWithSalt Int
_salt IngressConfiguration' {Maybe Bool
isPubliclyAccessible :: Maybe Bool
$sel:isPubliclyAccessible:IngressConfiguration' :: IngressConfiguration -> Maybe Bool
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isPubliclyAccessible

instance Prelude.NFData IngressConfiguration where
  rnf :: IngressConfiguration -> ()
rnf IngressConfiguration' {Maybe Bool
isPubliclyAccessible :: Maybe Bool
$sel:isPubliclyAccessible:IngressConfiguration' :: IngressConfiguration -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isPubliclyAccessible

instance Data.ToJSON IngressConfiguration where
  toJSON :: IngressConfiguration -> Value
toJSON IngressConfiguration' {Maybe Bool
isPubliclyAccessible :: Maybe Bool
$sel:isPubliclyAccessible:IngressConfiguration' :: IngressConfiguration -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"IsPubliclyAccessible" 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 Bool
isPubliclyAccessible
          ]
      )