{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeNodegroup
-- 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)
--
-- Returns descriptive information about an Amazon EKS node group.
module Amazonka.EKS.DescribeNodegroup
  ( -- * Creating a Request
    DescribeNodegroup (..),
    newDescribeNodegroup,

    -- * Request Lenses
    describeNodegroup_clusterName,
    describeNodegroup_nodegroupName,

    -- * Destructuring the Response
    DescribeNodegroupResponse (..),
    newDescribeNodegroupResponse,

    -- * Response Lenses
    describeNodegroupResponse_nodegroup,
    describeNodegroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EKS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeNodegroup' smart constructor.
data DescribeNodegroup = DescribeNodegroup'
  { -- | The name of the Amazon EKS cluster associated with the node group.
    DescribeNodegroup -> Text
clusterName :: Prelude.Text,
    -- | The name of the node group to describe.
    DescribeNodegroup -> Text
nodegroupName :: Prelude.Text
  }
  deriving (DescribeNodegroup -> DescribeNodegroup -> Bool
(DescribeNodegroup -> DescribeNodegroup -> Bool)
-> (DescribeNodegroup -> DescribeNodegroup -> Bool)
-> Eq DescribeNodegroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNodegroup -> DescribeNodegroup -> Bool
$c/= :: DescribeNodegroup -> DescribeNodegroup -> Bool
== :: DescribeNodegroup -> DescribeNodegroup -> Bool
$c== :: DescribeNodegroup -> DescribeNodegroup -> Bool
Prelude.Eq, ReadPrec [DescribeNodegroup]
ReadPrec DescribeNodegroup
Int -> ReadS DescribeNodegroup
ReadS [DescribeNodegroup]
(Int -> ReadS DescribeNodegroup)
-> ReadS [DescribeNodegroup]
-> ReadPrec DescribeNodegroup
-> ReadPrec [DescribeNodegroup]
-> Read DescribeNodegroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNodegroup]
$creadListPrec :: ReadPrec [DescribeNodegroup]
readPrec :: ReadPrec DescribeNodegroup
$creadPrec :: ReadPrec DescribeNodegroup
readList :: ReadS [DescribeNodegroup]
$creadList :: ReadS [DescribeNodegroup]
readsPrec :: Int -> ReadS DescribeNodegroup
$creadsPrec :: Int -> ReadS DescribeNodegroup
Prelude.Read, Int -> DescribeNodegroup -> ShowS
[DescribeNodegroup] -> ShowS
DescribeNodegroup -> String
(Int -> DescribeNodegroup -> ShowS)
-> (DescribeNodegroup -> String)
-> ([DescribeNodegroup] -> ShowS)
-> Show DescribeNodegroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNodegroup] -> ShowS
$cshowList :: [DescribeNodegroup] -> ShowS
show :: DescribeNodegroup -> String
$cshow :: DescribeNodegroup -> String
showsPrec :: Int -> DescribeNodegroup -> ShowS
$cshowsPrec :: Int -> DescribeNodegroup -> ShowS
Prelude.Show, (forall x. DescribeNodegroup -> Rep DescribeNodegroup x)
-> (forall x. Rep DescribeNodegroup x -> DescribeNodegroup)
-> Generic DescribeNodegroup
forall x. Rep DescribeNodegroup x -> DescribeNodegroup
forall x. DescribeNodegroup -> Rep DescribeNodegroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeNodegroup x -> DescribeNodegroup
$cfrom :: forall x. DescribeNodegroup -> Rep DescribeNodegroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNodegroup' 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:
--
-- 'clusterName', 'describeNodegroup_clusterName' - The name of the Amazon EKS cluster associated with the node group.
--
-- 'nodegroupName', 'describeNodegroup_nodegroupName' - The name of the node group to describe.
newDescribeNodegroup ::
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'nodegroupName'
  Prelude.Text ->
  DescribeNodegroup
newDescribeNodegroup :: Text -> Text -> DescribeNodegroup
newDescribeNodegroup Text
pClusterName_ Text
pNodegroupName_ =
  DescribeNodegroup' :: Text -> Text -> DescribeNodegroup
DescribeNodegroup'
    { $sel:clusterName:DescribeNodegroup' :: Text
clusterName = Text
pClusterName_,
      $sel:nodegroupName:DescribeNodegroup' :: Text
nodegroupName = Text
pNodegroupName_
    }

-- | The name of the Amazon EKS cluster associated with the node group.
describeNodegroup_clusterName :: Lens.Lens' DescribeNodegroup Prelude.Text
describeNodegroup_clusterName :: (Text -> f Text) -> DescribeNodegroup -> f DescribeNodegroup
describeNodegroup_clusterName = (DescribeNodegroup -> Text)
-> (DescribeNodegroup -> Text -> DescribeNodegroup)
-> Lens DescribeNodegroup DescribeNodegroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNodegroup' {Text
clusterName :: Text
$sel:clusterName:DescribeNodegroup' :: DescribeNodegroup -> Text
clusterName} -> Text
clusterName) (\s :: DescribeNodegroup
s@DescribeNodegroup' {} Text
a -> DescribeNodegroup
s {$sel:clusterName:DescribeNodegroup' :: Text
clusterName = Text
a} :: DescribeNodegroup)

-- | The name of the node group to describe.
describeNodegroup_nodegroupName :: Lens.Lens' DescribeNodegroup Prelude.Text
describeNodegroup_nodegroupName :: (Text -> f Text) -> DescribeNodegroup -> f DescribeNodegroup
describeNodegroup_nodegroupName = (DescribeNodegroup -> Text)
-> (DescribeNodegroup -> Text -> DescribeNodegroup)
-> Lens DescribeNodegroup DescribeNodegroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNodegroup' {Text
nodegroupName :: Text
$sel:nodegroupName:DescribeNodegroup' :: DescribeNodegroup -> Text
nodegroupName} -> Text
nodegroupName) (\s :: DescribeNodegroup
s@DescribeNodegroup' {} Text
a -> DescribeNodegroup
s {$sel:nodegroupName:DescribeNodegroup' :: Text
nodegroupName = Text
a} :: DescribeNodegroup)

instance Core.AWSRequest DescribeNodegroup where
  type
    AWSResponse DescribeNodegroup =
      DescribeNodegroupResponse
  request :: DescribeNodegroup -> Request DescribeNodegroup
request = Service -> DescribeNodegroup -> Request DescribeNodegroup
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeNodegroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeNodegroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeNodegroup))
-> Logger
-> Service
-> Proxy DescribeNodegroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeNodegroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Nodegroup -> Int -> DescribeNodegroupResponse
DescribeNodegroupResponse'
            (Maybe Nodegroup -> Int -> DescribeNodegroupResponse)
-> Either String (Maybe Nodegroup)
-> Either String (Int -> DescribeNodegroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Nodegroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nodegroup")
            Either String (Int -> DescribeNodegroupResponse)
-> Either String Int -> Either String DescribeNodegroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeNodegroup

instance Prelude.NFData DescribeNodegroup

instance Core.ToHeaders DescribeNodegroup where
  toHeaders :: DescribeNodegroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeNodegroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeNodegroup where
  toPath :: DescribeNodegroup -> ByteString
toPath DescribeNodegroup' {Text
nodegroupName :: Text
clusterName :: Text
$sel:nodegroupName:DescribeNodegroup' :: DescribeNodegroup -> Text
$sel:clusterName:DescribeNodegroup' :: DescribeNodegroup -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/clusters/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
clusterName,
        ByteString
"/node-groups/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
nodegroupName
      ]

instance Core.ToQuery DescribeNodegroup where
  toQuery :: DescribeNodegroup -> QueryString
toQuery = QueryString -> DescribeNodegroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeNodegroupResponse' smart constructor.
data DescribeNodegroupResponse = DescribeNodegroupResponse'
  { -- | The full description of your node group.
    DescribeNodegroupResponse -> Maybe Nodegroup
nodegroup :: Prelude.Maybe Nodegroup,
    -- | The response's http status code.
    DescribeNodegroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool
(DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool)
-> (DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool)
-> Eq DescribeNodegroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool
$c/= :: DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool
== :: DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool
$c== :: DescribeNodegroupResponse -> DescribeNodegroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeNodegroupResponse]
ReadPrec DescribeNodegroupResponse
Int -> ReadS DescribeNodegroupResponse
ReadS [DescribeNodegroupResponse]
(Int -> ReadS DescribeNodegroupResponse)
-> ReadS [DescribeNodegroupResponse]
-> ReadPrec DescribeNodegroupResponse
-> ReadPrec [DescribeNodegroupResponse]
-> Read DescribeNodegroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeNodegroupResponse]
$creadListPrec :: ReadPrec [DescribeNodegroupResponse]
readPrec :: ReadPrec DescribeNodegroupResponse
$creadPrec :: ReadPrec DescribeNodegroupResponse
readList :: ReadS [DescribeNodegroupResponse]
$creadList :: ReadS [DescribeNodegroupResponse]
readsPrec :: Int -> ReadS DescribeNodegroupResponse
$creadsPrec :: Int -> ReadS DescribeNodegroupResponse
Prelude.Read, Int -> DescribeNodegroupResponse -> ShowS
[DescribeNodegroupResponse] -> ShowS
DescribeNodegroupResponse -> String
(Int -> DescribeNodegroupResponse -> ShowS)
-> (DescribeNodegroupResponse -> String)
-> ([DescribeNodegroupResponse] -> ShowS)
-> Show DescribeNodegroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeNodegroupResponse] -> ShowS
$cshowList :: [DescribeNodegroupResponse] -> ShowS
show :: DescribeNodegroupResponse -> String
$cshow :: DescribeNodegroupResponse -> String
showsPrec :: Int -> DescribeNodegroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeNodegroupResponse -> ShowS
Prelude.Show, (forall x.
 DescribeNodegroupResponse -> Rep DescribeNodegroupResponse x)
-> (forall x.
    Rep DescribeNodegroupResponse x -> DescribeNodegroupResponse)
-> Generic DescribeNodegroupResponse
forall x.
Rep DescribeNodegroupResponse x -> DescribeNodegroupResponse
forall x.
DescribeNodegroupResponse -> Rep DescribeNodegroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeNodegroupResponse x -> DescribeNodegroupResponse
$cfrom :: forall x.
DescribeNodegroupResponse -> Rep DescribeNodegroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeNodegroupResponse' 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:
--
-- 'nodegroup', 'describeNodegroupResponse_nodegroup' - The full description of your node group.
--
-- 'httpStatus', 'describeNodegroupResponse_httpStatus' - The response's http status code.
newDescribeNodegroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeNodegroupResponse
newDescribeNodegroupResponse :: Int -> DescribeNodegroupResponse
newDescribeNodegroupResponse Int
pHttpStatus_ =
  DescribeNodegroupResponse' :: Maybe Nodegroup -> Int -> DescribeNodegroupResponse
DescribeNodegroupResponse'
    { $sel:nodegroup:DescribeNodegroupResponse' :: Maybe Nodegroup
nodegroup =
        Maybe Nodegroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeNodegroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The full description of your node group.
describeNodegroupResponse_nodegroup :: Lens.Lens' DescribeNodegroupResponse (Prelude.Maybe Nodegroup)
describeNodegroupResponse_nodegroup :: (Maybe Nodegroup -> f (Maybe Nodegroup))
-> DescribeNodegroupResponse -> f DescribeNodegroupResponse
describeNodegroupResponse_nodegroup = (DescribeNodegroupResponse -> Maybe Nodegroup)
-> (DescribeNodegroupResponse
    -> Maybe Nodegroup -> DescribeNodegroupResponse)
-> Lens
     DescribeNodegroupResponse
     DescribeNodegroupResponse
     (Maybe Nodegroup)
     (Maybe Nodegroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNodegroupResponse' {Maybe Nodegroup
nodegroup :: Maybe Nodegroup
$sel:nodegroup:DescribeNodegroupResponse' :: DescribeNodegroupResponse -> Maybe Nodegroup
nodegroup} -> Maybe Nodegroup
nodegroup) (\s :: DescribeNodegroupResponse
s@DescribeNodegroupResponse' {} Maybe Nodegroup
a -> DescribeNodegroupResponse
s {$sel:nodegroup:DescribeNodegroupResponse' :: Maybe Nodegroup
nodegroup = Maybe Nodegroup
a} :: DescribeNodegroupResponse)

-- | The response's http status code.
describeNodegroupResponse_httpStatus :: Lens.Lens' DescribeNodegroupResponse Prelude.Int
describeNodegroupResponse_httpStatus :: (Int -> f Int)
-> DescribeNodegroupResponse -> f DescribeNodegroupResponse
describeNodegroupResponse_httpStatus = (DescribeNodegroupResponse -> Int)
-> (DescribeNodegroupResponse -> Int -> DescribeNodegroupResponse)
-> Lens DescribeNodegroupResponse DescribeNodegroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeNodegroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeNodegroupResponse' :: DescribeNodegroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeNodegroupResponse
s@DescribeNodegroupResponse' {} Int
a -> DescribeNodegroupResponse
s {$sel:httpStatus:DescribeNodegroupResponse' :: Int
httpStatus = Int
a} :: DescribeNodegroupResponse)

instance Prelude.NFData DescribeNodegroupResponse