{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EKS.Types
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
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]
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
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. 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'
      { $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 :: Lens' DescribeFargateProfile Text
describeFargateProfile_clusterName = 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 :: Lens' DescribeFargateProfile Text
describeFargateProfile_fargateProfileName = 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 :: (Service -> Service)
-> DescribeFargateProfile -> Request DescribeFargateProfile
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeFargateProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeFargateProfile)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe FargateProfile -> Int -> DescribeFargateProfileResponse
DescribeFargateProfileResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"fargateProfile")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeFargateProfile where
  hashWithSalt :: Int -> DescribeFargateProfile -> Int
hashWithSalt Int
_salt DescribeFargateProfile' {Text
fargateProfileName :: Text
clusterName :: Text
$sel:fargateProfileName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
$sel:clusterName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fargateProfileName

instance Prelude.NFData DescribeFargateProfile where
  rnf :: DescribeFargateProfile -> ()
rnf DescribeFargateProfile' {Text
fargateProfileName :: Text
clusterName :: Text
$sel:fargateProfileName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
$sel:clusterName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
clusterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fargateProfileName

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

instance Data.ToPath DescribeFargateProfile where
  toPath :: DescribeFargateProfile -> ByteString
toPath DescribeFargateProfile' {Text
fargateProfileName :: Text
clusterName :: Text
$sel:fargateProfileName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
$sel:clusterName:DescribeFargateProfile' :: DescribeFargateProfile -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/clusters/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterName,
        ByteString
"/fargate-profiles/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
fargateProfileName
      ]

instance Data.ToQuery DescribeFargateProfile where
  toQuery :: DescribeFargateProfile -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:fargateProfile:DescribeFargateProfileResponse' :: Maybe FargateProfile
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 :: Lens' DescribeFargateProfileResponse (Maybe FargateProfile)
describeFargateProfileResponse_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 :: Lens' DescribeFargateProfileResponse Int
describeFargateProfileResponse_httpStatus = 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
  where
  rnf :: DescribeFargateProfileResponse -> ()
rnf DescribeFargateProfileResponse' {Int
Maybe FargateProfile
httpStatus :: Int
fargateProfile :: Maybe FargateProfile
$sel:httpStatus:DescribeFargateProfileResponse' :: DescribeFargateProfileResponse -> Int
$sel:fargateProfile:DescribeFargateProfileResponse' :: DescribeFargateProfileResponse -> Maybe FargateProfile
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FargateProfile
fargateProfile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus