{-# 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.AwsEcsServiceNetworkConfigurationDetails
-- 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.AwsEcsServiceNetworkConfigurationDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails

-- | For tasks that use the @awsvpc@ networking mode, the VPC subnet and
-- security group configuration.
--
-- /See:/ 'newAwsEcsServiceNetworkConfigurationDetails' smart constructor.
data AwsEcsServiceNetworkConfigurationDetails = AwsEcsServiceNetworkConfigurationDetails'
  { -- | The VPC subnet and security group configuration.
    AwsEcsServiceNetworkConfigurationDetails
-> Maybe
     AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration :: Prelude.Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
  }
  deriving (AwsEcsServiceNetworkConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails -> Bool
(AwsEcsServiceNetworkConfigurationDetails
 -> AwsEcsServiceNetworkConfigurationDetails -> Bool)
-> (AwsEcsServiceNetworkConfigurationDetails
    -> AwsEcsServiceNetworkConfigurationDetails -> Bool)
-> Eq AwsEcsServiceNetworkConfigurationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsServiceNetworkConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails -> Bool
$c/= :: AwsEcsServiceNetworkConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails -> Bool
== :: AwsEcsServiceNetworkConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails -> Bool
$c== :: AwsEcsServiceNetworkConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcsServiceNetworkConfigurationDetails]
ReadPrec AwsEcsServiceNetworkConfigurationDetails
Int -> ReadS AwsEcsServiceNetworkConfigurationDetails
ReadS [AwsEcsServiceNetworkConfigurationDetails]
(Int -> ReadS AwsEcsServiceNetworkConfigurationDetails)
-> ReadS [AwsEcsServiceNetworkConfigurationDetails]
-> ReadPrec AwsEcsServiceNetworkConfigurationDetails
-> ReadPrec [AwsEcsServiceNetworkConfigurationDetails]
-> Read AwsEcsServiceNetworkConfigurationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcsServiceNetworkConfigurationDetails]
$creadListPrec :: ReadPrec [AwsEcsServiceNetworkConfigurationDetails]
readPrec :: ReadPrec AwsEcsServiceNetworkConfigurationDetails
$creadPrec :: ReadPrec AwsEcsServiceNetworkConfigurationDetails
readList :: ReadS [AwsEcsServiceNetworkConfigurationDetails]
$creadList :: ReadS [AwsEcsServiceNetworkConfigurationDetails]
readsPrec :: Int -> ReadS AwsEcsServiceNetworkConfigurationDetails
$creadsPrec :: Int -> ReadS AwsEcsServiceNetworkConfigurationDetails
Prelude.Read, Int -> AwsEcsServiceNetworkConfigurationDetails -> ShowS
[AwsEcsServiceNetworkConfigurationDetails] -> ShowS
AwsEcsServiceNetworkConfigurationDetails -> String
(Int -> AwsEcsServiceNetworkConfigurationDetails -> ShowS)
-> (AwsEcsServiceNetworkConfigurationDetails -> String)
-> ([AwsEcsServiceNetworkConfigurationDetails] -> ShowS)
-> Show AwsEcsServiceNetworkConfigurationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsServiceNetworkConfigurationDetails] -> ShowS
$cshowList :: [AwsEcsServiceNetworkConfigurationDetails] -> ShowS
show :: AwsEcsServiceNetworkConfigurationDetails -> String
$cshow :: AwsEcsServiceNetworkConfigurationDetails -> String
showsPrec :: Int -> AwsEcsServiceNetworkConfigurationDetails -> ShowS
$cshowsPrec :: Int -> AwsEcsServiceNetworkConfigurationDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcsServiceNetworkConfigurationDetails
 -> Rep AwsEcsServiceNetworkConfigurationDetails x)
-> (forall x.
    Rep AwsEcsServiceNetworkConfigurationDetails x
    -> AwsEcsServiceNetworkConfigurationDetails)
-> Generic AwsEcsServiceNetworkConfigurationDetails
forall x.
Rep AwsEcsServiceNetworkConfigurationDetails x
-> AwsEcsServiceNetworkConfigurationDetails
forall x.
AwsEcsServiceNetworkConfigurationDetails
-> Rep AwsEcsServiceNetworkConfigurationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsServiceNetworkConfigurationDetails x
-> AwsEcsServiceNetworkConfigurationDetails
$cfrom :: forall x.
AwsEcsServiceNetworkConfigurationDetails
-> Rep AwsEcsServiceNetworkConfigurationDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsServiceNetworkConfigurationDetails' 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:
--
-- 'awsVpcConfiguration', 'awsEcsServiceNetworkConfigurationDetails_awsVpcConfiguration' - The VPC subnet and security group configuration.
newAwsEcsServiceNetworkConfigurationDetails ::
  AwsEcsServiceNetworkConfigurationDetails
newAwsEcsServiceNetworkConfigurationDetails :: AwsEcsServiceNetworkConfigurationDetails
newAwsEcsServiceNetworkConfigurationDetails =
  AwsEcsServiceNetworkConfigurationDetails' :: Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails
AwsEcsServiceNetworkConfigurationDetails'
    { $sel:awsVpcConfiguration:AwsEcsServiceNetworkConfigurationDetails' :: Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration =
        Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | The VPC subnet and security group configuration.
awsEcsServiceNetworkConfigurationDetails_awsVpcConfiguration :: Lens.Lens' AwsEcsServiceNetworkConfigurationDetails (Prelude.Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
awsEcsServiceNetworkConfigurationDetails_awsVpcConfiguration :: (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
 -> f (Maybe
         AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails))
-> AwsEcsServiceNetworkConfigurationDetails
-> f AwsEcsServiceNetworkConfigurationDetails
awsEcsServiceNetworkConfigurationDetails_awsVpcConfiguration = (AwsEcsServiceNetworkConfigurationDetails
 -> Maybe
      AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
-> (AwsEcsServiceNetworkConfigurationDetails
    -> Maybe
         AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
    -> AwsEcsServiceNetworkConfigurationDetails)
-> Lens
     AwsEcsServiceNetworkConfigurationDetails
     AwsEcsServiceNetworkConfigurationDetails
     (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
     (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsServiceNetworkConfigurationDetails' {Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration :: Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
$sel:awsVpcConfiguration:AwsEcsServiceNetworkConfigurationDetails' :: AwsEcsServiceNetworkConfigurationDetails
-> Maybe
     AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration} -> Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration) (\s :: AwsEcsServiceNetworkConfigurationDetails
s@AwsEcsServiceNetworkConfigurationDetails' {} Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
a -> AwsEcsServiceNetworkConfigurationDetails
s {$sel:awsVpcConfiguration:AwsEcsServiceNetworkConfigurationDetails' :: Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
awsVpcConfiguration = Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
a} :: AwsEcsServiceNetworkConfigurationDetails)

instance
  Core.FromJSON
    AwsEcsServiceNetworkConfigurationDetails
  where
  parseJSON :: Value -> Parser AwsEcsServiceNetworkConfigurationDetails
parseJSON =
    String
-> (Object -> Parser AwsEcsServiceNetworkConfigurationDetails)
-> Value
-> Parser AwsEcsServiceNetworkConfigurationDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsServiceNetworkConfigurationDetails"
      ( \Object
x ->
          Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
-> AwsEcsServiceNetworkConfigurationDetails
AwsEcsServiceNetworkConfigurationDetails'
            (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails
 -> AwsEcsServiceNetworkConfigurationDetails)
-> Parser
     (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
-> Parser AwsEcsServiceNetworkConfigurationDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text
-> Parser
     (Maybe AwsEcsServiceNetworkConfigurationAwsVpcConfigurationDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"AwsVpcConfiguration")
      )

instance
  Prelude.Hashable
    AwsEcsServiceNetworkConfigurationDetails

instance
  Prelude.NFData
    AwsEcsServiceNetworkConfigurationDetails

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