{-# 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.EKS.Types.NodegroupResources
-- 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.EKS.Types.NodegroupResources where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types.AutoScalingGroup
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing the resources associated with the node group,
-- such as Auto Scaling groups and security groups for remote access.
--
-- /See:/ 'newNodegroupResources' smart constructor.
data NodegroupResources = NodegroupResources'
  { -- | The remote access security group associated with the node group. This
    -- security group controls SSH access to the nodes.
    NodegroupResources -> Maybe Text
remoteAccessSecurityGroup :: Prelude.Maybe Prelude.Text,
    -- | The Auto Scaling groups associated with the node group.
    NodegroupResources -> Maybe [AutoScalingGroup]
autoScalingGroups :: Prelude.Maybe [AutoScalingGroup]
  }
  deriving (NodegroupResources -> NodegroupResources -> Bool
(NodegroupResources -> NodegroupResources -> Bool)
-> (NodegroupResources -> NodegroupResources -> Bool)
-> Eq NodegroupResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NodegroupResources -> NodegroupResources -> Bool
$c/= :: NodegroupResources -> NodegroupResources -> Bool
== :: NodegroupResources -> NodegroupResources -> Bool
$c== :: NodegroupResources -> NodegroupResources -> Bool
Prelude.Eq, ReadPrec [NodegroupResources]
ReadPrec NodegroupResources
Int -> ReadS NodegroupResources
ReadS [NodegroupResources]
(Int -> ReadS NodegroupResources)
-> ReadS [NodegroupResources]
-> ReadPrec NodegroupResources
-> ReadPrec [NodegroupResources]
-> Read NodegroupResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NodegroupResources]
$creadListPrec :: ReadPrec [NodegroupResources]
readPrec :: ReadPrec NodegroupResources
$creadPrec :: ReadPrec NodegroupResources
readList :: ReadS [NodegroupResources]
$creadList :: ReadS [NodegroupResources]
readsPrec :: Int -> ReadS NodegroupResources
$creadsPrec :: Int -> ReadS NodegroupResources
Prelude.Read, Int -> NodegroupResources -> ShowS
[NodegroupResources] -> ShowS
NodegroupResources -> String
(Int -> NodegroupResources -> ShowS)
-> (NodegroupResources -> String)
-> ([NodegroupResources] -> ShowS)
-> Show NodegroupResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NodegroupResources] -> ShowS
$cshowList :: [NodegroupResources] -> ShowS
show :: NodegroupResources -> String
$cshow :: NodegroupResources -> String
showsPrec :: Int -> NodegroupResources -> ShowS
$cshowsPrec :: Int -> NodegroupResources -> ShowS
Prelude.Show, (forall x. NodegroupResources -> Rep NodegroupResources x)
-> (forall x. Rep NodegroupResources x -> NodegroupResources)
-> Generic NodegroupResources
forall x. Rep NodegroupResources x -> NodegroupResources
forall x. NodegroupResources -> Rep NodegroupResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NodegroupResources x -> NodegroupResources
$cfrom :: forall x. NodegroupResources -> Rep NodegroupResources x
Prelude.Generic)

-- |
-- Create a value of 'NodegroupResources' 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:
--
-- 'remoteAccessSecurityGroup', 'nodegroupResources_remoteAccessSecurityGroup' - The remote access security group associated with the node group. This
-- security group controls SSH access to the nodes.
--
-- 'autoScalingGroups', 'nodegroupResources_autoScalingGroups' - The Auto Scaling groups associated with the node group.
newNodegroupResources ::
  NodegroupResources
newNodegroupResources :: NodegroupResources
newNodegroupResources =
  NodegroupResources' :: Maybe Text -> Maybe [AutoScalingGroup] -> NodegroupResources
NodegroupResources'
    { $sel:remoteAccessSecurityGroup:NodegroupResources' :: Maybe Text
remoteAccessSecurityGroup =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:autoScalingGroups:NodegroupResources' :: Maybe [AutoScalingGroup]
autoScalingGroups = Maybe [AutoScalingGroup]
forall a. Maybe a
Prelude.Nothing
    }

-- | The remote access security group associated with the node group. This
-- security group controls SSH access to the nodes.
nodegroupResources_remoteAccessSecurityGroup :: Lens.Lens' NodegroupResources (Prelude.Maybe Prelude.Text)
nodegroupResources_remoteAccessSecurityGroup :: (Maybe Text -> f (Maybe Text))
-> NodegroupResources -> f NodegroupResources
nodegroupResources_remoteAccessSecurityGroup = (NodegroupResources -> Maybe Text)
-> (NodegroupResources -> Maybe Text -> NodegroupResources)
-> Lens
     NodegroupResources NodegroupResources (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodegroupResources' {Maybe Text
remoteAccessSecurityGroup :: Maybe Text
$sel:remoteAccessSecurityGroup:NodegroupResources' :: NodegroupResources -> Maybe Text
remoteAccessSecurityGroup} -> Maybe Text
remoteAccessSecurityGroup) (\s :: NodegroupResources
s@NodegroupResources' {} Maybe Text
a -> NodegroupResources
s {$sel:remoteAccessSecurityGroup:NodegroupResources' :: Maybe Text
remoteAccessSecurityGroup = Maybe Text
a} :: NodegroupResources)

-- | The Auto Scaling groups associated with the node group.
nodegroupResources_autoScalingGroups :: Lens.Lens' NodegroupResources (Prelude.Maybe [AutoScalingGroup])
nodegroupResources_autoScalingGroups :: (Maybe [AutoScalingGroup] -> f (Maybe [AutoScalingGroup]))
-> NodegroupResources -> f NodegroupResources
nodegroupResources_autoScalingGroups = (NodegroupResources -> Maybe [AutoScalingGroup])
-> (NodegroupResources
    -> Maybe [AutoScalingGroup] -> NodegroupResources)
-> Lens
     NodegroupResources
     NodegroupResources
     (Maybe [AutoScalingGroup])
     (Maybe [AutoScalingGroup])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NodegroupResources' {Maybe [AutoScalingGroup]
autoScalingGroups :: Maybe [AutoScalingGroup]
$sel:autoScalingGroups:NodegroupResources' :: NodegroupResources -> Maybe [AutoScalingGroup]
autoScalingGroups} -> Maybe [AutoScalingGroup]
autoScalingGroups) (\s :: NodegroupResources
s@NodegroupResources' {} Maybe [AutoScalingGroup]
a -> NodegroupResources
s {$sel:autoScalingGroups:NodegroupResources' :: Maybe [AutoScalingGroup]
autoScalingGroups = Maybe [AutoScalingGroup]
a} :: NodegroupResources) ((Maybe [AutoScalingGroup] -> f (Maybe [AutoScalingGroup]))
 -> NodegroupResources -> f NodegroupResources)
-> ((Maybe [AutoScalingGroup] -> f (Maybe [AutoScalingGroup]))
    -> Maybe [AutoScalingGroup] -> f (Maybe [AutoScalingGroup]))
-> (Maybe [AutoScalingGroup] -> f (Maybe [AutoScalingGroup]))
-> NodegroupResources
-> f NodegroupResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AutoScalingGroup]
  [AutoScalingGroup]
  [AutoScalingGroup]
  [AutoScalingGroup]
-> Iso
     (Maybe [AutoScalingGroup])
     (Maybe [AutoScalingGroup])
     (Maybe [AutoScalingGroup])
     (Maybe [AutoScalingGroup])
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
  [AutoScalingGroup]
  [AutoScalingGroup]
  [AutoScalingGroup]
  [AutoScalingGroup]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON NodegroupResources where
  parseJSON :: Value -> Parser NodegroupResources
parseJSON =
    String
-> (Object -> Parser NodegroupResources)
-> Value
-> Parser NodegroupResources
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NodegroupResources"
      ( \Object
x ->
          Maybe Text -> Maybe [AutoScalingGroup] -> NodegroupResources
NodegroupResources'
            (Maybe Text -> Maybe [AutoScalingGroup] -> NodegroupResources)
-> Parser (Maybe Text)
-> Parser (Maybe [AutoScalingGroup] -> NodegroupResources)
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
"remoteAccessSecurityGroup")
            Parser (Maybe [AutoScalingGroup] -> NodegroupResources)
-> Parser (Maybe [AutoScalingGroup]) -> Parser NodegroupResources
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Parser (Maybe (Maybe [AutoScalingGroup]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"autoScalingGroups"
                            Parser (Maybe (Maybe [AutoScalingGroup]))
-> Maybe [AutoScalingGroup] -> Parser (Maybe [AutoScalingGroup])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AutoScalingGroup]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable NodegroupResources

instance Prelude.NFData NodegroupResources