{-# 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-- 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.SecurityHub.Types.AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails where

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

-- | A hostname and IP address mapping to append to the __\/etc\/hosts__ file
-- on the container.
--
-- /See:/ 'newAwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' smart constructor.
data AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails = AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails'
  { -- | The hostname to use in the __\/etc\/hosts__ entry.
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
hostname :: Prelude.Maybe Prelude.Text,
    -- | The IP address to use in the __\/etc\/hosts__ entry.
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
ipAddress :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Bool
(AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> Bool)
-> (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
    -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
    -> Bool)
-> Eq AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Bool
$c/= :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Bool
== :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Bool
$c== :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Bool
Prelude.Eq, ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
ReadPrec AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
ReadS [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
(Int
 -> ReadS AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)
-> ReadS
     [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
-> ReadPrec
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> ReadPrec
     [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
-> Read AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
$creadListPrec :: ReadPrec
  [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
readPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
$creadPrec :: ReadPrec AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
readList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
$creadList :: ReadS [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
readsPrec :: Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
$creadsPrec :: Int
-> ReadS AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
Prelude.Read, Int
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> ShowS
[AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
-> ShowS
AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails -> String
(Int
 -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> ShowS)
-> (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
    -> String)
-> ([AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
    -> ShowS)
-> Show AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
-> ShowS
$cshowList :: [AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails]
-> ShowS
show :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails -> String
$cshow :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails -> String
showsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> ShowS
$cshowsPrec :: Int
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x)
-> (forall x.
    Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x
    -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)
-> Generic
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
forall x.
AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Rep AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' 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:
--
-- 'hostname', 'awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_hostname' - The hostname to use in the __\/etc\/hosts__ entry.
--
-- 'ipAddress', 'awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_ipAddress' - The IP address to use in the __\/etc\/hosts__ entry.
newAwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails ::
  AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
newAwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
newAwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails =
  AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: Maybe Text
-> Maybe Text
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails'
    { $sel:hostname:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: Maybe Text
hostname =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddress:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: Maybe Text
ipAddress =
        Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The hostname to use in the __\/etc\/hosts__ entry.
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_hostname :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_hostname :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_hostname = (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' {Maybe Text
hostname :: Maybe Text
$sel:hostname:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
hostname} -> Maybe Text
hostname) (\s :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
s {$sel:hostname:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: Maybe Text
hostname = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)

-- | The IP address to use in the __\/etc\/hosts__ entry.
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_ipAddress :: Lens.Lens' AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_ipAddress :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> f AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
awsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails_ipAddress = (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
 -> Maybe Text)
-> (AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
    -> Maybe Text
    -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)
-> Lens
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
     AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' {Maybe Text
ipAddress :: Maybe Text
$sel:ipAddress:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
ipAddress} -> Maybe Text
ipAddress) (\s :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
s@AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
s {$sel:ipAddress:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: Maybe Text
ipAddress = Maybe Text
a} :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails)

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

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
  where
  toJSON :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails -> Value
toJSON
    AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' {Maybe Text
ipAddress :: Maybe Text
hostname :: Maybe Text
$sel:ipAddress:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
$sel:hostname:AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails' :: AwsEcsTaskDefinitionContainerDefinitionsExtraHostsDetails
-> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Hostname" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
hostname,
              (Text
"IpAddress" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
ipAddress
            ]
        )