{-# 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.Redshift.ModifyClusterDbRevision
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Modifies the database revision of a cluster. The database revision is a
-- unique revision of the database running in a cluster.
module Amazonka.Redshift.ModifyClusterDbRevision
  ( -- * Creating a Request
    ModifyClusterDbRevision (..),
    newModifyClusterDbRevision,

    -- * Request Lenses
    modifyClusterDbRevision_clusterIdentifier,
    modifyClusterDbRevision_revisionTarget,

    -- * Destructuring the Response
    ModifyClusterDbRevisionResponse (..),
    newModifyClusterDbRevisionResponse,

    -- * Response Lenses
    modifyClusterDbRevisionResponse_cluster,
    modifyClusterDbRevisionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newModifyClusterDbRevision' smart constructor.
data ModifyClusterDbRevision = ModifyClusterDbRevision'
  { -- | The unique identifier of a cluster whose database revision you want to
    -- modify.
    --
    -- Example: @examplecluster@
    ModifyClusterDbRevision -> Text
clusterIdentifier :: Prelude.Text,
    -- | The identifier of the database revision. You can retrieve this value
    -- from the response to the DescribeClusterDbRevisions request.
    ModifyClusterDbRevision -> Text
revisionTarget :: Prelude.Text
  }
  deriving (ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool
(ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool)
-> (ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool)
-> Eq ModifyClusterDbRevision
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool
$c/= :: ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool
== :: ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool
$c== :: ModifyClusterDbRevision -> ModifyClusterDbRevision -> Bool
Prelude.Eq, ReadPrec [ModifyClusterDbRevision]
ReadPrec ModifyClusterDbRevision
Int -> ReadS ModifyClusterDbRevision
ReadS [ModifyClusterDbRevision]
(Int -> ReadS ModifyClusterDbRevision)
-> ReadS [ModifyClusterDbRevision]
-> ReadPrec ModifyClusterDbRevision
-> ReadPrec [ModifyClusterDbRevision]
-> Read ModifyClusterDbRevision
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyClusterDbRevision]
$creadListPrec :: ReadPrec [ModifyClusterDbRevision]
readPrec :: ReadPrec ModifyClusterDbRevision
$creadPrec :: ReadPrec ModifyClusterDbRevision
readList :: ReadS [ModifyClusterDbRevision]
$creadList :: ReadS [ModifyClusterDbRevision]
readsPrec :: Int -> ReadS ModifyClusterDbRevision
$creadsPrec :: Int -> ReadS ModifyClusterDbRevision
Prelude.Read, Int -> ModifyClusterDbRevision -> ShowS
[ModifyClusterDbRevision] -> ShowS
ModifyClusterDbRevision -> String
(Int -> ModifyClusterDbRevision -> ShowS)
-> (ModifyClusterDbRevision -> String)
-> ([ModifyClusterDbRevision] -> ShowS)
-> Show ModifyClusterDbRevision
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyClusterDbRevision] -> ShowS
$cshowList :: [ModifyClusterDbRevision] -> ShowS
show :: ModifyClusterDbRevision -> String
$cshow :: ModifyClusterDbRevision -> String
showsPrec :: Int -> ModifyClusterDbRevision -> ShowS
$cshowsPrec :: Int -> ModifyClusterDbRevision -> ShowS
Prelude.Show, (forall x.
 ModifyClusterDbRevision -> Rep ModifyClusterDbRevision x)
-> (forall x.
    Rep ModifyClusterDbRevision x -> ModifyClusterDbRevision)
-> Generic ModifyClusterDbRevision
forall x. Rep ModifyClusterDbRevision x -> ModifyClusterDbRevision
forall x. ModifyClusterDbRevision -> Rep ModifyClusterDbRevision x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyClusterDbRevision x -> ModifyClusterDbRevision
$cfrom :: forall x. ModifyClusterDbRevision -> Rep ModifyClusterDbRevision x
Prelude.Generic)

-- |
-- Create a value of 'ModifyClusterDbRevision' 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:
--
-- 'clusterIdentifier', 'modifyClusterDbRevision_clusterIdentifier' - The unique identifier of a cluster whose database revision you want to
-- modify.
--
-- Example: @examplecluster@
--
-- 'revisionTarget', 'modifyClusterDbRevision_revisionTarget' - The identifier of the database revision. You can retrieve this value
-- from the response to the DescribeClusterDbRevisions request.
newModifyClusterDbRevision ::
  -- | 'clusterIdentifier'
  Prelude.Text ->
  -- | 'revisionTarget'
  Prelude.Text ->
  ModifyClusterDbRevision
newModifyClusterDbRevision :: Text -> Text -> ModifyClusterDbRevision
newModifyClusterDbRevision
  Text
pClusterIdentifier_
  Text
pRevisionTarget_ =
    ModifyClusterDbRevision' :: Text -> Text -> ModifyClusterDbRevision
ModifyClusterDbRevision'
      { $sel:clusterIdentifier:ModifyClusterDbRevision' :: Text
clusterIdentifier =
          Text
pClusterIdentifier_,
        $sel:revisionTarget:ModifyClusterDbRevision' :: Text
revisionTarget = Text
pRevisionTarget_
      }

-- | The unique identifier of a cluster whose database revision you want to
-- modify.
--
-- Example: @examplecluster@
modifyClusterDbRevision_clusterIdentifier :: Lens.Lens' ModifyClusterDbRevision Prelude.Text
modifyClusterDbRevision_clusterIdentifier :: (Text -> f Text)
-> ModifyClusterDbRevision -> f ModifyClusterDbRevision
modifyClusterDbRevision_clusterIdentifier = (ModifyClusterDbRevision -> Text)
-> (ModifyClusterDbRevision -> Text -> ModifyClusterDbRevision)
-> Lens ModifyClusterDbRevision ModifyClusterDbRevision Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterDbRevision' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:ModifyClusterDbRevision' :: ModifyClusterDbRevision -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: ModifyClusterDbRevision
s@ModifyClusterDbRevision' {} Text
a -> ModifyClusterDbRevision
s {$sel:clusterIdentifier:ModifyClusterDbRevision' :: Text
clusterIdentifier = Text
a} :: ModifyClusterDbRevision)

-- | The identifier of the database revision. You can retrieve this value
-- from the response to the DescribeClusterDbRevisions request.
modifyClusterDbRevision_revisionTarget :: Lens.Lens' ModifyClusterDbRevision Prelude.Text
modifyClusterDbRevision_revisionTarget :: (Text -> f Text)
-> ModifyClusterDbRevision -> f ModifyClusterDbRevision
modifyClusterDbRevision_revisionTarget = (ModifyClusterDbRevision -> Text)
-> (ModifyClusterDbRevision -> Text -> ModifyClusterDbRevision)
-> Lens ModifyClusterDbRevision ModifyClusterDbRevision Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterDbRevision' {Text
revisionTarget :: Text
$sel:revisionTarget:ModifyClusterDbRevision' :: ModifyClusterDbRevision -> Text
revisionTarget} -> Text
revisionTarget) (\s :: ModifyClusterDbRevision
s@ModifyClusterDbRevision' {} Text
a -> ModifyClusterDbRevision
s {$sel:revisionTarget:ModifyClusterDbRevision' :: Text
revisionTarget = Text
a} :: ModifyClusterDbRevision)

instance Core.AWSRequest ModifyClusterDbRevision where
  type
    AWSResponse ModifyClusterDbRevision =
      ModifyClusterDbRevisionResponse
  request :: ModifyClusterDbRevision -> Request ModifyClusterDbRevision
request = Service
-> ModifyClusterDbRevision -> Request ModifyClusterDbRevision
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyClusterDbRevision
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterDbRevision)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse ModifyClusterDbRevision))
-> Logger
-> Service
-> Proxy ModifyClusterDbRevision
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterDbRevision)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ModifyClusterDbRevisionResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Cluster -> Int -> ModifyClusterDbRevisionResponse
ModifyClusterDbRevisionResponse'
            (Maybe Cluster -> Int -> ModifyClusterDbRevisionResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> ModifyClusterDbRevisionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Cluster)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Cluster")
            Either String (Int -> ModifyClusterDbRevisionResponse)
-> Either String Int
-> Either String ModifyClusterDbRevisionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ModifyClusterDbRevision

instance Prelude.NFData ModifyClusterDbRevision

instance Core.ToHeaders ModifyClusterDbRevision where
  toHeaders :: ModifyClusterDbRevision -> ResponseHeaders
toHeaders = ResponseHeaders -> ModifyClusterDbRevision -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath ModifyClusterDbRevision where
  toPath :: ModifyClusterDbRevision -> ByteString
toPath = ByteString -> ModifyClusterDbRevision -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ModifyClusterDbRevision where
  toQuery :: ModifyClusterDbRevision -> QueryString
toQuery ModifyClusterDbRevision' {Text
revisionTarget :: Text
clusterIdentifier :: Text
$sel:revisionTarget:ModifyClusterDbRevision' :: ModifyClusterDbRevision -> Text
$sel:clusterIdentifier:ModifyClusterDbRevision' :: ModifyClusterDbRevision -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"ModifyClusterDbRevision" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier,
        ByteString
"RevisionTarget" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
revisionTarget
      ]

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

-- |
-- Create a value of 'ModifyClusterDbRevisionResponse' 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:
--
-- 'cluster', 'modifyClusterDbRevisionResponse_cluster' - Undocumented member.
--
-- 'httpStatus', 'modifyClusterDbRevisionResponse_httpStatus' - The response's http status code.
newModifyClusterDbRevisionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyClusterDbRevisionResponse
newModifyClusterDbRevisionResponse :: Int -> ModifyClusterDbRevisionResponse
newModifyClusterDbRevisionResponse Int
pHttpStatus_ =
  ModifyClusterDbRevisionResponse' :: Maybe Cluster -> Int -> ModifyClusterDbRevisionResponse
ModifyClusterDbRevisionResponse'
    { $sel:cluster:ModifyClusterDbRevisionResponse' :: Maybe Cluster
cluster =
        Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ModifyClusterDbRevisionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
modifyClusterDbRevisionResponse_cluster :: Lens.Lens' ModifyClusterDbRevisionResponse (Prelude.Maybe Cluster)
modifyClusterDbRevisionResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> ModifyClusterDbRevisionResponse
-> f ModifyClusterDbRevisionResponse
modifyClusterDbRevisionResponse_cluster = (ModifyClusterDbRevisionResponse -> Maybe Cluster)
-> (ModifyClusterDbRevisionResponse
    -> Maybe Cluster -> ModifyClusterDbRevisionResponse)
-> Lens
     ModifyClusterDbRevisionResponse
     ModifyClusterDbRevisionResponse
     (Maybe Cluster)
     (Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterDbRevisionResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:ModifyClusterDbRevisionResponse' :: ModifyClusterDbRevisionResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: ModifyClusterDbRevisionResponse
s@ModifyClusterDbRevisionResponse' {} Maybe Cluster
a -> ModifyClusterDbRevisionResponse
s {$sel:cluster:ModifyClusterDbRevisionResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: ModifyClusterDbRevisionResponse)

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

instance
  Prelude.NFData
    ModifyClusterDbRevisionResponse