{-# 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.SMS.NotifyAppValidationOutput
-- 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)
--
-- Provides information to AWS SMS about whether application validation is
-- successful.
module Amazonka.SMS.NotifyAppValidationOutput
  ( -- * Creating a Request
    NotifyAppValidationOutput (..),
    newNotifyAppValidationOutput,

    -- * Request Lenses
    notifyAppValidationOutput_notificationContext,
    notifyAppValidationOutput_appId,

    -- * Destructuring the Response
    NotifyAppValidationOutputResponse (..),
    newNotifyAppValidationOutputResponse,

    -- * Response Lenses
    notifyAppValidationOutputResponse_httpStatus,
  )
where

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

-- | /See:/ 'newNotifyAppValidationOutput' smart constructor.
data NotifyAppValidationOutput = NotifyAppValidationOutput'
  { -- | The notification information.
    NotifyAppValidationOutput -> Maybe NotificationContext
notificationContext :: Prelude.Maybe NotificationContext,
    -- | The ID of the application.
    NotifyAppValidationOutput -> Text
appId :: Prelude.Text
  }
  deriving (NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool
(NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool)
-> (NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool)
-> Eq NotifyAppValidationOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool
$c/= :: NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool
== :: NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool
$c== :: NotifyAppValidationOutput -> NotifyAppValidationOutput -> Bool
Prelude.Eq, ReadPrec [NotifyAppValidationOutput]
ReadPrec NotifyAppValidationOutput
Int -> ReadS NotifyAppValidationOutput
ReadS [NotifyAppValidationOutput]
(Int -> ReadS NotifyAppValidationOutput)
-> ReadS [NotifyAppValidationOutput]
-> ReadPrec NotifyAppValidationOutput
-> ReadPrec [NotifyAppValidationOutput]
-> Read NotifyAppValidationOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NotifyAppValidationOutput]
$creadListPrec :: ReadPrec [NotifyAppValidationOutput]
readPrec :: ReadPrec NotifyAppValidationOutput
$creadPrec :: ReadPrec NotifyAppValidationOutput
readList :: ReadS [NotifyAppValidationOutput]
$creadList :: ReadS [NotifyAppValidationOutput]
readsPrec :: Int -> ReadS NotifyAppValidationOutput
$creadsPrec :: Int -> ReadS NotifyAppValidationOutput
Prelude.Read, Int -> NotifyAppValidationOutput -> ShowS
[NotifyAppValidationOutput] -> ShowS
NotifyAppValidationOutput -> String
(Int -> NotifyAppValidationOutput -> ShowS)
-> (NotifyAppValidationOutput -> String)
-> ([NotifyAppValidationOutput] -> ShowS)
-> Show NotifyAppValidationOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotifyAppValidationOutput] -> ShowS
$cshowList :: [NotifyAppValidationOutput] -> ShowS
show :: NotifyAppValidationOutput -> String
$cshow :: NotifyAppValidationOutput -> String
showsPrec :: Int -> NotifyAppValidationOutput -> ShowS
$cshowsPrec :: Int -> NotifyAppValidationOutput -> ShowS
Prelude.Show, (forall x.
 NotifyAppValidationOutput -> Rep NotifyAppValidationOutput x)
-> (forall x.
    Rep NotifyAppValidationOutput x -> NotifyAppValidationOutput)
-> Generic NotifyAppValidationOutput
forall x.
Rep NotifyAppValidationOutput x -> NotifyAppValidationOutput
forall x.
NotifyAppValidationOutput -> Rep NotifyAppValidationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep NotifyAppValidationOutput x -> NotifyAppValidationOutput
$cfrom :: forall x.
NotifyAppValidationOutput -> Rep NotifyAppValidationOutput x
Prelude.Generic)

-- |
-- Create a value of 'NotifyAppValidationOutput' 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:
--
-- 'notificationContext', 'notifyAppValidationOutput_notificationContext' - The notification information.
--
-- 'appId', 'notifyAppValidationOutput_appId' - The ID of the application.
newNotifyAppValidationOutput ::
  -- | 'appId'
  Prelude.Text ->
  NotifyAppValidationOutput
newNotifyAppValidationOutput :: Text -> NotifyAppValidationOutput
newNotifyAppValidationOutput Text
pAppId_ =
  NotifyAppValidationOutput' :: Maybe NotificationContext -> Text -> NotifyAppValidationOutput
NotifyAppValidationOutput'
    { $sel:notificationContext:NotifyAppValidationOutput' :: Maybe NotificationContext
notificationContext =
        Maybe NotificationContext
forall a. Maybe a
Prelude.Nothing,
      $sel:appId:NotifyAppValidationOutput' :: Text
appId = Text
pAppId_
    }

-- | The notification information.
notifyAppValidationOutput_notificationContext :: Lens.Lens' NotifyAppValidationOutput (Prelude.Maybe NotificationContext)
notifyAppValidationOutput_notificationContext :: (Maybe NotificationContext -> f (Maybe NotificationContext))
-> NotifyAppValidationOutput -> f NotifyAppValidationOutput
notifyAppValidationOutput_notificationContext = (NotifyAppValidationOutput -> Maybe NotificationContext)
-> (NotifyAppValidationOutput
    -> Maybe NotificationContext -> NotifyAppValidationOutput)
-> Lens
     NotifyAppValidationOutput
     NotifyAppValidationOutput
     (Maybe NotificationContext)
     (Maybe NotificationContext)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyAppValidationOutput' {Maybe NotificationContext
notificationContext :: Maybe NotificationContext
$sel:notificationContext:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Maybe NotificationContext
notificationContext} -> Maybe NotificationContext
notificationContext) (\s :: NotifyAppValidationOutput
s@NotifyAppValidationOutput' {} Maybe NotificationContext
a -> NotifyAppValidationOutput
s {$sel:notificationContext:NotifyAppValidationOutput' :: Maybe NotificationContext
notificationContext = Maybe NotificationContext
a} :: NotifyAppValidationOutput)

-- | The ID of the application.
notifyAppValidationOutput_appId :: Lens.Lens' NotifyAppValidationOutput Prelude.Text
notifyAppValidationOutput_appId :: (Text -> f Text)
-> NotifyAppValidationOutput -> f NotifyAppValidationOutput
notifyAppValidationOutput_appId = (NotifyAppValidationOutput -> Text)
-> (NotifyAppValidationOutput -> Text -> NotifyAppValidationOutput)
-> Lens
     NotifyAppValidationOutput NotifyAppValidationOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NotifyAppValidationOutput' {Text
appId :: Text
$sel:appId:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Text
appId} -> Text
appId) (\s :: NotifyAppValidationOutput
s@NotifyAppValidationOutput' {} Text
a -> NotifyAppValidationOutput
s {$sel:appId:NotifyAppValidationOutput' :: Text
appId = Text
a} :: NotifyAppValidationOutput)

instance Core.AWSRequest NotifyAppValidationOutput where
  type
    AWSResponse NotifyAppValidationOutput =
      NotifyAppValidationOutputResponse
  request :: NotifyAppValidationOutput -> Request NotifyAppValidationOutput
request = Service
-> NotifyAppValidationOutput -> Request NotifyAppValidationOutput
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy NotifyAppValidationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse NotifyAppValidationOutput)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse NotifyAppValidationOutput))
-> Logger
-> Service
-> Proxy NotifyAppValidationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse NotifyAppValidationOutput)))
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 -> NotifyAppValidationOutputResponse
NotifyAppValidationOutputResponse'
            (Int -> NotifyAppValidationOutputResponse)
-> Either String Int
-> Either String NotifyAppValidationOutputResponse
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 NotifyAppValidationOutput

instance Prelude.NFData NotifyAppValidationOutput

instance Core.ToHeaders NotifyAppValidationOutput where
  toHeaders :: NotifyAppValidationOutput -> ResponseHeaders
toHeaders =
    ResponseHeaders -> NotifyAppValidationOutput -> 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
"AWSServerMigrationService_V2016_10_24.NotifyAppValidationOutput" ::
                          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 NotifyAppValidationOutput where
  toJSON :: NotifyAppValidationOutput -> Value
toJSON NotifyAppValidationOutput' {Maybe NotificationContext
Text
appId :: Text
notificationContext :: Maybe NotificationContext
$sel:appId:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Text
$sel:notificationContext:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Maybe NotificationContext
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"notificationContext" Text -> NotificationContext -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NotificationContext -> Pair)
-> Maybe NotificationContext -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationContext
notificationContext,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"appId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
appId)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    NotifyAppValidationOutputResponse