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

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

-- | Information about the VPC configuration used by the cluster control
-- plane.
--
-- /See:/ 'newAwsEksClusterResourcesVpcConfigDetails' smart constructor.
data AwsEksClusterResourcesVpcConfigDetails = AwsEksClusterResourcesVpcConfigDetails'
  { -- | The security groups that are associated with the cross-account elastic
    -- network interfaces that are used to allow communication between your
    -- nodes and the Amazon EKS control plane.
    AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | The subnets that are associated with the cluster.
    AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AwsEksClusterResourcesVpcConfigDetails
-> AwsEksClusterResourcesVpcConfigDetails -> Bool
(AwsEksClusterResourcesVpcConfigDetails
 -> AwsEksClusterResourcesVpcConfigDetails -> Bool)
-> (AwsEksClusterResourcesVpcConfigDetails
    -> AwsEksClusterResourcesVpcConfigDetails -> Bool)
-> Eq AwsEksClusterResourcesVpcConfigDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEksClusterResourcesVpcConfigDetails
-> AwsEksClusterResourcesVpcConfigDetails -> Bool
$c/= :: AwsEksClusterResourcesVpcConfigDetails
-> AwsEksClusterResourcesVpcConfigDetails -> Bool
== :: AwsEksClusterResourcesVpcConfigDetails
-> AwsEksClusterResourcesVpcConfigDetails -> Bool
$c== :: AwsEksClusterResourcesVpcConfigDetails
-> AwsEksClusterResourcesVpcConfigDetails -> Bool
Prelude.Eq, ReadPrec [AwsEksClusterResourcesVpcConfigDetails]
ReadPrec AwsEksClusterResourcesVpcConfigDetails
Int -> ReadS AwsEksClusterResourcesVpcConfigDetails
ReadS [AwsEksClusterResourcesVpcConfigDetails]
(Int -> ReadS AwsEksClusterResourcesVpcConfigDetails)
-> ReadS [AwsEksClusterResourcesVpcConfigDetails]
-> ReadPrec AwsEksClusterResourcesVpcConfigDetails
-> ReadPrec [AwsEksClusterResourcesVpcConfigDetails]
-> Read AwsEksClusterResourcesVpcConfigDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEksClusterResourcesVpcConfigDetails]
$creadListPrec :: ReadPrec [AwsEksClusterResourcesVpcConfigDetails]
readPrec :: ReadPrec AwsEksClusterResourcesVpcConfigDetails
$creadPrec :: ReadPrec AwsEksClusterResourcesVpcConfigDetails
readList :: ReadS [AwsEksClusterResourcesVpcConfigDetails]
$creadList :: ReadS [AwsEksClusterResourcesVpcConfigDetails]
readsPrec :: Int -> ReadS AwsEksClusterResourcesVpcConfigDetails
$creadsPrec :: Int -> ReadS AwsEksClusterResourcesVpcConfigDetails
Prelude.Read, Int -> AwsEksClusterResourcesVpcConfigDetails -> ShowS
[AwsEksClusterResourcesVpcConfigDetails] -> ShowS
AwsEksClusterResourcesVpcConfigDetails -> String
(Int -> AwsEksClusterResourcesVpcConfigDetails -> ShowS)
-> (AwsEksClusterResourcesVpcConfigDetails -> String)
-> ([AwsEksClusterResourcesVpcConfigDetails] -> ShowS)
-> Show AwsEksClusterResourcesVpcConfigDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEksClusterResourcesVpcConfigDetails] -> ShowS
$cshowList :: [AwsEksClusterResourcesVpcConfigDetails] -> ShowS
show :: AwsEksClusterResourcesVpcConfigDetails -> String
$cshow :: AwsEksClusterResourcesVpcConfigDetails -> String
showsPrec :: Int -> AwsEksClusterResourcesVpcConfigDetails -> ShowS
$cshowsPrec :: Int -> AwsEksClusterResourcesVpcConfigDetails -> ShowS
Prelude.Show, (forall x.
 AwsEksClusterResourcesVpcConfigDetails
 -> Rep AwsEksClusterResourcesVpcConfigDetails x)
-> (forall x.
    Rep AwsEksClusterResourcesVpcConfigDetails x
    -> AwsEksClusterResourcesVpcConfigDetails)
-> Generic AwsEksClusterResourcesVpcConfigDetails
forall x.
Rep AwsEksClusterResourcesVpcConfigDetails x
-> AwsEksClusterResourcesVpcConfigDetails
forall x.
AwsEksClusterResourcesVpcConfigDetails
-> Rep AwsEksClusterResourcesVpcConfigDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEksClusterResourcesVpcConfigDetails x
-> AwsEksClusterResourcesVpcConfigDetails
$cfrom :: forall x.
AwsEksClusterResourcesVpcConfigDetails
-> Rep AwsEksClusterResourcesVpcConfigDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEksClusterResourcesVpcConfigDetails' 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:
--
-- 'securityGroupIds', 'awsEksClusterResourcesVpcConfigDetails_securityGroupIds' - The security groups that are associated with the cross-account elastic
-- network interfaces that are used to allow communication between your
-- nodes and the Amazon EKS control plane.
--
-- 'subnetIds', 'awsEksClusterResourcesVpcConfigDetails_subnetIds' - The subnets that are associated with the cluster.
newAwsEksClusterResourcesVpcConfigDetails ::
  AwsEksClusterResourcesVpcConfigDetails
newAwsEksClusterResourcesVpcConfigDetails :: AwsEksClusterResourcesVpcConfigDetails
newAwsEksClusterResourcesVpcConfigDetails =
  AwsEksClusterResourcesVpcConfigDetails' :: Maybe [Text]
-> Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails
AwsEksClusterResourcesVpcConfigDetails'
    { $sel:securityGroupIds:AwsEksClusterResourcesVpcConfigDetails' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:AwsEksClusterResourcesVpcConfigDetails' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The security groups that are associated with the cross-account elastic
-- network interfaces that are used to allow communication between your
-- nodes and the Amazon EKS control plane.
awsEksClusterResourcesVpcConfigDetails_securityGroupIds :: Lens.Lens' AwsEksClusterResourcesVpcConfigDetails (Prelude.Maybe [Prelude.Text])
awsEksClusterResourcesVpcConfigDetails_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterResourcesVpcConfigDetails
-> f AwsEksClusterResourcesVpcConfigDetails
awsEksClusterResourcesVpcConfigDetails_securityGroupIds = (AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text])
-> (AwsEksClusterResourcesVpcConfigDetails
    -> Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails)
-> Lens
     AwsEksClusterResourcesVpcConfigDetails
     AwsEksClusterResourcesVpcConfigDetails
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEksClusterResourcesVpcConfigDetails' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:AwsEksClusterResourcesVpcConfigDetails' :: AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: AwsEksClusterResourcesVpcConfigDetails
s@AwsEksClusterResourcesVpcConfigDetails' {} Maybe [Text]
a -> AwsEksClusterResourcesVpcConfigDetails
s {$sel:securityGroupIds:AwsEksClusterResourcesVpcConfigDetails' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: AwsEksClusterResourcesVpcConfigDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsEksClusterResourcesVpcConfigDetails
 -> f AwsEksClusterResourcesVpcConfigDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterResourcesVpcConfigDetails
-> f AwsEksClusterResourcesVpcConfigDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The subnets that are associated with the cluster.
awsEksClusterResourcesVpcConfigDetails_subnetIds :: Lens.Lens' AwsEksClusterResourcesVpcConfigDetails (Prelude.Maybe [Prelude.Text])
awsEksClusterResourcesVpcConfigDetails_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterResourcesVpcConfigDetails
-> f AwsEksClusterResourcesVpcConfigDetails
awsEksClusterResourcesVpcConfigDetails_subnetIds = (AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text])
-> (AwsEksClusterResourcesVpcConfigDetails
    -> Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails)
-> Lens
     AwsEksClusterResourcesVpcConfigDetails
     AwsEksClusterResourcesVpcConfigDetails
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEksClusterResourcesVpcConfigDetails' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:AwsEksClusterResourcesVpcConfigDetails' :: AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: AwsEksClusterResourcesVpcConfigDetails
s@AwsEksClusterResourcesVpcConfigDetails' {} Maybe [Text]
a -> AwsEksClusterResourcesVpcConfigDetails
s {$sel:subnetIds:AwsEksClusterResourcesVpcConfigDetails' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: AwsEksClusterResourcesVpcConfigDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsEksClusterResourcesVpcConfigDetails
 -> f AwsEksClusterResourcesVpcConfigDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsEksClusterResourcesVpcConfigDetails
-> f AwsEksClusterResourcesVpcConfigDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Core.FromJSON
    AwsEksClusterResourcesVpcConfigDetails
  where
  parseJSON :: Value -> Parser AwsEksClusterResourcesVpcConfigDetails
parseJSON =
    String
-> (Object -> Parser AwsEksClusterResourcesVpcConfigDetails)
-> Value
-> Parser AwsEksClusterResourcesVpcConfigDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEksClusterResourcesVpcConfigDetails"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails
AwsEksClusterResourcesVpcConfigDetails'
            (Maybe [Text]
 -> Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails)
-> Parser (Maybe [Text])
-> Parser (Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecurityGroupIds"
                            Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
                        )
            Parser (Maybe [Text] -> AwsEksClusterResourcesVpcConfigDetails)
-> Parser (Maybe [Text])
-> Parser AwsEksClusterResourcesVpcConfigDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubnetIds" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance
  Prelude.Hashable
    AwsEksClusterResourcesVpcConfigDetails

instance
  Prelude.NFData
    AwsEksClusterResourcesVpcConfigDetails

instance
  Core.ToJSON
    AwsEksClusterResourcesVpcConfigDetails
  where
  toJSON :: AwsEksClusterResourcesVpcConfigDetails -> Value
toJSON AwsEksClusterResourcesVpcConfigDetails' {Maybe [Text]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:AwsEksClusterResourcesVpcConfigDetails' :: AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
$sel:securityGroupIds:AwsEksClusterResourcesVpcConfigDetails' :: AwsEksClusterResourcesVpcConfigDetails -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SecurityGroupIds" 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]
securityGroupIds,
            (Text
"SubnetIds" 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]
subnetIds
          ]
      )