{-# 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.ConnectCampaigns.DescribeCampaign
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes the specific campaign.
module Amazonka.ConnectCampaigns.DescribeCampaign
  ( -- * Creating a Request
    DescribeCampaign (..),
    newDescribeCampaign,

    -- * Request Lenses
    describeCampaign_id,

    -- * Destructuring the Response
    DescribeCampaignResponse (..),
    newDescribeCampaignResponse,

    -- * Response Lenses
    describeCampaignResponse_campaign,
    describeCampaignResponse_httpStatus,
  )
where

import Amazonka.ConnectCampaigns.Types
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

-- | DescribeCampaignRequests
--
-- /See:/ 'newDescribeCampaign' smart constructor.
data DescribeCampaign = DescribeCampaign'
  { DescribeCampaign -> Text
id :: Prelude.Text
  }
  deriving (DescribeCampaign -> DescribeCampaign -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeCampaign -> DescribeCampaign -> Bool
$c/= :: DescribeCampaign -> DescribeCampaign -> Bool
== :: DescribeCampaign -> DescribeCampaign -> Bool
$c== :: DescribeCampaign -> DescribeCampaign -> Bool
Prelude.Eq, ReadPrec [DescribeCampaign]
ReadPrec DescribeCampaign
Int -> ReadS DescribeCampaign
ReadS [DescribeCampaign]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeCampaign]
$creadListPrec :: ReadPrec [DescribeCampaign]
readPrec :: ReadPrec DescribeCampaign
$creadPrec :: ReadPrec DescribeCampaign
readList :: ReadS [DescribeCampaign]
$creadList :: ReadS [DescribeCampaign]
readsPrec :: Int -> ReadS DescribeCampaign
$creadsPrec :: Int -> ReadS DescribeCampaign
Prelude.Read, Int -> DescribeCampaign -> ShowS
[DescribeCampaign] -> ShowS
DescribeCampaign -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeCampaign] -> ShowS
$cshowList :: [DescribeCampaign] -> ShowS
show :: DescribeCampaign -> String
$cshow :: DescribeCampaign -> String
showsPrec :: Int -> DescribeCampaign -> ShowS
$cshowsPrec :: Int -> DescribeCampaign -> ShowS
Prelude.Show, forall x. Rep DescribeCampaign x -> DescribeCampaign
forall x. DescribeCampaign -> Rep DescribeCampaign x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeCampaign x -> DescribeCampaign
$cfrom :: forall x. DescribeCampaign -> Rep DescribeCampaign x
Prelude.Generic)

-- |
-- Create a value of 'DescribeCampaign' 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:
--
-- 'id', 'describeCampaign_id' - Undocumented member.
newDescribeCampaign ::
  -- | 'id'
  Prelude.Text ->
  DescribeCampaign
newDescribeCampaign :: Text -> DescribeCampaign
newDescribeCampaign Text
pId_ =
  DescribeCampaign' {$sel:id:DescribeCampaign' :: Text
id = Text
pId_}

-- | Undocumented member.
describeCampaign_id :: Lens.Lens' DescribeCampaign Prelude.Text
describeCampaign_id :: Lens' DescribeCampaign Text
describeCampaign_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCampaign' {Text
id :: Text
$sel:id:DescribeCampaign' :: DescribeCampaign -> Text
id} -> Text
id) (\s :: DescribeCampaign
s@DescribeCampaign' {} Text
a -> DescribeCampaign
s {$sel:id:DescribeCampaign' :: Text
id = Text
a} :: DescribeCampaign)

instance Core.AWSRequest DescribeCampaign where
  type
    AWSResponse DescribeCampaign =
      DescribeCampaignResponse
  request :: (Service -> Service)
-> DescribeCampaign -> Request DescribeCampaign
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeCampaign
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeCampaign)))
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 Campaign -> Int -> DescribeCampaignResponse
DescribeCampaignResponse'
            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
"campaign")
            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 DescribeCampaign where
  hashWithSalt :: Int -> DescribeCampaign -> Int
hashWithSalt Int
_salt DescribeCampaign' {Text
id :: Text
$sel:id:DescribeCampaign' :: DescribeCampaign -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DescribeCampaign where
  rnf :: DescribeCampaign -> ()
rnf DescribeCampaign' {Text
id :: Text
$sel:id:DescribeCampaign' :: DescribeCampaign -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance Data.ToHeaders DescribeCampaign where
  toHeaders :: DescribeCampaign -> 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.ToPath DescribeCampaign where
  toPath :: DescribeCampaign -> ByteString
toPath DescribeCampaign' {Text
id :: Text
$sel:id:DescribeCampaign' :: DescribeCampaign -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/campaigns/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
id]

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

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

-- |
-- Create a value of 'DescribeCampaignResponse' 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:
--
-- 'campaign', 'describeCampaignResponse_campaign' - Undocumented member.
--
-- 'httpStatus', 'describeCampaignResponse_httpStatus' - The response's http status code.
newDescribeCampaignResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeCampaignResponse
newDescribeCampaignResponse :: Int -> DescribeCampaignResponse
newDescribeCampaignResponse Int
pHttpStatus_ =
  DescribeCampaignResponse'
    { $sel:campaign:DescribeCampaignResponse' :: Maybe Campaign
campaign =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeCampaignResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
describeCampaignResponse_campaign :: Lens.Lens' DescribeCampaignResponse (Prelude.Maybe Campaign)
describeCampaignResponse_campaign :: Lens' DescribeCampaignResponse (Maybe Campaign)
describeCampaignResponse_campaign = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeCampaignResponse' {Maybe Campaign
campaign :: Maybe Campaign
$sel:campaign:DescribeCampaignResponse' :: DescribeCampaignResponse -> Maybe Campaign
campaign} -> Maybe Campaign
campaign) (\s :: DescribeCampaignResponse
s@DescribeCampaignResponse' {} Maybe Campaign
a -> DescribeCampaignResponse
s {$sel:campaign:DescribeCampaignResponse' :: Maybe Campaign
campaign = Maybe Campaign
a} :: DescribeCampaignResponse)

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

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