{-# 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.PinpointSMSVoice.GetConfigurationSetEventDestinations
-- 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)
--
-- Obtain information about an event destination, including the types of
-- events it reports, the Amazon Resource Name (ARN) of the destination,
-- and the name of the event destination.
module Amazonka.PinpointSMSVoice.GetConfigurationSetEventDestinations
  ( -- * Creating a Request
    GetConfigurationSetEventDestinations (..),
    newGetConfigurationSetEventDestinations,

    -- * Request Lenses
    getConfigurationSetEventDestinations_configurationSetName,

    -- * Destructuring the Response
    GetConfigurationSetEventDestinationsResponse (..),
    newGetConfigurationSetEventDestinationsResponse,

    -- * Response Lenses
    getConfigurationSetEventDestinationsResponse_eventDestinations,
    getConfigurationSetEventDestinationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetConfigurationSetEventDestinations' smart constructor.
data GetConfigurationSetEventDestinations = GetConfigurationSetEventDestinations'
  { -- | ConfigurationSetName
    GetConfigurationSetEventDestinations -> Text
configurationSetName :: Prelude.Text
  }
  deriving (GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
(GetConfigurationSetEventDestinations
 -> GetConfigurationSetEventDestinations -> Bool)
-> (GetConfigurationSetEventDestinations
    -> GetConfigurationSetEventDestinations -> Bool)
-> Eq GetConfigurationSetEventDestinations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
$c/= :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
== :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
$c== :: GetConfigurationSetEventDestinations
-> GetConfigurationSetEventDestinations -> Bool
Prelude.Eq, ReadPrec [GetConfigurationSetEventDestinations]
ReadPrec GetConfigurationSetEventDestinations
Int -> ReadS GetConfigurationSetEventDestinations
ReadS [GetConfigurationSetEventDestinations]
(Int -> ReadS GetConfigurationSetEventDestinations)
-> ReadS [GetConfigurationSetEventDestinations]
-> ReadPrec GetConfigurationSetEventDestinations
-> ReadPrec [GetConfigurationSetEventDestinations]
-> Read GetConfigurationSetEventDestinations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigurationSetEventDestinations]
$creadListPrec :: ReadPrec [GetConfigurationSetEventDestinations]
readPrec :: ReadPrec GetConfigurationSetEventDestinations
$creadPrec :: ReadPrec GetConfigurationSetEventDestinations
readList :: ReadS [GetConfigurationSetEventDestinations]
$creadList :: ReadS [GetConfigurationSetEventDestinations]
readsPrec :: Int -> ReadS GetConfigurationSetEventDestinations
$creadsPrec :: Int -> ReadS GetConfigurationSetEventDestinations
Prelude.Read, Int -> GetConfigurationSetEventDestinations -> ShowS
[GetConfigurationSetEventDestinations] -> ShowS
GetConfigurationSetEventDestinations -> String
(Int -> GetConfigurationSetEventDestinations -> ShowS)
-> (GetConfigurationSetEventDestinations -> String)
-> ([GetConfigurationSetEventDestinations] -> ShowS)
-> Show GetConfigurationSetEventDestinations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigurationSetEventDestinations] -> ShowS
$cshowList :: [GetConfigurationSetEventDestinations] -> ShowS
show :: GetConfigurationSetEventDestinations -> String
$cshow :: GetConfigurationSetEventDestinations -> String
showsPrec :: Int -> GetConfigurationSetEventDestinations -> ShowS
$cshowsPrec :: Int -> GetConfigurationSetEventDestinations -> ShowS
Prelude.Show, (forall x.
 GetConfigurationSetEventDestinations
 -> Rep GetConfigurationSetEventDestinations x)
-> (forall x.
    Rep GetConfigurationSetEventDestinations x
    -> GetConfigurationSetEventDestinations)
-> Generic GetConfigurationSetEventDestinations
forall x.
Rep GetConfigurationSetEventDestinations x
-> GetConfigurationSetEventDestinations
forall x.
GetConfigurationSetEventDestinations
-> Rep GetConfigurationSetEventDestinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConfigurationSetEventDestinations x
-> GetConfigurationSetEventDestinations
$cfrom :: forall x.
GetConfigurationSetEventDestinations
-> Rep GetConfigurationSetEventDestinations x
Prelude.Generic)

-- |
-- Create a value of 'GetConfigurationSetEventDestinations' 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:
--
-- 'configurationSetName', 'getConfigurationSetEventDestinations_configurationSetName' - ConfigurationSetName
newGetConfigurationSetEventDestinations ::
  -- | 'configurationSetName'
  Prelude.Text ->
  GetConfigurationSetEventDestinations
newGetConfigurationSetEventDestinations :: Text -> GetConfigurationSetEventDestinations
newGetConfigurationSetEventDestinations
  Text
pConfigurationSetName_ =
    GetConfigurationSetEventDestinations' :: Text -> GetConfigurationSetEventDestinations
GetConfigurationSetEventDestinations'
      { $sel:configurationSetName:GetConfigurationSetEventDestinations' :: Text
configurationSetName =
          Text
pConfigurationSetName_
      }

-- | ConfigurationSetName
getConfigurationSetEventDestinations_configurationSetName :: Lens.Lens' GetConfigurationSetEventDestinations Prelude.Text
getConfigurationSetEventDestinations_configurationSetName :: (Text -> f Text)
-> GetConfigurationSetEventDestinations
-> f GetConfigurationSetEventDestinations
getConfigurationSetEventDestinations_configurationSetName = (GetConfigurationSetEventDestinations -> Text)
-> (GetConfigurationSetEventDestinations
    -> Text -> GetConfigurationSetEventDestinations)
-> Lens
     GetConfigurationSetEventDestinations
     GetConfigurationSetEventDestinations
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
configurationSetName} -> Text
configurationSetName) (\s :: GetConfigurationSetEventDestinations
s@GetConfigurationSetEventDestinations' {} Text
a -> GetConfigurationSetEventDestinations
s {$sel:configurationSetName:GetConfigurationSetEventDestinations' :: Text
configurationSetName = Text
a} :: GetConfigurationSetEventDestinations)

instance
  Core.AWSRequest
    GetConfigurationSetEventDestinations
  where
  type
    AWSResponse GetConfigurationSetEventDestinations =
      GetConfigurationSetEventDestinationsResponse
  request :: GetConfigurationSetEventDestinations
-> Request GetConfigurationSetEventDestinations
request = Service
-> GetConfigurationSetEventDestinations
-> Request GetConfigurationSetEventDestinations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetConfigurationSetEventDestinations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetConfigurationSetEventDestinations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either
      String (AWSResponse GetConfigurationSetEventDestinations))
-> Logger
-> Service
-> Proxy GetConfigurationSetEventDestinations
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse
           (AWSResponse GetConfigurationSetEventDestinations)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [EventDestination]
-> Int -> GetConfigurationSetEventDestinationsResponse
GetConfigurationSetEventDestinationsResponse'
            (Maybe [EventDestination]
 -> Int -> GetConfigurationSetEventDestinationsResponse)
-> Either String (Maybe [EventDestination])
-> Either
     String (Int -> GetConfigurationSetEventDestinationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [EventDestination]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventDestinations"
                            Either String (Maybe (Maybe [EventDestination]))
-> Maybe [EventDestination]
-> Either String (Maybe [EventDestination])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EventDestination]
forall a. Monoid a => a
Prelude.mempty
                        )
              Either String (Int -> GetConfigurationSetEventDestinationsResponse)
-> Either String Int
-> Either String GetConfigurationSetEventDestinationsResponse
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
    GetConfigurationSetEventDestinations

instance
  Prelude.NFData
    GetConfigurationSetEventDestinations

instance
  Core.ToHeaders
    GetConfigurationSetEventDestinations
  where
  toHeaders :: GetConfigurationSetEventDestinations -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> GetConfigurationSetEventDestinations -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath
    GetConfigurationSetEventDestinations
  where
  toPath :: GetConfigurationSetEventDestinations -> ByteString
toPath GetConfigurationSetEventDestinations' {Text
configurationSetName :: Text
$sel:configurationSetName:GetConfigurationSetEventDestinations' :: GetConfigurationSetEventDestinations -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/sms-voice/configuration-sets/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
configurationSetName,
        ByteString
"/event-destinations"
      ]

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

-- | An object that contains information about an event destination.
--
-- /See:/ 'newGetConfigurationSetEventDestinationsResponse' smart constructor.
data GetConfigurationSetEventDestinationsResponse = GetConfigurationSetEventDestinationsResponse'
  { GetConfigurationSetEventDestinationsResponse
-> Maybe [EventDestination]
eventDestinations :: Prelude.Maybe [EventDestination],
    -- | The response's http status code.
    GetConfigurationSetEventDestinationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
(GetConfigurationSetEventDestinationsResponse
 -> GetConfigurationSetEventDestinationsResponse -> Bool)
-> (GetConfigurationSetEventDestinationsResponse
    -> GetConfigurationSetEventDestinationsResponse -> Bool)
-> Eq GetConfigurationSetEventDestinationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
$c/= :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
== :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
$c== :: GetConfigurationSetEventDestinationsResponse
-> GetConfigurationSetEventDestinationsResponse -> Bool
Prelude.Eq, ReadPrec [GetConfigurationSetEventDestinationsResponse]
ReadPrec GetConfigurationSetEventDestinationsResponse
Int -> ReadS GetConfigurationSetEventDestinationsResponse
ReadS [GetConfigurationSetEventDestinationsResponse]
(Int -> ReadS GetConfigurationSetEventDestinationsResponse)
-> ReadS [GetConfigurationSetEventDestinationsResponse]
-> ReadPrec GetConfigurationSetEventDestinationsResponse
-> ReadPrec [GetConfigurationSetEventDestinationsResponse]
-> Read GetConfigurationSetEventDestinationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigurationSetEventDestinationsResponse]
$creadListPrec :: ReadPrec [GetConfigurationSetEventDestinationsResponse]
readPrec :: ReadPrec GetConfigurationSetEventDestinationsResponse
$creadPrec :: ReadPrec GetConfigurationSetEventDestinationsResponse
readList :: ReadS [GetConfigurationSetEventDestinationsResponse]
$creadList :: ReadS [GetConfigurationSetEventDestinationsResponse]
readsPrec :: Int -> ReadS GetConfigurationSetEventDestinationsResponse
$creadsPrec :: Int -> ReadS GetConfigurationSetEventDestinationsResponse
Prelude.Read, Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
[GetConfigurationSetEventDestinationsResponse] -> ShowS
GetConfigurationSetEventDestinationsResponse -> String
(Int -> GetConfigurationSetEventDestinationsResponse -> ShowS)
-> (GetConfigurationSetEventDestinationsResponse -> String)
-> ([GetConfigurationSetEventDestinationsResponse] -> ShowS)
-> Show GetConfigurationSetEventDestinationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigurationSetEventDestinationsResponse] -> ShowS
$cshowList :: [GetConfigurationSetEventDestinationsResponse] -> ShowS
show :: GetConfigurationSetEventDestinationsResponse -> String
$cshow :: GetConfigurationSetEventDestinationsResponse -> String
showsPrec :: Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
$cshowsPrec :: Int -> GetConfigurationSetEventDestinationsResponse -> ShowS
Prelude.Show, (forall x.
 GetConfigurationSetEventDestinationsResponse
 -> Rep GetConfigurationSetEventDestinationsResponse x)
-> (forall x.
    Rep GetConfigurationSetEventDestinationsResponse x
    -> GetConfigurationSetEventDestinationsResponse)
-> Generic GetConfigurationSetEventDestinationsResponse
forall x.
Rep GetConfigurationSetEventDestinationsResponse x
-> GetConfigurationSetEventDestinationsResponse
forall x.
GetConfigurationSetEventDestinationsResponse
-> Rep GetConfigurationSetEventDestinationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetConfigurationSetEventDestinationsResponse x
-> GetConfigurationSetEventDestinationsResponse
$cfrom :: forall x.
GetConfigurationSetEventDestinationsResponse
-> Rep GetConfigurationSetEventDestinationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetConfigurationSetEventDestinationsResponse' 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:
--
-- 'eventDestinations', 'getConfigurationSetEventDestinationsResponse_eventDestinations' - Undocumented member.
--
-- 'httpStatus', 'getConfigurationSetEventDestinationsResponse_httpStatus' - The response's http status code.
newGetConfigurationSetEventDestinationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetConfigurationSetEventDestinationsResponse
newGetConfigurationSetEventDestinationsResponse :: Int -> GetConfigurationSetEventDestinationsResponse
newGetConfigurationSetEventDestinationsResponse
  Int
pHttpStatus_ =
    GetConfigurationSetEventDestinationsResponse' :: Maybe [EventDestination]
-> Int -> GetConfigurationSetEventDestinationsResponse
GetConfigurationSetEventDestinationsResponse'
      { $sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: Maybe [EventDestination]
eventDestinations =
          Maybe [EventDestination]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetConfigurationSetEventDestinationsResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
getConfigurationSetEventDestinationsResponse_eventDestinations :: Lens.Lens' GetConfigurationSetEventDestinationsResponse (Prelude.Maybe [EventDestination])
getConfigurationSetEventDestinationsResponse_eventDestinations :: (Maybe [EventDestination] -> f (Maybe [EventDestination]))
-> GetConfigurationSetEventDestinationsResponse
-> f GetConfigurationSetEventDestinationsResponse
getConfigurationSetEventDestinationsResponse_eventDestinations = (GetConfigurationSetEventDestinationsResponse
 -> Maybe [EventDestination])
-> (GetConfigurationSetEventDestinationsResponse
    -> Maybe [EventDestination]
    -> GetConfigurationSetEventDestinationsResponse)
-> Lens
     GetConfigurationSetEventDestinationsResponse
     GetConfigurationSetEventDestinationsResponse
     (Maybe [EventDestination])
     (Maybe [EventDestination])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigurationSetEventDestinationsResponse' {Maybe [EventDestination]
eventDestinations :: Maybe [EventDestination]
$sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: GetConfigurationSetEventDestinationsResponse
-> Maybe [EventDestination]
eventDestinations} -> Maybe [EventDestination]
eventDestinations) (\s :: GetConfigurationSetEventDestinationsResponse
s@GetConfigurationSetEventDestinationsResponse' {} Maybe [EventDestination]
a -> GetConfigurationSetEventDestinationsResponse
s {$sel:eventDestinations:GetConfigurationSetEventDestinationsResponse' :: Maybe [EventDestination]
eventDestinations = Maybe [EventDestination]
a} :: GetConfigurationSetEventDestinationsResponse) ((Maybe [EventDestination] -> f (Maybe [EventDestination]))
 -> GetConfigurationSetEventDestinationsResponse
 -> f GetConfigurationSetEventDestinationsResponse)
-> ((Maybe [EventDestination] -> f (Maybe [EventDestination]))
    -> Maybe [EventDestination] -> f (Maybe [EventDestination]))
-> (Maybe [EventDestination] -> f (Maybe [EventDestination]))
-> GetConfigurationSetEventDestinationsResponse
-> f GetConfigurationSetEventDestinationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EventDestination]
  [EventDestination]
  [EventDestination]
  [EventDestination]
-> Iso
     (Maybe [EventDestination])
     (Maybe [EventDestination])
     (Maybe [EventDestination])
     (Maybe [EventDestination])
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 AnIso
  [EventDestination]
  [EventDestination]
  [EventDestination]
  [EventDestination]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetConfigurationSetEventDestinationsResponse