{-# 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.ElastiCache.PurchaseReservedCacheNodesOffering
-- 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)
--
-- Allows you to purchase a reserved cache node offering. Reserved nodes
-- are not eligible for cancellation and are non-refundable. For more
-- information, see
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/reserved-nodes.html Managing Costs with Reserved Nodes>
-- for Redis or
-- <https://docs.aws.amazon.com/AmazonElastiCache/latest/mem-ug/reserved-nodes.html Managing Costs with Reserved Nodes>
-- for Memcached.
module Amazonka.ElastiCache.PurchaseReservedCacheNodesOffering
  ( -- * Creating a Request
    PurchaseReservedCacheNodesOffering (..),
    newPurchaseReservedCacheNodesOffering,

    -- * Request Lenses
    purchaseReservedCacheNodesOffering_cacheNodeCount,
    purchaseReservedCacheNodesOffering_reservedCacheNodeId,
    purchaseReservedCacheNodesOffering_tags,
    purchaseReservedCacheNodesOffering_reservedCacheNodesOfferingId,

    -- * Destructuring the Response
    PurchaseReservedCacheNodesOfferingResponse (..),
    newPurchaseReservedCacheNodesOfferingResponse,

    -- * Response Lenses
    purchaseReservedCacheNodesOfferingResponse_reservedCacheNode,
    purchaseReservedCacheNodesOfferingResponse_httpStatus,
  )
where

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

-- | Represents the input of a @PurchaseReservedCacheNodesOffering@
-- operation.
--
-- /See:/ 'newPurchaseReservedCacheNodesOffering' smart constructor.
data PurchaseReservedCacheNodesOffering = PurchaseReservedCacheNodesOffering'
  { -- | The number of cache node instances to reserve.
    --
    -- Default: @1@
    PurchaseReservedCacheNodesOffering -> Maybe Int
cacheNodeCount :: Prelude.Maybe Prelude.Int,
    -- | A customer-specified identifier to track this reservation.
    --
    -- The Reserved Cache Node ID is an unique customer-specified identifier to
    -- track this reservation. If this parameter is not specified, ElastiCache
    -- automatically generates an identifier for the reservation.
    --
    -- Example: myreservationID
    PurchaseReservedCacheNodesOffering -> Maybe Text
reservedCacheNodeId :: Prelude.Maybe Prelude.Text,
    -- | A list of tags to be added to this resource. A tag is a key-value pair.
    -- A tag key must be accompanied by a tag value, although null is accepted.
    PurchaseReservedCacheNodesOffering -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The ID of the reserved cache node offering to purchase.
    --
    -- Example: @438012d3-4052-4cc7-b2e3-8d3372e0e706@
    PurchaseReservedCacheNodesOffering -> Text
reservedCacheNodesOfferingId :: Prelude.Text
  }
  deriving (PurchaseReservedCacheNodesOffering
-> PurchaseReservedCacheNodesOffering -> Bool
(PurchaseReservedCacheNodesOffering
 -> PurchaseReservedCacheNodesOffering -> Bool)
-> (PurchaseReservedCacheNodesOffering
    -> PurchaseReservedCacheNodesOffering -> Bool)
-> Eq PurchaseReservedCacheNodesOffering
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PurchaseReservedCacheNodesOffering
-> PurchaseReservedCacheNodesOffering -> Bool
$c/= :: PurchaseReservedCacheNodesOffering
-> PurchaseReservedCacheNodesOffering -> Bool
== :: PurchaseReservedCacheNodesOffering
-> PurchaseReservedCacheNodesOffering -> Bool
$c== :: PurchaseReservedCacheNodesOffering
-> PurchaseReservedCacheNodesOffering -> Bool
Prelude.Eq, ReadPrec [PurchaseReservedCacheNodesOffering]
ReadPrec PurchaseReservedCacheNodesOffering
Int -> ReadS PurchaseReservedCacheNodesOffering
ReadS [PurchaseReservedCacheNodesOffering]
(Int -> ReadS PurchaseReservedCacheNodesOffering)
-> ReadS [PurchaseReservedCacheNodesOffering]
-> ReadPrec PurchaseReservedCacheNodesOffering
-> ReadPrec [PurchaseReservedCacheNodesOffering]
-> Read PurchaseReservedCacheNodesOffering
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PurchaseReservedCacheNodesOffering]
$creadListPrec :: ReadPrec [PurchaseReservedCacheNodesOffering]
readPrec :: ReadPrec PurchaseReservedCacheNodesOffering
$creadPrec :: ReadPrec PurchaseReservedCacheNodesOffering
readList :: ReadS [PurchaseReservedCacheNodesOffering]
$creadList :: ReadS [PurchaseReservedCacheNodesOffering]
readsPrec :: Int -> ReadS PurchaseReservedCacheNodesOffering
$creadsPrec :: Int -> ReadS PurchaseReservedCacheNodesOffering
Prelude.Read, Int -> PurchaseReservedCacheNodesOffering -> ShowS
[PurchaseReservedCacheNodesOffering] -> ShowS
PurchaseReservedCacheNodesOffering -> String
(Int -> PurchaseReservedCacheNodesOffering -> ShowS)
-> (PurchaseReservedCacheNodesOffering -> String)
-> ([PurchaseReservedCacheNodesOffering] -> ShowS)
-> Show PurchaseReservedCacheNodesOffering
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PurchaseReservedCacheNodesOffering] -> ShowS
$cshowList :: [PurchaseReservedCacheNodesOffering] -> ShowS
show :: PurchaseReservedCacheNodesOffering -> String
$cshow :: PurchaseReservedCacheNodesOffering -> String
showsPrec :: Int -> PurchaseReservedCacheNodesOffering -> ShowS
$cshowsPrec :: Int -> PurchaseReservedCacheNodesOffering -> ShowS
Prelude.Show, (forall x.
 PurchaseReservedCacheNodesOffering
 -> Rep PurchaseReservedCacheNodesOffering x)
-> (forall x.
    Rep PurchaseReservedCacheNodesOffering x
    -> PurchaseReservedCacheNodesOffering)
-> Generic PurchaseReservedCacheNodesOffering
forall x.
Rep PurchaseReservedCacheNodesOffering x
-> PurchaseReservedCacheNodesOffering
forall x.
PurchaseReservedCacheNodesOffering
-> Rep PurchaseReservedCacheNodesOffering x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep PurchaseReservedCacheNodesOffering x
-> PurchaseReservedCacheNodesOffering
$cfrom :: forall x.
PurchaseReservedCacheNodesOffering
-> Rep PurchaseReservedCacheNodesOffering x
Prelude.Generic)

-- |
-- Create a value of 'PurchaseReservedCacheNodesOffering' 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:
--
-- 'cacheNodeCount', 'purchaseReservedCacheNodesOffering_cacheNodeCount' - The number of cache node instances to reserve.
--
-- Default: @1@
--
-- 'reservedCacheNodeId', 'purchaseReservedCacheNodesOffering_reservedCacheNodeId' - A customer-specified identifier to track this reservation.
--
-- The Reserved Cache Node ID is an unique customer-specified identifier to
-- track this reservation. If this parameter is not specified, ElastiCache
-- automatically generates an identifier for the reservation.
--
-- Example: myreservationID
--
-- 'tags', 'purchaseReservedCacheNodesOffering_tags' - A list of tags to be added to this resource. A tag is a key-value pair.
-- A tag key must be accompanied by a tag value, although null is accepted.
--
-- 'reservedCacheNodesOfferingId', 'purchaseReservedCacheNodesOffering_reservedCacheNodesOfferingId' - The ID of the reserved cache node offering to purchase.
--
-- Example: @438012d3-4052-4cc7-b2e3-8d3372e0e706@
newPurchaseReservedCacheNodesOffering ::
  -- | 'reservedCacheNodesOfferingId'
  Prelude.Text ->
  PurchaseReservedCacheNodesOffering
newPurchaseReservedCacheNodesOffering :: Text -> PurchaseReservedCacheNodesOffering
newPurchaseReservedCacheNodesOffering
  Text
pReservedCacheNodesOfferingId_ =
    PurchaseReservedCacheNodesOffering' :: Maybe Int
-> Maybe Text
-> Maybe [Tag]
-> Text
-> PurchaseReservedCacheNodesOffering
PurchaseReservedCacheNodesOffering'
      { $sel:cacheNodeCount:PurchaseReservedCacheNodesOffering' :: Maybe Int
cacheNodeCount =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:reservedCacheNodeId:PurchaseReservedCacheNodesOffering' :: Maybe Text
reservedCacheNodeId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:PurchaseReservedCacheNodesOffering' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:reservedCacheNodesOfferingId:PurchaseReservedCacheNodesOffering' :: Text
reservedCacheNodesOfferingId =
          Text
pReservedCacheNodesOfferingId_
      }

-- | The number of cache node instances to reserve.
--
-- Default: @1@
purchaseReservedCacheNodesOffering_cacheNodeCount :: Lens.Lens' PurchaseReservedCacheNodesOffering (Prelude.Maybe Prelude.Int)
purchaseReservedCacheNodesOffering_cacheNodeCount :: (Maybe Int -> f (Maybe Int))
-> PurchaseReservedCacheNodesOffering
-> f PurchaseReservedCacheNodesOffering
purchaseReservedCacheNodesOffering_cacheNodeCount = (PurchaseReservedCacheNodesOffering -> Maybe Int)
-> (PurchaseReservedCacheNodesOffering
    -> Maybe Int -> PurchaseReservedCacheNodesOffering)
-> Lens
     PurchaseReservedCacheNodesOffering
     PurchaseReservedCacheNodesOffering
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedCacheNodesOffering' {Maybe Int
cacheNodeCount :: Maybe Int
$sel:cacheNodeCount:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe Int
cacheNodeCount} -> Maybe Int
cacheNodeCount) (\s :: PurchaseReservedCacheNodesOffering
s@PurchaseReservedCacheNodesOffering' {} Maybe Int
a -> PurchaseReservedCacheNodesOffering
s {$sel:cacheNodeCount:PurchaseReservedCacheNodesOffering' :: Maybe Int
cacheNodeCount = Maybe Int
a} :: PurchaseReservedCacheNodesOffering)

-- | A customer-specified identifier to track this reservation.
--
-- The Reserved Cache Node ID is an unique customer-specified identifier to
-- track this reservation. If this parameter is not specified, ElastiCache
-- automatically generates an identifier for the reservation.
--
-- Example: myreservationID
purchaseReservedCacheNodesOffering_reservedCacheNodeId :: Lens.Lens' PurchaseReservedCacheNodesOffering (Prelude.Maybe Prelude.Text)
purchaseReservedCacheNodesOffering_reservedCacheNodeId :: (Maybe Text -> f (Maybe Text))
-> PurchaseReservedCacheNodesOffering
-> f PurchaseReservedCacheNodesOffering
purchaseReservedCacheNodesOffering_reservedCacheNodeId = (PurchaseReservedCacheNodesOffering -> Maybe Text)
-> (PurchaseReservedCacheNodesOffering
    -> Maybe Text -> PurchaseReservedCacheNodesOffering)
-> Lens
     PurchaseReservedCacheNodesOffering
     PurchaseReservedCacheNodesOffering
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedCacheNodesOffering' {Maybe Text
reservedCacheNodeId :: Maybe Text
$sel:reservedCacheNodeId:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe Text
reservedCacheNodeId} -> Maybe Text
reservedCacheNodeId) (\s :: PurchaseReservedCacheNodesOffering
s@PurchaseReservedCacheNodesOffering' {} Maybe Text
a -> PurchaseReservedCacheNodesOffering
s {$sel:reservedCacheNodeId:PurchaseReservedCacheNodesOffering' :: Maybe Text
reservedCacheNodeId = Maybe Text
a} :: PurchaseReservedCacheNodesOffering)

-- | A list of tags to be added to this resource. A tag is a key-value pair.
-- A tag key must be accompanied by a tag value, although null is accepted.
purchaseReservedCacheNodesOffering_tags :: Lens.Lens' PurchaseReservedCacheNodesOffering (Prelude.Maybe [Tag])
purchaseReservedCacheNodesOffering_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> PurchaseReservedCacheNodesOffering
-> f PurchaseReservedCacheNodesOffering
purchaseReservedCacheNodesOffering_tags = (PurchaseReservedCacheNodesOffering -> Maybe [Tag])
-> (PurchaseReservedCacheNodesOffering
    -> Maybe [Tag] -> PurchaseReservedCacheNodesOffering)
-> Lens
     PurchaseReservedCacheNodesOffering
     PurchaseReservedCacheNodesOffering
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedCacheNodesOffering' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: PurchaseReservedCacheNodesOffering
s@PurchaseReservedCacheNodesOffering' {} Maybe [Tag]
a -> PurchaseReservedCacheNodesOffering
s {$sel:tags:PurchaseReservedCacheNodesOffering' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: PurchaseReservedCacheNodesOffering) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> PurchaseReservedCacheNodesOffering
 -> f PurchaseReservedCacheNodesOffering)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> PurchaseReservedCacheNodesOffering
-> f PurchaseReservedCacheNodesOffering
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the reserved cache node offering to purchase.
--
-- Example: @438012d3-4052-4cc7-b2e3-8d3372e0e706@
purchaseReservedCacheNodesOffering_reservedCacheNodesOfferingId :: Lens.Lens' PurchaseReservedCacheNodesOffering Prelude.Text
purchaseReservedCacheNodesOffering_reservedCacheNodesOfferingId :: (Text -> f Text)
-> PurchaseReservedCacheNodesOffering
-> f PurchaseReservedCacheNodesOffering
purchaseReservedCacheNodesOffering_reservedCacheNodesOfferingId = (PurchaseReservedCacheNodesOffering -> Text)
-> (PurchaseReservedCacheNodesOffering
    -> Text -> PurchaseReservedCacheNodesOffering)
-> Lens
     PurchaseReservedCacheNodesOffering
     PurchaseReservedCacheNodesOffering
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedCacheNodesOffering' {Text
reservedCacheNodesOfferingId :: Text
$sel:reservedCacheNodesOfferingId:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Text
reservedCacheNodesOfferingId} -> Text
reservedCacheNodesOfferingId) (\s :: PurchaseReservedCacheNodesOffering
s@PurchaseReservedCacheNodesOffering' {} Text
a -> PurchaseReservedCacheNodesOffering
s {$sel:reservedCacheNodesOfferingId:PurchaseReservedCacheNodesOffering' :: Text
reservedCacheNodesOfferingId = Text
a} :: PurchaseReservedCacheNodesOffering)

instance
  Core.AWSRequest
    PurchaseReservedCacheNodesOffering
  where
  type
    AWSResponse PurchaseReservedCacheNodesOffering =
      PurchaseReservedCacheNodesOfferingResponse
  request :: PurchaseReservedCacheNodesOffering
-> Request PurchaseReservedCacheNodesOffering
request = Service
-> PurchaseReservedCacheNodesOffering
-> Request PurchaseReservedCacheNodesOffering
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy PurchaseReservedCacheNodesOffering
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PurchaseReservedCacheNodesOffering)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse PurchaseReservedCacheNodesOffering))
-> Logger
-> Service
-> Proxy PurchaseReservedCacheNodesOffering
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse PurchaseReservedCacheNodesOffering)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"PurchaseReservedCacheNodesOfferingResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe ReservedCacheNode
-> Int -> PurchaseReservedCacheNodesOfferingResponse
PurchaseReservedCacheNodesOfferingResponse'
            (Maybe ReservedCacheNode
 -> Int -> PurchaseReservedCacheNodesOfferingResponse)
-> Either String (Maybe ReservedCacheNode)
-> Either
     String (Int -> PurchaseReservedCacheNodesOfferingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReservedCacheNode)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ReservedCacheNode")
              Either String (Int -> PurchaseReservedCacheNodesOfferingResponse)
-> Either String Int
-> Either String PurchaseReservedCacheNodesOfferingResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance
  Prelude.Hashable
    PurchaseReservedCacheNodesOffering

instance
  Prelude.NFData
    PurchaseReservedCacheNodesOffering

instance
  Core.ToHeaders
    PurchaseReservedCacheNodesOffering
  where
  toHeaders :: PurchaseReservedCacheNodesOffering -> ResponseHeaders
toHeaders = ResponseHeaders
-> PurchaseReservedCacheNodesOffering -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance
  Core.ToPath
    PurchaseReservedCacheNodesOffering
  where
  toPath :: PurchaseReservedCacheNodesOffering -> ByteString
toPath = ByteString -> PurchaseReservedCacheNodesOffering -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Core.ToQuery
    PurchaseReservedCacheNodesOffering
  where
  toQuery :: PurchaseReservedCacheNodesOffering -> QueryString
toQuery PurchaseReservedCacheNodesOffering' {Maybe Int
Maybe [Tag]
Maybe Text
Text
reservedCacheNodesOfferingId :: Text
tags :: Maybe [Tag]
reservedCacheNodeId :: Maybe Text
cacheNodeCount :: Maybe Int
$sel:reservedCacheNodesOfferingId:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Text
$sel:tags:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe [Tag]
$sel:reservedCacheNodeId:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe Text
$sel:cacheNodeCount:PurchaseReservedCacheNodesOffering' :: PurchaseReservedCacheNodesOffering -> Maybe Int
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"PurchaseReservedCacheNodesOffering" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-02-02" :: Prelude.ByteString),
        ByteString
"CacheNodeCount" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
cacheNodeCount,
        ByteString
"ReservedCacheNodeId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
reservedCacheNodeId,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"Tag" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"ReservedCacheNodesOfferingId"
          ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
reservedCacheNodesOfferingId
      ]

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

-- |
-- Create a value of 'PurchaseReservedCacheNodesOfferingResponse' 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:
--
-- 'reservedCacheNode', 'purchaseReservedCacheNodesOfferingResponse_reservedCacheNode' - Undocumented member.
--
-- 'httpStatus', 'purchaseReservedCacheNodesOfferingResponse_httpStatus' - The response's http status code.
newPurchaseReservedCacheNodesOfferingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PurchaseReservedCacheNodesOfferingResponse
newPurchaseReservedCacheNodesOfferingResponse :: Int -> PurchaseReservedCacheNodesOfferingResponse
newPurchaseReservedCacheNodesOfferingResponse
  Int
pHttpStatus_ =
    PurchaseReservedCacheNodesOfferingResponse' :: Maybe ReservedCacheNode
-> Int -> PurchaseReservedCacheNodesOfferingResponse
PurchaseReservedCacheNodesOfferingResponse'
      { $sel:reservedCacheNode:PurchaseReservedCacheNodesOfferingResponse' :: Maybe ReservedCacheNode
reservedCacheNode =
          Maybe ReservedCacheNode
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:PurchaseReservedCacheNodesOfferingResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Undocumented member.
purchaseReservedCacheNodesOfferingResponse_reservedCacheNode :: Lens.Lens' PurchaseReservedCacheNodesOfferingResponse (Prelude.Maybe ReservedCacheNode)
purchaseReservedCacheNodesOfferingResponse_reservedCacheNode :: (Maybe ReservedCacheNode -> f (Maybe ReservedCacheNode))
-> PurchaseReservedCacheNodesOfferingResponse
-> f PurchaseReservedCacheNodesOfferingResponse
purchaseReservedCacheNodesOfferingResponse_reservedCacheNode = (PurchaseReservedCacheNodesOfferingResponse
 -> Maybe ReservedCacheNode)
-> (PurchaseReservedCacheNodesOfferingResponse
    -> Maybe ReservedCacheNode
    -> PurchaseReservedCacheNodesOfferingResponse)
-> Lens
     PurchaseReservedCacheNodesOfferingResponse
     PurchaseReservedCacheNodesOfferingResponse
     (Maybe ReservedCacheNode)
     (Maybe ReservedCacheNode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseReservedCacheNodesOfferingResponse' {Maybe ReservedCacheNode
reservedCacheNode :: Maybe ReservedCacheNode
$sel:reservedCacheNode:PurchaseReservedCacheNodesOfferingResponse' :: PurchaseReservedCacheNodesOfferingResponse
-> Maybe ReservedCacheNode
reservedCacheNode} -> Maybe ReservedCacheNode
reservedCacheNode) (\s :: PurchaseReservedCacheNodesOfferingResponse
s@PurchaseReservedCacheNodesOfferingResponse' {} Maybe ReservedCacheNode
a -> PurchaseReservedCacheNodesOfferingResponse
s {$sel:reservedCacheNode:PurchaseReservedCacheNodesOfferingResponse' :: Maybe ReservedCacheNode
reservedCacheNode = Maybe ReservedCacheNode
a} :: PurchaseReservedCacheNodesOfferingResponse)

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

instance
  Prelude.NFData
    PurchaseReservedCacheNodesOfferingResponse