{-# 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 #-}
module Amazonka.Snowball.CreateLongTermPricing
(
CreateLongTermPricing (..),
newCreateLongTermPricing,
createLongTermPricing_snowballType,
createLongTermPricing_isLongTermPricingAutoRenew,
createLongTermPricing_longTermPricingType,
CreateLongTermPricingResponse (..),
newCreateLongTermPricingResponse,
createLongTermPricingResponse_longTermPricingId,
createLongTermPricingResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Snowball.Types
data CreateLongTermPricing = CreateLongTermPricing'
{
CreateLongTermPricing -> Maybe SnowballType
snowballType :: Prelude.Maybe SnowballType,
CreateLongTermPricing -> Maybe Bool
isLongTermPricingAutoRenew :: Prelude.Maybe Prelude.Bool,
CreateLongTermPricing -> LongTermPricingType
longTermPricingType :: LongTermPricingType
}
deriving (CreateLongTermPricing -> CreateLongTermPricing -> Bool
(CreateLongTermPricing -> CreateLongTermPricing -> Bool)
-> (CreateLongTermPricing -> CreateLongTermPricing -> Bool)
-> Eq CreateLongTermPricing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLongTermPricing -> CreateLongTermPricing -> Bool
$c/= :: CreateLongTermPricing -> CreateLongTermPricing -> Bool
== :: CreateLongTermPricing -> CreateLongTermPricing -> Bool
$c== :: CreateLongTermPricing -> CreateLongTermPricing -> Bool
Prelude.Eq, ReadPrec [CreateLongTermPricing]
ReadPrec CreateLongTermPricing
Int -> ReadS CreateLongTermPricing
ReadS [CreateLongTermPricing]
(Int -> ReadS CreateLongTermPricing)
-> ReadS [CreateLongTermPricing]
-> ReadPrec CreateLongTermPricing
-> ReadPrec [CreateLongTermPricing]
-> Read CreateLongTermPricing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLongTermPricing]
$creadListPrec :: ReadPrec [CreateLongTermPricing]
readPrec :: ReadPrec CreateLongTermPricing
$creadPrec :: ReadPrec CreateLongTermPricing
readList :: ReadS [CreateLongTermPricing]
$creadList :: ReadS [CreateLongTermPricing]
readsPrec :: Int -> ReadS CreateLongTermPricing
$creadsPrec :: Int -> ReadS CreateLongTermPricing
Prelude.Read, Int -> CreateLongTermPricing -> ShowS
[CreateLongTermPricing] -> ShowS
CreateLongTermPricing -> String
(Int -> CreateLongTermPricing -> ShowS)
-> (CreateLongTermPricing -> String)
-> ([CreateLongTermPricing] -> ShowS)
-> Show CreateLongTermPricing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLongTermPricing] -> ShowS
$cshowList :: [CreateLongTermPricing] -> ShowS
show :: CreateLongTermPricing -> String
$cshow :: CreateLongTermPricing -> String
showsPrec :: Int -> CreateLongTermPricing -> ShowS
$cshowsPrec :: Int -> CreateLongTermPricing -> ShowS
Prelude.Show, (forall x. CreateLongTermPricing -> Rep CreateLongTermPricing x)
-> (forall x. Rep CreateLongTermPricing x -> CreateLongTermPricing)
-> Generic CreateLongTermPricing
forall x. Rep CreateLongTermPricing x -> CreateLongTermPricing
forall x. CreateLongTermPricing -> Rep CreateLongTermPricing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLongTermPricing x -> CreateLongTermPricing
$cfrom :: forall x. CreateLongTermPricing -> Rep CreateLongTermPricing x
Prelude.Generic)
newCreateLongTermPricing ::
LongTermPricingType ->
CreateLongTermPricing
newCreateLongTermPricing :: LongTermPricingType -> CreateLongTermPricing
newCreateLongTermPricing LongTermPricingType
pLongTermPricingType_ =
CreateLongTermPricing' :: Maybe SnowballType
-> Maybe Bool -> LongTermPricingType -> CreateLongTermPricing
CreateLongTermPricing'
{ $sel:snowballType:CreateLongTermPricing' :: Maybe SnowballType
snowballType =
Maybe SnowballType
forall a. Maybe a
Prelude.Nothing,
$sel:isLongTermPricingAutoRenew:CreateLongTermPricing' :: Maybe Bool
isLongTermPricingAutoRenew = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:longTermPricingType:CreateLongTermPricing' :: LongTermPricingType
longTermPricingType = LongTermPricingType
pLongTermPricingType_
}
createLongTermPricing_snowballType :: Lens.Lens' CreateLongTermPricing (Prelude.Maybe SnowballType)
createLongTermPricing_snowballType :: (Maybe SnowballType -> f (Maybe SnowballType))
-> CreateLongTermPricing -> f CreateLongTermPricing
createLongTermPricing_snowballType = (CreateLongTermPricing -> Maybe SnowballType)
-> (CreateLongTermPricing
-> Maybe SnowballType -> CreateLongTermPricing)
-> Lens
CreateLongTermPricing
CreateLongTermPricing
(Maybe SnowballType)
(Maybe SnowballType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLongTermPricing' {Maybe SnowballType
snowballType :: Maybe SnowballType
$sel:snowballType:CreateLongTermPricing' :: CreateLongTermPricing -> Maybe SnowballType
snowballType} -> Maybe SnowballType
snowballType) (\s :: CreateLongTermPricing
s@CreateLongTermPricing' {} Maybe SnowballType
a -> CreateLongTermPricing
s {$sel:snowballType:CreateLongTermPricing' :: Maybe SnowballType
snowballType = Maybe SnowballType
a} :: CreateLongTermPricing)
createLongTermPricing_isLongTermPricingAutoRenew :: Lens.Lens' CreateLongTermPricing (Prelude.Maybe Prelude.Bool)
createLongTermPricing_isLongTermPricingAutoRenew :: (Maybe Bool -> f (Maybe Bool))
-> CreateLongTermPricing -> f CreateLongTermPricing
createLongTermPricing_isLongTermPricingAutoRenew = (CreateLongTermPricing -> Maybe Bool)
-> (CreateLongTermPricing -> Maybe Bool -> CreateLongTermPricing)
-> Lens
CreateLongTermPricing
CreateLongTermPricing
(Maybe Bool)
(Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLongTermPricing' {Maybe Bool
isLongTermPricingAutoRenew :: Maybe Bool
$sel:isLongTermPricingAutoRenew:CreateLongTermPricing' :: CreateLongTermPricing -> Maybe Bool
isLongTermPricingAutoRenew} -> Maybe Bool
isLongTermPricingAutoRenew) (\s :: CreateLongTermPricing
s@CreateLongTermPricing' {} Maybe Bool
a -> CreateLongTermPricing
s {$sel:isLongTermPricingAutoRenew:CreateLongTermPricing' :: Maybe Bool
isLongTermPricingAutoRenew = Maybe Bool
a} :: CreateLongTermPricing)
createLongTermPricing_longTermPricingType :: Lens.Lens' CreateLongTermPricing LongTermPricingType
createLongTermPricing_longTermPricingType :: (LongTermPricingType -> f LongTermPricingType)
-> CreateLongTermPricing -> f CreateLongTermPricing
createLongTermPricing_longTermPricingType = (CreateLongTermPricing -> LongTermPricingType)
-> (CreateLongTermPricing
-> LongTermPricingType -> CreateLongTermPricing)
-> Lens
CreateLongTermPricing
CreateLongTermPricing
LongTermPricingType
LongTermPricingType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLongTermPricing' {LongTermPricingType
longTermPricingType :: LongTermPricingType
$sel:longTermPricingType:CreateLongTermPricing' :: CreateLongTermPricing -> LongTermPricingType
longTermPricingType} -> LongTermPricingType
longTermPricingType) (\s :: CreateLongTermPricing
s@CreateLongTermPricing' {} LongTermPricingType
a -> CreateLongTermPricing
s {$sel:longTermPricingType:CreateLongTermPricing' :: LongTermPricingType
longTermPricingType = LongTermPricingType
a} :: CreateLongTermPricing)
instance Core.AWSRequest CreateLongTermPricing where
type
AWSResponse CreateLongTermPricing =
CreateLongTermPricingResponse
request :: CreateLongTermPricing -> Request CreateLongTermPricing
request = Service -> CreateLongTermPricing -> Request CreateLongTermPricing
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateLongTermPricing
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateLongTermPricing)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateLongTermPricing))
-> Logger
-> Service
-> Proxy CreateLongTermPricing
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateLongTermPricing)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Text -> Int -> CreateLongTermPricingResponse
CreateLongTermPricingResponse'
(Maybe Text -> Int -> CreateLongTermPricingResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLongTermPricingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LongTermPricingId")
Either String (Int -> CreateLongTermPricingResponse)
-> Either String Int -> Either String CreateLongTermPricingResponse
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 CreateLongTermPricing
instance Prelude.NFData CreateLongTermPricing
instance Core.ToHeaders CreateLongTermPricing where
toHeaders :: CreateLongTermPricing -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateLongTermPricing -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSIESnowballJobManagementService.CreateLongTermPricing" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON CreateLongTermPricing where
toJSON :: CreateLongTermPricing -> Value
toJSON CreateLongTermPricing' {Maybe Bool
Maybe SnowballType
LongTermPricingType
longTermPricingType :: LongTermPricingType
isLongTermPricingAutoRenew :: Maybe Bool
snowballType :: Maybe SnowballType
$sel:longTermPricingType:CreateLongTermPricing' :: CreateLongTermPricing -> LongTermPricingType
$sel:isLongTermPricingAutoRenew:CreateLongTermPricing' :: CreateLongTermPricing -> Maybe Bool
$sel:snowballType:CreateLongTermPricing' :: CreateLongTermPricing -> Maybe SnowballType
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SnowballType" Text -> SnowballType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SnowballType -> Pair) -> Maybe SnowballType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SnowballType
snowballType,
(Text
"IsLongTermPricingAutoRenew" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isLongTermPricingAutoRenew,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"LongTermPricingType" Text -> LongTermPricingType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LongTermPricingType
longTermPricingType)
]
)
instance Core.ToPath CreateLongTermPricing where
toPath :: CreateLongTermPricing -> ByteString
toPath = ByteString -> CreateLongTermPricing -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateLongTermPricing where
toQuery :: CreateLongTermPricing -> QueryString
toQuery = QueryString -> CreateLongTermPricing -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateLongTermPricingResponse = CreateLongTermPricingResponse'
{
CreateLongTermPricingResponse -> Maybe Text
longTermPricingId :: Prelude.Maybe Prelude.Text,
CreateLongTermPricingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool
(CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool)
-> (CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool)
-> Eq CreateLongTermPricingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool
$c/= :: CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool
== :: CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool
$c== :: CreateLongTermPricingResponse
-> CreateLongTermPricingResponse -> Bool
Prelude.Eq, ReadPrec [CreateLongTermPricingResponse]
ReadPrec CreateLongTermPricingResponse
Int -> ReadS CreateLongTermPricingResponse
ReadS [CreateLongTermPricingResponse]
(Int -> ReadS CreateLongTermPricingResponse)
-> ReadS [CreateLongTermPricingResponse]
-> ReadPrec CreateLongTermPricingResponse
-> ReadPrec [CreateLongTermPricingResponse]
-> Read CreateLongTermPricingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLongTermPricingResponse]
$creadListPrec :: ReadPrec [CreateLongTermPricingResponse]
readPrec :: ReadPrec CreateLongTermPricingResponse
$creadPrec :: ReadPrec CreateLongTermPricingResponse
readList :: ReadS [CreateLongTermPricingResponse]
$creadList :: ReadS [CreateLongTermPricingResponse]
readsPrec :: Int -> ReadS CreateLongTermPricingResponse
$creadsPrec :: Int -> ReadS CreateLongTermPricingResponse
Prelude.Read, Int -> CreateLongTermPricingResponse -> ShowS
[CreateLongTermPricingResponse] -> ShowS
CreateLongTermPricingResponse -> String
(Int -> CreateLongTermPricingResponse -> ShowS)
-> (CreateLongTermPricingResponse -> String)
-> ([CreateLongTermPricingResponse] -> ShowS)
-> Show CreateLongTermPricingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLongTermPricingResponse] -> ShowS
$cshowList :: [CreateLongTermPricingResponse] -> ShowS
show :: CreateLongTermPricingResponse -> String
$cshow :: CreateLongTermPricingResponse -> String
showsPrec :: Int -> CreateLongTermPricingResponse -> ShowS
$cshowsPrec :: Int -> CreateLongTermPricingResponse -> ShowS
Prelude.Show, (forall x.
CreateLongTermPricingResponse
-> Rep CreateLongTermPricingResponse x)
-> (forall x.
Rep CreateLongTermPricingResponse x
-> CreateLongTermPricingResponse)
-> Generic CreateLongTermPricingResponse
forall x.
Rep CreateLongTermPricingResponse x
-> CreateLongTermPricingResponse
forall x.
CreateLongTermPricingResponse
-> Rep CreateLongTermPricingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLongTermPricingResponse x
-> CreateLongTermPricingResponse
$cfrom :: forall x.
CreateLongTermPricingResponse
-> Rep CreateLongTermPricingResponse x
Prelude.Generic)
newCreateLongTermPricingResponse ::
Prelude.Int ->
CreateLongTermPricingResponse
newCreateLongTermPricingResponse :: Int -> CreateLongTermPricingResponse
newCreateLongTermPricingResponse Int
pHttpStatus_ =
CreateLongTermPricingResponse' :: Maybe Text -> Int -> CreateLongTermPricingResponse
CreateLongTermPricingResponse'
{ $sel:longTermPricingId:CreateLongTermPricingResponse' :: Maybe Text
longTermPricingId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateLongTermPricingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createLongTermPricingResponse_longTermPricingId :: Lens.Lens' CreateLongTermPricingResponse (Prelude.Maybe Prelude.Text)
createLongTermPricingResponse_longTermPricingId :: (Maybe Text -> f (Maybe Text))
-> CreateLongTermPricingResponse -> f CreateLongTermPricingResponse
createLongTermPricingResponse_longTermPricingId = (CreateLongTermPricingResponse -> Maybe Text)
-> (CreateLongTermPricingResponse
-> Maybe Text -> CreateLongTermPricingResponse)
-> Lens
CreateLongTermPricingResponse
CreateLongTermPricingResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLongTermPricingResponse' {Maybe Text
longTermPricingId :: Maybe Text
$sel:longTermPricingId:CreateLongTermPricingResponse' :: CreateLongTermPricingResponse -> Maybe Text
longTermPricingId} -> Maybe Text
longTermPricingId) (\s :: CreateLongTermPricingResponse
s@CreateLongTermPricingResponse' {} Maybe Text
a -> CreateLongTermPricingResponse
s {$sel:longTermPricingId:CreateLongTermPricingResponse' :: Maybe Text
longTermPricingId = Maybe Text
a} :: CreateLongTermPricingResponse)
createLongTermPricingResponse_httpStatus :: Lens.Lens' CreateLongTermPricingResponse Prelude.Int
createLongTermPricingResponse_httpStatus :: (Int -> f Int)
-> CreateLongTermPricingResponse -> f CreateLongTermPricingResponse
createLongTermPricingResponse_httpStatus = (CreateLongTermPricingResponse -> Int)
-> (CreateLongTermPricingResponse
-> Int -> CreateLongTermPricingResponse)
-> Lens
CreateLongTermPricingResponse CreateLongTermPricingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLongTermPricingResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLongTermPricingResponse' :: CreateLongTermPricingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLongTermPricingResponse
s@CreateLongTermPricingResponse' {} Int
a -> CreateLongTermPricingResponse
s {$sel:httpStatus:CreateLongTermPricingResponse' :: Int
httpStatus = Int
a} :: CreateLongTermPricingResponse)
instance Prelude.NFData CreateLongTermPricingResponse