{-# 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.GetAppValidationOutput
-- 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)
--
-- Retrieves output from validating an application.
module Amazonka.SMS.GetAppValidationOutput
  ( -- * Creating a Request
    GetAppValidationOutput (..),
    newGetAppValidationOutput,

    -- * Request Lenses
    getAppValidationOutput_appId,

    -- * Destructuring the Response
    GetAppValidationOutputResponse (..),
    newGetAppValidationOutputResponse,

    -- * Response Lenses
    getAppValidationOutputResponse_validationOutputList,
    getAppValidationOutputResponse_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:/ 'newGetAppValidationOutput' smart constructor.
data GetAppValidationOutput = GetAppValidationOutput'
  { -- | The ID of the application.
    GetAppValidationOutput -> Text
appId :: Prelude.Text
  }
  deriving (GetAppValidationOutput -> GetAppValidationOutput -> Bool
(GetAppValidationOutput -> GetAppValidationOutput -> Bool)
-> (GetAppValidationOutput -> GetAppValidationOutput -> Bool)
-> Eq GetAppValidationOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAppValidationOutput -> GetAppValidationOutput -> Bool
$c/= :: GetAppValidationOutput -> GetAppValidationOutput -> Bool
== :: GetAppValidationOutput -> GetAppValidationOutput -> Bool
$c== :: GetAppValidationOutput -> GetAppValidationOutput -> Bool
Prelude.Eq, ReadPrec [GetAppValidationOutput]
ReadPrec GetAppValidationOutput
Int -> ReadS GetAppValidationOutput
ReadS [GetAppValidationOutput]
(Int -> ReadS GetAppValidationOutput)
-> ReadS [GetAppValidationOutput]
-> ReadPrec GetAppValidationOutput
-> ReadPrec [GetAppValidationOutput]
-> Read GetAppValidationOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAppValidationOutput]
$creadListPrec :: ReadPrec [GetAppValidationOutput]
readPrec :: ReadPrec GetAppValidationOutput
$creadPrec :: ReadPrec GetAppValidationOutput
readList :: ReadS [GetAppValidationOutput]
$creadList :: ReadS [GetAppValidationOutput]
readsPrec :: Int -> ReadS GetAppValidationOutput
$creadsPrec :: Int -> ReadS GetAppValidationOutput
Prelude.Read, Int -> GetAppValidationOutput -> ShowS
[GetAppValidationOutput] -> ShowS
GetAppValidationOutput -> String
(Int -> GetAppValidationOutput -> ShowS)
-> (GetAppValidationOutput -> String)
-> ([GetAppValidationOutput] -> ShowS)
-> Show GetAppValidationOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAppValidationOutput] -> ShowS
$cshowList :: [GetAppValidationOutput] -> ShowS
show :: GetAppValidationOutput -> String
$cshow :: GetAppValidationOutput -> String
showsPrec :: Int -> GetAppValidationOutput -> ShowS
$cshowsPrec :: Int -> GetAppValidationOutput -> ShowS
Prelude.Show, (forall x. GetAppValidationOutput -> Rep GetAppValidationOutput x)
-> (forall x.
    Rep GetAppValidationOutput x -> GetAppValidationOutput)
-> Generic GetAppValidationOutput
forall x. Rep GetAppValidationOutput x -> GetAppValidationOutput
forall x. GetAppValidationOutput -> Rep GetAppValidationOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAppValidationOutput x -> GetAppValidationOutput
$cfrom :: forall x. GetAppValidationOutput -> Rep GetAppValidationOutput x
Prelude.Generic)

-- |
-- Create a value of 'GetAppValidationOutput' 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:
--
-- 'appId', 'getAppValidationOutput_appId' - The ID of the application.
newGetAppValidationOutput ::
  -- | 'appId'
  Prelude.Text ->
  GetAppValidationOutput
newGetAppValidationOutput :: Text -> GetAppValidationOutput
newGetAppValidationOutput Text
pAppId_ =
  GetAppValidationOutput' :: Text -> GetAppValidationOutput
GetAppValidationOutput' {$sel:appId:GetAppValidationOutput' :: Text
appId = Text
pAppId_}

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

instance Core.AWSRequest GetAppValidationOutput where
  type
    AWSResponse GetAppValidationOutput =
      GetAppValidationOutputResponse
  request :: GetAppValidationOutput -> Request GetAppValidationOutput
request = Service -> GetAppValidationOutput -> Request GetAppValidationOutput
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAppValidationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAppValidationOutput)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAppValidationOutput))
-> Logger
-> Service
-> Proxy GetAppValidationOutput
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetAppValidationOutput)))
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 [ValidationOutput] -> Int -> GetAppValidationOutputResponse
GetAppValidationOutputResponse'
            (Maybe [ValidationOutput] -> Int -> GetAppValidationOutputResponse)
-> Either String (Maybe [ValidationOutput])
-> Either String (Int -> GetAppValidationOutputResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [ValidationOutput]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"validationOutputList"
                            Either String (Maybe (Maybe [ValidationOutput]))
-> Maybe [ValidationOutput]
-> Either String (Maybe [ValidationOutput])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ValidationOutput]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Int -> GetAppValidationOutputResponse)
-> Either String Int
-> Either String GetAppValidationOutputResponse
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 GetAppValidationOutput

instance Prelude.NFData GetAppValidationOutput

instance Core.ToHeaders GetAppValidationOutput where
  toHeaders :: GetAppValidationOutput -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetAppValidationOutput -> 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.GetAppValidationOutput" ::
                          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 GetAppValidationOutput where
  toJSON :: GetAppValidationOutput -> Value
toJSON GetAppValidationOutput' {Text
appId :: Text
$sel:appId:GetAppValidationOutput' :: GetAppValidationOutput -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [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 GetAppValidationOutput where
  toPath :: GetAppValidationOutput -> ByteString
toPath = ByteString -> GetAppValidationOutput -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'GetAppValidationOutputResponse' 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:
--
-- 'validationOutputList', 'getAppValidationOutputResponse_validationOutputList' - The validation output.
--
-- 'httpStatus', 'getAppValidationOutputResponse_httpStatus' - The response's http status code.
newGetAppValidationOutputResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAppValidationOutputResponse
newGetAppValidationOutputResponse :: Int -> GetAppValidationOutputResponse
newGetAppValidationOutputResponse Int
pHttpStatus_ =
  GetAppValidationOutputResponse' :: Maybe [ValidationOutput] -> Int -> GetAppValidationOutputResponse
GetAppValidationOutputResponse'
    { $sel:validationOutputList:GetAppValidationOutputResponse' :: Maybe [ValidationOutput]
validationOutputList =
        Maybe [ValidationOutput]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAppValidationOutputResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The validation output.
getAppValidationOutputResponse_validationOutputList :: Lens.Lens' GetAppValidationOutputResponse (Prelude.Maybe [ValidationOutput])
getAppValidationOutputResponse_validationOutputList :: (Maybe [ValidationOutput] -> f (Maybe [ValidationOutput]))
-> GetAppValidationOutputResponse
-> f GetAppValidationOutputResponse
getAppValidationOutputResponse_validationOutputList = (GetAppValidationOutputResponse -> Maybe [ValidationOutput])
-> (GetAppValidationOutputResponse
    -> Maybe [ValidationOutput] -> GetAppValidationOutputResponse)
-> Lens
     GetAppValidationOutputResponse
     GetAppValidationOutputResponse
     (Maybe [ValidationOutput])
     (Maybe [ValidationOutput])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAppValidationOutputResponse' {Maybe [ValidationOutput]
validationOutputList :: Maybe [ValidationOutput]
$sel:validationOutputList:GetAppValidationOutputResponse' :: GetAppValidationOutputResponse -> Maybe [ValidationOutput]
validationOutputList} -> Maybe [ValidationOutput]
validationOutputList) (\s :: GetAppValidationOutputResponse
s@GetAppValidationOutputResponse' {} Maybe [ValidationOutput]
a -> GetAppValidationOutputResponse
s {$sel:validationOutputList:GetAppValidationOutputResponse' :: Maybe [ValidationOutput]
validationOutputList = Maybe [ValidationOutput]
a} :: GetAppValidationOutputResponse) ((Maybe [ValidationOutput] -> f (Maybe [ValidationOutput]))
 -> GetAppValidationOutputResponse
 -> f GetAppValidationOutputResponse)
-> ((Maybe [ValidationOutput] -> f (Maybe [ValidationOutput]))
    -> Maybe [ValidationOutput] -> f (Maybe [ValidationOutput]))
-> (Maybe [ValidationOutput] -> f (Maybe [ValidationOutput]))
-> GetAppValidationOutputResponse
-> f GetAppValidationOutputResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ValidationOutput]
  [ValidationOutput]
  [ValidationOutput]
  [ValidationOutput]
-> Iso
     (Maybe [ValidationOutput])
     (Maybe [ValidationOutput])
     (Maybe [ValidationOutput])
     (Maybe [ValidationOutput])
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
  [ValidationOutput]
  [ValidationOutput]
  [ValidationOutput]
  [ValidationOutput]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    GetAppValidationOutputResponse