{-# 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.UpdatePartnerStatus
-- 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)
--
-- Updates the status of a partner integration.
module Amazonka.Redshift.UpdatePartnerStatus
  ( -- * Creating a Request
    UpdatePartnerStatus (..),
    newUpdatePartnerStatus,

    -- * Request Lenses
    updatePartnerStatus_statusMessage,
    updatePartnerStatus_accountId,
    updatePartnerStatus_clusterIdentifier,
    updatePartnerStatus_databaseName,
    updatePartnerStatus_partnerName,
    updatePartnerStatus_status,

    -- * Destructuring the Response
    PartnerIntegrationOutputMessage (..),
    newPartnerIntegrationOutputMessage,

    -- * Response Lenses
    partnerIntegrationOutputMessage_partnerName,
    partnerIntegrationOutputMessage_databaseName,
  )
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:/ 'newUpdatePartnerStatus' smart constructor.
data UpdatePartnerStatus = UpdatePartnerStatus'
  { -- | The status message provided by the partner.
    UpdatePartnerStatus -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account ID that owns the cluster.
    UpdatePartnerStatus -> Text
accountId :: Prelude.Text,
    -- | The cluster identifier of the cluster whose partner integration status
    -- is being updated.
    UpdatePartnerStatus -> Text
clusterIdentifier :: Prelude.Text,
    -- | The name of the database whose partner integration status is being
    -- updated.
    UpdatePartnerStatus -> Text
databaseName :: Prelude.Text,
    -- | The name of the partner whose integration status is being updated.
    UpdatePartnerStatus -> Text
partnerName :: Prelude.Text,
    -- | The value of the updated status.
    UpdatePartnerStatus -> PartnerIntegrationStatus
status :: PartnerIntegrationStatus
  }
  deriving (UpdatePartnerStatus -> UpdatePartnerStatus -> Bool
(UpdatePartnerStatus -> UpdatePartnerStatus -> Bool)
-> (UpdatePartnerStatus -> UpdatePartnerStatus -> Bool)
-> Eq UpdatePartnerStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdatePartnerStatus -> UpdatePartnerStatus -> Bool
$c/= :: UpdatePartnerStatus -> UpdatePartnerStatus -> Bool
== :: UpdatePartnerStatus -> UpdatePartnerStatus -> Bool
$c== :: UpdatePartnerStatus -> UpdatePartnerStatus -> Bool
Prelude.Eq, ReadPrec [UpdatePartnerStatus]
ReadPrec UpdatePartnerStatus
Int -> ReadS UpdatePartnerStatus
ReadS [UpdatePartnerStatus]
(Int -> ReadS UpdatePartnerStatus)
-> ReadS [UpdatePartnerStatus]
-> ReadPrec UpdatePartnerStatus
-> ReadPrec [UpdatePartnerStatus]
-> Read UpdatePartnerStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdatePartnerStatus]
$creadListPrec :: ReadPrec [UpdatePartnerStatus]
readPrec :: ReadPrec UpdatePartnerStatus
$creadPrec :: ReadPrec UpdatePartnerStatus
readList :: ReadS [UpdatePartnerStatus]
$creadList :: ReadS [UpdatePartnerStatus]
readsPrec :: Int -> ReadS UpdatePartnerStatus
$creadsPrec :: Int -> ReadS UpdatePartnerStatus
Prelude.Read, Int -> UpdatePartnerStatus -> ShowS
[UpdatePartnerStatus] -> ShowS
UpdatePartnerStatus -> String
(Int -> UpdatePartnerStatus -> ShowS)
-> (UpdatePartnerStatus -> String)
-> ([UpdatePartnerStatus] -> ShowS)
-> Show UpdatePartnerStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdatePartnerStatus] -> ShowS
$cshowList :: [UpdatePartnerStatus] -> ShowS
show :: UpdatePartnerStatus -> String
$cshow :: UpdatePartnerStatus -> String
showsPrec :: Int -> UpdatePartnerStatus -> ShowS
$cshowsPrec :: Int -> UpdatePartnerStatus -> ShowS
Prelude.Show, (forall x. UpdatePartnerStatus -> Rep UpdatePartnerStatus x)
-> (forall x. Rep UpdatePartnerStatus x -> UpdatePartnerStatus)
-> Generic UpdatePartnerStatus
forall x. Rep UpdatePartnerStatus x -> UpdatePartnerStatus
forall x. UpdatePartnerStatus -> Rep UpdatePartnerStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdatePartnerStatus x -> UpdatePartnerStatus
$cfrom :: forall x. UpdatePartnerStatus -> Rep UpdatePartnerStatus x
Prelude.Generic)

-- |
-- Create a value of 'UpdatePartnerStatus' 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:
--
-- 'statusMessage', 'updatePartnerStatus_statusMessage' - The status message provided by the partner.
--
-- 'accountId', 'updatePartnerStatus_accountId' - The Amazon Web Services account ID that owns the cluster.
--
-- 'clusterIdentifier', 'updatePartnerStatus_clusterIdentifier' - The cluster identifier of the cluster whose partner integration status
-- is being updated.
--
-- 'databaseName', 'updatePartnerStatus_databaseName' - The name of the database whose partner integration status is being
-- updated.
--
-- 'partnerName', 'updatePartnerStatus_partnerName' - The name of the partner whose integration status is being updated.
--
-- 'status', 'updatePartnerStatus_status' - The value of the updated status.
newUpdatePartnerStatus ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'clusterIdentifier'
  Prelude.Text ->
  -- | 'databaseName'
  Prelude.Text ->
  -- | 'partnerName'
  Prelude.Text ->
  -- | 'status'
  PartnerIntegrationStatus ->
  UpdatePartnerStatus
newUpdatePartnerStatus :: Text
-> Text
-> Text
-> Text
-> PartnerIntegrationStatus
-> UpdatePartnerStatus
newUpdatePartnerStatus
  Text
pAccountId_
  Text
pClusterIdentifier_
  Text
pDatabaseName_
  Text
pPartnerName_
  PartnerIntegrationStatus
pStatus_ =
    UpdatePartnerStatus' :: Maybe Text
-> Text
-> Text
-> Text
-> Text
-> PartnerIntegrationStatus
-> UpdatePartnerStatus
UpdatePartnerStatus'
      { $sel:statusMessage:UpdatePartnerStatus' :: Maybe Text
statusMessage =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:accountId:UpdatePartnerStatus' :: Text
accountId = Text
pAccountId_,
        $sel:clusterIdentifier:UpdatePartnerStatus' :: Text
clusterIdentifier = Text
pClusterIdentifier_,
        $sel:databaseName:UpdatePartnerStatus' :: Text
databaseName = Text
pDatabaseName_,
        $sel:partnerName:UpdatePartnerStatus' :: Text
partnerName = Text
pPartnerName_,
        $sel:status:UpdatePartnerStatus' :: PartnerIntegrationStatus
status = PartnerIntegrationStatus
pStatus_
      }

-- | The status message provided by the partner.
updatePartnerStatus_statusMessage :: Lens.Lens' UpdatePartnerStatus (Prelude.Maybe Prelude.Text)
updatePartnerStatus_statusMessage :: (Maybe Text -> f (Maybe Text))
-> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_statusMessage = (UpdatePartnerStatus -> Maybe Text)
-> (UpdatePartnerStatus -> Maybe Text -> UpdatePartnerStatus)
-> Lens
     UpdatePartnerStatus UpdatePartnerStatus (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:UpdatePartnerStatus' :: UpdatePartnerStatus -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} Maybe Text
a -> UpdatePartnerStatus
s {$sel:statusMessage:UpdatePartnerStatus' :: Maybe Text
statusMessage = Maybe Text
a} :: UpdatePartnerStatus)

-- | The Amazon Web Services account ID that owns the cluster.
updatePartnerStatus_accountId :: Lens.Lens' UpdatePartnerStatus Prelude.Text
updatePartnerStatus_accountId :: (Text -> f Text) -> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_accountId = (UpdatePartnerStatus -> Text)
-> (UpdatePartnerStatus -> Text -> UpdatePartnerStatus)
-> Lens UpdatePartnerStatus UpdatePartnerStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {Text
accountId :: Text
$sel:accountId:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
accountId} -> Text
accountId) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} Text
a -> UpdatePartnerStatus
s {$sel:accountId:UpdatePartnerStatus' :: Text
accountId = Text
a} :: UpdatePartnerStatus)

-- | The cluster identifier of the cluster whose partner integration status
-- is being updated.
updatePartnerStatus_clusterIdentifier :: Lens.Lens' UpdatePartnerStatus Prelude.Text
updatePartnerStatus_clusterIdentifier :: (Text -> f Text) -> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_clusterIdentifier = (UpdatePartnerStatus -> Text)
-> (UpdatePartnerStatus -> Text -> UpdatePartnerStatus)
-> Lens UpdatePartnerStatus UpdatePartnerStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} Text
a -> UpdatePartnerStatus
s {$sel:clusterIdentifier:UpdatePartnerStatus' :: Text
clusterIdentifier = Text
a} :: UpdatePartnerStatus)

-- | The name of the database whose partner integration status is being
-- updated.
updatePartnerStatus_databaseName :: Lens.Lens' UpdatePartnerStatus Prelude.Text
updatePartnerStatus_databaseName :: (Text -> f Text) -> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_databaseName = (UpdatePartnerStatus -> Text)
-> (UpdatePartnerStatus -> Text -> UpdatePartnerStatus)
-> Lens UpdatePartnerStatus UpdatePartnerStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {Text
databaseName :: Text
$sel:databaseName:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
databaseName} -> Text
databaseName) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} Text
a -> UpdatePartnerStatus
s {$sel:databaseName:UpdatePartnerStatus' :: Text
databaseName = Text
a} :: UpdatePartnerStatus)

-- | The name of the partner whose integration status is being updated.
updatePartnerStatus_partnerName :: Lens.Lens' UpdatePartnerStatus Prelude.Text
updatePartnerStatus_partnerName :: (Text -> f Text) -> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_partnerName = (UpdatePartnerStatus -> Text)
-> (UpdatePartnerStatus -> Text -> UpdatePartnerStatus)
-> Lens UpdatePartnerStatus UpdatePartnerStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {Text
partnerName :: Text
$sel:partnerName:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
partnerName} -> Text
partnerName) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} Text
a -> UpdatePartnerStatus
s {$sel:partnerName:UpdatePartnerStatus' :: Text
partnerName = Text
a} :: UpdatePartnerStatus)

-- | The value of the updated status.
updatePartnerStatus_status :: Lens.Lens' UpdatePartnerStatus PartnerIntegrationStatus
updatePartnerStatus_status :: (PartnerIntegrationStatus -> f PartnerIntegrationStatus)
-> UpdatePartnerStatus -> f UpdatePartnerStatus
updatePartnerStatus_status = (UpdatePartnerStatus -> PartnerIntegrationStatus)
-> (UpdatePartnerStatus
    -> PartnerIntegrationStatus -> UpdatePartnerStatus)
-> Lens
     UpdatePartnerStatus
     UpdatePartnerStatus
     PartnerIntegrationStatus
     PartnerIntegrationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdatePartnerStatus' {PartnerIntegrationStatus
status :: PartnerIntegrationStatus
$sel:status:UpdatePartnerStatus' :: UpdatePartnerStatus -> PartnerIntegrationStatus
status} -> PartnerIntegrationStatus
status) (\s :: UpdatePartnerStatus
s@UpdatePartnerStatus' {} PartnerIntegrationStatus
a -> UpdatePartnerStatus
s {$sel:status:UpdatePartnerStatus' :: PartnerIntegrationStatus
status = PartnerIntegrationStatus
a} :: UpdatePartnerStatus)

instance Core.AWSRequest UpdatePartnerStatus where
  type
    AWSResponse UpdatePartnerStatus =
      PartnerIntegrationOutputMessage
  request :: UpdatePartnerStatus -> Request UpdatePartnerStatus
request = Service -> UpdatePartnerStatus -> Request UpdatePartnerStatus
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdatePartnerStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdatePartnerStatus)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse UpdatePartnerStatus))
-> Logger
-> Service
-> Proxy UpdatePartnerStatus
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdatePartnerStatus)))
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
"UpdatePartnerStatusResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String PartnerIntegrationOutputMessage
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable UpdatePartnerStatus

instance Prelude.NFData UpdatePartnerStatus

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

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

instance Core.ToQuery UpdatePartnerStatus where
  toQuery :: UpdatePartnerStatus -> QueryString
toQuery UpdatePartnerStatus' {Maybe Text
Text
PartnerIntegrationStatus
status :: PartnerIntegrationStatus
partnerName :: Text
databaseName :: Text
clusterIdentifier :: Text
accountId :: Text
statusMessage :: Maybe Text
$sel:status:UpdatePartnerStatus' :: UpdatePartnerStatus -> PartnerIntegrationStatus
$sel:partnerName:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
$sel:databaseName:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
$sel:clusterIdentifier:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
$sel:accountId:UpdatePartnerStatus' :: UpdatePartnerStatus -> Text
$sel:statusMessage:UpdatePartnerStatus' :: UpdatePartnerStatus -> Maybe 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
"UpdatePartnerStatus" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"StatusMessage" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
statusMessage,
        ByteString
"AccountId" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
accountId,
        ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier,
        ByteString
"DatabaseName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
databaseName,
        ByteString
"PartnerName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
partnerName,
        ByteString
"Status" ByteString -> PartnerIntegrationStatus -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: PartnerIntegrationStatus
status
      ]