{-# 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.IotTwinMaker.GetPricingPlan
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the pricing plan.
module Amazonka.IotTwinMaker.GetPricingPlan
  ( -- * Creating a Request
    GetPricingPlan (..),
    newGetPricingPlan,

    -- * Destructuring the Response
    GetPricingPlanResponse (..),
    newGetPricingPlanResponse,

    -- * Response Lenses
    getPricingPlanResponse_pendingPricingPlan,
    getPricingPlanResponse_httpStatus,
    getPricingPlanResponse_currentPricingPlan,
  )
where

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

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

-- |
-- Create a value of 'GetPricingPlan' 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.
newGetPricingPlan ::
  GetPricingPlan
newGetPricingPlan :: GetPricingPlan
newGetPricingPlan = GetPricingPlan
GetPricingPlan'

instance Core.AWSRequest GetPricingPlan where
  type
    AWSResponse GetPricingPlan =
      GetPricingPlanResponse
  request :: (Service -> Service) -> GetPricingPlan -> Request GetPricingPlan
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 GetPricingPlan
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPricingPlan)))
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 PricingPlan -> Int -> PricingPlan -> GetPricingPlanResponse
GetPricingPlanResponse'
            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
"pendingPricingPlan")
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"currentPricingPlan")
      )

instance Prelude.Hashable GetPricingPlan where
  hashWithSalt :: Int -> GetPricingPlan -> Int
hashWithSalt Int
_salt GetPricingPlan
_ =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ()

instance Prelude.NFData GetPricingPlan where
  rnf :: GetPricingPlan -> ()
rnf GetPricingPlan
_ = ()

instance Data.ToHeaders GetPricingPlan where
  toHeaders :: GetPricingPlan -> 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 GetPricingPlan where
  toPath :: GetPricingPlan -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/pricingplan"

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

-- | /See:/ 'newGetPricingPlanResponse' smart constructor.
data GetPricingPlanResponse = GetPricingPlanResponse'
  { -- | The pending pricing plan.
    GetPricingPlanResponse -> Maybe PricingPlan
pendingPricingPlan :: Prelude.Maybe PricingPlan,
    -- | The response's http status code.
    GetPricingPlanResponse -> Int
httpStatus :: Prelude.Int,
    -- | The chosen pricing plan for the current billing cycle.
    GetPricingPlanResponse -> PricingPlan
currentPricingPlan :: PricingPlan
  }
  deriving (GetPricingPlanResponse -> GetPricingPlanResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPricingPlanResponse -> GetPricingPlanResponse -> Bool
$c/= :: GetPricingPlanResponse -> GetPricingPlanResponse -> Bool
== :: GetPricingPlanResponse -> GetPricingPlanResponse -> Bool
$c== :: GetPricingPlanResponse -> GetPricingPlanResponse -> Bool
Prelude.Eq, ReadPrec [GetPricingPlanResponse]
ReadPrec GetPricingPlanResponse
Int -> ReadS GetPricingPlanResponse
ReadS [GetPricingPlanResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPricingPlanResponse]
$creadListPrec :: ReadPrec [GetPricingPlanResponse]
readPrec :: ReadPrec GetPricingPlanResponse
$creadPrec :: ReadPrec GetPricingPlanResponse
readList :: ReadS [GetPricingPlanResponse]
$creadList :: ReadS [GetPricingPlanResponse]
readsPrec :: Int -> ReadS GetPricingPlanResponse
$creadsPrec :: Int -> ReadS GetPricingPlanResponse
Prelude.Read, Int -> GetPricingPlanResponse -> ShowS
[GetPricingPlanResponse] -> ShowS
GetPricingPlanResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPricingPlanResponse] -> ShowS
$cshowList :: [GetPricingPlanResponse] -> ShowS
show :: GetPricingPlanResponse -> String
$cshow :: GetPricingPlanResponse -> String
showsPrec :: Int -> GetPricingPlanResponse -> ShowS
$cshowsPrec :: Int -> GetPricingPlanResponse -> ShowS
Prelude.Show, forall x. Rep GetPricingPlanResponse x -> GetPricingPlanResponse
forall x. GetPricingPlanResponse -> Rep GetPricingPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPricingPlanResponse x -> GetPricingPlanResponse
$cfrom :: forall x. GetPricingPlanResponse -> Rep GetPricingPlanResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetPricingPlanResponse' 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:
--
-- 'pendingPricingPlan', 'getPricingPlanResponse_pendingPricingPlan' - The pending pricing plan.
--
-- 'httpStatus', 'getPricingPlanResponse_httpStatus' - The response's http status code.
--
-- 'currentPricingPlan', 'getPricingPlanResponse_currentPricingPlan' - The chosen pricing plan for the current billing cycle.
newGetPricingPlanResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'currentPricingPlan'
  PricingPlan ->
  GetPricingPlanResponse
newGetPricingPlanResponse :: Int -> PricingPlan -> GetPricingPlanResponse
newGetPricingPlanResponse
  Int
pHttpStatus_
  PricingPlan
pCurrentPricingPlan_ =
    GetPricingPlanResponse'
      { $sel:pendingPricingPlan:GetPricingPlanResponse' :: Maybe PricingPlan
pendingPricingPlan =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetPricingPlanResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:currentPricingPlan:GetPricingPlanResponse' :: PricingPlan
currentPricingPlan = PricingPlan
pCurrentPricingPlan_
      }

-- | The pending pricing plan.
getPricingPlanResponse_pendingPricingPlan :: Lens.Lens' GetPricingPlanResponse (Prelude.Maybe PricingPlan)
getPricingPlanResponse_pendingPricingPlan :: Lens' GetPricingPlanResponse (Maybe PricingPlan)
getPricingPlanResponse_pendingPricingPlan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPricingPlanResponse' {Maybe PricingPlan
pendingPricingPlan :: Maybe PricingPlan
$sel:pendingPricingPlan:GetPricingPlanResponse' :: GetPricingPlanResponse -> Maybe PricingPlan
pendingPricingPlan} -> Maybe PricingPlan
pendingPricingPlan) (\s :: GetPricingPlanResponse
s@GetPricingPlanResponse' {} Maybe PricingPlan
a -> GetPricingPlanResponse
s {$sel:pendingPricingPlan:GetPricingPlanResponse' :: Maybe PricingPlan
pendingPricingPlan = Maybe PricingPlan
a} :: GetPricingPlanResponse)

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

-- | The chosen pricing plan for the current billing cycle.
getPricingPlanResponse_currentPricingPlan :: Lens.Lens' GetPricingPlanResponse PricingPlan
getPricingPlanResponse_currentPricingPlan :: Lens' GetPricingPlanResponse PricingPlan
getPricingPlanResponse_currentPricingPlan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPricingPlanResponse' {PricingPlan
currentPricingPlan :: PricingPlan
$sel:currentPricingPlan:GetPricingPlanResponse' :: GetPricingPlanResponse -> PricingPlan
currentPricingPlan} -> PricingPlan
currentPricingPlan) (\s :: GetPricingPlanResponse
s@GetPricingPlanResponse' {} PricingPlan
a -> GetPricingPlanResponse
s {$sel:currentPricingPlan:GetPricingPlanResponse' :: PricingPlan
currentPricingPlan = PricingPlan
a} :: GetPricingPlanResponse)

instance Prelude.NFData GetPricingPlanResponse where
  rnf :: GetPricingPlanResponse -> ()
rnf GetPricingPlanResponse' {Int
Maybe PricingPlan
PricingPlan
currentPricingPlan :: PricingPlan
httpStatus :: Int
pendingPricingPlan :: Maybe PricingPlan
$sel:currentPricingPlan:GetPricingPlanResponse' :: GetPricingPlanResponse -> PricingPlan
$sel:httpStatus:GetPricingPlanResponse' :: GetPricingPlanResponse -> Int
$sel:pendingPricingPlan:GetPricingPlanResponse' :: GetPricingPlanResponse -> Maybe PricingPlan
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe PricingPlan
pendingPricingPlan
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 PricingPlan
currentPricingPlan