{-# 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.MediaLive.PurchaseOffering
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Purchase an offering and create a reservation.
module Amazonka.MediaLive.PurchaseOffering
  ( -- * Creating a Request
    PurchaseOffering' (..),
    newPurchaseOffering',

    -- * Request Lenses
    purchaseOffering'_name,
    purchaseOffering'_renewalSettings,
    purchaseOffering'_requestId,
    purchaseOffering'_start,
    purchaseOffering'_tags,
    purchaseOffering'_offeringId,
    purchaseOffering'_count,

    -- * Destructuring the Response
    PurchaseOfferingResponse (..),
    newPurchaseOfferingResponse,

    -- * Response Lenses
    purchaseOfferingResponse_reservation,
    purchaseOfferingResponse_httpStatus,
  )
where

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

-- | Placeholder documentation for PurchaseOfferingRequest
--
-- /See:/ 'newPurchaseOffering'' smart constructor.
data PurchaseOffering' = PurchaseOffering''
  { -- | Name for the new reservation
    PurchaseOffering' -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Renewal settings for the reservation
    PurchaseOffering' -> Maybe RenewalSettings
renewalSettings :: Prelude.Maybe RenewalSettings,
    -- | Unique request ID to be specified. This is needed to prevent retries
    -- from creating multiple resources.
    PurchaseOffering' -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | Requested reservation start time (UTC) in ISO-8601 format. The specified
    -- time must be between the first day of the current month and one year
    -- from now. If no value is given, the default is now.
    PurchaseOffering' -> Maybe Text
start :: Prelude.Maybe Prelude.Text,
    -- | A collection of key-value pairs
    PurchaseOffering' -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Offering to purchase, e.g. \'87654321\'
    PurchaseOffering' -> Text
offeringId :: Prelude.Text,
    -- | Number of resources
    PurchaseOffering' -> Natural
count :: Prelude.Natural
  }
  deriving (PurchaseOffering' -> PurchaseOffering' -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PurchaseOffering' -> PurchaseOffering' -> Bool
$c/= :: PurchaseOffering' -> PurchaseOffering' -> Bool
== :: PurchaseOffering' -> PurchaseOffering' -> Bool
$c== :: PurchaseOffering' -> PurchaseOffering' -> Bool
Prelude.Eq, ReadPrec [PurchaseOffering']
ReadPrec PurchaseOffering'
Int -> ReadS PurchaseOffering'
ReadS [PurchaseOffering']
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PurchaseOffering']
$creadListPrec :: ReadPrec [PurchaseOffering']
readPrec :: ReadPrec PurchaseOffering'
$creadPrec :: ReadPrec PurchaseOffering'
readList :: ReadS [PurchaseOffering']
$creadList :: ReadS [PurchaseOffering']
readsPrec :: Int -> ReadS PurchaseOffering'
$creadsPrec :: Int -> ReadS PurchaseOffering'
Prelude.Read, Int -> PurchaseOffering' -> ShowS
[PurchaseOffering'] -> ShowS
PurchaseOffering' -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PurchaseOffering'] -> ShowS
$cshowList :: [PurchaseOffering'] -> ShowS
show :: PurchaseOffering' -> String
$cshow :: PurchaseOffering' -> String
showsPrec :: Int -> PurchaseOffering' -> ShowS
$cshowsPrec :: Int -> PurchaseOffering' -> ShowS
Prelude.Show, forall x. Rep PurchaseOffering' x -> PurchaseOffering'
forall x. PurchaseOffering' -> Rep PurchaseOffering' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PurchaseOffering' x -> PurchaseOffering'
$cfrom :: forall x. PurchaseOffering' -> Rep PurchaseOffering' x
Prelude.Generic)

-- |
-- Create a value of 'PurchaseOffering'' 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:
--
-- 'name', 'purchaseOffering'_name' - Name for the new reservation
--
-- 'renewalSettings', 'purchaseOffering'_renewalSettings' - Renewal settings for the reservation
--
-- 'requestId', 'purchaseOffering'_requestId' - Unique request ID to be specified. This is needed to prevent retries
-- from creating multiple resources.
--
-- 'start', 'purchaseOffering'_start' - Requested reservation start time (UTC) in ISO-8601 format. The specified
-- time must be between the first day of the current month and one year
-- from now. If no value is given, the default is now.
--
-- 'tags', 'purchaseOffering'_tags' - A collection of key-value pairs
--
-- 'offeringId', 'purchaseOffering'_offeringId' - Offering to purchase, e.g. \'87654321\'
--
-- 'count', 'purchaseOffering'_count' - Number of resources
newPurchaseOffering' ::
  -- | 'offeringId'
  Prelude.Text ->
  -- | 'count'
  Prelude.Natural ->
  PurchaseOffering'
newPurchaseOffering' :: Text -> Natural -> PurchaseOffering'
newPurchaseOffering' Text
pOfferingId_ Natural
pCount_ =
  PurchaseOffering''
    { $sel:name:PurchaseOffering'' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:renewalSettings:PurchaseOffering'' :: Maybe RenewalSettings
renewalSettings = forall a. Maybe a
Prelude.Nothing,
      $sel:requestId:PurchaseOffering'' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
      $sel:start:PurchaseOffering'' :: Maybe Text
start = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:PurchaseOffering'' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:offeringId:PurchaseOffering'' :: Text
offeringId = Text
pOfferingId_,
      $sel:count:PurchaseOffering'' :: Natural
count = Natural
pCount_
    }

-- | Name for the new reservation
purchaseOffering'_name :: Lens.Lens' PurchaseOffering' (Prelude.Maybe Prelude.Text)
purchaseOffering'_name :: Lens' PurchaseOffering' (Maybe Text)
purchaseOffering'_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Maybe Text
name :: Maybe Text
$sel:name:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
name} -> Maybe Text
name) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Maybe Text
a -> PurchaseOffering'
s {$sel:name:PurchaseOffering'' :: Maybe Text
name = Maybe Text
a} :: PurchaseOffering')

-- | Renewal settings for the reservation
purchaseOffering'_renewalSettings :: Lens.Lens' PurchaseOffering' (Prelude.Maybe RenewalSettings)
purchaseOffering'_renewalSettings :: Lens' PurchaseOffering' (Maybe RenewalSettings)
purchaseOffering'_renewalSettings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Maybe RenewalSettings
renewalSettings :: Maybe RenewalSettings
$sel:renewalSettings:PurchaseOffering'' :: PurchaseOffering' -> Maybe RenewalSettings
renewalSettings} -> Maybe RenewalSettings
renewalSettings) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Maybe RenewalSettings
a -> PurchaseOffering'
s {$sel:renewalSettings:PurchaseOffering'' :: Maybe RenewalSettings
renewalSettings = Maybe RenewalSettings
a} :: PurchaseOffering')

-- | Unique request ID to be specified. This is needed to prevent retries
-- from creating multiple resources.
purchaseOffering'_requestId :: Lens.Lens' PurchaseOffering' (Prelude.Maybe Prelude.Text)
purchaseOffering'_requestId :: Lens' PurchaseOffering' (Maybe Text)
purchaseOffering'_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Maybe Text
requestId :: Maybe Text
$sel:requestId:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Maybe Text
a -> PurchaseOffering'
s {$sel:requestId:PurchaseOffering'' :: Maybe Text
requestId = Maybe Text
a} :: PurchaseOffering')

-- | Requested reservation start time (UTC) in ISO-8601 format. The specified
-- time must be between the first day of the current month and one year
-- from now. If no value is given, the default is now.
purchaseOffering'_start :: Lens.Lens' PurchaseOffering' (Prelude.Maybe Prelude.Text)
purchaseOffering'_start :: Lens' PurchaseOffering' (Maybe Text)
purchaseOffering'_start = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Maybe Text
start :: Maybe Text
$sel:start:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
start} -> Maybe Text
start) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Maybe Text
a -> PurchaseOffering'
s {$sel:start:PurchaseOffering'' :: Maybe Text
start = Maybe Text
a} :: PurchaseOffering')

-- | A collection of key-value pairs
purchaseOffering'_tags :: Lens.Lens' PurchaseOffering' (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
purchaseOffering'_tags :: Lens' PurchaseOffering' (Maybe (HashMap Text Text))
purchaseOffering'_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:PurchaseOffering'' :: PurchaseOffering' -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Maybe (HashMap Text Text)
a -> PurchaseOffering'
s {$sel:tags:PurchaseOffering'' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: PurchaseOffering') forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Offering to purchase, e.g. \'87654321\'
purchaseOffering'_offeringId :: Lens.Lens' PurchaseOffering' Prelude.Text
purchaseOffering'_offeringId :: Lens' PurchaseOffering' Text
purchaseOffering'_offeringId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Text
offeringId :: Text
$sel:offeringId:PurchaseOffering'' :: PurchaseOffering' -> Text
offeringId} -> Text
offeringId) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Text
a -> PurchaseOffering'
s {$sel:offeringId:PurchaseOffering'' :: Text
offeringId = Text
a} :: PurchaseOffering')

-- | Number of resources
purchaseOffering'_count :: Lens.Lens' PurchaseOffering' Prelude.Natural
purchaseOffering'_count :: Lens' PurchaseOffering' Natural
purchaseOffering'_count = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOffering'' {Natural
count :: Natural
$sel:count:PurchaseOffering'' :: PurchaseOffering' -> Natural
count} -> Natural
count) (\s :: PurchaseOffering'
s@PurchaseOffering'' {} Natural
a -> PurchaseOffering'
s {$sel:count:PurchaseOffering'' :: Natural
count = Natural
a} :: PurchaseOffering')

instance Core.AWSRequest PurchaseOffering' where
  type
    AWSResponse PurchaseOffering' =
      PurchaseOfferingResponse
  request :: (Service -> Service)
-> PurchaseOffering' -> Request PurchaseOffering'
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy PurchaseOffering'
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse PurchaseOffering')))
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 Reservation -> Int -> PurchaseOfferingResponse
PurchaseOfferingResponse'
            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
"reservation")
            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 PurchaseOffering' where
  hashWithSalt :: Int -> PurchaseOffering' -> Int
hashWithSalt Int
_salt PurchaseOffering'' {Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe RenewalSettings
Text
count :: Natural
offeringId :: Text
tags :: Maybe (HashMap Text Text)
start :: Maybe Text
requestId :: Maybe Text
renewalSettings :: Maybe RenewalSettings
name :: Maybe Text
$sel:count:PurchaseOffering'' :: PurchaseOffering' -> Natural
$sel:offeringId:PurchaseOffering'' :: PurchaseOffering' -> Text
$sel:tags:PurchaseOffering'' :: PurchaseOffering' -> Maybe (HashMap Text Text)
$sel:start:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:requestId:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:renewalSettings:PurchaseOffering'' :: PurchaseOffering' -> Maybe RenewalSettings
$sel:name:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RenewalSettings
renewalSettings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
requestId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
start
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
offeringId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
count

instance Prelude.NFData PurchaseOffering' where
  rnf :: PurchaseOffering' -> ()
rnf PurchaseOffering'' {Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe RenewalSettings
Text
count :: Natural
offeringId :: Text
tags :: Maybe (HashMap Text Text)
start :: Maybe Text
requestId :: Maybe Text
renewalSettings :: Maybe RenewalSettings
name :: Maybe Text
$sel:count:PurchaseOffering'' :: PurchaseOffering' -> Natural
$sel:offeringId:PurchaseOffering'' :: PurchaseOffering' -> Text
$sel:tags:PurchaseOffering'' :: PurchaseOffering' -> Maybe (HashMap Text Text)
$sel:start:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:requestId:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:renewalSettings:PurchaseOffering'' :: PurchaseOffering' -> Maybe RenewalSettings
$sel:name:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RenewalSettings
renewalSettings
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
start
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
offeringId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Natural
count

instance Data.ToHeaders PurchaseOffering' where
  toHeaders :: PurchaseOffering' -> 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 PurchaseOffering' where
  toJSON :: PurchaseOffering' -> Value
toJSON PurchaseOffering'' {Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe RenewalSettings
Text
count :: Natural
offeringId :: Text
tags :: Maybe (HashMap Text Text)
start :: Maybe Text
requestId :: Maybe Text
renewalSettings :: Maybe RenewalSettings
name :: Maybe Text
$sel:count:PurchaseOffering'' :: PurchaseOffering' -> Natural
$sel:offeringId:PurchaseOffering'' :: PurchaseOffering' -> Text
$sel:tags:PurchaseOffering'' :: PurchaseOffering' -> Maybe (HashMap Text Text)
$sel:start:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:requestId:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:renewalSettings:PurchaseOffering'' :: PurchaseOffering' -> Maybe RenewalSettings
$sel:name:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Key
"renewalSettings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RenewalSettings
renewalSettings,
            (Key
"requestId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
requestId,
            (Key
"start" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
start,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            forall a. a -> Maybe a
Prelude.Just (Key
"count" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Natural
count)
          ]
      )

instance Data.ToPath PurchaseOffering' where
  toPath :: PurchaseOffering' -> ByteString
toPath PurchaseOffering'' {Natural
Maybe Text
Maybe (HashMap Text Text)
Maybe RenewalSettings
Text
count :: Natural
offeringId :: Text
tags :: Maybe (HashMap Text Text)
start :: Maybe Text
requestId :: Maybe Text
renewalSettings :: Maybe RenewalSettings
name :: Maybe Text
$sel:count:PurchaseOffering'' :: PurchaseOffering' -> Natural
$sel:offeringId:PurchaseOffering'' :: PurchaseOffering' -> Text
$sel:tags:PurchaseOffering'' :: PurchaseOffering' -> Maybe (HashMap Text Text)
$sel:start:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:requestId:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
$sel:renewalSettings:PurchaseOffering'' :: PurchaseOffering' -> Maybe RenewalSettings
$sel:name:PurchaseOffering'' :: PurchaseOffering' -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/prod/offerings/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
offeringId,
        ByteString
"/purchase"
      ]

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

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

-- |
-- Create a value of 'PurchaseOfferingResponse' 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:
--
-- 'reservation', 'purchaseOfferingResponse_reservation' - Undocumented member.
--
-- 'httpStatus', 'purchaseOfferingResponse_httpStatus' - The response's http status code.
newPurchaseOfferingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  PurchaseOfferingResponse
newPurchaseOfferingResponse :: Int -> PurchaseOfferingResponse
newPurchaseOfferingResponse Int
pHttpStatus_ =
  PurchaseOfferingResponse'
    { $sel:reservation:PurchaseOfferingResponse' :: Maybe Reservation
reservation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:PurchaseOfferingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
purchaseOfferingResponse_reservation :: Lens.Lens' PurchaseOfferingResponse (Prelude.Maybe Reservation)
purchaseOfferingResponse_reservation :: Lens' PurchaseOfferingResponse (Maybe Reservation)
purchaseOfferingResponse_reservation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PurchaseOfferingResponse' {Maybe Reservation
reservation :: Maybe Reservation
$sel:reservation:PurchaseOfferingResponse' :: PurchaseOfferingResponse -> Maybe Reservation
reservation} -> Maybe Reservation
reservation) (\s :: PurchaseOfferingResponse
s@PurchaseOfferingResponse' {} Maybe Reservation
a -> PurchaseOfferingResponse
s {$sel:reservation:PurchaseOfferingResponse' :: Maybe Reservation
reservation = Maybe Reservation
a} :: PurchaseOfferingResponse)

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

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