{-# 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.CreateAddon
-- 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 Amazon EKS add-on.
--
-- Amazon EKS add-ons help to automate the provisioning and lifecycle
-- management of common operational software for Amazon EKS clusters. For
-- more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/eks-add-ons.html Amazon EKS add-ons>
-- in the /Amazon EKS User Guide/.
module Amazonka.EKS.CreateAddon
  ( -- * Creating a Request
    CreateAddon (..),
    newCreateAddon,

    -- * Request Lenses
    createAddon_addonVersion,
    createAddon_clientRequestToken,
    createAddon_configurationValues,
    createAddon_resolveConflicts,
    createAddon_serviceAccountRoleArn,
    createAddon_tags,
    createAddon_clusterName,
    createAddon_addonName,

    -- * Destructuring the Response
    CreateAddonResponse (..),
    newCreateAddonResponse,

    -- * Response Lenses
    createAddonResponse_addon,
    createAddonResponse_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:/ 'newCreateAddon' smart constructor.
data CreateAddon = CreateAddon'
  { -- | The version of the add-on. The version must match one of the versions
    -- returned by
    -- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
    -- .
    CreateAddon -> Maybe Text
addonVersion :: Prelude.Maybe Prelude.Text,
    -- | A unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    CreateAddon -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The set of configuration values for the add-on that\'s created. The
    -- values that you provide are validated against the schema in
    -- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonConfiguration.html DescribeAddonConfiguration>
    -- .
    CreateAddon -> Maybe Text
configurationValues :: Prelude.Maybe Prelude.Text,
    -- | How to resolve field value conflicts for an Amazon EKS add-on. Conflicts
    -- are handled based on the value you choose:
    --
    -- -   __None__ – If the self-managed version of the add-on is installed on
    --     your cluster, Amazon EKS doesn\'t change the value. Creation of the
    --     add-on might fail.
    --
    -- -   __Overwrite__ – If the self-managed version of the add-on is
    --     installed on your cluster and the Amazon EKS default value is
    --     different than the existing value, Amazon EKS changes the value to
    --     the Amazon EKS default value.
    --
    -- -   __Preserve__ – Not supported. You can set this value when updating
    --     an add-on though. For more information, see
    --     <https://docs.aws.amazon.com/eks/latest/APIReference/API_UpdateAddon.html UpdateAddon>.
    --
    -- If you don\'t currently have the self-managed version of the add-on
    -- installed on your cluster, the Amazon EKS add-on is installed. Amazon
    -- EKS sets all values to default values, regardless of the option that you
    -- specify.
    CreateAddon -> Maybe ResolveConflicts
resolveConflicts :: Prelude.Maybe ResolveConflicts,
    -- | The Amazon Resource Name (ARN) of an existing IAM role to bind to the
    -- add-on\'s service account. The role must be assigned the IAM permissions
    -- required by the add-on. If you don\'t specify an existing IAM role, then
    -- the add-on uses the permissions assigned to the node IAM role. For more
    -- information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html Amazon EKS node IAM role>
    -- in the /Amazon EKS User Guide/.
    --
    -- To specify an existing IAM role, you must have an IAM OpenID Connect
    -- (OIDC) provider created for your cluster. For more information, see
    -- <https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html Enabling IAM roles for service accounts on your cluster>
    -- in the /Amazon EKS User Guide/.
    CreateAddon -> Maybe Text
serviceAccountRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The metadata to apply to the cluster to assist with categorization and
    -- organization. Each tag consists of a key and an optional value. You
    -- define both.
    CreateAddon -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the cluster to create the add-on for.
    CreateAddon -> Text
clusterName :: Prelude.Text,
    -- | The name of the add-on. The name must match one of the names that
    -- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
    -- returns.
    CreateAddon -> Text
addonName :: Prelude.Text
  }
  deriving (CreateAddon -> CreateAddon -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAddon -> CreateAddon -> Bool
$c/= :: CreateAddon -> CreateAddon -> Bool
== :: CreateAddon -> CreateAddon -> Bool
$c== :: CreateAddon -> CreateAddon -> Bool
Prelude.Eq, ReadPrec [CreateAddon]
ReadPrec CreateAddon
Int -> ReadS CreateAddon
ReadS [CreateAddon]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAddon]
$creadListPrec :: ReadPrec [CreateAddon]
readPrec :: ReadPrec CreateAddon
$creadPrec :: ReadPrec CreateAddon
readList :: ReadS [CreateAddon]
$creadList :: ReadS [CreateAddon]
readsPrec :: Int -> ReadS CreateAddon
$creadsPrec :: Int -> ReadS CreateAddon
Prelude.Read, Int -> CreateAddon -> ShowS
[CreateAddon] -> ShowS
CreateAddon -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAddon] -> ShowS
$cshowList :: [CreateAddon] -> ShowS
show :: CreateAddon -> String
$cshow :: CreateAddon -> String
showsPrec :: Int -> CreateAddon -> ShowS
$cshowsPrec :: Int -> CreateAddon -> ShowS
Prelude.Show, forall x. Rep CreateAddon x -> CreateAddon
forall x. CreateAddon -> Rep CreateAddon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAddon x -> CreateAddon
$cfrom :: forall x. CreateAddon -> Rep CreateAddon x
Prelude.Generic)

-- |
-- Create a value of 'CreateAddon' 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:
--
-- 'addonVersion', 'createAddon_addonVersion' - The version of the add-on. The version must match one of the versions
-- returned by
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
-- .
--
-- 'clientRequestToken', 'createAddon_clientRequestToken' - A unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'configurationValues', 'createAddon_configurationValues' - The set of configuration values for the add-on that\'s created. The
-- values that you provide are validated against the schema in
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonConfiguration.html DescribeAddonConfiguration>
-- .
--
-- 'resolveConflicts', 'createAddon_resolveConflicts' - How to resolve field value conflicts for an Amazon EKS add-on. Conflicts
-- are handled based on the value you choose:
--
-- -   __None__ – If the self-managed version of the add-on is installed on
--     your cluster, Amazon EKS doesn\'t change the value. Creation of the
--     add-on might fail.
--
-- -   __Overwrite__ – If the self-managed version of the add-on is
--     installed on your cluster and the Amazon EKS default value is
--     different than the existing value, Amazon EKS changes the value to
--     the Amazon EKS default value.
--
-- -   __Preserve__ – Not supported. You can set this value when updating
--     an add-on though. For more information, see
--     <https://docs.aws.amazon.com/eks/latest/APIReference/API_UpdateAddon.html UpdateAddon>.
--
-- If you don\'t currently have the self-managed version of the add-on
-- installed on your cluster, the Amazon EKS add-on is installed. Amazon
-- EKS sets all values to default values, regardless of the option that you
-- specify.
--
-- 'serviceAccountRoleArn', 'createAddon_serviceAccountRoleArn' - The Amazon Resource Name (ARN) of an existing IAM role to bind to the
-- add-on\'s service account. The role must be assigned the IAM permissions
-- required by the add-on. If you don\'t specify an existing IAM role, then
-- the add-on uses the permissions assigned to the node IAM role. For more
-- information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html Amazon EKS node IAM role>
-- in the /Amazon EKS User Guide/.
--
-- To specify an existing IAM role, you must have an IAM OpenID Connect
-- (OIDC) provider created for your cluster. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html Enabling IAM roles for service accounts on your cluster>
-- in the /Amazon EKS User Guide/.
--
-- 'tags', 'createAddon_tags' - The metadata to apply to the cluster to assist with categorization and
-- organization. Each tag consists of a key and an optional value. You
-- define both.
--
-- 'clusterName', 'createAddon_clusterName' - The name of the cluster to create the add-on for.
--
-- 'addonName', 'createAddon_addonName' - The name of the add-on. The name must match one of the names that
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
-- returns.
newCreateAddon ::
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'addonName'
  Prelude.Text ->
  CreateAddon
newCreateAddon :: Text -> Text -> CreateAddon
newCreateAddon Text
pClusterName_ Text
pAddonName_ =
  CreateAddon'
    { $sel:addonVersion:CreateAddon' :: Maybe Text
addonVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:CreateAddon' :: Maybe Text
clientRequestToken = forall a. Maybe a
Prelude.Nothing,
      $sel:configurationValues:CreateAddon' :: Maybe Text
configurationValues = forall a. Maybe a
Prelude.Nothing,
      $sel:resolveConflicts:CreateAddon' :: Maybe ResolveConflicts
resolveConflicts = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceAccountRoleArn:CreateAddon' :: Maybe Text
serviceAccountRoleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateAddon' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:clusterName:CreateAddon' :: Text
clusterName = Text
pClusterName_,
      $sel:addonName:CreateAddon' :: Text
addonName = Text
pAddonName_
    }

-- | The version of the add-on. The version must match one of the versions
-- returned by
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
-- .
createAddon_addonVersion :: Lens.Lens' CreateAddon (Prelude.Maybe Prelude.Text)
createAddon_addonVersion :: Lens' CreateAddon (Maybe Text)
createAddon_addonVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Maybe Text
addonVersion :: Maybe Text
$sel:addonVersion:CreateAddon' :: CreateAddon -> Maybe Text
addonVersion} -> Maybe Text
addonVersion) (\s :: CreateAddon
s@CreateAddon' {} Maybe Text
a -> CreateAddon
s {$sel:addonVersion:CreateAddon' :: Maybe Text
addonVersion = Maybe Text
a} :: CreateAddon)

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

-- | The set of configuration values for the add-on that\'s created. The
-- values that you provide are validated against the schema in
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonConfiguration.html DescribeAddonConfiguration>
-- .
createAddon_configurationValues :: Lens.Lens' CreateAddon (Prelude.Maybe Prelude.Text)
createAddon_configurationValues :: Lens' CreateAddon (Maybe Text)
createAddon_configurationValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Maybe Text
configurationValues :: Maybe Text
$sel:configurationValues:CreateAddon' :: CreateAddon -> Maybe Text
configurationValues} -> Maybe Text
configurationValues) (\s :: CreateAddon
s@CreateAddon' {} Maybe Text
a -> CreateAddon
s {$sel:configurationValues:CreateAddon' :: Maybe Text
configurationValues = Maybe Text
a} :: CreateAddon)

-- | How to resolve field value conflicts for an Amazon EKS add-on. Conflicts
-- are handled based on the value you choose:
--
-- -   __None__ – If the self-managed version of the add-on is installed on
--     your cluster, Amazon EKS doesn\'t change the value. Creation of the
--     add-on might fail.
--
-- -   __Overwrite__ – If the self-managed version of the add-on is
--     installed on your cluster and the Amazon EKS default value is
--     different than the existing value, Amazon EKS changes the value to
--     the Amazon EKS default value.
--
-- -   __Preserve__ – Not supported. You can set this value when updating
--     an add-on though. For more information, see
--     <https://docs.aws.amazon.com/eks/latest/APIReference/API_UpdateAddon.html UpdateAddon>.
--
-- If you don\'t currently have the self-managed version of the add-on
-- installed on your cluster, the Amazon EKS add-on is installed. Amazon
-- EKS sets all values to default values, regardless of the option that you
-- specify.
createAddon_resolveConflicts :: Lens.Lens' CreateAddon (Prelude.Maybe ResolveConflicts)
createAddon_resolveConflicts :: Lens' CreateAddon (Maybe ResolveConflicts)
createAddon_resolveConflicts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Maybe ResolveConflicts
resolveConflicts :: Maybe ResolveConflicts
$sel:resolveConflicts:CreateAddon' :: CreateAddon -> Maybe ResolveConflicts
resolveConflicts} -> Maybe ResolveConflicts
resolveConflicts) (\s :: CreateAddon
s@CreateAddon' {} Maybe ResolveConflicts
a -> CreateAddon
s {$sel:resolveConflicts:CreateAddon' :: Maybe ResolveConflicts
resolveConflicts = Maybe ResolveConflicts
a} :: CreateAddon)

-- | The Amazon Resource Name (ARN) of an existing IAM role to bind to the
-- add-on\'s service account. The role must be assigned the IAM permissions
-- required by the add-on. If you don\'t specify an existing IAM role, then
-- the add-on uses the permissions assigned to the node IAM role. For more
-- information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html Amazon EKS node IAM role>
-- in the /Amazon EKS User Guide/.
--
-- To specify an existing IAM role, you must have an IAM OpenID Connect
-- (OIDC) provider created for your cluster. For more information, see
-- <https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html Enabling IAM roles for service accounts on your cluster>
-- in the /Amazon EKS User Guide/.
createAddon_serviceAccountRoleArn :: Lens.Lens' CreateAddon (Prelude.Maybe Prelude.Text)
createAddon_serviceAccountRoleArn :: Lens' CreateAddon (Maybe Text)
createAddon_serviceAccountRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Maybe Text
serviceAccountRoleArn :: Maybe Text
$sel:serviceAccountRoleArn:CreateAddon' :: CreateAddon -> Maybe Text
serviceAccountRoleArn} -> Maybe Text
serviceAccountRoleArn) (\s :: CreateAddon
s@CreateAddon' {} Maybe Text
a -> CreateAddon
s {$sel:serviceAccountRoleArn:CreateAddon' :: Maybe Text
serviceAccountRoleArn = Maybe Text
a} :: CreateAddon)

-- | The metadata to apply to the cluster to assist with categorization and
-- organization. Each tag consists of a key and an optional value. You
-- define both.
createAddon_tags :: Lens.Lens' CreateAddon (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createAddon_tags :: Lens' CreateAddon (Maybe (HashMap Text Text))
createAddon_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateAddon' :: CreateAddon -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateAddon
s@CreateAddon' {} Maybe (HashMap Text Text)
a -> CreateAddon
s {$sel:tags:CreateAddon' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateAddon) 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 cluster to create the add-on for.
createAddon_clusterName :: Lens.Lens' CreateAddon Prelude.Text
createAddon_clusterName :: Lens' CreateAddon Text
createAddon_clusterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Text
clusterName :: Text
$sel:clusterName:CreateAddon' :: CreateAddon -> Text
clusterName} -> Text
clusterName) (\s :: CreateAddon
s@CreateAddon' {} Text
a -> CreateAddon
s {$sel:clusterName:CreateAddon' :: Text
clusterName = Text
a} :: CreateAddon)

-- | The name of the add-on. The name must match one of the names that
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_DescribeAddonVersions.html DescribeAddonVersions>
-- returns.
createAddon_addonName :: Lens.Lens' CreateAddon Prelude.Text
createAddon_addonName :: Lens' CreateAddon Text
createAddon_addonName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddon' {Text
addonName :: Text
$sel:addonName:CreateAddon' :: CreateAddon -> Text
addonName} -> Text
addonName) (\s :: CreateAddon
s@CreateAddon' {} Text
a -> CreateAddon
s {$sel:addonName:CreateAddon' :: Text
addonName = Text
a} :: CreateAddon)

instance Core.AWSRequest CreateAddon where
  type AWSResponse CreateAddon = CreateAddonResponse
  request :: (Service -> Service) -> CreateAddon -> Request CreateAddon
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 CreateAddon
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAddon)))
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 Addon -> Int -> CreateAddonResponse
CreateAddonResponse'
            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
"addon")
            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 CreateAddon where
  hashWithSalt :: Int -> CreateAddon -> Int
hashWithSalt Int
_salt CreateAddon' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResolveConflicts
Text
addonName :: Text
clusterName :: Text
tags :: Maybe (HashMap Text Text)
serviceAccountRoleArn :: Maybe Text
resolveConflicts :: Maybe ResolveConflicts
configurationValues :: Maybe Text
clientRequestToken :: Maybe Text
addonVersion :: Maybe Text
$sel:addonName:CreateAddon' :: CreateAddon -> Text
$sel:clusterName:CreateAddon' :: CreateAddon -> Text
$sel:tags:CreateAddon' :: CreateAddon -> Maybe (HashMap Text Text)
$sel:serviceAccountRoleArn:CreateAddon' :: CreateAddon -> Maybe Text
$sel:resolveConflicts:CreateAddon' :: CreateAddon -> Maybe ResolveConflicts
$sel:configurationValues:CreateAddon' :: CreateAddon -> Maybe Text
$sel:clientRequestToken:CreateAddon' :: CreateAddon -> Maybe Text
$sel:addonVersion:CreateAddon' :: CreateAddon -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
addonVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configurationValues
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ResolveConflicts
resolveConflicts
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serviceAccountRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
addonName

instance Prelude.NFData CreateAddon where
  rnf :: CreateAddon -> ()
rnf CreateAddon' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResolveConflicts
Text
addonName :: Text
clusterName :: Text
tags :: Maybe (HashMap Text Text)
serviceAccountRoleArn :: Maybe Text
resolveConflicts :: Maybe ResolveConflicts
configurationValues :: Maybe Text
clientRequestToken :: Maybe Text
addonVersion :: Maybe Text
$sel:addonName:CreateAddon' :: CreateAddon -> Text
$sel:clusterName:CreateAddon' :: CreateAddon -> Text
$sel:tags:CreateAddon' :: CreateAddon -> Maybe (HashMap Text Text)
$sel:serviceAccountRoleArn:CreateAddon' :: CreateAddon -> Maybe Text
$sel:resolveConflicts:CreateAddon' :: CreateAddon -> Maybe ResolveConflicts
$sel:configurationValues:CreateAddon' :: CreateAddon -> Maybe Text
$sel:clientRequestToken:CreateAddon' :: CreateAddon -> Maybe Text
$sel:addonVersion:CreateAddon' :: CreateAddon -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
addonVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
configurationValues
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ResolveConflicts
resolveConflicts
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serviceAccountRoleArn
      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
clusterName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
addonName

instance Data.ToHeaders CreateAddon where
  toHeaders :: CreateAddon -> 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 CreateAddon where
  toJSON :: CreateAddon -> Value
toJSON CreateAddon' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResolveConflicts
Text
addonName :: Text
clusterName :: Text
tags :: Maybe (HashMap Text Text)
serviceAccountRoleArn :: Maybe Text
resolveConflicts :: Maybe ResolveConflicts
configurationValues :: Maybe Text
clientRequestToken :: Maybe Text
addonVersion :: Maybe Text
$sel:addonName:CreateAddon' :: CreateAddon -> Text
$sel:clusterName:CreateAddon' :: CreateAddon -> Text
$sel:tags:CreateAddon' :: CreateAddon -> Maybe (HashMap Text Text)
$sel:serviceAccountRoleArn:CreateAddon' :: CreateAddon -> Maybe Text
$sel:resolveConflicts:CreateAddon' :: CreateAddon -> Maybe ResolveConflicts
$sel:configurationValues:CreateAddon' :: CreateAddon -> Maybe Text
$sel:clientRequestToken:CreateAddon' :: CreateAddon -> Maybe Text
$sel:addonVersion:CreateAddon' :: CreateAddon -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"addonVersion" 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
addonVersion,
            (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
"configurationValues" 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
configurationValues,
            (Key
"resolveConflicts" 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 ResolveConflicts
resolveConflicts,
            (Key
"serviceAccountRoleArn" 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
serviceAccountRoleArn,
            (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
"addonName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
addonName)
          ]
      )

instance Data.ToPath CreateAddon where
  toPath :: CreateAddon -> ByteString
toPath CreateAddon' {Maybe Text
Maybe (HashMap Text Text)
Maybe ResolveConflicts
Text
addonName :: Text
clusterName :: Text
tags :: Maybe (HashMap Text Text)
serviceAccountRoleArn :: Maybe Text
resolveConflicts :: Maybe ResolveConflicts
configurationValues :: Maybe Text
clientRequestToken :: Maybe Text
addonVersion :: Maybe Text
$sel:addonName:CreateAddon' :: CreateAddon -> Text
$sel:clusterName:CreateAddon' :: CreateAddon -> Text
$sel:tags:CreateAddon' :: CreateAddon -> Maybe (HashMap Text Text)
$sel:serviceAccountRoleArn:CreateAddon' :: CreateAddon -> Maybe Text
$sel:resolveConflicts:CreateAddon' :: CreateAddon -> Maybe ResolveConflicts
$sel:configurationValues:CreateAddon' :: CreateAddon -> Maybe Text
$sel:clientRequestToken:CreateAddon' :: CreateAddon -> Maybe Text
$sel:addonVersion:CreateAddon' :: CreateAddon -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/clusters/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
clusterName, ByteString
"/addons"]

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

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

-- |
-- Create a value of 'CreateAddonResponse' 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:
--
-- 'addon', 'createAddonResponse_addon' - Undocumented member.
--
-- 'httpStatus', 'createAddonResponse_httpStatus' - The response's http status code.
newCreateAddonResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateAddonResponse
newCreateAddonResponse :: Int -> CreateAddonResponse
newCreateAddonResponse Int
pHttpStatus_ =
  CreateAddonResponse'
    { $sel:addon:CreateAddonResponse' :: Maybe Addon
addon = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateAddonResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
createAddonResponse_addon :: Lens.Lens' CreateAddonResponse (Prelude.Maybe Addon)
createAddonResponse_addon :: Lens' CreateAddonResponse (Maybe Addon)
createAddonResponse_addon = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAddonResponse' {Maybe Addon
addon :: Maybe Addon
$sel:addon:CreateAddonResponse' :: CreateAddonResponse -> Maybe Addon
addon} -> Maybe Addon
addon) (\s :: CreateAddonResponse
s@CreateAddonResponse' {} Maybe Addon
a -> CreateAddonResponse
s {$sel:addon:CreateAddonResponse' :: Maybe Addon
addon = Maybe Addon
a} :: CreateAddonResponse)

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

instance Prelude.NFData CreateAddonResponse where
  rnf :: CreateAddonResponse -> ()
rnf CreateAddonResponse' {Int
Maybe Addon
httpStatus :: Int
addon :: Maybe Addon
$sel:httpStatus:CreateAddonResponse' :: CreateAddonResponse -> Int
$sel:addon:CreateAddonResponse' :: CreateAddonResponse -> Maybe Addon
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Addon
addon
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus