{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides information to Server Migration Service 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
    { $sel:notificationContext:NotifyAppValidationOutput' :: Maybe NotificationContext
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 :: Lens' NotifyAppValidationOutput (Maybe NotificationContext)
notifyAppValidationOutput_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 :: Lens' NotifyAppValidationOutput Text
notifyAppValidationOutput_appId = 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 :: (Service -> Service)
-> NotifyAppValidationOutput -> Request NotifyAppValidationOutput
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 NotifyAppValidationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse NotifyAppValidationOutput)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> NotifyAppValidationOutputResponse
NotifyAppValidationOutputResponse'
            forall (f :: * -> *) a b. Functor 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 NotifyAppValidationOutput where
  hashWithSalt :: Int -> NotifyAppValidationOutput -> Int
hashWithSalt Int
_salt NotifyAppValidationOutput' {Maybe NotificationContext
Text
appId :: Text
notificationContext :: Maybe NotificationContext
$sel:appId:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Text
$sel:notificationContext:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Maybe NotificationContext
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationContext
notificationContext
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId

instance Prelude.NFData NotifyAppValidationOutput where
  rnf :: NotifyAppValidationOutput -> ()
rnf NotifyAppValidationOutput' {Maybe NotificationContext
Text
appId :: Text
notificationContext :: Maybe NotificationContext
$sel:appId:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Text
$sel:notificationContext:NotifyAppValidationOutput' :: NotifyAppValidationOutput -> Maybe NotificationContext
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationContext
notificationContext
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
appId

instance Data.ToHeaders NotifyAppValidationOutput where
  toHeaders :: NotifyAppValidationOutput -> 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
"AWSServerMigrationService_V2016_10_24.NotifyAppValidationOutput" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"notificationContext" 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 NotificationContext
notificationContext,
            forall a. a -> Maybe a
Prelude.Just (Key
"appId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
appId)
          ]
      )

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

instance Data.ToQuery NotifyAppValidationOutput where
  toQuery :: NotifyAppValidationOutput -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:NotifyAppValidationOutputResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
notifyAppValidationOutputResponse_httpStatus :: Lens.Lens' NotifyAppValidationOutputResponse Prelude.Int
notifyAppValidationOutputResponse_httpStatus :: Lens' NotifyAppValidationOutputResponse Int
notifyAppValidationOutputResponse_httpStatus = 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
  where
  rnf :: NotifyAppValidationOutputResponse -> ()
rnf NotifyAppValidationOutputResponse' {Int
httpStatus :: Int
$sel:httpStatus:NotifyAppValidationOutputResponse' :: NotifyAppValidationOutputResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus