{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EKS.Types.NodegroupResources where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types.AutoScalingGroup
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 Auto Scaling groups associated with the node group.
    NodegroupResources -> Maybe [AutoScalingGroup]
autoScalingGroups :: Prelude.Maybe [AutoScalingGroup],
    -- | 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
  }
  deriving (NodegroupResources -> NodegroupResources -> Bool
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]
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
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. 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:
--
-- 'autoScalingGroups', 'nodegroupResources_autoScalingGroups' - The Auto Scaling groups associated with the node group.
--
-- 'remoteAccessSecurityGroup', 'nodegroupResources_remoteAccessSecurityGroup' - The remote access security group associated with the node group. This
-- security group controls SSH access to the nodes.
newNodegroupResources ::
  NodegroupResources
newNodegroupResources :: NodegroupResources
newNodegroupResources =
  NodegroupResources'
    { $sel:autoScalingGroups:NodegroupResources' :: Maybe [AutoScalingGroup]
autoScalingGroups =
        forall a. Maybe a
Prelude.Nothing,
      $sel:remoteAccessSecurityGroup:NodegroupResources' :: Maybe Text
remoteAccessSecurityGroup = forall a. Maybe a
Prelude.Nothing
    }

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

-- | 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 :: Lens' NodegroupResources (Maybe Text)
nodegroupResources_remoteAccessSecurityGroup = 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)

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

instance Prelude.Hashable NodegroupResources where
  hashWithSalt :: Int -> NodegroupResources -> Int
hashWithSalt Int
_salt NodegroupResources' {Maybe [AutoScalingGroup]
Maybe Text
remoteAccessSecurityGroup :: Maybe Text
autoScalingGroups :: Maybe [AutoScalingGroup]
$sel:remoteAccessSecurityGroup:NodegroupResources' :: NodegroupResources -> Maybe Text
$sel:autoScalingGroups:NodegroupResources' :: NodegroupResources -> Maybe [AutoScalingGroup]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AutoScalingGroup]
autoScalingGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
remoteAccessSecurityGroup

instance Prelude.NFData NodegroupResources where
  rnf :: NodegroupResources -> ()
rnf NodegroupResources' {Maybe [AutoScalingGroup]
Maybe Text
remoteAccessSecurityGroup :: Maybe Text
autoScalingGroups :: Maybe [AutoScalingGroup]
$sel:remoteAccessSecurityGroup:NodegroupResources' :: NodegroupResources -> Maybe Text
$sel:autoScalingGroups:NodegroupResources' :: NodegroupResources -> Maybe [AutoScalingGroup]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AutoScalingGroup]
autoScalingGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
remoteAccessSecurityGroup