{-# 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.Firehose.UpdateDestination
-- 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 specified destination of the specified delivery stream.
--
-- Use this operation to change the destination type (for example, to
-- replace the Amazon S3 destination with Amazon Redshift) or change the
-- parameters associated with a destination (for example, to change the
-- bucket name of the Amazon S3 destination). The update might not occur
-- immediately. The target delivery stream remains active while the
-- configurations are updated, so data writes to the delivery stream can
-- continue during this process. The updated configurations are usually
-- effective within a few minutes.
--
-- Switching between Amazon ES and other services is not supported. For an
-- Amazon ES destination, you can only update to another Amazon ES
-- destination.
--
-- If the destination type is the same, Kinesis Data Firehose merges the
-- configuration parameters specified with the destination configuration
-- that already exists on the delivery stream. If any of the parameters are
-- not specified in the call, the existing values are retained. For
-- example, in the Amazon S3 destination, if EncryptionConfiguration is not
-- specified, then the existing @EncryptionConfiguration@ is maintained on
-- the destination.
--
-- If the destination type is not the same, for example, changing the
-- destination from Amazon S3 to Amazon Redshift, Kinesis Data Firehose
-- does not merge any parameters. In this case, all parameters must be
-- specified.
--
-- Kinesis Data Firehose uses @CurrentDeliveryStreamVersionId@ to avoid
-- race conditions and conflicting merges. This is a required field, and
-- the service updates the configuration only if the existing configuration
-- has a version ID that matches. After the update is applied successfully,
-- the version ID is updated, and can be retrieved using
-- DescribeDeliveryStream. Use the new version ID to set
-- @CurrentDeliveryStreamVersionId@ in the next call.
module Amazonka.Firehose.UpdateDestination
  ( -- * Creating a Request
    UpdateDestination (..),
    newUpdateDestination,

    -- * Request Lenses
    updateDestination_amazonopensearchserviceDestinationUpdate,
    updateDestination_splunkDestinationUpdate,
    updateDestination_s3DestinationUpdate,
    updateDestination_redshiftDestinationUpdate,
    updateDestination_elasticsearchDestinationUpdate,
    updateDestination_extendedS3DestinationUpdate,
    updateDestination_httpEndpointDestinationUpdate,
    updateDestination_deliveryStreamName,
    updateDestination_currentDeliveryStreamVersionId,
    updateDestination_destinationId,

    -- * Destructuring the Response
    UpdateDestinationResponse (..),
    newUpdateDestinationResponse,

    -- * Response Lenses
    updateDestinationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateDestination' smart constructor.
data UpdateDestination = UpdateDestination'
  { UpdateDestination -> Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate :: Prelude.Maybe AmazonopensearchserviceDestinationUpdate,
    -- | Describes an update for a destination in Splunk.
    UpdateDestination -> Maybe SplunkDestinationUpdate
splunkDestinationUpdate :: Prelude.Maybe SplunkDestinationUpdate,
    -- | [Deprecated] Describes an update for a destination in Amazon S3.
    UpdateDestination -> Maybe S3DestinationUpdate
s3DestinationUpdate :: Prelude.Maybe S3DestinationUpdate,
    -- | Describes an update for a destination in Amazon Redshift.
    UpdateDestination -> Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate :: Prelude.Maybe RedshiftDestinationUpdate,
    -- | Describes an update for a destination in Amazon ES.
    UpdateDestination -> Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate :: Prelude.Maybe ElasticsearchDestinationUpdate,
    -- | Describes an update for a destination in Amazon S3.
    UpdateDestination -> Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate :: Prelude.Maybe ExtendedS3DestinationUpdate,
    -- | Describes an update to the specified HTTP endpoint destination.
    UpdateDestination -> Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate :: Prelude.Maybe HttpEndpointDestinationUpdate,
    -- | The name of the delivery stream.
    UpdateDestination -> Text
deliveryStreamName :: Prelude.Text,
    -- | Obtain this value from the @VersionId@ result of
    -- DeliveryStreamDescription. This value is required, and helps the service
    -- perform conditional operations. For example, if there is an interleaving
    -- update and this value is null, then the update destination fails. After
    -- the update is successful, the @VersionId@ value is updated. The service
    -- then performs a merge of the old configuration with the new
    -- configuration.
    UpdateDestination -> Text
currentDeliveryStreamVersionId :: Prelude.Text,
    -- | The ID of the destination.
    UpdateDestination -> Text
destinationId :: Prelude.Text
  }
  deriving (UpdateDestination -> UpdateDestination -> Bool
(UpdateDestination -> UpdateDestination -> Bool)
-> (UpdateDestination -> UpdateDestination -> Bool)
-> Eq UpdateDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateDestination -> UpdateDestination -> Bool
$c/= :: UpdateDestination -> UpdateDestination -> Bool
== :: UpdateDestination -> UpdateDestination -> Bool
$c== :: UpdateDestination -> UpdateDestination -> Bool
Prelude.Eq, Int -> UpdateDestination -> ShowS
[UpdateDestination] -> ShowS
UpdateDestination -> String
(Int -> UpdateDestination -> ShowS)
-> (UpdateDestination -> String)
-> ([UpdateDestination] -> ShowS)
-> Show UpdateDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateDestination] -> ShowS
$cshowList :: [UpdateDestination] -> ShowS
show :: UpdateDestination -> String
$cshow :: UpdateDestination -> String
showsPrec :: Int -> UpdateDestination -> ShowS
$cshowsPrec :: Int -> UpdateDestination -> ShowS
Prelude.Show, (forall x. UpdateDestination -> Rep UpdateDestination x)
-> (forall x. Rep UpdateDestination x -> UpdateDestination)
-> Generic UpdateDestination
forall x. Rep UpdateDestination x -> UpdateDestination
forall x. UpdateDestination -> Rep UpdateDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateDestination x -> UpdateDestination
$cfrom :: forall x. UpdateDestination -> Rep UpdateDestination x
Prelude.Generic)

-- |
-- Create a value of 'UpdateDestination' 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:
--
-- 'amazonopensearchserviceDestinationUpdate', 'updateDestination_amazonopensearchserviceDestinationUpdate' - Undocumented member.
--
-- 'splunkDestinationUpdate', 'updateDestination_splunkDestinationUpdate' - Describes an update for a destination in Splunk.
--
-- 's3DestinationUpdate', 'updateDestination_s3DestinationUpdate' - [Deprecated] Describes an update for a destination in Amazon S3.
--
-- 'redshiftDestinationUpdate', 'updateDestination_redshiftDestinationUpdate' - Describes an update for a destination in Amazon Redshift.
--
-- 'elasticsearchDestinationUpdate', 'updateDestination_elasticsearchDestinationUpdate' - Describes an update for a destination in Amazon ES.
--
-- 'extendedS3DestinationUpdate', 'updateDestination_extendedS3DestinationUpdate' - Describes an update for a destination in Amazon S3.
--
-- 'httpEndpointDestinationUpdate', 'updateDestination_httpEndpointDestinationUpdate' - Describes an update to the specified HTTP endpoint destination.
--
-- 'deliveryStreamName', 'updateDestination_deliveryStreamName' - The name of the delivery stream.
--
-- 'currentDeliveryStreamVersionId', 'updateDestination_currentDeliveryStreamVersionId' - Obtain this value from the @VersionId@ result of
-- DeliveryStreamDescription. This value is required, and helps the service
-- perform conditional operations. For example, if there is an interleaving
-- update and this value is null, then the update destination fails. After
-- the update is successful, the @VersionId@ value is updated. The service
-- then performs a merge of the old configuration with the new
-- configuration.
--
-- 'destinationId', 'updateDestination_destinationId' - The ID of the destination.
newUpdateDestination ::
  -- | 'deliveryStreamName'
  Prelude.Text ->
  -- | 'currentDeliveryStreamVersionId'
  Prelude.Text ->
  -- | 'destinationId'
  Prelude.Text ->
  UpdateDestination
newUpdateDestination :: Text -> Text -> Text -> UpdateDestination
newUpdateDestination
  Text
pDeliveryStreamName_
  Text
pCurrentDeliveryStreamVersionId_
  Text
pDestinationId_ =
    UpdateDestination' :: Maybe AmazonopensearchserviceDestinationUpdate
-> Maybe SplunkDestinationUpdate
-> Maybe S3DestinationUpdate
-> Maybe RedshiftDestinationUpdate
-> Maybe ElasticsearchDestinationUpdate
-> Maybe ExtendedS3DestinationUpdate
-> Maybe HttpEndpointDestinationUpdate
-> Text
-> Text
-> Text
-> UpdateDestination
UpdateDestination'
      { $sel:amazonopensearchserviceDestinationUpdate:UpdateDestination' :: Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate =
          Maybe AmazonopensearchserviceDestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:splunkDestinationUpdate:UpdateDestination' :: Maybe SplunkDestinationUpdate
splunkDestinationUpdate = Maybe SplunkDestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:s3DestinationUpdate:UpdateDestination' :: Maybe S3DestinationUpdate
s3DestinationUpdate = Maybe S3DestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:redshiftDestinationUpdate:UpdateDestination' :: Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate = Maybe RedshiftDestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:elasticsearchDestinationUpdate:UpdateDestination' :: Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate = Maybe ElasticsearchDestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:extendedS3DestinationUpdate:UpdateDestination' :: Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate = Maybe ExtendedS3DestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:httpEndpointDestinationUpdate:UpdateDestination' :: Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate = Maybe HttpEndpointDestinationUpdate
forall a. Maybe a
Prelude.Nothing,
        $sel:deliveryStreamName:UpdateDestination' :: Text
deliveryStreamName = Text
pDeliveryStreamName_,
        $sel:currentDeliveryStreamVersionId:UpdateDestination' :: Text
currentDeliveryStreamVersionId =
          Text
pCurrentDeliveryStreamVersionId_,
        $sel:destinationId:UpdateDestination' :: Text
destinationId = Text
pDestinationId_
      }

-- | Undocumented member.
updateDestination_amazonopensearchserviceDestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe AmazonopensearchserviceDestinationUpdate)
updateDestination_amazonopensearchserviceDestinationUpdate :: (Maybe AmazonopensearchserviceDestinationUpdate
 -> f (Maybe AmazonopensearchserviceDestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_amazonopensearchserviceDestinationUpdate = (UpdateDestination
 -> Maybe AmazonopensearchserviceDestinationUpdate)
-> (UpdateDestination
    -> Maybe AmazonopensearchserviceDestinationUpdate
    -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe AmazonopensearchserviceDestinationUpdate)
     (Maybe AmazonopensearchserviceDestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate :: Maybe AmazonopensearchserviceDestinationUpdate
$sel:amazonopensearchserviceDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate} -> Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe AmazonopensearchserviceDestinationUpdate
a -> UpdateDestination
s {$sel:amazonopensearchserviceDestinationUpdate:UpdateDestination' :: Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate = Maybe AmazonopensearchserviceDestinationUpdate
a} :: UpdateDestination)

-- | Describes an update for a destination in Splunk.
updateDestination_splunkDestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe SplunkDestinationUpdate)
updateDestination_splunkDestinationUpdate :: (Maybe SplunkDestinationUpdate
 -> f (Maybe SplunkDestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_splunkDestinationUpdate = (UpdateDestination -> Maybe SplunkDestinationUpdate)
-> (UpdateDestination
    -> Maybe SplunkDestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe SplunkDestinationUpdate)
     (Maybe SplunkDestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe SplunkDestinationUpdate
splunkDestinationUpdate :: Maybe SplunkDestinationUpdate
$sel:splunkDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe SplunkDestinationUpdate
splunkDestinationUpdate} -> Maybe SplunkDestinationUpdate
splunkDestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe SplunkDestinationUpdate
a -> UpdateDestination
s {$sel:splunkDestinationUpdate:UpdateDestination' :: Maybe SplunkDestinationUpdate
splunkDestinationUpdate = Maybe SplunkDestinationUpdate
a} :: UpdateDestination)

-- | [Deprecated] Describes an update for a destination in Amazon S3.
updateDestination_s3DestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe S3DestinationUpdate)
updateDestination_s3DestinationUpdate :: (Maybe S3DestinationUpdate -> f (Maybe S3DestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_s3DestinationUpdate = (UpdateDestination -> Maybe S3DestinationUpdate)
-> (UpdateDestination
    -> Maybe S3DestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe S3DestinationUpdate)
     (Maybe S3DestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe S3DestinationUpdate
s3DestinationUpdate :: Maybe S3DestinationUpdate
$sel:s3DestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe S3DestinationUpdate
s3DestinationUpdate} -> Maybe S3DestinationUpdate
s3DestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe S3DestinationUpdate
a -> UpdateDestination
s {$sel:s3DestinationUpdate:UpdateDestination' :: Maybe S3DestinationUpdate
s3DestinationUpdate = Maybe S3DestinationUpdate
a} :: UpdateDestination)

-- | Describes an update for a destination in Amazon Redshift.
updateDestination_redshiftDestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe RedshiftDestinationUpdate)
updateDestination_redshiftDestinationUpdate :: (Maybe RedshiftDestinationUpdate
 -> f (Maybe RedshiftDestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_redshiftDestinationUpdate = (UpdateDestination -> Maybe RedshiftDestinationUpdate)
-> (UpdateDestination
    -> Maybe RedshiftDestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe RedshiftDestinationUpdate)
     (Maybe RedshiftDestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate :: Maybe RedshiftDestinationUpdate
$sel:redshiftDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate} -> Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe RedshiftDestinationUpdate
a -> UpdateDestination
s {$sel:redshiftDestinationUpdate:UpdateDestination' :: Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate = Maybe RedshiftDestinationUpdate
a} :: UpdateDestination)

-- | Describes an update for a destination in Amazon ES.
updateDestination_elasticsearchDestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe ElasticsearchDestinationUpdate)
updateDestination_elasticsearchDestinationUpdate :: (Maybe ElasticsearchDestinationUpdate
 -> f (Maybe ElasticsearchDestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_elasticsearchDestinationUpdate = (UpdateDestination -> Maybe ElasticsearchDestinationUpdate)
-> (UpdateDestination
    -> Maybe ElasticsearchDestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe ElasticsearchDestinationUpdate)
     (Maybe ElasticsearchDestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate :: Maybe ElasticsearchDestinationUpdate
$sel:elasticsearchDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate} -> Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe ElasticsearchDestinationUpdate
a -> UpdateDestination
s {$sel:elasticsearchDestinationUpdate:UpdateDestination' :: Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate = Maybe ElasticsearchDestinationUpdate
a} :: UpdateDestination)

-- | Describes an update for a destination in Amazon S3.
updateDestination_extendedS3DestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe ExtendedS3DestinationUpdate)
updateDestination_extendedS3DestinationUpdate :: (Maybe ExtendedS3DestinationUpdate
 -> f (Maybe ExtendedS3DestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_extendedS3DestinationUpdate = (UpdateDestination -> Maybe ExtendedS3DestinationUpdate)
-> (UpdateDestination
    -> Maybe ExtendedS3DestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe ExtendedS3DestinationUpdate)
     (Maybe ExtendedS3DestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate :: Maybe ExtendedS3DestinationUpdate
$sel:extendedS3DestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate} -> Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe ExtendedS3DestinationUpdate
a -> UpdateDestination
s {$sel:extendedS3DestinationUpdate:UpdateDestination' :: Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate = Maybe ExtendedS3DestinationUpdate
a} :: UpdateDestination)

-- | Describes an update to the specified HTTP endpoint destination.
updateDestination_httpEndpointDestinationUpdate :: Lens.Lens' UpdateDestination (Prelude.Maybe HttpEndpointDestinationUpdate)
updateDestination_httpEndpointDestinationUpdate :: (Maybe HttpEndpointDestinationUpdate
 -> f (Maybe HttpEndpointDestinationUpdate))
-> UpdateDestination -> f UpdateDestination
updateDestination_httpEndpointDestinationUpdate = (UpdateDestination -> Maybe HttpEndpointDestinationUpdate)
-> (UpdateDestination
    -> Maybe HttpEndpointDestinationUpdate -> UpdateDestination)
-> Lens
     UpdateDestination
     UpdateDestination
     (Maybe HttpEndpointDestinationUpdate)
     (Maybe HttpEndpointDestinationUpdate)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate :: Maybe HttpEndpointDestinationUpdate
$sel:httpEndpointDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate} -> Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate) (\s :: UpdateDestination
s@UpdateDestination' {} Maybe HttpEndpointDestinationUpdate
a -> UpdateDestination
s {$sel:httpEndpointDestinationUpdate:UpdateDestination' :: Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate = Maybe HttpEndpointDestinationUpdate
a} :: UpdateDestination)

-- | The name of the delivery stream.
updateDestination_deliveryStreamName :: Lens.Lens' UpdateDestination Prelude.Text
updateDestination_deliveryStreamName :: (Text -> f Text) -> UpdateDestination -> f UpdateDestination
updateDestination_deliveryStreamName = (UpdateDestination -> Text)
-> (UpdateDestination -> Text -> UpdateDestination)
-> Lens UpdateDestination UpdateDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Text
deliveryStreamName :: Text
$sel:deliveryStreamName:UpdateDestination' :: UpdateDestination -> Text
deliveryStreamName} -> Text
deliveryStreamName) (\s :: UpdateDestination
s@UpdateDestination' {} Text
a -> UpdateDestination
s {$sel:deliveryStreamName:UpdateDestination' :: Text
deliveryStreamName = Text
a} :: UpdateDestination)

-- | Obtain this value from the @VersionId@ result of
-- DeliveryStreamDescription. This value is required, and helps the service
-- perform conditional operations. For example, if there is an interleaving
-- update and this value is null, then the update destination fails. After
-- the update is successful, the @VersionId@ value is updated. The service
-- then performs a merge of the old configuration with the new
-- configuration.
updateDestination_currentDeliveryStreamVersionId :: Lens.Lens' UpdateDestination Prelude.Text
updateDestination_currentDeliveryStreamVersionId :: (Text -> f Text) -> UpdateDestination -> f UpdateDestination
updateDestination_currentDeliveryStreamVersionId = (UpdateDestination -> Text)
-> (UpdateDestination -> Text -> UpdateDestination)
-> Lens UpdateDestination UpdateDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Text
currentDeliveryStreamVersionId :: Text
$sel:currentDeliveryStreamVersionId:UpdateDestination' :: UpdateDestination -> Text
currentDeliveryStreamVersionId} -> Text
currentDeliveryStreamVersionId) (\s :: UpdateDestination
s@UpdateDestination' {} Text
a -> UpdateDestination
s {$sel:currentDeliveryStreamVersionId:UpdateDestination' :: Text
currentDeliveryStreamVersionId = Text
a} :: UpdateDestination)

-- | The ID of the destination.
updateDestination_destinationId :: Lens.Lens' UpdateDestination Prelude.Text
updateDestination_destinationId :: (Text -> f Text) -> UpdateDestination -> f UpdateDestination
updateDestination_destinationId = (UpdateDestination -> Text)
-> (UpdateDestination -> Text -> UpdateDestination)
-> Lens UpdateDestination UpdateDestination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateDestination' {Text
destinationId :: Text
$sel:destinationId:UpdateDestination' :: UpdateDestination -> Text
destinationId} -> Text
destinationId) (\s :: UpdateDestination
s@UpdateDestination' {} Text
a -> UpdateDestination
s {$sel:destinationId:UpdateDestination' :: Text
destinationId = Text
a} :: UpdateDestination)

instance Core.AWSRequest UpdateDestination where
  type
    AWSResponse UpdateDestination =
      UpdateDestinationResponse
  request :: UpdateDestination -> Request UpdateDestination
request = Service -> UpdateDestination -> Request UpdateDestination
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDestination)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse UpdateDestination))
-> Logger
-> Service
-> Proxy UpdateDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateDestination)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> UpdateDestinationResponse
UpdateDestinationResponse'
            (Int -> UpdateDestinationResponse)
-> Either String Int -> Either String UpdateDestinationResponse
forall (f :: * -> *) a b. Functor 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 UpdateDestination

instance Prelude.NFData UpdateDestination

instance Core.ToHeaders UpdateDestination where
  toHeaders :: UpdateDestination -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateDestination -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Firehose_20150804.UpdateDestination" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateDestination where
  toJSON :: UpdateDestination -> Value
toJSON UpdateDestination' {Maybe S3DestinationUpdate
Maybe RedshiftDestinationUpdate
Maybe HttpEndpointDestinationUpdate
Maybe ElasticsearchDestinationUpdate
Maybe AmazonopensearchserviceDestinationUpdate
Maybe ExtendedS3DestinationUpdate
Maybe SplunkDestinationUpdate
Text
destinationId :: Text
currentDeliveryStreamVersionId :: Text
deliveryStreamName :: Text
httpEndpointDestinationUpdate :: Maybe HttpEndpointDestinationUpdate
extendedS3DestinationUpdate :: Maybe ExtendedS3DestinationUpdate
elasticsearchDestinationUpdate :: Maybe ElasticsearchDestinationUpdate
redshiftDestinationUpdate :: Maybe RedshiftDestinationUpdate
s3DestinationUpdate :: Maybe S3DestinationUpdate
splunkDestinationUpdate :: Maybe SplunkDestinationUpdate
amazonopensearchserviceDestinationUpdate :: Maybe AmazonopensearchserviceDestinationUpdate
$sel:destinationId:UpdateDestination' :: UpdateDestination -> Text
$sel:currentDeliveryStreamVersionId:UpdateDestination' :: UpdateDestination -> Text
$sel:deliveryStreamName:UpdateDestination' :: UpdateDestination -> Text
$sel:httpEndpointDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe HttpEndpointDestinationUpdate
$sel:extendedS3DestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe ExtendedS3DestinationUpdate
$sel:elasticsearchDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe ElasticsearchDestinationUpdate
$sel:redshiftDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe RedshiftDestinationUpdate
$sel:s3DestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe S3DestinationUpdate
$sel:splunkDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe SplunkDestinationUpdate
$sel:amazonopensearchserviceDestinationUpdate:UpdateDestination' :: UpdateDestination -> Maybe AmazonopensearchserviceDestinationUpdate
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AmazonopensearchserviceDestinationUpdate" Text -> AmazonopensearchserviceDestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AmazonopensearchserviceDestinationUpdate -> Pair)
-> Maybe AmazonopensearchserviceDestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AmazonopensearchserviceDestinationUpdate
amazonopensearchserviceDestinationUpdate,
            (Text
"SplunkDestinationUpdate" Text -> SplunkDestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (SplunkDestinationUpdate -> Pair)
-> Maybe SplunkDestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SplunkDestinationUpdate
splunkDestinationUpdate,
            (Text
"S3DestinationUpdate" Text -> S3DestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (S3DestinationUpdate -> Pair)
-> Maybe S3DestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3DestinationUpdate
s3DestinationUpdate,
            (Text
"RedshiftDestinationUpdate" Text -> RedshiftDestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RedshiftDestinationUpdate -> Pair)
-> Maybe RedshiftDestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RedshiftDestinationUpdate
redshiftDestinationUpdate,
            (Text
"ElasticsearchDestinationUpdate" Text -> ElasticsearchDestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ElasticsearchDestinationUpdate -> Pair)
-> Maybe ElasticsearchDestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ElasticsearchDestinationUpdate
elasticsearchDestinationUpdate,
            (Text
"ExtendedS3DestinationUpdate" Text -> ExtendedS3DestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ExtendedS3DestinationUpdate -> Pair)
-> Maybe ExtendedS3DestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ExtendedS3DestinationUpdate
extendedS3DestinationUpdate,
            (Text
"HttpEndpointDestinationUpdate" Text -> HttpEndpointDestinationUpdate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HttpEndpointDestinationUpdate -> Pair)
-> Maybe HttpEndpointDestinationUpdate -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HttpEndpointDestinationUpdate
httpEndpointDestinationUpdate,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DeliveryStreamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deliveryStreamName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"CurrentDeliveryStreamVersionId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
currentDeliveryStreamVersionId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DestinationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
destinationId)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateDestinationResponse' 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:
--
-- 'httpStatus', 'updateDestinationResponse_httpStatus' - The response's http status code.
newUpdateDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateDestinationResponse
newUpdateDestinationResponse :: Int -> UpdateDestinationResponse
newUpdateDestinationResponse Int
pHttpStatus_ =
  UpdateDestinationResponse' :: Int -> UpdateDestinationResponse
UpdateDestinationResponse'
    { $sel:httpStatus:UpdateDestinationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData UpdateDestinationResponse