{-# 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.WAFV2.GetMobileSdkRelease
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information for the specified mobile SDK release, including
-- release notes and tags.
--
-- The mobile SDK is not generally available. Customers who have access to
-- the mobile SDK can use it to establish and manage WAF tokens for use in
-- HTTP(S) requests from a mobile device to WAF. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-application-integration.html WAF client application integration>
-- in the /WAF Developer Guide/.
module Amazonka.WAFV2.GetMobileSdkRelease
  ( -- * Creating a Request
    GetMobileSdkRelease (..),
    newGetMobileSdkRelease,

    -- * Request Lenses
    getMobileSdkRelease_platform,
    getMobileSdkRelease_releaseVersion,

    -- * Destructuring the Response
    GetMobileSdkReleaseResponse (..),
    newGetMobileSdkReleaseResponse,

    -- * Response Lenses
    getMobileSdkReleaseResponse_mobileSdkRelease,
    getMobileSdkReleaseResponse_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.WAFV2.Types

-- | /See:/ 'newGetMobileSdkRelease' smart constructor.
data GetMobileSdkRelease = GetMobileSdkRelease'
  { -- | The device platform.
    GetMobileSdkRelease -> Platform
platform :: Platform,
    -- | The release version. For the latest available version, specify @LATEST@.
    GetMobileSdkRelease -> Text
releaseVersion :: Prelude.Text
  }
  deriving (GetMobileSdkRelease -> GetMobileSdkRelease -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMobileSdkRelease -> GetMobileSdkRelease -> Bool
$c/= :: GetMobileSdkRelease -> GetMobileSdkRelease -> Bool
== :: GetMobileSdkRelease -> GetMobileSdkRelease -> Bool
$c== :: GetMobileSdkRelease -> GetMobileSdkRelease -> Bool
Prelude.Eq, ReadPrec [GetMobileSdkRelease]
ReadPrec GetMobileSdkRelease
Int -> ReadS GetMobileSdkRelease
ReadS [GetMobileSdkRelease]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMobileSdkRelease]
$creadListPrec :: ReadPrec [GetMobileSdkRelease]
readPrec :: ReadPrec GetMobileSdkRelease
$creadPrec :: ReadPrec GetMobileSdkRelease
readList :: ReadS [GetMobileSdkRelease]
$creadList :: ReadS [GetMobileSdkRelease]
readsPrec :: Int -> ReadS GetMobileSdkRelease
$creadsPrec :: Int -> ReadS GetMobileSdkRelease
Prelude.Read, Int -> GetMobileSdkRelease -> ShowS
[GetMobileSdkRelease] -> ShowS
GetMobileSdkRelease -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMobileSdkRelease] -> ShowS
$cshowList :: [GetMobileSdkRelease] -> ShowS
show :: GetMobileSdkRelease -> String
$cshow :: GetMobileSdkRelease -> String
showsPrec :: Int -> GetMobileSdkRelease -> ShowS
$cshowsPrec :: Int -> GetMobileSdkRelease -> ShowS
Prelude.Show, forall x. Rep GetMobileSdkRelease x -> GetMobileSdkRelease
forall x. GetMobileSdkRelease -> Rep GetMobileSdkRelease x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMobileSdkRelease x -> GetMobileSdkRelease
$cfrom :: forall x. GetMobileSdkRelease -> Rep GetMobileSdkRelease x
Prelude.Generic)

-- |
-- Create a value of 'GetMobileSdkRelease' 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:
--
-- 'platform', 'getMobileSdkRelease_platform' - The device platform.
--
-- 'releaseVersion', 'getMobileSdkRelease_releaseVersion' - The release version. For the latest available version, specify @LATEST@.
newGetMobileSdkRelease ::
  -- | 'platform'
  Platform ->
  -- | 'releaseVersion'
  Prelude.Text ->
  GetMobileSdkRelease
newGetMobileSdkRelease :: Platform -> Text -> GetMobileSdkRelease
newGetMobileSdkRelease Platform
pPlatform_ Text
pReleaseVersion_ =
  GetMobileSdkRelease'
    { $sel:platform:GetMobileSdkRelease' :: Platform
platform = Platform
pPlatform_,
      $sel:releaseVersion:GetMobileSdkRelease' :: Text
releaseVersion = Text
pReleaseVersion_
    }

-- | The device platform.
getMobileSdkRelease_platform :: Lens.Lens' GetMobileSdkRelease Platform
getMobileSdkRelease_platform :: Lens' GetMobileSdkRelease Platform
getMobileSdkRelease_platform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMobileSdkRelease' {Platform
platform :: Platform
$sel:platform:GetMobileSdkRelease' :: GetMobileSdkRelease -> Platform
platform} -> Platform
platform) (\s :: GetMobileSdkRelease
s@GetMobileSdkRelease' {} Platform
a -> GetMobileSdkRelease
s {$sel:platform:GetMobileSdkRelease' :: Platform
platform = Platform
a} :: GetMobileSdkRelease)

-- | The release version. For the latest available version, specify @LATEST@.
getMobileSdkRelease_releaseVersion :: Lens.Lens' GetMobileSdkRelease Prelude.Text
getMobileSdkRelease_releaseVersion :: Lens' GetMobileSdkRelease Text
getMobileSdkRelease_releaseVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMobileSdkRelease' {Text
releaseVersion :: Text
$sel:releaseVersion:GetMobileSdkRelease' :: GetMobileSdkRelease -> Text
releaseVersion} -> Text
releaseVersion) (\s :: GetMobileSdkRelease
s@GetMobileSdkRelease' {} Text
a -> GetMobileSdkRelease
s {$sel:releaseVersion:GetMobileSdkRelease' :: Text
releaseVersion = Text
a} :: GetMobileSdkRelease)

instance Core.AWSRequest GetMobileSdkRelease where
  type
    AWSResponse GetMobileSdkRelease =
      GetMobileSdkReleaseResponse
  request :: (Service -> Service)
-> GetMobileSdkRelease -> Request GetMobileSdkRelease
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 GetMobileSdkRelease
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetMobileSdkRelease)))
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 MobileSdkRelease -> Int -> GetMobileSdkReleaseResponse
GetMobileSdkReleaseResponse'
            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
"MobileSdkRelease")
            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 GetMobileSdkRelease where
  hashWithSalt :: Int -> GetMobileSdkRelease -> Int
hashWithSalt Int
_salt GetMobileSdkRelease' {Text
Platform
releaseVersion :: Text
platform :: Platform
$sel:releaseVersion:GetMobileSdkRelease' :: GetMobileSdkRelease -> Text
$sel:platform:GetMobileSdkRelease' :: GetMobileSdkRelease -> Platform
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Platform
platform
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
releaseVersion

instance Prelude.NFData GetMobileSdkRelease where
  rnf :: GetMobileSdkRelease -> ()
rnf GetMobileSdkRelease' {Text
Platform
releaseVersion :: Text
platform :: Platform
$sel:releaseVersion:GetMobileSdkRelease' :: GetMobileSdkRelease -> Text
$sel:platform:GetMobileSdkRelease' :: GetMobileSdkRelease -> Platform
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Platform
platform
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
releaseVersion

instance Data.ToHeaders GetMobileSdkRelease where
  toHeaders :: GetMobileSdkRelease -> 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
"AWSWAF_20190729.GetMobileSdkRelease" ::
                          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 GetMobileSdkRelease where
  toJSON :: GetMobileSdkRelease -> Value
toJSON GetMobileSdkRelease' {Text
Platform
releaseVersion :: Text
platform :: Platform
$sel:releaseVersion:GetMobileSdkRelease' :: GetMobileSdkRelease -> Text
$sel:platform:GetMobileSdkRelease' :: GetMobileSdkRelease -> Platform
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"Platform" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Platform
platform),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"ReleaseVersion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
releaseVersion)
          ]
      )

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

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

-- | /See:/ 'newGetMobileSdkReleaseResponse' smart constructor.
data GetMobileSdkReleaseResponse = GetMobileSdkReleaseResponse'
  { -- | Information for a specified SDK release, including release notes and
    -- tags.
    GetMobileSdkReleaseResponse -> Maybe MobileSdkRelease
mobileSdkRelease :: Prelude.Maybe MobileSdkRelease,
    -- | The response's http status code.
    GetMobileSdkReleaseResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetMobileSdkReleaseResponse -> GetMobileSdkReleaseResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMobileSdkReleaseResponse -> GetMobileSdkReleaseResponse -> Bool
$c/= :: GetMobileSdkReleaseResponse -> GetMobileSdkReleaseResponse -> Bool
== :: GetMobileSdkReleaseResponse -> GetMobileSdkReleaseResponse -> Bool
$c== :: GetMobileSdkReleaseResponse -> GetMobileSdkReleaseResponse -> Bool
Prelude.Eq, ReadPrec [GetMobileSdkReleaseResponse]
ReadPrec GetMobileSdkReleaseResponse
Int -> ReadS GetMobileSdkReleaseResponse
ReadS [GetMobileSdkReleaseResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMobileSdkReleaseResponse]
$creadListPrec :: ReadPrec [GetMobileSdkReleaseResponse]
readPrec :: ReadPrec GetMobileSdkReleaseResponse
$creadPrec :: ReadPrec GetMobileSdkReleaseResponse
readList :: ReadS [GetMobileSdkReleaseResponse]
$creadList :: ReadS [GetMobileSdkReleaseResponse]
readsPrec :: Int -> ReadS GetMobileSdkReleaseResponse
$creadsPrec :: Int -> ReadS GetMobileSdkReleaseResponse
Prelude.Read, Int -> GetMobileSdkReleaseResponse -> ShowS
[GetMobileSdkReleaseResponse] -> ShowS
GetMobileSdkReleaseResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMobileSdkReleaseResponse] -> ShowS
$cshowList :: [GetMobileSdkReleaseResponse] -> ShowS
show :: GetMobileSdkReleaseResponse -> String
$cshow :: GetMobileSdkReleaseResponse -> String
showsPrec :: Int -> GetMobileSdkReleaseResponse -> ShowS
$cshowsPrec :: Int -> GetMobileSdkReleaseResponse -> ShowS
Prelude.Show, forall x.
Rep GetMobileSdkReleaseResponse x -> GetMobileSdkReleaseResponse
forall x.
GetMobileSdkReleaseResponse -> Rep GetMobileSdkReleaseResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetMobileSdkReleaseResponse x -> GetMobileSdkReleaseResponse
$cfrom :: forall x.
GetMobileSdkReleaseResponse -> Rep GetMobileSdkReleaseResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetMobileSdkReleaseResponse' 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:
--
-- 'mobileSdkRelease', 'getMobileSdkReleaseResponse_mobileSdkRelease' - Information for a specified SDK release, including release notes and
-- tags.
--
-- 'httpStatus', 'getMobileSdkReleaseResponse_httpStatus' - The response's http status code.
newGetMobileSdkReleaseResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetMobileSdkReleaseResponse
newGetMobileSdkReleaseResponse :: Int -> GetMobileSdkReleaseResponse
newGetMobileSdkReleaseResponse Int
pHttpStatus_ =
  GetMobileSdkReleaseResponse'
    { $sel:mobileSdkRelease:GetMobileSdkReleaseResponse' :: Maybe MobileSdkRelease
mobileSdkRelease =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetMobileSdkReleaseResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information for a specified SDK release, including release notes and
-- tags.
getMobileSdkReleaseResponse_mobileSdkRelease :: Lens.Lens' GetMobileSdkReleaseResponse (Prelude.Maybe MobileSdkRelease)
getMobileSdkReleaseResponse_mobileSdkRelease :: Lens' GetMobileSdkReleaseResponse (Maybe MobileSdkRelease)
getMobileSdkReleaseResponse_mobileSdkRelease = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMobileSdkReleaseResponse' {Maybe MobileSdkRelease
mobileSdkRelease :: Maybe MobileSdkRelease
$sel:mobileSdkRelease:GetMobileSdkReleaseResponse' :: GetMobileSdkReleaseResponse -> Maybe MobileSdkRelease
mobileSdkRelease} -> Maybe MobileSdkRelease
mobileSdkRelease) (\s :: GetMobileSdkReleaseResponse
s@GetMobileSdkReleaseResponse' {} Maybe MobileSdkRelease
a -> GetMobileSdkReleaseResponse
s {$sel:mobileSdkRelease:GetMobileSdkReleaseResponse' :: Maybe MobileSdkRelease
mobileSdkRelease = Maybe MobileSdkRelease
a} :: GetMobileSdkReleaseResponse)

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

instance Prelude.NFData GetMobileSdkReleaseResponse where
  rnf :: GetMobileSdkReleaseResponse -> ()
rnf GetMobileSdkReleaseResponse' {Int
Maybe MobileSdkRelease
httpStatus :: Int
mobileSdkRelease :: Maybe MobileSdkRelease
$sel:httpStatus:GetMobileSdkReleaseResponse' :: GetMobileSdkReleaseResponse -> Int
$sel:mobileSdkRelease:GetMobileSdkReleaseResponse' :: GetMobileSdkReleaseResponse -> Maybe MobileSdkRelease
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe MobileSdkRelease
mobileSdkRelease
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus