{-# 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.Pinpoint.GetApplicationSettings
-- 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 information about the settings for an application.
module Amazonka.Pinpoint.GetApplicationSettings
  ( -- * Creating a Request
    GetApplicationSettings (..),
    newGetApplicationSettings,

    -- * Request Lenses
    getApplicationSettings_applicationId,

    -- * Destructuring the Response
    GetApplicationSettingsResponse (..),
    newGetApplicationSettingsResponse,

    -- * Response Lenses
    getApplicationSettingsResponse_httpStatus,
    getApplicationSettingsResponse_applicationSettingsResource,
  )
where

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

-- | /See:/ 'newGetApplicationSettings' smart constructor.
data GetApplicationSettings = GetApplicationSettings'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetApplicationSettings -> Text
applicationId :: Prelude.Text
  }
  deriving (GetApplicationSettings -> GetApplicationSettings -> Bool
(GetApplicationSettings -> GetApplicationSettings -> Bool)
-> (GetApplicationSettings -> GetApplicationSettings -> Bool)
-> Eq GetApplicationSettings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetApplicationSettings -> GetApplicationSettings -> Bool
$c/= :: GetApplicationSettings -> GetApplicationSettings -> Bool
== :: GetApplicationSettings -> GetApplicationSettings -> Bool
$c== :: GetApplicationSettings -> GetApplicationSettings -> Bool
Prelude.Eq, ReadPrec [GetApplicationSettings]
ReadPrec GetApplicationSettings
Int -> ReadS GetApplicationSettings
ReadS [GetApplicationSettings]
(Int -> ReadS GetApplicationSettings)
-> ReadS [GetApplicationSettings]
-> ReadPrec GetApplicationSettings
-> ReadPrec [GetApplicationSettings]
-> Read GetApplicationSettings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetApplicationSettings]
$creadListPrec :: ReadPrec [GetApplicationSettings]
readPrec :: ReadPrec GetApplicationSettings
$creadPrec :: ReadPrec GetApplicationSettings
readList :: ReadS [GetApplicationSettings]
$creadList :: ReadS [GetApplicationSettings]
readsPrec :: Int -> ReadS GetApplicationSettings
$creadsPrec :: Int -> ReadS GetApplicationSettings
Prelude.Read, Int -> GetApplicationSettings -> ShowS
[GetApplicationSettings] -> ShowS
GetApplicationSettings -> String
(Int -> GetApplicationSettings -> ShowS)
-> (GetApplicationSettings -> String)
-> ([GetApplicationSettings] -> ShowS)
-> Show GetApplicationSettings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetApplicationSettings] -> ShowS
$cshowList :: [GetApplicationSettings] -> ShowS
show :: GetApplicationSettings -> String
$cshow :: GetApplicationSettings -> String
showsPrec :: Int -> GetApplicationSettings -> ShowS
$cshowsPrec :: Int -> GetApplicationSettings -> ShowS
Prelude.Show, (forall x. GetApplicationSettings -> Rep GetApplicationSettings x)
-> (forall x.
    Rep GetApplicationSettings x -> GetApplicationSettings)
-> Generic GetApplicationSettings
forall x. Rep GetApplicationSettings x -> GetApplicationSettings
forall x. GetApplicationSettings -> Rep GetApplicationSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetApplicationSettings x -> GetApplicationSettings
$cfrom :: forall x. GetApplicationSettings -> Rep GetApplicationSettings x
Prelude.Generic)

-- |
-- Create a value of 'GetApplicationSettings' 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:
--
-- 'applicationId', 'getApplicationSettings_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
newGetApplicationSettings ::
  -- | 'applicationId'
  Prelude.Text ->
  GetApplicationSettings
newGetApplicationSettings :: Text -> GetApplicationSettings
newGetApplicationSettings Text
pApplicationId_ =
  GetApplicationSettings' :: Text -> GetApplicationSettings
GetApplicationSettings'
    { $sel:applicationId:GetApplicationSettings' :: Text
applicationId =
        Text
pApplicationId_
    }

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getApplicationSettings_applicationId :: Lens.Lens' GetApplicationSettings Prelude.Text
getApplicationSettings_applicationId :: (Text -> f Text)
-> GetApplicationSettings -> f GetApplicationSettings
getApplicationSettings_applicationId = (GetApplicationSettings -> Text)
-> (GetApplicationSettings -> Text -> GetApplicationSettings)
-> Lens GetApplicationSettings GetApplicationSettings Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationSettings' {Text
applicationId :: Text
$sel:applicationId:GetApplicationSettings' :: GetApplicationSettings -> Text
applicationId} -> Text
applicationId) (\s :: GetApplicationSettings
s@GetApplicationSettings' {} Text
a -> GetApplicationSettings
s {$sel:applicationId:GetApplicationSettings' :: Text
applicationId = Text
a} :: GetApplicationSettings)

instance Core.AWSRequest GetApplicationSettings where
  type
    AWSResponse GetApplicationSettings =
      GetApplicationSettingsResponse
  request :: GetApplicationSettings -> Request GetApplicationSettings
request = Service -> GetApplicationSettings -> Request GetApplicationSettings
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetApplicationSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetApplicationSettings)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetApplicationSettings))
-> Logger
-> Service
-> Proxy GetApplicationSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetApplicationSettings)))
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 ->
          Int
-> ApplicationSettingsResource -> GetApplicationSettingsResponse
GetApplicationSettingsResponse'
            (Int
 -> ApplicationSettingsResource -> GetApplicationSettingsResponse)
-> Either String Int
-> Either
     String
     (ApplicationSettingsResource -> GetApplicationSettingsResponse)
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))
            Either
  String
  (ApplicationSettingsResource -> GetApplicationSettingsResponse)
-> Either String ApplicationSettingsResource
-> Either String GetApplicationSettingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ApplicationSettingsResource
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetApplicationSettings

instance Prelude.NFData GetApplicationSettings

instance Core.ToHeaders GetApplicationSettings where
  toHeaders :: GetApplicationSettings -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetApplicationSettings -> 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 GetApplicationSettings where
  toPath :: GetApplicationSettings -> ByteString
toPath GetApplicationSettings' {Text
applicationId :: Text
$sel:applicationId:GetApplicationSettings' :: GetApplicationSettings -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/apps/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId, ByteString
"/settings"]

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

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

-- |
-- Create a value of 'GetApplicationSettingsResponse' 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', 'getApplicationSettingsResponse_httpStatus' - The response's http status code.
--
-- 'applicationSettingsResource', 'getApplicationSettingsResponse_applicationSettingsResource' - Undocumented member.
newGetApplicationSettingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'applicationSettingsResource'
  ApplicationSettingsResource ->
  GetApplicationSettingsResponse
newGetApplicationSettingsResponse :: Int
-> ApplicationSettingsResource -> GetApplicationSettingsResponse
newGetApplicationSettingsResponse
  Int
pHttpStatus_
  ApplicationSettingsResource
pApplicationSettingsResource_ =
    GetApplicationSettingsResponse' :: Int
-> ApplicationSettingsResource -> GetApplicationSettingsResponse
GetApplicationSettingsResponse'
      { $sel:httpStatus:GetApplicationSettingsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:applicationSettingsResource:GetApplicationSettingsResponse' :: ApplicationSettingsResource
applicationSettingsResource =
          ApplicationSettingsResource
pApplicationSettingsResource_
      }

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

-- | Undocumented member.
getApplicationSettingsResponse_applicationSettingsResource :: Lens.Lens' GetApplicationSettingsResponse ApplicationSettingsResource
getApplicationSettingsResponse_applicationSettingsResource :: (ApplicationSettingsResource -> f ApplicationSettingsResource)
-> GetApplicationSettingsResponse
-> f GetApplicationSettingsResponse
getApplicationSettingsResponse_applicationSettingsResource = (GetApplicationSettingsResponse -> ApplicationSettingsResource)
-> (GetApplicationSettingsResponse
    -> ApplicationSettingsResource -> GetApplicationSettingsResponse)
-> Lens
     GetApplicationSettingsResponse
     GetApplicationSettingsResponse
     ApplicationSettingsResource
     ApplicationSettingsResource
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetApplicationSettingsResponse' {ApplicationSettingsResource
applicationSettingsResource :: ApplicationSettingsResource
$sel:applicationSettingsResource:GetApplicationSettingsResponse' :: GetApplicationSettingsResponse -> ApplicationSettingsResource
applicationSettingsResource} -> ApplicationSettingsResource
applicationSettingsResource) (\s :: GetApplicationSettingsResponse
s@GetApplicationSettingsResponse' {} ApplicationSettingsResource
a -> GetApplicationSettingsResponse
s {$sel:applicationSettingsResource:GetApplicationSettingsResponse' :: ApplicationSettingsResource
applicationSettingsResource = ApplicationSettingsResource
a} :: GetApplicationSettingsResponse)

instance
  Prelude.NFData
    GetApplicationSettingsResponse