{-# 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.CreateFargateProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an Fargate profile for your Amazon EKS cluster. You must have at
-- least one Fargate profile in a cluster to be able to run pods on
-- Fargate.
--
-- The Fargate profile allows an administrator to declare which pods run on
-- Fargate and specify which pods run on which Fargate profile. This
-- declaration is done through the profile’s selectors. Each profile can
-- have up to five selectors that contain a namespace and labels. A
-- namespace is required for every selector. The label field consists of
-- multiple optional key-value pairs. Pods that match the selectors are
-- scheduled on Fargate. If a to-be-scheduled pod matches any of the
-- selectors in the Fargate profile, then that pod is run on Fargate.
--
-- When you create a Fargate profile, you must specify a pod execution role
-- to use with the pods that are scheduled with the profile. This role is
-- added to the cluster\'s Kubernetes
-- <https://kubernetes.io/docs/admin/authorization/rbac/ Role Based Access Control>
-- (RBAC) for authorization so that the @kubelet@ that is running on the
-- Fargate infrastructure can register with your Amazon EKS cluster so that
-- it can appear in your cluster as a node. The pod execution role also
-- provides IAM permissions to the Fargate infrastructure to allow read
-- access to Amazon ECR image repositories. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html Pod Execution Role>
-- in the /Amazon EKS User Guide/.
--
-- Fargate profiles are immutable. However, you can create a new updated
-- profile to replace an existing profile and then delete the original
-- after the updated profile has finished creating.
--
-- If any Fargate profiles in a cluster are in the @DELETING@ status, you
-- must wait for that Fargate profile to finish deleting before you can
-- create any other profiles in that cluster.
--
-- For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/fargate-profile.html Fargate Profile>
-- in the /Amazon EKS User Guide/.
module Amazonka.EKS.CreateFargateProfile
  ( -- * Creating a Request
    CreateFargateProfile (..),
    newCreateFargateProfile,

    -- * Request Lenses
    createFargateProfile_clientRequestToken,
    createFargateProfile_selectors,
    createFargateProfile_subnets,
    createFargateProfile_tags,
    createFargateProfile_fargateProfileName,
    createFargateProfile_clusterName,
    createFargateProfile_podExecutionRoleArn,

    -- * Destructuring the Response
    CreateFargateProfileResponse (..),
    newCreateFargateProfileResponse,

    -- * Response Lenses
    createFargateProfileResponse_fargateProfile,
    createFargateProfileResponse_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:/ 'newCreateFargateProfile' smart constructor.
data CreateFargateProfile = CreateFargateProfile'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateFargateProfile -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The selectors to match for pods to use this Fargate profile. Each
    -- selector must have an associated namespace. Optionally, you can also
    -- specify labels for a namespace. You may specify up to five selectors in
    -- a Fargate profile.
    CreateFargateProfile -> Maybe [FargateProfileSelector]
selectors :: Prelude.Maybe [FargateProfileSelector],
    -- | The IDs of subnets to launch your pods into. At this time, pods running
    -- on Fargate are not assigned public IP addresses, so only private subnets
    -- (with no direct route to an Internet Gateway) are accepted for this
    -- parameter.
    CreateFargateProfile -> Maybe [Text]
subnets :: Prelude.Maybe [Prelude.Text],
    -- | The metadata to apply to the Fargate profile to assist with
    -- categorization and organization. Each tag consists of a key and an
    -- optional value. You define both. Fargate profile tags do not propagate
    -- to any other resources associated with the Fargate profile, such as the
    -- pods that are scheduled with it.
    CreateFargateProfile -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the Fargate profile.
    CreateFargateProfile -> Text
fargateProfileName :: Prelude.Text,
    -- | The name of the Amazon EKS cluster to apply the Fargate profile to.
    CreateFargateProfile -> Text
clusterName :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the pod execution role to use for pods
    -- that match the selectors in the Fargate profile. The pod execution role
    -- allows Fargate infrastructure to register with your cluster as a node,
    -- and it provides read access to Amazon ECR image repositories. For more
    -- information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html Pod Execution Role>
    -- in the /Amazon EKS User Guide/.
    CreateFargateProfile -> Text
podExecutionRoleArn :: Prelude.Text
  }
  deriving (CreateFargateProfile -> CreateFargateProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFargateProfile -> CreateFargateProfile -> Bool
$c/= :: CreateFargateProfile -> CreateFargateProfile -> Bool
== :: CreateFargateProfile -> CreateFargateProfile -> Bool
$c== :: CreateFargateProfile -> CreateFargateProfile -> Bool
Prelude.Eq, ReadPrec [CreateFargateProfile]
ReadPrec CreateFargateProfile
Int -> ReadS CreateFargateProfile
ReadS [CreateFargateProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFargateProfile]
$creadListPrec :: ReadPrec [CreateFargateProfile]
readPrec :: ReadPrec CreateFargateProfile
$creadPrec :: ReadPrec CreateFargateProfile
readList :: ReadS [CreateFargateProfile]
$creadList :: ReadS [CreateFargateProfile]
readsPrec :: Int -> ReadS CreateFargateProfile
$creadsPrec :: Int -> ReadS CreateFargateProfile
Prelude.Read, Int -> CreateFargateProfile -> ShowS
[CreateFargateProfile] -> ShowS
CreateFargateProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFargateProfile] -> ShowS
$cshowList :: [CreateFargateProfile] -> ShowS
show :: CreateFargateProfile -> String
$cshow :: CreateFargateProfile -> String
showsPrec :: Int -> CreateFargateProfile -> ShowS
$cshowsPrec :: Int -> CreateFargateProfile -> ShowS
Prelude.Show, forall x. Rep CreateFargateProfile x -> CreateFargateProfile
forall x. CreateFargateProfile -> Rep CreateFargateProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFargateProfile x -> CreateFargateProfile
$cfrom :: forall x. CreateFargateProfile -> Rep CreateFargateProfile x
Prelude.Generic)

-- |
-- Create a value of 'CreateFargateProfile' 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:
--
-- 'clientRequestToken', 'createFargateProfile_clientRequestToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'selectors', 'createFargateProfile_selectors' - The selectors to match for pods to use this Fargate profile. Each
-- selector must have an associated namespace. Optionally, you can also
-- specify labels for a namespace. You may specify up to five selectors in
-- a Fargate profile.
--
-- 'subnets', 'createFargateProfile_subnets' - The IDs of subnets to launch your pods into. At this time, pods running
-- on Fargate are not assigned public IP addresses, so only private subnets
-- (with no direct route to an Internet Gateway) are accepted for this
-- parameter.
--
-- 'tags', 'createFargateProfile_tags' - The metadata to apply to the Fargate profile to assist with
-- categorization and organization. Each tag consists of a key and an
-- optional value. You define both. Fargate profile tags do not propagate
-- to any other resources associated with the Fargate profile, such as the
-- pods that are scheduled with it.
--
-- 'fargateProfileName', 'createFargateProfile_fargateProfileName' - The name of the Fargate profile.
--
-- 'clusterName', 'createFargateProfile_clusterName' - The name of the Amazon EKS cluster to apply the Fargate profile to.
--
-- 'podExecutionRoleArn', 'createFargateProfile_podExecutionRoleArn' - The Amazon Resource Name (ARN) of the pod execution role to use for pods
-- that match the selectors in the Fargate profile. The pod execution role
-- allows Fargate infrastructure to register with your cluster as a node,
-- and it provides read access to Amazon ECR image repositories. For more
-- information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html Pod Execution Role>
-- in the /Amazon EKS User Guide/.
newCreateFargateProfile ::
  -- | 'fargateProfileName'
  Prelude.Text ->
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'podExecutionRoleArn'
  Prelude.Text ->
  CreateFargateProfile
newCreateFargateProfile :: Text -> Text -> Text -> CreateFargateProfile
newCreateFargateProfile
  Text
pFargateProfileName_
  Text
pClusterName_
  Text
pPodExecutionRoleArn_ =
    CreateFargateProfile'
      { $sel:clientRequestToken:CreateFargateProfile' :: Maybe Text
clientRequestToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:selectors:CreateFargateProfile' :: Maybe [FargateProfileSelector]
selectors = forall a. Maybe a
Prelude.Nothing,
        $sel:subnets:CreateFargateProfile' :: Maybe [Text]
subnets = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateFargateProfile' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:fargateProfileName:CreateFargateProfile' :: Text
fargateProfileName = Text
pFargateProfileName_,
        $sel:clusterName:CreateFargateProfile' :: Text
clusterName = Text
pClusterName_,
        $sel:podExecutionRoleArn:CreateFargateProfile' :: Text
podExecutionRoleArn = Text
pPodExecutionRoleArn_
      }

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
createFargateProfile_clientRequestToken :: Lens.Lens' CreateFargateProfile (Prelude.Maybe Prelude.Text)
createFargateProfile_clientRequestToken :: Lens' CreateFargateProfile (Maybe Text)
createFargateProfile_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:CreateFargateProfile' :: CreateFargateProfile -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Maybe Text
a -> CreateFargateProfile
s {$sel:clientRequestToken:CreateFargateProfile' :: Maybe Text
clientRequestToken = Maybe Text
a} :: CreateFargateProfile)

-- | The selectors to match for pods to use this Fargate profile. Each
-- selector must have an associated namespace. Optionally, you can also
-- specify labels for a namespace. You may specify up to five selectors in
-- a Fargate profile.
createFargateProfile_selectors :: Lens.Lens' CreateFargateProfile (Prelude.Maybe [FargateProfileSelector])
createFargateProfile_selectors :: Lens' CreateFargateProfile (Maybe [FargateProfileSelector])
createFargateProfile_selectors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Maybe [FargateProfileSelector]
selectors :: Maybe [FargateProfileSelector]
$sel:selectors:CreateFargateProfile' :: CreateFargateProfile -> Maybe [FargateProfileSelector]
selectors} -> Maybe [FargateProfileSelector]
selectors) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Maybe [FargateProfileSelector]
a -> CreateFargateProfile
s {$sel:selectors:CreateFargateProfile' :: Maybe [FargateProfileSelector]
selectors = Maybe [FargateProfileSelector]
a} :: CreateFargateProfile) 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 IDs of subnets to launch your pods into. At this time, pods running
-- on Fargate are not assigned public IP addresses, so only private subnets
-- (with no direct route to an Internet Gateway) are accepted for this
-- parameter.
createFargateProfile_subnets :: Lens.Lens' CreateFargateProfile (Prelude.Maybe [Prelude.Text])
createFargateProfile_subnets :: Lens' CreateFargateProfile (Maybe [Text])
createFargateProfile_subnets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Maybe [Text]
subnets :: Maybe [Text]
$sel:subnets:CreateFargateProfile' :: CreateFargateProfile -> Maybe [Text]
subnets} -> Maybe [Text]
subnets) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Maybe [Text]
a -> CreateFargateProfile
s {$sel:subnets:CreateFargateProfile' :: Maybe [Text]
subnets = Maybe [Text]
a} :: CreateFargateProfile) 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 metadata to apply to the Fargate profile to assist with
-- categorization and organization. Each tag consists of a key and an
-- optional value. You define both. Fargate profile tags do not propagate
-- to any other resources associated with the Fargate profile, such as the
-- pods that are scheduled with it.
createFargateProfile_tags :: Lens.Lens' CreateFargateProfile (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createFargateProfile_tags :: Lens' CreateFargateProfile (Maybe (HashMap Text Text))
createFargateProfile_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateFargateProfile' :: CreateFargateProfile -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Maybe (HashMap Text Text)
a -> CreateFargateProfile
s {$sel:tags:CreateFargateProfile' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateFargateProfile) 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 name of the Fargate profile.
createFargateProfile_fargateProfileName :: Lens.Lens' CreateFargateProfile Prelude.Text
createFargateProfile_fargateProfileName :: Lens' CreateFargateProfile Text
createFargateProfile_fargateProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Text
fargateProfileName :: Text
$sel:fargateProfileName:CreateFargateProfile' :: CreateFargateProfile -> Text
fargateProfileName} -> Text
fargateProfileName) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Text
a -> CreateFargateProfile
s {$sel:fargateProfileName:CreateFargateProfile' :: Text
fargateProfileName = Text
a} :: CreateFargateProfile)

-- | The name of the Amazon EKS cluster to apply the Fargate profile to.
createFargateProfile_clusterName :: Lens.Lens' CreateFargateProfile Prelude.Text
createFargateProfile_clusterName :: Lens' CreateFargateProfile Text
createFargateProfile_clusterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Text
clusterName :: Text
$sel:clusterName:CreateFargateProfile' :: CreateFargateProfile -> Text
clusterName} -> Text
clusterName) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Text
a -> CreateFargateProfile
s {$sel:clusterName:CreateFargateProfile' :: Text
clusterName = Text
a} :: CreateFargateProfile)

-- | The Amazon Resource Name (ARN) of the pod execution role to use for pods
-- that match the selectors in the Fargate profile. The pod execution role
-- allows Fargate infrastructure to register with your cluster as a node,
-- and it provides read access to Amazon ECR image repositories. For more
-- information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/pod-execution-role.html Pod Execution Role>
-- in the /Amazon EKS User Guide/.
createFargateProfile_podExecutionRoleArn :: Lens.Lens' CreateFargateProfile Prelude.Text
createFargateProfile_podExecutionRoleArn :: Lens' CreateFargateProfile Text
createFargateProfile_podExecutionRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFargateProfile' {Text
podExecutionRoleArn :: Text
$sel:podExecutionRoleArn:CreateFargateProfile' :: CreateFargateProfile -> Text
podExecutionRoleArn} -> Text
podExecutionRoleArn) (\s :: CreateFargateProfile
s@CreateFargateProfile' {} Text
a -> CreateFargateProfile
s {$sel:podExecutionRoleArn:CreateFargateProfile' :: Text
podExecutionRoleArn = Text
a} :: CreateFargateProfile)

instance Core.AWSRequest CreateFargateProfile where
  type
    AWSResponse CreateFargateProfile =
      CreateFargateProfileResponse
  request :: (Service -> Service)
-> CreateFargateProfile -> Request CreateFargateProfile
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateFargateProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFargateProfile)))
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 -> CreateFargateProfileResponse
CreateFargateProfileResponse'
            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 CreateFargateProfile where
  hashWithSalt :: Int -> CreateFargateProfile -> Int
hashWithSalt Int
_salt CreateFargateProfile' {Maybe [Text]
Maybe [FargateProfileSelector]
Maybe Text
Maybe (HashMap Text Text)
Text
podExecutionRoleArn :: Text
clusterName :: Text
fargateProfileName :: Text
tags :: Maybe (HashMap Text Text)
subnets :: Maybe [Text]
selectors :: Maybe [FargateProfileSelector]
clientRequestToken :: Maybe Text
$sel:podExecutionRoleArn:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:clusterName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:fargateProfileName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:tags:CreateFargateProfile' :: CreateFargateProfile -> Maybe (HashMap Text Text)
$sel:subnets:CreateFargateProfile' :: CreateFargateProfile -> Maybe [Text]
$sel:selectors:CreateFargateProfile' :: CreateFargateProfile -> Maybe [FargateProfileSelector]
$sel:clientRequestToken:CreateFargateProfile' :: CreateFargateProfile -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [FargateProfileSelector]
selectors
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnets
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
fargateProfileName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
podExecutionRoleArn

instance Prelude.NFData CreateFargateProfile where
  rnf :: CreateFargateProfile -> ()
rnf CreateFargateProfile' {Maybe [Text]
Maybe [FargateProfileSelector]
Maybe Text
Maybe (HashMap Text Text)
Text
podExecutionRoleArn :: Text
clusterName :: Text
fargateProfileName :: Text
tags :: Maybe (HashMap Text Text)
subnets :: Maybe [Text]
selectors :: Maybe [FargateProfileSelector]
clientRequestToken :: Maybe Text
$sel:podExecutionRoleArn:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:clusterName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:fargateProfileName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:tags:CreateFargateProfile' :: CreateFargateProfile -> Maybe (HashMap Text Text)
$sel:subnets:CreateFargateProfile' :: CreateFargateProfile -> Maybe [Text]
$sel:selectors:CreateFargateProfile' :: CreateFargateProfile -> Maybe [FargateProfileSelector]
$sel:clientRequestToken:CreateFargateProfile' :: CreateFargateProfile -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [FargateProfileSelector]
selectors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnets
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
fargateProfileName
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
podExecutionRoleArn

instance Data.ToHeaders CreateFargateProfile where
  toHeaders :: CreateFargateProfile -> 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.ToJSON CreateFargateProfile where
  toJSON :: CreateFargateProfile -> Value
toJSON CreateFargateProfile' {Maybe [Text]
Maybe [FargateProfileSelector]
Maybe Text
Maybe (HashMap Text Text)
Text
podExecutionRoleArn :: Text
clusterName :: Text
fargateProfileName :: Text
tags :: Maybe (HashMap Text Text)
subnets :: Maybe [Text]
selectors :: Maybe [FargateProfileSelector]
clientRequestToken :: Maybe Text
$sel:podExecutionRoleArn:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:clusterName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:fargateProfileName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:tags:CreateFargateProfile' :: CreateFargateProfile -> Maybe (HashMap Text Text)
$sel:subnets:CreateFargateProfile' :: CreateFargateProfile -> Maybe [Text]
$sel:selectors:CreateFargateProfile' :: CreateFargateProfile -> Maybe [FargateProfileSelector]
$sel:clientRequestToken:CreateFargateProfile' :: CreateFargateProfile -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"clientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
            (Key
"selectors" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [FargateProfileSelector]
selectors,
            (Key
"subnets" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
subnets,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"fargateProfileName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
fargateProfileName),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"podExecutionRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
podExecutionRoleArn)
          ]
      )

instance Data.ToPath CreateFargateProfile where
  toPath :: CreateFargateProfile -> ByteString
toPath CreateFargateProfile' {Maybe [Text]
Maybe [FargateProfileSelector]
Maybe Text
Maybe (HashMap Text Text)
Text
podExecutionRoleArn :: Text
clusterName :: Text
fargateProfileName :: Text
tags :: Maybe (HashMap Text Text)
subnets :: Maybe [Text]
selectors :: Maybe [FargateProfileSelector]
clientRequestToken :: Maybe Text
$sel:podExecutionRoleArn:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:clusterName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:fargateProfileName:CreateFargateProfile' :: CreateFargateProfile -> Text
$sel:tags:CreateFargateProfile' :: CreateFargateProfile -> Maybe (HashMap Text Text)
$sel:subnets:CreateFargateProfile' :: CreateFargateProfile -> Maybe [Text]
$sel:selectors:CreateFargateProfile' :: CreateFargateProfile -> Maybe [FargateProfileSelector]
$sel:clientRequestToken:CreateFargateProfile' :: CreateFargateProfile -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/clusters/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterName,
        ByteString
"/fargate-profiles"
      ]

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

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

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

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

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

instance Prelude.NFData CreateFargateProfileResponse where
  rnf :: CreateFargateProfileResponse -> ()
rnf CreateFargateProfileResponse' {Int
Maybe FargateProfile
httpStatus :: Int
fargateProfile :: Maybe FargateProfile
$sel:httpStatus:CreateFargateProfileResponse' :: CreateFargateProfileResponse -> Int
$sel:fargateProfile:CreateFargateProfileResponse' :: CreateFargateProfileResponse -> 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