{-# 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.UpdateApplicationSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the settings for an application.
module Amazonka.Pinpoint.UpdateApplicationSettings
  ( -- * Creating a Request
    UpdateApplicationSettings (..),
    newUpdateApplicationSettings,

    -- * Request Lenses
    updateApplicationSettings_applicationId,
    updateApplicationSettings_writeApplicationSettingsRequest,

    -- * Destructuring the Response
    UpdateApplicationSettingsResponse (..),
    newUpdateApplicationSettingsResponse,

    -- * Response Lenses
    updateApplicationSettingsResponse_httpStatus,
    updateApplicationSettingsResponse_applicationSettingsResource,
  )
where

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

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

-- |
-- Create a value of 'UpdateApplicationSettings' 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', 'updateApplicationSettings_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'writeApplicationSettingsRequest', 'updateApplicationSettings_writeApplicationSettingsRequest' - Undocumented member.
newUpdateApplicationSettings ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'writeApplicationSettingsRequest'
  WriteApplicationSettingsRequest ->
  UpdateApplicationSettings
newUpdateApplicationSettings :: Text
-> WriteApplicationSettingsRequest -> UpdateApplicationSettings
newUpdateApplicationSettings
  Text
pApplicationId_
  WriteApplicationSettingsRequest
pWriteApplicationSettingsRequest_ =
    UpdateApplicationSettings'
      { $sel:applicationId:UpdateApplicationSettings' :: Text
applicationId =
          Text
pApplicationId_,
        $sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: WriteApplicationSettingsRequest
writeApplicationSettingsRequest =
          WriteApplicationSettingsRequest
pWriteApplicationSettingsRequest_
      }

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

-- | Undocumented member.
updateApplicationSettings_writeApplicationSettingsRequest :: Lens.Lens' UpdateApplicationSettings WriteApplicationSettingsRequest
updateApplicationSettings_writeApplicationSettingsRequest :: Lens' UpdateApplicationSettings WriteApplicationSettingsRequest
updateApplicationSettings_writeApplicationSettingsRequest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateApplicationSettings' {WriteApplicationSettingsRequest
writeApplicationSettingsRequest :: WriteApplicationSettingsRequest
$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: UpdateApplicationSettings -> WriteApplicationSettingsRequest
writeApplicationSettingsRequest} -> WriteApplicationSettingsRequest
writeApplicationSettingsRequest) (\s :: UpdateApplicationSettings
s@UpdateApplicationSettings' {} WriteApplicationSettingsRequest
a -> UpdateApplicationSettings
s {$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: WriteApplicationSettingsRequest
writeApplicationSettingsRequest = WriteApplicationSettingsRequest
a} :: UpdateApplicationSettings)

instance Core.AWSRequest UpdateApplicationSettings where
  type
    AWSResponse UpdateApplicationSettings =
      UpdateApplicationSettingsResponse
  request :: (Service -> Service)
-> UpdateApplicationSettings -> Request UpdateApplicationSettings
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateApplicationSettings
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateApplicationSettings)))
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 ->
          Int
-> ApplicationSettingsResource -> UpdateApplicationSettingsResponse
UpdateApplicationSettingsResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance Prelude.Hashable UpdateApplicationSettings where
  hashWithSalt :: Int -> UpdateApplicationSettings -> Int
hashWithSalt Int
_salt UpdateApplicationSettings' {Text
WriteApplicationSettingsRequest
writeApplicationSettingsRequest :: WriteApplicationSettingsRequest
applicationId :: Text
$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: UpdateApplicationSettings -> WriteApplicationSettingsRequest
$sel:applicationId:UpdateApplicationSettings' :: UpdateApplicationSettings -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WriteApplicationSettingsRequest
writeApplicationSettingsRequest

instance Prelude.NFData UpdateApplicationSettings where
  rnf :: UpdateApplicationSettings -> ()
rnf UpdateApplicationSettings' {Text
WriteApplicationSettingsRequest
writeApplicationSettingsRequest :: WriteApplicationSettingsRequest
applicationId :: Text
$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: UpdateApplicationSettings -> WriteApplicationSettingsRequest
$sel:applicationId:UpdateApplicationSettings' :: UpdateApplicationSettings -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WriteApplicationSettingsRequest
writeApplicationSettingsRequest

instance Data.ToHeaders UpdateApplicationSettings where
  toHeaders :: UpdateApplicationSettings -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON UpdateApplicationSettings where
  toJSON :: UpdateApplicationSettings -> Value
toJSON UpdateApplicationSettings' {Text
WriteApplicationSettingsRequest
writeApplicationSettingsRequest :: WriteApplicationSettingsRequest
applicationId :: Text
$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: UpdateApplicationSettings -> WriteApplicationSettingsRequest
$sel:applicationId:UpdateApplicationSettings' :: UpdateApplicationSettings -> Text
..} =
    forall a. ToJSON a => a -> Value
Data.toJSON WriteApplicationSettingsRequest
writeApplicationSettingsRequest

instance Data.ToPath UpdateApplicationSettings where
  toPath :: UpdateApplicationSettings -> ByteString
toPath UpdateApplicationSettings' {Text
WriteApplicationSettingsRequest
writeApplicationSettingsRequest :: WriteApplicationSettingsRequest
applicationId :: Text
$sel:writeApplicationSettingsRequest:UpdateApplicationSettings' :: UpdateApplicationSettings -> WriteApplicationSettingsRequest
$sel:applicationId:UpdateApplicationSettings' :: UpdateApplicationSettings -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/v1/apps/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId, ByteString
"/settings"]

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

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

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

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

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

instance
  Prelude.NFData
    UpdateApplicationSettingsResponse
  where
  rnf :: UpdateApplicationSettingsResponse -> ()
rnf UpdateApplicationSettingsResponse' {Int
ApplicationSettingsResource
applicationSettingsResource :: ApplicationSettingsResource
httpStatus :: Int
$sel:applicationSettingsResource:UpdateApplicationSettingsResponse' :: UpdateApplicationSettingsResponse -> ApplicationSettingsResource
$sel:httpStatus:UpdateApplicationSettingsResponse' :: UpdateApplicationSettingsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ApplicationSettingsResource
applicationSettingsResource