{-# 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.PinpointSmsVoiceV2.UpdateEventDestination
-- 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 existing event destination in a configuration set. You can
-- update the IAM role ARN for CloudWatch Logs and Kinesis Data Firehose.
-- You can also enable or disable the event destination.
--
-- You may want to update an event destination to change its matching event
-- types or updating the destination resource ARN. You can\'t change an
-- event destination\'s type between CloudWatch Logs, Kinesis Data
-- Firehose, and Amazon SNS.
module Amazonka.PinpointSmsVoiceV2.UpdateEventDestination
  ( -- * Creating a Request
    UpdateEventDestination (..),
    newUpdateEventDestination,

    -- * Request Lenses
    updateEventDestination_cloudWatchLogsDestination,
    updateEventDestination_enabled,
    updateEventDestination_kinesisFirehoseDestination,
    updateEventDestination_matchingEventTypes,
    updateEventDestination_snsDestination,
    updateEventDestination_configurationSetName,
    updateEventDestination_eventDestinationName,

    -- * Destructuring the Response
    UpdateEventDestinationResponse (..),
    newUpdateEventDestinationResponse,

    -- * Response Lenses
    updateEventDestinationResponse_configurationSetArn,
    updateEventDestinationResponse_configurationSetName,
    updateEventDestinationResponse_eventDestination,
    updateEventDestinationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.PinpointSmsVoiceV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateEventDestination' smart constructor.
data UpdateEventDestination = UpdateEventDestination'
  { -- | An object that contains information about an event destination that
    -- sends data to CloudWatch Logs.
    UpdateEventDestination -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Prelude.Maybe CloudWatchLogsDestination,
    -- | When set to true logging is enabled.
    UpdateEventDestination -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | An object that contains information about an event destination for
    -- logging to Kinesis Data Firehose.
    UpdateEventDestination -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Prelude.Maybe KinesisFirehoseDestination,
    -- | An array of event types that determine which events to log.
    UpdateEventDestination -> Maybe (NonEmpty EventType)
matchingEventTypes :: Prelude.Maybe (Prelude.NonEmpty EventType),
    -- | An object that contains information about an event destination that
    -- sends data to Amazon SNS.
    UpdateEventDestination -> Maybe SnsDestination
snsDestination :: Prelude.Maybe SnsDestination,
    -- | The configuration set to update with the new event destination. Valid
    -- values for this can be the ConfigurationSetName or ConfigurationSetArn.
    UpdateEventDestination -> Text
configurationSetName :: Prelude.Text,
    -- | The name to use for the event destination.
    UpdateEventDestination -> Text
eventDestinationName :: Prelude.Text
  }
  deriving (UpdateEventDestination -> UpdateEventDestination -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEventDestination -> UpdateEventDestination -> Bool
$c/= :: UpdateEventDestination -> UpdateEventDestination -> Bool
== :: UpdateEventDestination -> UpdateEventDestination -> Bool
$c== :: UpdateEventDestination -> UpdateEventDestination -> Bool
Prelude.Eq, ReadPrec [UpdateEventDestination]
ReadPrec UpdateEventDestination
Int -> ReadS UpdateEventDestination
ReadS [UpdateEventDestination]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEventDestination]
$creadListPrec :: ReadPrec [UpdateEventDestination]
readPrec :: ReadPrec UpdateEventDestination
$creadPrec :: ReadPrec UpdateEventDestination
readList :: ReadS [UpdateEventDestination]
$creadList :: ReadS [UpdateEventDestination]
readsPrec :: Int -> ReadS UpdateEventDestination
$creadsPrec :: Int -> ReadS UpdateEventDestination
Prelude.Read, Int -> UpdateEventDestination -> ShowS
[UpdateEventDestination] -> ShowS
UpdateEventDestination -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEventDestination] -> ShowS
$cshowList :: [UpdateEventDestination] -> ShowS
show :: UpdateEventDestination -> String
$cshow :: UpdateEventDestination -> String
showsPrec :: Int -> UpdateEventDestination -> ShowS
$cshowsPrec :: Int -> UpdateEventDestination -> ShowS
Prelude.Show, forall x. Rep UpdateEventDestination x -> UpdateEventDestination
forall x. UpdateEventDestination -> Rep UpdateEventDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEventDestination x -> UpdateEventDestination
$cfrom :: forall x. UpdateEventDestination -> Rep UpdateEventDestination x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEventDestination' 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:
--
-- 'cloudWatchLogsDestination', 'updateEventDestination_cloudWatchLogsDestination' - An object that contains information about an event destination that
-- sends data to CloudWatch Logs.
--
-- 'enabled', 'updateEventDestination_enabled' - When set to true logging is enabled.
--
-- 'kinesisFirehoseDestination', 'updateEventDestination_kinesisFirehoseDestination' - An object that contains information about an event destination for
-- logging to Kinesis Data Firehose.
--
-- 'matchingEventTypes', 'updateEventDestination_matchingEventTypes' - An array of event types that determine which events to log.
--
-- 'snsDestination', 'updateEventDestination_snsDestination' - An object that contains information about an event destination that
-- sends data to Amazon SNS.
--
-- 'configurationSetName', 'updateEventDestination_configurationSetName' - The configuration set to update with the new event destination. Valid
-- values for this can be the ConfigurationSetName or ConfigurationSetArn.
--
-- 'eventDestinationName', 'updateEventDestination_eventDestinationName' - The name to use for the event destination.
newUpdateEventDestination ::
  -- | 'configurationSetName'
  Prelude.Text ->
  -- | 'eventDestinationName'
  Prelude.Text ->
  UpdateEventDestination
newUpdateEventDestination :: Text -> Text -> UpdateEventDestination
newUpdateEventDestination
  Text
pConfigurationSetName_
  Text
pEventDestinationName_ =
    UpdateEventDestination'
      { $sel:cloudWatchLogsDestination:UpdateEventDestination' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination =
          forall a. Maybe a
Prelude.Nothing,
        $sel:enabled:UpdateEventDestination' :: Maybe Bool
enabled = forall a. Maybe a
Prelude.Nothing,
        $sel:kinesisFirehoseDestination:UpdateEventDestination' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = forall a. Maybe a
Prelude.Nothing,
        $sel:matchingEventTypes:UpdateEventDestination' :: Maybe (NonEmpty EventType)
matchingEventTypes = forall a. Maybe a
Prelude.Nothing,
        $sel:snsDestination:UpdateEventDestination' :: Maybe SnsDestination
snsDestination = forall a. Maybe a
Prelude.Nothing,
        $sel:configurationSetName:UpdateEventDestination' :: Text
configurationSetName = Text
pConfigurationSetName_,
        $sel:eventDestinationName:UpdateEventDestination' :: Text
eventDestinationName = Text
pEventDestinationName_
      }

-- | An object that contains information about an event destination that
-- sends data to CloudWatch Logs.
updateEventDestination_cloudWatchLogsDestination :: Lens.Lens' UpdateEventDestination (Prelude.Maybe CloudWatchLogsDestination)
updateEventDestination_cloudWatchLogsDestination :: Lens' UpdateEventDestination (Maybe CloudWatchLogsDestination)
updateEventDestination_cloudWatchLogsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Maybe CloudWatchLogsDestination
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:cloudWatchLogsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination} -> Maybe CloudWatchLogsDestination
cloudWatchLogsDestination) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Maybe CloudWatchLogsDestination
a -> UpdateEventDestination
s {$sel:cloudWatchLogsDestination:UpdateEventDestination' :: Maybe CloudWatchLogsDestination
cloudWatchLogsDestination = Maybe CloudWatchLogsDestination
a} :: UpdateEventDestination)

-- | When set to true logging is enabled.
updateEventDestination_enabled :: Lens.Lens' UpdateEventDestination (Prelude.Maybe Prelude.Bool)
updateEventDestination_enabled :: Lens' UpdateEventDestination (Maybe Bool)
updateEventDestination_enabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:UpdateEventDestination' :: UpdateEventDestination -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Maybe Bool
a -> UpdateEventDestination
s {$sel:enabled:UpdateEventDestination' :: Maybe Bool
enabled = Maybe Bool
a} :: UpdateEventDestination)

-- | An object that contains information about an event destination for
-- logging to Kinesis Data Firehose.
updateEventDestination_kinesisFirehoseDestination :: Lens.Lens' UpdateEventDestination (Prelude.Maybe KinesisFirehoseDestination)
updateEventDestination_kinesisFirehoseDestination :: Lens' UpdateEventDestination (Maybe KinesisFirehoseDestination)
updateEventDestination_kinesisFirehoseDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Maybe KinesisFirehoseDestination
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
$sel:kinesisFirehoseDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination} -> Maybe KinesisFirehoseDestination
kinesisFirehoseDestination) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Maybe KinesisFirehoseDestination
a -> UpdateEventDestination
s {$sel:kinesisFirehoseDestination:UpdateEventDestination' :: Maybe KinesisFirehoseDestination
kinesisFirehoseDestination = Maybe KinesisFirehoseDestination
a} :: UpdateEventDestination)

-- | An array of event types that determine which events to log.
updateEventDestination_matchingEventTypes :: Lens.Lens' UpdateEventDestination (Prelude.Maybe (Prelude.NonEmpty EventType))
updateEventDestination_matchingEventTypes :: Lens' UpdateEventDestination (Maybe (NonEmpty EventType))
updateEventDestination_matchingEventTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Maybe (NonEmpty EventType)
matchingEventTypes :: Maybe (NonEmpty EventType)
$sel:matchingEventTypes:UpdateEventDestination' :: UpdateEventDestination -> Maybe (NonEmpty EventType)
matchingEventTypes} -> Maybe (NonEmpty EventType)
matchingEventTypes) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Maybe (NonEmpty EventType)
a -> UpdateEventDestination
s {$sel:matchingEventTypes:UpdateEventDestination' :: Maybe (NonEmpty EventType)
matchingEventTypes = Maybe (NonEmpty EventType)
a} :: UpdateEventDestination) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that contains information about an event destination that
-- sends data to Amazon SNS.
updateEventDestination_snsDestination :: Lens.Lens' UpdateEventDestination (Prelude.Maybe SnsDestination)
updateEventDestination_snsDestination :: Lens' UpdateEventDestination (Maybe SnsDestination)
updateEventDestination_snsDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Maybe SnsDestination
snsDestination :: Maybe SnsDestination
$sel:snsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe SnsDestination
snsDestination} -> Maybe SnsDestination
snsDestination) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Maybe SnsDestination
a -> UpdateEventDestination
s {$sel:snsDestination:UpdateEventDestination' :: Maybe SnsDestination
snsDestination = Maybe SnsDestination
a} :: UpdateEventDestination)

-- | The configuration set to update with the new event destination. Valid
-- values for this can be the ConfigurationSetName or ConfigurationSetArn.
updateEventDestination_configurationSetName :: Lens.Lens' UpdateEventDestination Prelude.Text
updateEventDestination_configurationSetName :: Lens' UpdateEventDestination Text
updateEventDestination_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Text
configurationSetName :: Text
$sel:configurationSetName:UpdateEventDestination' :: UpdateEventDestination -> Text
configurationSetName} -> Text
configurationSetName) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Text
a -> UpdateEventDestination
s {$sel:configurationSetName:UpdateEventDestination' :: Text
configurationSetName = Text
a} :: UpdateEventDestination)

-- | The name to use for the event destination.
updateEventDestination_eventDestinationName :: Lens.Lens' UpdateEventDestination Prelude.Text
updateEventDestination_eventDestinationName :: Lens' UpdateEventDestination Text
updateEventDestination_eventDestinationName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestination' {Text
eventDestinationName :: Text
$sel:eventDestinationName:UpdateEventDestination' :: UpdateEventDestination -> Text
eventDestinationName} -> Text
eventDestinationName) (\s :: UpdateEventDestination
s@UpdateEventDestination' {} Text
a -> UpdateEventDestination
s {$sel:eventDestinationName:UpdateEventDestination' :: Text
eventDestinationName = Text
a} :: UpdateEventDestination)

instance Core.AWSRequest UpdateEventDestination where
  type
    AWSResponse UpdateEventDestination =
      UpdateEventDestinationResponse
  request :: (Service -> Service)
-> UpdateEventDestination -> Request UpdateEventDestination
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 UpdateEventDestination
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEventDestination)))
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 Text
-> Maybe Text
-> Maybe EventDestination
-> Int
-> UpdateEventDestinationResponse
UpdateEventDestinationResponse'
            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
"ConfigurationSetArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConfigurationSetName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"EventDestination")
            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 UpdateEventDestination where
  hashWithSalt :: Int -> UpdateEventDestination -> Int
hashWithSalt Int
_salt UpdateEventDestination' {Maybe Bool
Maybe (NonEmpty EventType)
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
Text
eventDestinationName :: Text
configurationSetName :: Text
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe (NonEmpty EventType)
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:eventDestinationName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:configurationSetName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:snsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe SnsDestination
$sel:matchingEventTypes:UpdateEventDestination' :: UpdateEventDestination -> Maybe (NonEmpty EventType)
$sel:kinesisFirehoseDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe KinesisFirehoseDestination
$sel:enabled:UpdateEventDestination' :: UpdateEventDestination -> Maybe Bool
$sel:cloudWatchLogsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe CloudWatchLogsDestination
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsDestination
cloudWatchLogsDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe KinesisFirehoseDestination
kinesisFirehoseDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty EventType)
matchingEventTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SnsDestination
snsDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
configurationSetName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
eventDestinationName

instance Prelude.NFData UpdateEventDestination where
  rnf :: UpdateEventDestination -> ()
rnf UpdateEventDestination' {Maybe Bool
Maybe (NonEmpty EventType)
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
Text
eventDestinationName :: Text
configurationSetName :: Text
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe (NonEmpty EventType)
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:eventDestinationName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:configurationSetName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:snsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe SnsDestination
$sel:matchingEventTypes:UpdateEventDestination' :: UpdateEventDestination -> Maybe (NonEmpty EventType)
$sel:kinesisFirehoseDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe KinesisFirehoseDestination
$sel:enabled:UpdateEventDestination' :: UpdateEventDestination -> Maybe Bool
$sel:cloudWatchLogsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe CloudWatchLogsDestination
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchLogsDestination
cloudWatchLogsDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe KinesisFirehoseDestination
kinesisFirehoseDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty EventType)
matchingEventTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SnsDestination
snsDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
eventDestinationName

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

instance Data.ToJSON UpdateEventDestination where
  toJSON :: UpdateEventDestination -> Value
toJSON UpdateEventDestination' {Maybe Bool
Maybe (NonEmpty EventType)
Maybe CloudWatchLogsDestination
Maybe KinesisFirehoseDestination
Maybe SnsDestination
Text
eventDestinationName :: Text
configurationSetName :: Text
snsDestination :: Maybe SnsDestination
matchingEventTypes :: Maybe (NonEmpty EventType)
kinesisFirehoseDestination :: Maybe KinesisFirehoseDestination
enabled :: Maybe Bool
cloudWatchLogsDestination :: Maybe CloudWatchLogsDestination
$sel:eventDestinationName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:configurationSetName:UpdateEventDestination' :: UpdateEventDestination -> Text
$sel:snsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe SnsDestination
$sel:matchingEventTypes:UpdateEventDestination' :: UpdateEventDestination -> Maybe (NonEmpty EventType)
$sel:kinesisFirehoseDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe KinesisFirehoseDestination
$sel:enabled:UpdateEventDestination' :: UpdateEventDestination -> Maybe Bool
$sel:cloudWatchLogsDestination:UpdateEventDestination' :: UpdateEventDestination -> Maybe CloudWatchLogsDestination
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"CloudWatchLogsDestination" 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 CloudWatchLogsDestination
cloudWatchLogsDestination,
            (Key
"Enabled" 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 Bool
enabled,
            (Key
"KinesisFirehoseDestination" 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 KinesisFirehoseDestination
kinesisFirehoseDestination,
            (Key
"MatchingEventTypes" 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 (NonEmpty EventType)
matchingEventTypes,
            (Key
"SnsDestination" 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 SnsDestination
snsDestination,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"ConfigurationSetName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
configurationSetName
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"EventDestinationName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
eventDestinationName
              )
          ]
      )

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

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

-- | /See:/ 'newUpdateEventDestinationResponse' smart constructor.
data UpdateEventDestinationResponse = UpdateEventDestinationResponse'
  { -- | The Amazon Resource Name (ARN) for the ConfigurationSet that was
    -- updated.
    UpdateEventDestinationResponse -> Maybe Text
configurationSetArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the configuration set.
    UpdateEventDestinationResponse -> Maybe Text
configurationSetName :: Prelude.Maybe Prelude.Text,
    -- | An EventDestination object containing the details of where events will
    -- be logged.
    UpdateEventDestinationResponse -> Maybe EventDestination
eventDestination :: Prelude.Maybe EventDestination,
    -- | The response's http status code.
    UpdateEventDestinationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateEventDestinationResponse
-> UpdateEventDestinationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEventDestinationResponse
-> UpdateEventDestinationResponse -> Bool
$c/= :: UpdateEventDestinationResponse
-> UpdateEventDestinationResponse -> Bool
== :: UpdateEventDestinationResponse
-> UpdateEventDestinationResponse -> Bool
$c== :: UpdateEventDestinationResponse
-> UpdateEventDestinationResponse -> Bool
Prelude.Eq, ReadPrec [UpdateEventDestinationResponse]
ReadPrec UpdateEventDestinationResponse
Int -> ReadS UpdateEventDestinationResponse
ReadS [UpdateEventDestinationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEventDestinationResponse]
$creadListPrec :: ReadPrec [UpdateEventDestinationResponse]
readPrec :: ReadPrec UpdateEventDestinationResponse
$creadPrec :: ReadPrec UpdateEventDestinationResponse
readList :: ReadS [UpdateEventDestinationResponse]
$creadList :: ReadS [UpdateEventDestinationResponse]
readsPrec :: Int -> ReadS UpdateEventDestinationResponse
$creadsPrec :: Int -> ReadS UpdateEventDestinationResponse
Prelude.Read, Int -> UpdateEventDestinationResponse -> ShowS
[UpdateEventDestinationResponse] -> ShowS
UpdateEventDestinationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEventDestinationResponse] -> ShowS
$cshowList :: [UpdateEventDestinationResponse] -> ShowS
show :: UpdateEventDestinationResponse -> String
$cshow :: UpdateEventDestinationResponse -> String
showsPrec :: Int -> UpdateEventDestinationResponse -> ShowS
$cshowsPrec :: Int -> UpdateEventDestinationResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateEventDestinationResponse x
-> UpdateEventDestinationResponse
forall x.
UpdateEventDestinationResponse
-> Rep UpdateEventDestinationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateEventDestinationResponse x
-> UpdateEventDestinationResponse
$cfrom :: forall x.
UpdateEventDestinationResponse
-> Rep UpdateEventDestinationResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEventDestinationResponse' 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:
--
-- 'configurationSetArn', 'updateEventDestinationResponse_configurationSetArn' - The Amazon Resource Name (ARN) for the ConfigurationSet that was
-- updated.
--
-- 'configurationSetName', 'updateEventDestinationResponse_configurationSetName' - The name of the configuration set.
--
-- 'eventDestination', 'updateEventDestinationResponse_eventDestination' - An EventDestination object containing the details of where events will
-- be logged.
--
-- 'httpStatus', 'updateEventDestinationResponse_httpStatus' - The response's http status code.
newUpdateEventDestinationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateEventDestinationResponse
newUpdateEventDestinationResponse :: Int -> UpdateEventDestinationResponse
newUpdateEventDestinationResponse Int
pHttpStatus_ =
  UpdateEventDestinationResponse'
    { $sel:configurationSetArn:UpdateEventDestinationResponse' :: Maybe Text
configurationSetArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:configurationSetName:UpdateEventDestinationResponse' :: Maybe Text
configurationSetName = forall a. Maybe a
Prelude.Nothing,
      $sel:eventDestination:UpdateEventDestinationResponse' :: Maybe EventDestination
eventDestination = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateEventDestinationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) for the ConfigurationSet that was
-- updated.
updateEventDestinationResponse_configurationSetArn :: Lens.Lens' UpdateEventDestinationResponse (Prelude.Maybe Prelude.Text)
updateEventDestinationResponse_configurationSetArn :: Lens' UpdateEventDestinationResponse (Maybe Text)
updateEventDestinationResponse_configurationSetArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestinationResponse' {Maybe Text
configurationSetArn :: Maybe Text
$sel:configurationSetArn:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe Text
configurationSetArn} -> Maybe Text
configurationSetArn) (\s :: UpdateEventDestinationResponse
s@UpdateEventDestinationResponse' {} Maybe Text
a -> UpdateEventDestinationResponse
s {$sel:configurationSetArn:UpdateEventDestinationResponse' :: Maybe Text
configurationSetArn = Maybe Text
a} :: UpdateEventDestinationResponse)

-- | The name of the configuration set.
updateEventDestinationResponse_configurationSetName :: Lens.Lens' UpdateEventDestinationResponse (Prelude.Maybe Prelude.Text)
updateEventDestinationResponse_configurationSetName :: Lens' UpdateEventDestinationResponse (Maybe Text)
updateEventDestinationResponse_configurationSetName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestinationResponse' {Maybe Text
configurationSetName :: Maybe Text
$sel:configurationSetName:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe Text
configurationSetName} -> Maybe Text
configurationSetName) (\s :: UpdateEventDestinationResponse
s@UpdateEventDestinationResponse' {} Maybe Text
a -> UpdateEventDestinationResponse
s {$sel:configurationSetName:UpdateEventDestinationResponse' :: Maybe Text
configurationSetName = Maybe Text
a} :: UpdateEventDestinationResponse)

-- | An EventDestination object containing the details of where events will
-- be logged.
updateEventDestinationResponse_eventDestination :: Lens.Lens' UpdateEventDestinationResponse (Prelude.Maybe EventDestination)
updateEventDestinationResponse_eventDestination :: Lens' UpdateEventDestinationResponse (Maybe EventDestination)
updateEventDestinationResponse_eventDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEventDestinationResponse' {Maybe EventDestination
eventDestination :: Maybe EventDestination
$sel:eventDestination:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe EventDestination
eventDestination} -> Maybe EventDestination
eventDestination) (\s :: UpdateEventDestinationResponse
s@UpdateEventDestinationResponse' {} Maybe EventDestination
a -> UpdateEventDestinationResponse
s {$sel:eventDestination:UpdateEventDestinationResponse' :: Maybe EventDestination
eventDestination = Maybe EventDestination
a} :: UpdateEventDestinationResponse)

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

instance
  Prelude.NFData
    UpdateEventDestinationResponse
  where
  rnf :: UpdateEventDestinationResponse -> ()
rnf UpdateEventDestinationResponse' {Int
Maybe Text
Maybe EventDestination
httpStatus :: Int
eventDestination :: Maybe EventDestination
configurationSetName :: Maybe Text
configurationSetArn :: Maybe Text
$sel:httpStatus:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Int
$sel:eventDestination:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe EventDestination
$sel:configurationSetName:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe Text
$sel:configurationSetArn:UpdateEventDestinationResponse' :: UpdateEventDestinationResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configurationSetName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EventDestination
eventDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus