{-# 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.UpdateAdmChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables the ADM channel for an application or updates the status and
-- settings of the ADM channel for an application.
module Amazonka.Pinpoint.UpdateAdmChannel
  ( -- * Creating a Request
    UpdateAdmChannel (..),
    newUpdateAdmChannel,

    -- * Request Lenses
    updateAdmChannel_applicationId,
    updateAdmChannel_aDMChannelRequest,

    -- * Destructuring the Response
    UpdateAdmChannelResponse (..),
    newUpdateAdmChannelResponse,

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

-- |
-- Create a value of 'UpdateAdmChannel' 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', 'updateAdmChannel_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'aDMChannelRequest', 'updateAdmChannel_aDMChannelRequest' - Undocumented member.
newUpdateAdmChannel ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'aDMChannelRequest'
  ADMChannelRequest ->
  UpdateAdmChannel
newUpdateAdmChannel :: Text -> ADMChannelRequest -> UpdateAdmChannel
newUpdateAdmChannel
  Text
pApplicationId_
  ADMChannelRequest
pADMChannelRequest_ =
    UpdateAdmChannel'
      { $sel:applicationId:UpdateAdmChannel' :: Text
applicationId = Text
pApplicationId_,
        $sel:aDMChannelRequest:UpdateAdmChannel' :: ADMChannelRequest
aDMChannelRequest = ADMChannelRequest
pADMChannelRequest_
      }

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

-- | Undocumented member.
updateAdmChannel_aDMChannelRequest :: Lens.Lens' UpdateAdmChannel ADMChannelRequest
updateAdmChannel_aDMChannelRequest :: Lens' UpdateAdmChannel ADMChannelRequest
updateAdmChannel_aDMChannelRequest = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAdmChannel' {ADMChannelRequest
aDMChannelRequest :: ADMChannelRequest
$sel:aDMChannelRequest:UpdateAdmChannel' :: UpdateAdmChannel -> ADMChannelRequest
aDMChannelRequest} -> ADMChannelRequest
aDMChannelRequest) (\s :: UpdateAdmChannel
s@UpdateAdmChannel' {} ADMChannelRequest
a -> UpdateAdmChannel
s {$sel:aDMChannelRequest:UpdateAdmChannel' :: ADMChannelRequest
aDMChannelRequest = ADMChannelRequest
a} :: UpdateAdmChannel)

instance Core.AWSRequest UpdateAdmChannel where
  type
    AWSResponse UpdateAdmChannel =
      UpdateAdmChannelResponse
  request :: (Service -> Service)
-> UpdateAdmChannel -> Request UpdateAdmChannel
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 UpdateAdmChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAdmChannel)))
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 -> ADMChannelResponse -> UpdateAdmChannelResponse
UpdateAdmChannelResponse'
            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 UpdateAdmChannel where
  hashWithSalt :: Int -> UpdateAdmChannel -> Int
hashWithSalt Int
_salt UpdateAdmChannel' {Text
ADMChannelRequest
aDMChannelRequest :: ADMChannelRequest
applicationId :: Text
$sel:aDMChannelRequest:UpdateAdmChannel' :: UpdateAdmChannel -> ADMChannelRequest
$sel:applicationId:UpdateAdmChannel' :: UpdateAdmChannel -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ADMChannelRequest
aDMChannelRequest

instance Prelude.NFData UpdateAdmChannel where
  rnf :: UpdateAdmChannel -> ()
rnf UpdateAdmChannel' {Text
ADMChannelRequest
aDMChannelRequest :: ADMChannelRequest
applicationId :: Text
$sel:aDMChannelRequest:UpdateAdmChannel' :: UpdateAdmChannel -> ADMChannelRequest
$sel:applicationId:UpdateAdmChannel' :: UpdateAdmChannel -> 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 ADMChannelRequest
aDMChannelRequest

instance Data.ToHeaders UpdateAdmChannel where
  toHeaders :: UpdateAdmChannel -> 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 UpdateAdmChannel where
  toJSON :: UpdateAdmChannel -> Value
toJSON UpdateAdmChannel' {Text
ADMChannelRequest
aDMChannelRequest :: ADMChannelRequest
applicationId :: Text
$sel:aDMChannelRequest:UpdateAdmChannel' :: UpdateAdmChannel -> ADMChannelRequest
$sel:applicationId:UpdateAdmChannel' :: UpdateAdmChannel -> Text
..} =
    forall a. ToJSON a => a -> Value
Data.toJSON ADMChannelRequest
aDMChannelRequest

instance Data.ToPath UpdateAdmChannel where
  toPath :: UpdateAdmChannel -> ByteString
toPath UpdateAdmChannel' {Text
ADMChannelRequest
aDMChannelRequest :: ADMChannelRequest
applicationId :: Text
$sel:aDMChannelRequest:UpdateAdmChannel' :: UpdateAdmChannel -> ADMChannelRequest
$sel:applicationId:UpdateAdmChannel' :: UpdateAdmChannel -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
        ByteString
"/channels/adm"
      ]

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

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

-- |
-- Create a value of 'UpdateAdmChannelResponse' 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', 'updateAdmChannelResponse_httpStatus' - The response's http status code.
--
-- 'aDMChannelResponse', 'updateAdmChannelResponse_aDMChannelResponse' - Undocumented member.
newUpdateAdmChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'aDMChannelResponse'
  ADMChannelResponse ->
  UpdateAdmChannelResponse
newUpdateAdmChannelResponse :: Int -> ADMChannelResponse -> UpdateAdmChannelResponse
newUpdateAdmChannelResponse
  Int
pHttpStatus_
  ADMChannelResponse
pADMChannelResponse_ =
    UpdateAdmChannelResponse'
      { $sel:httpStatus:UpdateAdmChannelResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:aDMChannelResponse:UpdateAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
pADMChannelResponse_
      }

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

-- | Undocumented member.
updateAdmChannelResponse_aDMChannelResponse :: Lens.Lens' UpdateAdmChannelResponse ADMChannelResponse
updateAdmChannelResponse_aDMChannelResponse :: Lens' UpdateAdmChannelResponse ADMChannelResponse
updateAdmChannelResponse_aDMChannelResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAdmChannelResponse' {ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
$sel:aDMChannelResponse:UpdateAdmChannelResponse' :: UpdateAdmChannelResponse -> ADMChannelResponse
aDMChannelResponse} -> ADMChannelResponse
aDMChannelResponse) (\s :: UpdateAdmChannelResponse
s@UpdateAdmChannelResponse' {} ADMChannelResponse
a -> UpdateAdmChannelResponse
s {$sel:aDMChannelResponse:UpdateAdmChannelResponse' :: ADMChannelResponse
aDMChannelResponse = ADMChannelResponse
a} :: UpdateAdmChannelResponse)

instance Prelude.NFData UpdateAdmChannelResponse where
  rnf :: UpdateAdmChannelResponse -> ()
rnf UpdateAdmChannelResponse' {Int
ADMChannelResponse
aDMChannelResponse :: ADMChannelResponse
httpStatus :: Int
$sel:aDMChannelResponse:UpdateAdmChannelResponse' :: UpdateAdmChannelResponse -> ADMChannelResponse
$sel:httpStatus:UpdateAdmChannelResponse' :: UpdateAdmChannelResponse -> 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 ADMChannelResponse
aDMChannelResponse