{-# 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.DescribeFargateProfile
-- 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 Fargate profile.
module Amazonka.EKS.DescribeFargateProfile
  ( -- * Creating a Request
    DescribeFargateProfile (..),
    newDescribeFargateProfile,

    -- * Request Lenses
    describeFargateProfile_clusterName,
    describeFargateProfile_fargateProfileName,

    -- * Destructuring the Response
    DescribeFargateProfileResponse (..),
    newDescribeFargateProfileResponse,

    -- * Response Lenses
    describeFargateProfileResponse_fargateProfile,
    describeFargateProfileResponse_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:/ 'newDescribeFargateProfile' smart constructor.
data DescribeFargateProfile = DescribeFargateProfile'
  { -- | The name of the Amazon EKS cluster associated with the Fargate profile.
    DescribeFargateProfile -> Text
clusterName :: Prelude.Text,
    -- | The name of the Fargate profile to describe.
    DescribeFargateProfile -> Text
fargateProfileName :: Prelude.Text
  }
  deriving (DescribeFargateProfile -> DescribeFargateProfile -> Bool
(DescribeFargateProfile -> DescribeFargateProfile -> Bool)
-> (DescribeFargateProfile -> DescribeFargateProfile -> Bool)
-> Eq DescribeFargateProfile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeFargateProfile -> DescribeFargateProfile -> Bool
$c/= :: DescribeFargateProfile -> DescribeFargateProfile -> Bool
== :: DescribeFargateProfile -> DescribeFargateProfile -> Bool
$c== :: DescribeFargateProfile -> DescribeFargateProfile -> Bool
Prelude.Eq, ReadPrec [DescribeFargateProfile]
ReadPrec DescribeFargateProfile
Int -> ReadS DescribeFargateProfile
ReadS [DescribeFargateProfile]
(Int -> ReadS DescribeFargateProfile)
-> ReadS [DescribeFargateProfile]
-> ReadPrec DescribeFargateProfile
-> ReadPrec [DescribeFargateProfile]
-> Read DescribeFargateProfile
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeFargateProfile]
$creadListPrec :: ReadPrec [DescribeFargateProfile]
readPrec :: ReadPrec DescribeFargateProfile
$creadPrec :: ReadPrec DescribeFargateProfile
readList :: ReadS [DescribeFargateProfile]
$creadList :: ReadS [DescribeFargateProfile]
readsPrec :: Int -> ReadS DescribeFargateProfile
$creadsPrec :: Int -> ReadS DescribeFargateProfile
Prelude.Read, Int -> DescribeFargateProfile -> ShowS
[DescribeFargateProfile] -> ShowS
DescribeFargateProfile -> String
(Int -> DescribeFargateProfile -> ShowS)
-> (DescribeFargateProfile -> String)
-> ([DescribeFargateProfile] -> ShowS)
-> Show DescribeFargateProfile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeFargateProfile] -> ShowS
$cshowList :: [DescribeFargateProfile] -> ShowS
show :: DescribeFargateProfile -> String
$cshow :: DescribeFargateProfile -> String
showsPrec :: Int -> DescribeFargateProfile -> ShowS
$cshowsPrec :: Int -> DescribeFargateProfile -> ShowS
Prelude.Show, (forall x. DescribeFargateProfile -> Rep DescribeFargateProfile x)
-> (forall x.
    Rep DescribeFargateProfile x -> DescribeFargateProfile)
-> Generic DescribeFargateProfile
forall x. Rep DescribeFargateProfile x -> DescribeFargateProfile
forall x. DescribeFargateProfile -> Rep DescribeFargateProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeFargateProfile x -> DescribeFargateProfile
$cfrom :: forall x. DescribeFargateProfile -> Rep DescribeFargateProfile x
Prelude.Generic)

-- |
-- Create a value of 'DescribeFargateProfile' 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', 'describeFargateProfile_clusterName' - The name of the Amazon EKS cluster associated with the Fargate profile.
--
-- 'fargateProfileName', 'describeFargateProfile_fargateProfileName' - The name of the Fargate profile to describe.
newDescribeFargateProfile ::
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'fargateProfileName'
  Prelude.Text ->
  DescribeFargateProfile
newDescribeFargateProfile :: Text -> Text -> DescribeFargateProfile
newDescribeFargateProfile
  Text
pClusterName_
  Text
pFargateProfileName_ =
    DescribeFargateProfile' :: Text -> Text -> DescribeFargateProfile
DescribeFargateProfile'
      { $sel:clusterName:DescribeFargateProfile' :: Text
clusterName =
          Text
pClusterName_,
        $sel:fargateProfileName:DescribeFargateProfile' :: Text
fargateProfileName = Text
pFargateProfileName_
      }

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

-- | The name of the Fargate profile to describe.
describeFargateProfile_fargateProfileName :: Lens.Lens' DescribeFargateProfile Prelude.Text
describeFargateProfile_fargateProfileName :: (Text -> f Text)
-> DescribeFargateProfile -> f DescribeFargateProfile
describeFargateProfile_fargateProfileName = (DescribeFargateProfile -> Text)
-> (DescribeFargateProfile -> Text -> DescribeFargateProfile)
-> Lens DescribeFargateProfile DescribeFargateProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFargateProfile' {Text
fargateProfileName :: Text
$sel:fargateProfileName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
fargateProfileName} -> Text
fargateProfileName) (\s :: DescribeFargateProfile
s@DescribeFargateProfile' {} Text
a -> DescribeFargateProfile
s {$sel:fargateProfileName:DescribeFargateProfile' :: Text
fargateProfileName = Text
a} :: DescribeFargateProfile)

instance Core.AWSRequest DescribeFargateProfile where
  type
    AWSResponse DescribeFargateProfile =
      DescribeFargateProfileResponse
  request :: DescribeFargateProfile -> Request DescribeFargateProfile
request = Service -> DescribeFargateProfile -> Request DescribeFargateProfile
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeFargateProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFargateProfile)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeFargateProfile))
-> Logger
-> Service
-> Proxy DescribeFargateProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFargateProfile)))
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 FargateProfile -> Int -> DescribeFargateProfileResponse
DescribeFargateProfileResponse'
            (Maybe FargateProfile -> Int -> DescribeFargateProfileResponse)
-> Either String (Maybe FargateProfile)
-> Either String (Int -> DescribeFargateProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe FargateProfile)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"fargateProfile")
            Either String (Int -> DescribeFargateProfileResponse)
-> Either String Int
-> Either String DescribeFargateProfileResponse
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 DescribeFargateProfile

instance Prelude.NFData DescribeFargateProfile

instance Core.ToHeaders DescribeFargateProfile where
  toHeaders :: DescribeFargateProfile -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeFargateProfile -> 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 DescribeFargateProfile where
  toPath :: DescribeFargateProfile -> ByteString
toPath DescribeFargateProfile' {Text
fargateProfileName :: Text
clusterName :: Text
$sel:fargateProfileName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
$sel:clusterName:DescribeFargateProfile' :: DescribeFargateProfile -> 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
"/fargate-profiles/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
fargateProfileName
      ]

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

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

-- |
-- Create a value of 'DescribeFargateProfileResponse' 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:
--
-- 'fargateProfile', 'describeFargateProfileResponse_fargateProfile' - The full description of your Fargate profile.
--
-- 'httpStatus', 'describeFargateProfileResponse_httpStatus' - The response's http status code.
newDescribeFargateProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeFargateProfileResponse
newDescribeFargateProfileResponse :: Int -> DescribeFargateProfileResponse
newDescribeFargateProfileResponse Int
pHttpStatus_ =
  DescribeFargateProfileResponse' :: Maybe FargateProfile -> Int -> DescribeFargateProfileResponse
DescribeFargateProfileResponse'
    { $sel:fargateProfile:DescribeFargateProfileResponse' :: Maybe FargateProfile
fargateProfile =
        Maybe FargateProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeFargateProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The full description of your Fargate profile.
describeFargateProfileResponse_fargateProfile :: Lens.Lens' DescribeFargateProfileResponse (Prelude.Maybe FargateProfile)
describeFargateProfileResponse_fargateProfile :: (Maybe FargateProfile -> f (Maybe FargateProfile))
-> DescribeFargateProfileResponse
-> f DescribeFargateProfileResponse
describeFargateProfileResponse_fargateProfile = (DescribeFargateProfileResponse -> Maybe FargateProfile)
-> (DescribeFargateProfileResponse
    -> Maybe FargateProfile -> DescribeFargateProfileResponse)
-> Lens
     DescribeFargateProfileResponse
     DescribeFargateProfileResponse
     (Maybe FargateProfile)
     (Maybe FargateProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeFargateProfileResponse' {Maybe FargateProfile
fargateProfile :: Maybe FargateProfile
$sel:fargateProfile:DescribeFargateProfileResponse' :: DescribeFargateProfileResponse -> Maybe FargateProfile
fargateProfile} -> Maybe FargateProfile
fargateProfile) (\s :: DescribeFargateProfileResponse
s@DescribeFargateProfileResponse' {} Maybe FargateProfile
a -> DescribeFargateProfileResponse
s {$sel:fargateProfile:DescribeFargateProfileResponse' :: Maybe FargateProfile
fargateProfile = Maybe FargateProfile
a} :: DescribeFargateProfileResponse)

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

instance
  Prelude.NFData
    DescribeFargateProfileResponse