{-# 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.BillingConductor.CreatePricingPlan
(
CreatePricingPlan (..),
newCreatePricingPlan,
createPricingPlan_clientToken,
createPricingPlan_description,
createPricingPlan_pricingRuleArns,
createPricingPlan_tags,
createPricingPlan_name,
CreatePricingPlanResponse (..),
newCreatePricingPlanResponse,
createPricingPlanResponse_arn,
createPricingPlanResponse_httpStatus,
)
where
import Amazonka.BillingConductor.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
data CreatePricingPlan = CreatePricingPlan'
{
CreatePricingPlan -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreatePricingPlan -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
CreatePricingPlan -> Maybe [Text]
pricingRuleArns :: Prelude.Maybe [Prelude.Text],
CreatePricingPlan -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreatePricingPlan -> Sensitive Text
name :: Data.Sensitive Prelude.Text
}
deriving (CreatePricingPlan -> CreatePricingPlan -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePricingPlan -> CreatePricingPlan -> Bool
$c/= :: CreatePricingPlan -> CreatePricingPlan -> Bool
== :: CreatePricingPlan -> CreatePricingPlan -> Bool
$c== :: CreatePricingPlan -> CreatePricingPlan -> Bool
Prelude.Eq, Int -> CreatePricingPlan -> ShowS
[CreatePricingPlan] -> ShowS
CreatePricingPlan -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePricingPlan] -> ShowS
$cshowList :: [CreatePricingPlan] -> ShowS
show :: CreatePricingPlan -> String
$cshow :: CreatePricingPlan -> String
showsPrec :: Int -> CreatePricingPlan -> ShowS
$cshowsPrec :: Int -> CreatePricingPlan -> ShowS
Prelude.Show, forall x. Rep CreatePricingPlan x -> CreatePricingPlan
forall x. CreatePricingPlan -> Rep CreatePricingPlan x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePricingPlan x -> CreatePricingPlan
$cfrom :: forall x. CreatePricingPlan -> Rep CreatePricingPlan x
Prelude.Generic)
newCreatePricingPlan ::
Prelude.Text ->
CreatePricingPlan
newCreatePricingPlan :: Text -> CreatePricingPlan
newCreatePricingPlan Text
pName_ =
CreatePricingPlan'
{ $sel:clientToken:CreatePricingPlan' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreatePricingPlan' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
$sel:pricingRuleArns:CreatePricingPlan' :: Maybe [Text]
pricingRuleArns = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreatePricingPlan' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:name:CreatePricingPlan' :: Sensitive Text
name = forall a. Iso' (Sensitive a) a
Data._Sensitive forall t b. AReview t b -> b -> t
Lens.# Text
pName_
}
createPricingPlan_clientToken :: Lens.Lens' CreatePricingPlan (Prelude.Maybe Prelude.Text)
createPricingPlan_clientToken :: Lens' CreatePricingPlan (Maybe Text)
createPricingPlan_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlan' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreatePricingPlan' :: CreatePricingPlan -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreatePricingPlan
s@CreatePricingPlan' {} Maybe Text
a -> CreatePricingPlan
s {$sel:clientToken:CreatePricingPlan' :: Maybe Text
clientToken = Maybe Text
a} :: CreatePricingPlan)
createPricingPlan_description :: Lens.Lens' CreatePricingPlan (Prelude.Maybe Prelude.Text)
createPricingPlan_description :: Lens' CreatePricingPlan (Maybe Text)
createPricingPlan_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlan' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreatePricingPlan' :: CreatePricingPlan -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreatePricingPlan
s@CreatePricingPlan' {} Maybe (Sensitive Text)
a -> CreatePricingPlan
s {$sel:description:CreatePricingPlan' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreatePricingPlan) 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 a. Iso' (Sensitive a) a
Data._Sensitive
createPricingPlan_pricingRuleArns :: Lens.Lens' CreatePricingPlan (Prelude.Maybe [Prelude.Text])
createPricingPlan_pricingRuleArns :: Lens' CreatePricingPlan (Maybe [Text])
createPricingPlan_pricingRuleArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlan' {Maybe [Text]
pricingRuleArns :: Maybe [Text]
$sel:pricingRuleArns:CreatePricingPlan' :: CreatePricingPlan -> Maybe [Text]
pricingRuleArns} -> Maybe [Text]
pricingRuleArns) (\s :: CreatePricingPlan
s@CreatePricingPlan' {} Maybe [Text]
a -> CreatePricingPlan
s {$sel:pricingRuleArns:CreatePricingPlan' :: Maybe [Text]
pricingRuleArns = Maybe [Text]
a} :: CreatePricingPlan) 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
createPricingPlan_tags :: Lens.Lens' CreatePricingPlan (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPricingPlan_tags :: Lens' CreatePricingPlan (Maybe (HashMap Text Text))
createPricingPlan_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlan' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreatePricingPlan' :: CreatePricingPlan -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreatePricingPlan
s@CreatePricingPlan' {} Maybe (HashMap Text Text)
a -> CreatePricingPlan
s {$sel:tags:CreatePricingPlan' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreatePricingPlan) 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
createPricingPlan_name :: Lens.Lens' CreatePricingPlan Prelude.Text
createPricingPlan_name :: Lens' CreatePricingPlan Text
createPricingPlan_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlan' {Sensitive Text
name :: Sensitive Text
$sel:name:CreatePricingPlan' :: CreatePricingPlan -> Sensitive Text
name} -> Sensitive Text
name) (\s :: CreatePricingPlan
s@CreatePricingPlan' {} Sensitive Text
a -> CreatePricingPlan
s {$sel:name:CreatePricingPlan' :: Sensitive Text
name = Sensitive Text
a} :: CreatePricingPlan) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive
instance Core.AWSRequest CreatePricingPlan where
type
AWSResponse CreatePricingPlan =
CreatePricingPlanResponse
request :: (Service -> Service)
-> CreatePricingPlan -> Request CreatePricingPlan
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 CreatePricingPlan
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreatePricingPlan)))
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 Text -> Int -> CreatePricingPlanResponse
CreatePricingPlanResponse'
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
"Arn")
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 CreatePricingPlan where
hashWithSalt :: Int -> CreatePricingPlan -> Int
hashWithSalt Int
_salt CreatePricingPlan' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Sensitive Text
name :: Sensitive Text
tags :: Maybe (HashMap Text Text)
pricingRuleArns :: Maybe [Text]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:name:CreatePricingPlan' :: CreatePricingPlan -> Sensitive Text
$sel:tags:CreatePricingPlan' :: CreatePricingPlan -> Maybe (HashMap Text Text)
$sel:pricingRuleArns:CreatePricingPlan' :: CreatePricingPlan -> Maybe [Text]
$sel:description:CreatePricingPlan' :: CreatePricingPlan -> Maybe (Sensitive Text)
$sel:clientToken:CreatePricingPlan' :: CreatePricingPlan -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
pricingRuleArns
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive Text
name
instance Prelude.NFData CreatePricingPlan where
rnf :: CreatePricingPlan -> ()
rnf CreatePricingPlan' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Sensitive Text
name :: Sensitive Text
tags :: Maybe (HashMap Text Text)
pricingRuleArns :: Maybe [Text]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:name:CreatePricingPlan' :: CreatePricingPlan -> Sensitive Text
$sel:tags:CreatePricingPlan' :: CreatePricingPlan -> Maybe (HashMap Text Text)
$sel:pricingRuleArns:CreatePricingPlan' :: CreatePricingPlan -> Maybe [Text]
$sel:description:CreatePricingPlan' :: CreatePricingPlan -> Maybe (Sensitive Text)
$sel:clientToken:CreatePricingPlan' :: CreatePricingPlan -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
pricingRuleArns
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 Sensitive Text
name
instance Data.ToHeaders CreatePricingPlan where
toHeaders :: CreatePricingPlan -> ResponseHeaders
toHeaders CreatePricingPlan' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Sensitive Text
name :: Sensitive Text
tags :: Maybe (HashMap Text Text)
pricingRuleArns :: Maybe [Text]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:name:CreatePricingPlan' :: CreatePricingPlan -> Sensitive Text
$sel:tags:CreatePricingPlan' :: CreatePricingPlan -> Maybe (HashMap Text Text)
$sel:pricingRuleArns:CreatePricingPlan' :: CreatePricingPlan -> Maybe [Text]
$sel:description:CreatePricingPlan' :: CreatePricingPlan -> Maybe (Sensitive Text)
$sel:clientToken:CreatePricingPlan' :: CreatePricingPlan -> Maybe Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amzn-Client-Token" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
clientToken,
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
]
instance Data.ToJSON CreatePricingPlan where
toJSON :: CreatePricingPlan -> Value
toJSON CreatePricingPlan' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (Sensitive Text)
Sensitive Text
name :: Sensitive Text
tags :: Maybe (HashMap Text Text)
pricingRuleArns :: Maybe [Text]
description :: Maybe (Sensitive Text)
clientToken :: Maybe Text
$sel:name:CreatePricingPlan' :: CreatePricingPlan -> Sensitive Text
$sel:tags:CreatePricingPlan' :: CreatePricingPlan -> Maybe (HashMap Text Text)
$sel:pricingRuleArns:CreatePricingPlan' :: CreatePricingPlan -> Maybe [Text]
$sel:description:CreatePricingPlan' :: CreatePricingPlan -> Maybe (Sensitive Text)
$sel:clientToken:CreatePricingPlan' :: CreatePricingPlan -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" 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 (Sensitive Text)
description,
(Key
"PricingRuleArns" 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]
pricingRuleArns,
(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
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive Text
name)
]
)
instance Data.ToPath CreatePricingPlan where
toPath :: CreatePricingPlan -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/create-pricing-plan"
instance Data.ToQuery CreatePricingPlan where
toQuery :: CreatePricingPlan -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreatePricingPlanResponse = CreatePricingPlanResponse'
{
CreatePricingPlanResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
CreatePricingPlanResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreatePricingPlanResponse -> CreatePricingPlanResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePricingPlanResponse -> CreatePricingPlanResponse -> Bool
$c/= :: CreatePricingPlanResponse -> CreatePricingPlanResponse -> Bool
== :: CreatePricingPlanResponse -> CreatePricingPlanResponse -> Bool
$c== :: CreatePricingPlanResponse -> CreatePricingPlanResponse -> Bool
Prelude.Eq, ReadPrec [CreatePricingPlanResponse]
ReadPrec CreatePricingPlanResponse
Int -> ReadS CreatePricingPlanResponse
ReadS [CreatePricingPlanResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePricingPlanResponse]
$creadListPrec :: ReadPrec [CreatePricingPlanResponse]
readPrec :: ReadPrec CreatePricingPlanResponse
$creadPrec :: ReadPrec CreatePricingPlanResponse
readList :: ReadS [CreatePricingPlanResponse]
$creadList :: ReadS [CreatePricingPlanResponse]
readsPrec :: Int -> ReadS CreatePricingPlanResponse
$creadsPrec :: Int -> ReadS CreatePricingPlanResponse
Prelude.Read, Int -> CreatePricingPlanResponse -> ShowS
[CreatePricingPlanResponse] -> ShowS
CreatePricingPlanResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePricingPlanResponse] -> ShowS
$cshowList :: [CreatePricingPlanResponse] -> ShowS
show :: CreatePricingPlanResponse -> String
$cshow :: CreatePricingPlanResponse -> String
showsPrec :: Int -> CreatePricingPlanResponse -> ShowS
$cshowsPrec :: Int -> CreatePricingPlanResponse -> ShowS
Prelude.Show, forall x.
Rep CreatePricingPlanResponse x -> CreatePricingPlanResponse
forall x.
CreatePricingPlanResponse -> Rep CreatePricingPlanResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePricingPlanResponse x -> CreatePricingPlanResponse
$cfrom :: forall x.
CreatePricingPlanResponse -> Rep CreatePricingPlanResponse x
Prelude.Generic)
newCreatePricingPlanResponse ::
Prelude.Int ->
CreatePricingPlanResponse
newCreatePricingPlanResponse :: Int -> CreatePricingPlanResponse
newCreatePricingPlanResponse Int
pHttpStatus_ =
CreatePricingPlanResponse'
{ $sel:arn:CreatePricingPlanResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreatePricingPlanResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createPricingPlanResponse_arn :: Lens.Lens' CreatePricingPlanResponse (Prelude.Maybe Prelude.Text)
createPricingPlanResponse_arn :: Lens' CreatePricingPlanResponse (Maybe Text)
createPricingPlanResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlanResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreatePricingPlanResponse' :: CreatePricingPlanResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreatePricingPlanResponse
s@CreatePricingPlanResponse' {} Maybe Text
a -> CreatePricingPlanResponse
s {$sel:arn:CreatePricingPlanResponse' :: Maybe Text
arn = Maybe Text
a} :: CreatePricingPlanResponse)
createPricingPlanResponse_httpStatus :: Lens.Lens' CreatePricingPlanResponse Prelude.Int
createPricingPlanResponse_httpStatus :: Lens' CreatePricingPlanResponse Int
createPricingPlanResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePricingPlanResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreatePricingPlanResponse' :: CreatePricingPlanResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreatePricingPlanResponse
s@CreatePricingPlanResponse' {} Int
a -> CreatePricingPlanResponse
s {$sel:httpStatus:CreatePricingPlanResponse' :: Int
httpStatus = Int
a} :: CreatePricingPlanResponse)
instance Prelude.NFData CreatePricingPlanResponse where
rnf :: CreatePricingPlanResponse -> ()
rnf CreatePricingPlanResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:CreatePricingPlanResponse' :: CreatePricingPlanResponse -> Int
$sel:arn:CreatePricingPlanResponse' :: CreatePricingPlanResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus