{-# 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.UpdateAddon
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates an Amazon EKS add-on.
module Amazonka.EKS.UpdateAddon
  ( -- * Creating a Request
    UpdateAddon (..),
    newUpdateAddon,

    -- * Request Lenses
    updateAddon_addonVersion,
    updateAddon_clientRequestToken,
    updateAddon_configurationValues,
    updateAddon_resolveConflicts,
    updateAddon_serviceAccountRoleArn,
    updateAddon_clusterName,
    updateAddon_addonName,

    -- * Destructuring the Response
    UpdateAddonResponse (..),
    newUpdateAddonResponse,

    -- * Response Lenses
    updateAddonResponse_update,
    updateAddonResponse_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:/ 'newUpdateAddon' smart constructor.
data UpdateAddon = UpdateAddon'
  { -- | 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>
    -- .
    UpdateAddon -> Maybe Text
addonVersion :: Prelude.Maybe Prelude.Text,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request.
    UpdateAddon -> 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>.
    UpdateAddon -> Maybe Text
configurationValues :: Prelude.Maybe Prelude.Text,
    -- | How to resolve field value conflicts for an Amazon EKS add-on if you\'ve
    -- changed a value from the Amazon EKS default value. Conflicts are handled
    -- based on the option you choose:
    --
    -- -   __None__ – Amazon EKS doesn\'t change the value. The update might
    --     fail.
    --
    -- -   __Overwrite__ – Amazon EKS overwrites the changed value back to the
    --     Amazon EKS default value.
    --
    -- -   __Preserve__ – Amazon EKS preserves the value. If you choose this
    --     option, we recommend that you test any field and value changes on a
    --     non-production cluster before updating the add-on on your production
    --     cluster.
    UpdateAddon -> 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/.
    UpdateAddon -> Maybe Text
serviceAccountRoleArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the cluster.
    UpdateAddon -> Text
clusterName :: Prelude.Text,
    -- | The name of the add-on. The name must match one of the names returned by
    -- <https://docs.aws.amazon.com/eks/latest/APIReference/API_ListAddons.html ListAddons>
    -- .
    UpdateAddon -> Text
addonName :: Prelude.Text
  }
  deriving (UpdateAddon -> UpdateAddon -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAddon -> UpdateAddon -> Bool
$c/= :: UpdateAddon -> UpdateAddon -> Bool
== :: UpdateAddon -> UpdateAddon -> Bool
$c== :: UpdateAddon -> UpdateAddon -> Bool
Prelude.Eq, ReadPrec [UpdateAddon]
ReadPrec UpdateAddon
Int -> ReadS UpdateAddon
ReadS [UpdateAddon]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAddon]
$creadListPrec :: ReadPrec [UpdateAddon]
readPrec :: ReadPrec UpdateAddon
$creadPrec :: ReadPrec UpdateAddon
readList :: ReadS [UpdateAddon]
$creadList :: ReadS [UpdateAddon]
readsPrec :: Int -> ReadS UpdateAddon
$creadsPrec :: Int -> ReadS UpdateAddon
Prelude.Read, Int -> UpdateAddon -> ShowS
[UpdateAddon] -> ShowS
UpdateAddon -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAddon] -> ShowS
$cshowList :: [UpdateAddon] -> ShowS
show :: UpdateAddon -> String
$cshow :: UpdateAddon -> String
showsPrec :: Int -> UpdateAddon -> ShowS
$cshowsPrec :: Int -> UpdateAddon -> ShowS
Prelude.Show, forall x. Rep UpdateAddon x -> UpdateAddon
forall x. UpdateAddon -> Rep UpdateAddon x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAddon x -> UpdateAddon
$cfrom :: forall x. UpdateAddon -> Rep UpdateAddon x
Prelude.Generic)

-- |
-- Create a value of 'UpdateAddon' 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', 'updateAddon_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', 'updateAddon_clientRequestToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request.
--
-- 'configurationValues', 'updateAddon_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', 'updateAddon_resolveConflicts' - How to resolve field value conflicts for an Amazon EKS add-on if you\'ve
-- changed a value from the Amazon EKS default value. Conflicts are handled
-- based on the option you choose:
--
-- -   __None__ – Amazon EKS doesn\'t change the value. The update might
--     fail.
--
-- -   __Overwrite__ – Amazon EKS overwrites the changed value back to the
--     Amazon EKS default value.
--
-- -   __Preserve__ – Amazon EKS preserves the value. If you choose this
--     option, we recommend that you test any field and value changes on a
--     non-production cluster before updating the add-on on your production
--     cluster.
--
-- 'serviceAccountRoleArn', 'updateAddon_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/.
--
-- 'clusterName', 'updateAddon_clusterName' - The name of the cluster.
--
-- 'addonName', 'updateAddon_addonName' - The name of the add-on. The name must match one of the names returned by
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_ListAddons.html ListAddons>
-- .
newUpdateAddon ::
  -- | 'clusterName'
  Prelude.Text ->
  -- | 'addonName'
  Prelude.Text ->
  UpdateAddon
newUpdateAddon :: Text -> Text -> UpdateAddon
newUpdateAddon Text
pClusterName_ Text
pAddonName_ =
  UpdateAddon'
    { $sel:addonVersion:UpdateAddon' :: Maybe Text
addonVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:UpdateAddon' :: Maybe Text
clientRequestToken = forall a. Maybe a
Prelude.Nothing,
      $sel:configurationValues:UpdateAddon' :: Maybe Text
configurationValues = forall a. Maybe a
Prelude.Nothing,
      $sel:resolveConflicts:UpdateAddon' :: Maybe ResolveConflicts
resolveConflicts = forall a. Maybe a
Prelude.Nothing,
      $sel:serviceAccountRoleArn:UpdateAddon' :: Maybe Text
serviceAccountRoleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:clusterName:UpdateAddon' :: Text
clusterName = Text
pClusterName_,
      $sel:addonName:UpdateAddon' :: 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>
-- .
updateAddon_addonVersion :: Lens.Lens' UpdateAddon (Prelude.Maybe Prelude.Text)
updateAddon_addonVersion :: Lens' UpdateAddon (Maybe Text)
updateAddon_addonVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Maybe Text
addonVersion :: Maybe Text
$sel:addonVersion:UpdateAddon' :: UpdateAddon -> Maybe Text
addonVersion} -> Maybe Text
addonVersion) (\s :: UpdateAddon
s@UpdateAddon' {} Maybe Text
a -> UpdateAddon
s {$sel:addonVersion:UpdateAddon' :: Maybe Text
addonVersion = Maybe Text
a} :: UpdateAddon)

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

-- | 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>.
updateAddon_configurationValues :: Lens.Lens' UpdateAddon (Prelude.Maybe Prelude.Text)
updateAddon_configurationValues :: Lens' UpdateAddon (Maybe Text)
updateAddon_configurationValues = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Maybe Text
configurationValues :: Maybe Text
$sel:configurationValues:UpdateAddon' :: UpdateAddon -> Maybe Text
configurationValues} -> Maybe Text
configurationValues) (\s :: UpdateAddon
s@UpdateAddon' {} Maybe Text
a -> UpdateAddon
s {$sel:configurationValues:UpdateAddon' :: Maybe Text
configurationValues = Maybe Text
a} :: UpdateAddon)

-- | How to resolve field value conflicts for an Amazon EKS add-on if you\'ve
-- changed a value from the Amazon EKS default value. Conflicts are handled
-- based on the option you choose:
--
-- -   __None__ – Amazon EKS doesn\'t change the value. The update might
--     fail.
--
-- -   __Overwrite__ – Amazon EKS overwrites the changed value back to the
--     Amazon EKS default value.
--
-- -   __Preserve__ – Amazon EKS preserves the value. If you choose this
--     option, we recommend that you test any field and value changes on a
--     non-production cluster before updating the add-on on your production
--     cluster.
updateAddon_resolveConflicts :: Lens.Lens' UpdateAddon (Prelude.Maybe ResolveConflicts)
updateAddon_resolveConflicts :: Lens' UpdateAddon (Maybe ResolveConflicts)
updateAddon_resolveConflicts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Maybe ResolveConflicts
resolveConflicts :: Maybe ResolveConflicts
$sel:resolveConflicts:UpdateAddon' :: UpdateAddon -> Maybe ResolveConflicts
resolveConflicts} -> Maybe ResolveConflicts
resolveConflicts) (\s :: UpdateAddon
s@UpdateAddon' {} Maybe ResolveConflicts
a -> UpdateAddon
s {$sel:resolveConflicts:UpdateAddon' :: Maybe ResolveConflicts
resolveConflicts = Maybe ResolveConflicts
a} :: UpdateAddon)

-- | 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/.
updateAddon_serviceAccountRoleArn :: Lens.Lens' UpdateAddon (Prelude.Maybe Prelude.Text)
updateAddon_serviceAccountRoleArn :: Lens' UpdateAddon (Maybe Text)
updateAddon_serviceAccountRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Maybe Text
serviceAccountRoleArn :: Maybe Text
$sel:serviceAccountRoleArn:UpdateAddon' :: UpdateAddon -> Maybe Text
serviceAccountRoleArn} -> Maybe Text
serviceAccountRoleArn) (\s :: UpdateAddon
s@UpdateAddon' {} Maybe Text
a -> UpdateAddon
s {$sel:serviceAccountRoleArn:UpdateAddon' :: Maybe Text
serviceAccountRoleArn = Maybe Text
a} :: UpdateAddon)

-- | The name of the cluster.
updateAddon_clusterName :: Lens.Lens' UpdateAddon Prelude.Text
updateAddon_clusterName :: Lens' UpdateAddon Text
updateAddon_clusterName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Text
clusterName :: Text
$sel:clusterName:UpdateAddon' :: UpdateAddon -> Text
clusterName} -> Text
clusterName) (\s :: UpdateAddon
s@UpdateAddon' {} Text
a -> UpdateAddon
s {$sel:clusterName:UpdateAddon' :: Text
clusterName = Text
a} :: UpdateAddon)

-- | The name of the add-on. The name must match one of the names returned by
-- <https://docs.aws.amazon.com/eks/latest/APIReference/API_ListAddons.html ListAddons>
-- .
updateAddon_addonName :: Lens.Lens' UpdateAddon Prelude.Text
updateAddon_addonName :: Lens' UpdateAddon Text
updateAddon_addonName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddon' {Text
addonName :: Text
$sel:addonName:UpdateAddon' :: UpdateAddon -> Text
addonName} -> Text
addonName) (\s :: UpdateAddon
s@UpdateAddon' {} Text
a -> UpdateAddon
s {$sel:addonName:UpdateAddon' :: Text
addonName = Text
a} :: UpdateAddon)

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

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

instance Data.ToHeaders UpdateAddon where
  toHeaders :: UpdateAddon -> 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 UpdateAddon where
  toJSON :: UpdateAddon -> Value
toJSON UpdateAddon' {Maybe Text
Maybe ResolveConflicts
Text
addonName :: Text
clusterName :: Text
serviceAccountRoleArn :: Maybe Text
resolveConflicts :: Maybe ResolveConflicts
configurationValues :: Maybe Text
clientRequestToken :: Maybe Text
addonVersion :: Maybe Text
$sel:addonName:UpdateAddon' :: UpdateAddon -> Text
$sel:clusterName:UpdateAddon' :: UpdateAddon -> Text
$sel:serviceAccountRoleArn:UpdateAddon' :: UpdateAddon -> Maybe Text
$sel:resolveConflicts:UpdateAddon' :: UpdateAddon -> Maybe ResolveConflicts
$sel:configurationValues:UpdateAddon' :: UpdateAddon -> Maybe Text
$sel:clientRequestToken:UpdateAddon' :: UpdateAddon -> Maybe Text
$sel:addonVersion:UpdateAddon' :: UpdateAddon -> 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
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateAddonResponse' 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:
--
-- 'update', 'updateAddonResponse_update' - Undocumented member.
--
-- 'httpStatus', 'updateAddonResponse_httpStatus' - The response's http status code.
newUpdateAddonResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateAddonResponse
newUpdateAddonResponse :: Int -> UpdateAddonResponse
newUpdateAddonResponse Int
pHttpStatus_ =
  UpdateAddonResponse'
    { $sel:update:UpdateAddonResponse' :: Maybe Update
update = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateAddonResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
updateAddonResponse_update :: Lens.Lens' UpdateAddonResponse (Prelude.Maybe Update)
updateAddonResponse_update :: Lens' UpdateAddonResponse (Maybe Update)
updateAddonResponse_update = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAddonResponse' {Maybe Update
update :: Maybe Update
$sel:update:UpdateAddonResponse' :: UpdateAddonResponse -> Maybe Update
update} -> Maybe Update
update) (\s :: UpdateAddonResponse
s@UpdateAddonResponse' {} Maybe Update
a -> UpdateAddonResponse
s {$sel:update:UpdateAddonResponse' :: Maybe Update
update = Maybe Update
a} :: UpdateAddonResponse)

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

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