{-# 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.Redshift.CreateUsageLimit
(
CreateUsageLimit (..),
newCreateUsageLimit,
createUsageLimit_period,
createUsageLimit_breachAction,
createUsageLimit_tags,
createUsageLimit_clusterIdentifier,
createUsageLimit_featureType,
createUsageLimit_limitType,
createUsageLimit_amount,
UsageLimit (..),
newUsageLimit,
usageLimit_amount,
usageLimit_limitType,
usageLimit_usageLimitId,
usageLimit_period,
usageLimit_clusterIdentifier,
usageLimit_breachAction,
usageLimit_featureType,
usageLimit_tags,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateUsageLimit = CreateUsageLimit'
{
CreateUsageLimit -> Maybe UsageLimitPeriod
period :: Prelude.Maybe UsageLimitPeriod,
CreateUsageLimit -> Maybe UsageLimitBreachAction
breachAction :: Prelude.Maybe UsageLimitBreachAction,
CreateUsageLimit -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateUsageLimit -> Text
clusterIdentifier :: Prelude.Text,
CreateUsageLimit -> UsageLimitFeatureType
featureType :: UsageLimitFeatureType,
CreateUsageLimit -> UsageLimitLimitType
limitType :: UsageLimitLimitType,
CreateUsageLimit -> Integer
amount :: Prelude.Integer
}
deriving (CreateUsageLimit -> CreateUsageLimit -> Bool
(CreateUsageLimit -> CreateUsageLimit -> Bool)
-> (CreateUsageLimit -> CreateUsageLimit -> Bool)
-> Eq CreateUsageLimit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateUsageLimit -> CreateUsageLimit -> Bool
$c/= :: CreateUsageLimit -> CreateUsageLimit -> Bool
== :: CreateUsageLimit -> CreateUsageLimit -> Bool
$c== :: CreateUsageLimit -> CreateUsageLimit -> Bool
Prelude.Eq, ReadPrec [CreateUsageLimit]
ReadPrec CreateUsageLimit
Int -> ReadS CreateUsageLimit
ReadS [CreateUsageLimit]
(Int -> ReadS CreateUsageLimit)
-> ReadS [CreateUsageLimit]
-> ReadPrec CreateUsageLimit
-> ReadPrec [CreateUsageLimit]
-> Read CreateUsageLimit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateUsageLimit]
$creadListPrec :: ReadPrec [CreateUsageLimit]
readPrec :: ReadPrec CreateUsageLimit
$creadPrec :: ReadPrec CreateUsageLimit
readList :: ReadS [CreateUsageLimit]
$creadList :: ReadS [CreateUsageLimit]
readsPrec :: Int -> ReadS CreateUsageLimit
$creadsPrec :: Int -> ReadS CreateUsageLimit
Prelude.Read, Int -> CreateUsageLimit -> ShowS
[CreateUsageLimit] -> ShowS
CreateUsageLimit -> String
(Int -> CreateUsageLimit -> ShowS)
-> (CreateUsageLimit -> String)
-> ([CreateUsageLimit] -> ShowS)
-> Show CreateUsageLimit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateUsageLimit] -> ShowS
$cshowList :: [CreateUsageLimit] -> ShowS
show :: CreateUsageLimit -> String
$cshow :: CreateUsageLimit -> String
showsPrec :: Int -> CreateUsageLimit -> ShowS
$cshowsPrec :: Int -> CreateUsageLimit -> ShowS
Prelude.Show, (forall x. CreateUsageLimit -> Rep CreateUsageLimit x)
-> (forall x. Rep CreateUsageLimit x -> CreateUsageLimit)
-> Generic CreateUsageLimit
forall x. Rep CreateUsageLimit x -> CreateUsageLimit
forall x. CreateUsageLimit -> Rep CreateUsageLimit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateUsageLimit x -> CreateUsageLimit
$cfrom :: forall x. CreateUsageLimit -> Rep CreateUsageLimit x
Prelude.Generic)
newCreateUsageLimit ::
Prelude.Text ->
UsageLimitFeatureType ->
UsageLimitLimitType ->
Prelude.Integer ->
CreateUsageLimit
newCreateUsageLimit :: Text
-> UsageLimitFeatureType
-> UsageLimitLimitType
-> Integer
-> CreateUsageLimit
newCreateUsageLimit
Text
pClusterIdentifier_
UsageLimitFeatureType
pFeatureType_
UsageLimitLimitType
pLimitType_
Integer
pAmount_ =
CreateUsageLimit' :: Maybe UsageLimitPeriod
-> Maybe UsageLimitBreachAction
-> Maybe [Tag]
-> Text
-> UsageLimitFeatureType
-> UsageLimitLimitType
-> Integer
-> CreateUsageLimit
CreateUsageLimit'
{ $sel:period:CreateUsageLimit' :: Maybe UsageLimitPeriod
period = Maybe UsageLimitPeriod
forall a. Maybe a
Prelude.Nothing,
$sel:breachAction:CreateUsageLimit' :: Maybe UsageLimitBreachAction
breachAction = Maybe UsageLimitBreachAction
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateUsageLimit' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:clusterIdentifier:CreateUsageLimit' :: Text
clusterIdentifier = Text
pClusterIdentifier_,
$sel:featureType:CreateUsageLimit' :: UsageLimitFeatureType
featureType = UsageLimitFeatureType
pFeatureType_,
$sel:limitType:CreateUsageLimit' :: UsageLimitLimitType
limitType = UsageLimitLimitType
pLimitType_,
$sel:amount:CreateUsageLimit' :: Integer
amount = Integer
pAmount_
}
createUsageLimit_period :: Lens.Lens' CreateUsageLimit (Prelude.Maybe UsageLimitPeriod)
createUsageLimit_period :: (Maybe UsageLimitPeriod -> f (Maybe UsageLimitPeriod))
-> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_period = (CreateUsageLimit -> Maybe UsageLimitPeriod)
-> (CreateUsageLimit -> Maybe UsageLimitPeriod -> CreateUsageLimit)
-> Lens
CreateUsageLimit
CreateUsageLimit
(Maybe UsageLimitPeriod)
(Maybe UsageLimitPeriod)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {Maybe UsageLimitPeriod
period :: Maybe UsageLimitPeriod
$sel:period:CreateUsageLimit' :: CreateUsageLimit -> Maybe UsageLimitPeriod
period} -> Maybe UsageLimitPeriod
period) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} Maybe UsageLimitPeriod
a -> CreateUsageLimit
s {$sel:period:CreateUsageLimit' :: Maybe UsageLimitPeriod
period = Maybe UsageLimitPeriod
a} :: CreateUsageLimit)
createUsageLimit_breachAction :: Lens.Lens' CreateUsageLimit (Prelude.Maybe UsageLimitBreachAction)
createUsageLimit_breachAction :: (Maybe UsageLimitBreachAction -> f (Maybe UsageLimitBreachAction))
-> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_breachAction = (CreateUsageLimit -> Maybe UsageLimitBreachAction)
-> (CreateUsageLimit
-> Maybe UsageLimitBreachAction -> CreateUsageLimit)
-> Lens
CreateUsageLimit
CreateUsageLimit
(Maybe UsageLimitBreachAction)
(Maybe UsageLimitBreachAction)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {Maybe UsageLimitBreachAction
breachAction :: Maybe UsageLimitBreachAction
$sel:breachAction:CreateUsageLimit' :: CreateUsageLimit -> Maybe UsageLimitBreachAction
breachAction} -> Maybe UsageLimitBreachAction
breachAction) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} Maybe UsageLimitBreachAction
a -> CreateUsageLimit
s {$sel:breachAction:CreateUsageLimit' :: Maybe UsageLimitBreachAction
breachAction = Maybe UsageLimitBreachAction
a} :: CreateUsageLimit)
createUsageLimit_tags :: Lens.Lens' CreateUsageLimit (Prelude.Maybe [Tag])
createUsageLimit_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_tags = (CreateUsageLimit -> Maybe [Tag])
-> (CreateUsageLimit -> Maybe [Tag] -> CreateUsageLimit)
-> Lens
CreateUsageLimit CreateUsageLimit (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateUsageLimit' :: CreateUsageLimit -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} Maybe [Tag]
a -> CreateUsageLimit
s {$sel:tags:CreateUsageLimit' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateUsageLimit) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUsageLimit -> f CreateUsageLimit)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateUsageLimit
-> f CreateUsageLimit
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
createUsageLimit_clusterIdentifier :: Lens.Lens' CreateUsageLimit Prelude.Text
createUsageLimit_clusterIdentifier :: (Text -> f Text) -> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_clusterIdentifier = (CreateUsageLimit -> Text)
-> (CreateUsageLimit -> Text -> CreateUsageLimit)
-> Lens CreateUsageLimit CreateUsageLimit Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:CreateUsageLimit' :: CreateUsageLimit -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} Text
a -> CreateUsageLimit
s {$sel:clusterIdentifier:CreateUsageLimit' :: Text
clusterIdentifier = Text
a} :: CreateUsageLimit)
createUsageLimit_featureType :: Lens.Lens' CreateUsageLimit UsageLimitFeatureType
createUsageLimit_featureType :: (UsageLimitFeatureType -> f UsageLimitFeatureType)
-> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_featureType = (CreateUsageLimit -> UsageLimitFeatureType)
-> (CreateUsageLimit -> UsageLimitFeatureType -> CreateUsageLimit)
-> Lens
CreateUsageLimit
CreateUsageLimit
UsageLimitFeatureType
UsageLimitFeatureType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {UsageLimitFeatureType
featureType :: UsageLimitFeatureType
$sel:featureType:CreateUsageLimit' :: CreateUsageLimit -> UsageLimitFeatureType
featureType} -> UsageLimitFeatureType
featureType) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} UsageLimitFeatureType
a -> CreateUsageLimit
s {$sel:featureType:CreateUsageLimit' :: UsageLimitFeatureType
featureType = UsageLimitFeatureType
a} :: CreateUsageLimit)
createUsageLimit_limitType :: Lens.Lens' CreateUsageLimit UsageLimitLimitType
createUsageLimit_limitType :: (UsageLimitLimitType -> f UsageLimitLimitType)
-> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_limitType = (CreateUsageLimit -> UsageLimitLimitType)
-> (CreateUsageLimit -> UsageLimitLimitType -> CreateUsageLimit)
-> Lens
CreateUsageLimit
CreateUsageLimit
UsageLimitLimitType
UsageLimitLimitType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {UsageLimitLimitType
limitType :: UsageLimitLimitType
$sel:limitType:CreateUsageLimit' :: CreateUsageLimit -> UsageLimitLimitType
limitType} -> UsageLimitLimitType
limitType) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} UsageLimitLimitType
a -> CreateUsageLimit
s {$sel:limitType:CreateUsageLimit' :: UsageLimitLimitType
limitType = UsageLimitLimitType
a} :: CreateUsageLimit)
createUsageLimit_amount :: Lens.Lens' CreateUsageLimit Prelude.Integer
createUsageLimit_amount :: (Integer -> f Integer) -> CreateUsageLimit -> f CreateUsageLimit
createUsageLimit_amount = (CreateUsageLimit -> Integer)
-> (CreateUsageLimit -> Integer -> CreateUsageLimit)
-> Lens CreateUsageLimit CreateUsageLimit Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateUsageLimit' {Integer
amount :: Integer
$sel:amount:CreateUsageLimit' :: CreateUsageLimit -> Integer
amount} -> Integer
amount) (\s :: CreateUsageLimit
s@CreateUsageLimit' {} Integer
a -> CreateUsageLimit
s {$sel:amount:CreateUsageLimit' :: Integer
amount = Integer
a} :: CreateUsageLimit)
instance Core.AWSRequest CreateUsageLimit where
type AWSResponse CreateUsageLimit = UsageLimit
request :: CreateUsageLimit -> Request CreateUsageLimit
request = Service -> CreateUsageLimit -> Request CreateUsageLimit
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
response :: Logger
-> Service
-> Proxy CreateUsageLimit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUsageLimit)))
response =
Text
-> (Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse CreateUsageLimit))
-> Logger
-> Service
-> Proxy CreateUsageLimit
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateUsageLimit)))
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
"CreateUsageLimitResult"
(\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String UsageLimit
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
instance Prelude.Hashable CreateUsageLimit
instance Prelude.NFData CreateUsageLimit
instance Core.ToHeaders CreateUsageLimit where
toHeaders :: CreateUsageLimit -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateUsageLimit -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath CreateUsageLimit where
toPath :: CreateUsageLimit -> ByteString
toPath = ByteString -> CreateUsageLimit -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateUsageLimit where
toQuery :: CreateUsageLimit -> QueryString
toQuery CreateUsageLimit' {Integer
Maybe [Tag]
Maybe UsageLimitBreachAction
Maybe UsageLimitPeriod
Text
UsageLimitFeatureType
UsageLimitLimitType
amount :: Integer
limitType :: UsageLimitLimitType
featureType :: UsageLimitFeatureType
clusterIdentifier :: Text
tags :: Maybe [Tag]
breachAction :: Maybe UsageLimitBreachAction
period :: Maybe UsageLimitPeriod
$sel:amount:CreateUsageLimit' :: CreateUsageLimit -> Integer
$sel:limitType:CreateUsageLimit' :: CreateUsageLimit -> UsageLimitLimitType
$sel:featureType:CreateUsageLimit' :: CreateUsageLimit -> UsageLimitFeatureType
$sel:clusterIdentifier:CreateUsageLimit' :: CreateUsageLimit -> Text
$sel:tags:CreateUsageLimit' :: CreateUsageLimit -> Maybe [Tag]
$sel:breachAction:CreateUsageLimit' :: CreateUsageLimit -> Maybe UsageLimitBreachAction
$sel:period:CreateUsageLimit' :: CreateUsageLimit -> Maybe UsageLimitPeriod
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Action"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateUsageLimit" :: Prelude.ByteString),
ByteString
"Version"
ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
ByteString
"Period" ByteString -> Maybe UsageLimitPeriod -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe UsageLimitPeriod
period,
ByteString
"BreachAction" ByteString -> Maybe UsageLimitBreachAction -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe UsageLimitBreachAction
breachAction,
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
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier,
ByteString
"FeatureType" ByteString -> UsageLimitFeatureType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: UsageLimitFeatureType
featureType,
ByteString
"LimitType" ByteString -> UsageLimitLimitType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: UsageLimitLimitType
limitType,
ByteString
"Amount" ByteString -> Integer -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Integer
amount
]