{-# 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.IoT.UpdateBillingGroup
(
UpdateBillingGroup (..),
newUpdateBillingGroup,
updateBillingGroup_expectedVersion,
updateBillingGroup_billingGroupName,
updateBillingGroup_billingGroupProperties,
UpdateBillingGroupResponse (..),
newUpdateBillingGroupResponse,
updateBillingGroupResponse_version,
updateBillingGroupResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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
data UpdateBillingGroup = UpdateBillingGroup'
{
UpdateBillingGroup -> Maybe Integer
expectedVersion :: Prelude.Maybe Prelude.Integer,
UpdateBillingGroup -> Text
billingGroupName :: Prelude.Text,
UpdateBillingGroup -> BillingGroupProperties
billingGroupProperties :: BillingGroupProperties
}
deriving (UpdateBillingGroup -> UpdateBillingGroup -> Bool
(UpdateBillingGroup -> UpdateBillingGroup -> Bool)
-> (UpdateBillingGroup -> UpdateBillingGroup -> Bool)
-> Eq UpdateBillingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBillingGroup -> UpdateBillingGroup -> Bool
$c/= :: UpdateBillingGroup -> UpdateBillingGroup -> Bool
== :: UpdateBillingGroup -> UpdateBillingGroup -> Bool
$c== :: UpdateBillingGroup -> UpdateBillingGroup -> Bool
Prelude.Eq, ReadPrec [UpdateBillingGroup]
ReadPrec UpdateBillingGroup
Int -> ReadS UpdateBillingGroup
ReadS [UpdateBillingGroup]
(Int -> ReadS UpdateBillingGroup)
-> ReadS [UpdateBillingGroup]
-> ReadPrec UpdateBillingGroup
-> ReadPrec [UpdateBillingGroup]
-> Read UpdateBillingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBillingGroup]
$creadListPrec :: ReadPrec [UpdateBillingGroup]
readPrec :: ReadPrec UpdateBillingGroup
$creadPrec :: ReadPrec UpdateBillingGroup
readList :: ReadS [UpdateBillingGroup]
$creadList :: ReadS [UpdateBillingGroup]
readsPrec :: Int -> ReadS UpdateBillingGroup
$creadsPrec :: Int -> ReadS UpdateBillingGroup
Prelude.Read, Int -> UpdateBillingGroup -> ShowS
[UpdateBillingGroup] -> ShowS
UpdateBillingGroup -> String
(Int -> UpdateBillingGroup -> ShowS)
-> (UpdateBillingGroup -> String)
-> ([UpdateBillingGroup] -> ShowS)
-> Show UpdateBillingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBillingGroup] -> ShowS
$cshowList :: [UpdateBillingGroup] -> ShowS
show :: UpdateBillingGroup -> String
$cshow :: UpdateBillingGroup -> String
showsPrec :: Int -> UpdateBillingGroup -> ShowS
$cshowsPrec :: Int -> UpdateBillingGroup -> ShowS
Prelude.Show, (forall x. UpdateBillingGroup -> Rep UpdateBillingGroup x)
-> (forall x. Rep UpdateBillingGroup x -> UpdateBillingGroup)
-> Generic UpdateBillingGroup
forall x. Rep UpdateBillingGroup x -> UpdateBillingGroup
forall x. UpdateBillingGroup -> Rep UpdateBillingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateBillingGroup x -> UpdateBillingGroup
$cfrom :: forall x. UpdateBillingGroup -> Rep UpdateBillingGroup x
Prelude.Generic)
newUpdateBillingGroup ::
Prelude.Text ->
BillingGroupProperties ->
UpdateBillingGroup
newUpdateBillingGroup :: Text -> BillingGroupProperties -> UpdateBillingGroup
newUpdateBillingGroup
Text
pBillingGroupName_
BillingGroupProperties
pBillingGroupProperties_ =
UpdateBillingGroup' :: Maybe Integer
-> Text -> BillingGroupProperties -> UpdateBillingGroup
UpdateBillingGroup'
{ $sel:expectedVersion:UpdateBillingGroup' :: Maybe Integer
expectedVersion =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:billingGroupName:UpdateBillingGroup' :: Text
billingGroupName = Text
pBillingGroupName_,
$sel:billingGroupProperties:UpdateBillingGroup' :: BillingGroupProperties
billingGroupProperties = BillingGroupProperties
pBillingGroupProperties_
}
updateBillingGroup_expectedVersion :: Lens.Lens' UpdateBillingGroup (Prelude.Maybe Prelude.Integer)
updateBillingGroup_expectedVersion :: (Maybe Integer -> f (Maybe Integer))
-> UpdateBillingGroup -> f UpdateBillingGroup
updateBillingGroup_expectedVersion = (UpdateBillingGroup -> Maybe Integer)
-> (UpdateBillingGroup -> Maybe Integer -> UpdateBillingGroup)
-> Lens
UpdateBillingGroup
UpdateBillingGroup
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBillingGroup' {Maybe Integer
expectedVersion :: Maybe Integer
$sel:expectedVersion:UpdateBillingGroup' :: UpdateBillingGroup -> Maybe Integer
expectedVersion} -> Maybe Integer
expectedVersion) (\s :: UpdateBillingGroup
s@UpdateBillingGroup' {} Maybe Integer
a -> UpdateBillingGroup
s {$sel:expectedVersion:UpdateBillingGroup' :: Maybe Integer
expectedVersion = Maybe Integer
a} :: UpdateBillingGroup)
updateBillingGroup_billingGroupName :: Lens.Lens' UpdateBillingGroup Prelude.Text
updateBillingGroup_billingGroupName :: (Text -> f Text) -> UpdateBillingGroup -> f UpdateBillingGroup
updateBillingGroup_billingGroupName = (UpdateBillingGroup -> Text)
-> (UpdateBillingGroup -> Text -> UpdateBillingGroup)
-> Lens UpdateBillingGroup UpdateBillingGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBillingGroup' {Text
billingGroupName :: Text
$sel:billingGroupName:UpdateBillingGroup' :: UpdateBillingGroup -> Text
billingGroupName} -> Text
billingGroupName) (\s :: UpdateBillingGroup
s@UpdateBillingGroup' {} Text
a -> UpdateBillingGroup
s {$sel:billingGroupName:UpdateBillingGroup' :: Text
billingGroupName = Text
a} :: UpdateBillingGroup)
updateBillingGroup_billingGroupProperties :: Lens.Lens' UpdateBillingGroup BillingGroupProperties
updateBillingGroup_billingGroupProperties :: (BillingGroupProperties -> f BillingGroupProperties)
-> UpdateBillingGroup -> f UpdateBillingGroup
updateBillingGroup_billingGroupProperties = (UpdateBillingGroup -> BillingGroupProperties)
-> (UpdateBillingGroup
-> BillingGroupProperties -> UpdateBillingGroup)
-> Lens
UpdateBillingGroup
UpdateBillingGroup
BillingGroupProperties
BillingGroupProperties
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBillingGroup' {BillingGroupProperties
billingGroupProperties :: BillingGroupProperties
$sel:billingGroupProperties:UpdateBillingGroup' :: UpdateBillingGroup -> BillingGroupProperties
billingGroupProperties} -> BillingGroupProperties
billingGroupProperties) (\s :: UpdateBillingGroup
s@UpdateBillingGroup' {} BillingGroupProperties
a -> UpdateBillingGroup
s {$sel:billingGroupProperties:UpdateBillingGroup' :: BillingGroupProperties
billingGroupProperties = BillingGroupProperties
a} :: UpdateBillingGroup)
instance Core.AWSRequest UpdateBillingGroup where
type
AWSResponse UpdateBillingGroup =
UpdateBillingGroupResponse
request :: UpdateBillingGroup -> Request UpdateBillingGroup
request = Service -> UpdateBillingGroup -> Request UpdateBillingGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateBillingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateBillingGroup)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateBillingGroup))
-> Logger
-> Service
-> Proxy UpdateBillingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateBillingGroup)))
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 Integer -> Int -> UpdateBillingGroupResponse
UpdateBillingGroupResponse'
(Maybe Integer -> Int -> UpdateBillingGroupResponse)
-> Either String (Maybe Integer)
-> Either String (Int -> UpdateBillingGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Integer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"version")
Either String (Int -> UpdateBillingGroupResponse)
-> Either String Int -> Either String UpdateBillingGroupResponse
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 UpdateBillingGroup
instance Prelude.NFData UpdateBillingGroup
instance Core.ToHeaders UpdateBillingGroup where
toHeaders :: UpdateBillingGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> UpdateBillingGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON UpdateBillingGroup where
toJSON :: UpdateBillingGroup -> Value
toJSON UpdateBillingGroup' {Maybe Integer
Text
BillingGroupProperties
billingGroupProperties :: BillingGroupProperties
billingGroupName :: Text
expectedVersion :: Maybe Integer
$sel:billingGroupProperties:UpdateBillingGroup' :: UpdateBillingGroup -> BillingGroupProperties
$sel:billingGroupName:UpdateBillingGroup' :: UpdateBillingGroup -> Text
$sel:expectedVersion:UpdateBillingGroup' :: UpdateBillingGroup -> Maybe Integer
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"expectedVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
expectedVersion,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"billingGroupProperties"
Text -> BillingGroupProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BillingGroupProperties
billingGroupProperties
)
]
)
instance Core.ToPath UpdateBillingGroup where
toPath :: UpdateBillingGroup -> ByteString
toPath UpdateBillingGroup' {Maybe Integer
Text
BillingGroupProperties
billingGroupProperties :: BillingGroupProperties
billingGroupName :: Text
expectedVersion :: Maybe Integer
$sel:billingGroupProperties:UpdateBillingGroup' :: UpdateBillingGroup -> BillingGroupProperties
$sel:billingGroupName:UpdateBillingGroup' :: UpdateBillingGroup -> Text
$sel:expectedVersion:UpdateBillingGroup' :: UpdateBillingGroup -> Maybe Integer
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/billing-groups/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
billingGroupName]
instance Core.ToQuery UpdateBillingGroup where
toQuery :: UpdateBillingGroup -> QueryString
toQuery = QueryString -> UpdateBillingGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateBillingGroupResponse = UpdateBillingGroupResponse'
{
UpdateBillingGroupResponse -> Maybe Integer
version :: Prelude.Maybe Prelude.Integer,
UpdateBillingGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool
(UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool)
-> (UpdateBillingGroupResponse
-> UpdateBillingGroupResponse -> Bool)
-> Eq UpdateBillingGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool
$c/= :: UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool
== :: UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool
$c== :: UpdateBillingGroupResponse -> UpdateBillingGroupResponse -> Bool
Prelude.Eq, ReadPrec [UpdateBillingGroupResponse]
ReadPrec UpdateBillingGroupResponse
Int -> ReadS UpdateBillingGroupResponse
ReadS [UpdateBillingGroupResponse]
(Int -> ReadS UpdateBillingGroupResponse)
-> ReadS [UpdateBillingGroupResponse]
-> ReadPrec UpdateBillingGroupResponse
-> ReadPrec [UpdateBillingGroupResponse]
-> Read UpdateBillingGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateBillingGroupResponse]
$creadListPrec :: ReadPrec [UpdateBillingGroupResponse]
readPrec :: ReadPrec UpdateBillingGroupResponse
$creadPrec :: ReadPrec UpdateBillingGroupResponse
readList :: ReadS [UpdateBillingGroupResponse]
$creadList :: ReadS [UpdateBillingGroupResponse]
readsPrec :: Int -> ReadS UpdateBillingGroupResponse
$creadsPrec :: Int -> ReadS UpdateBillingGroupResponse
Prelude.Read, Int -> UpdateBillingGroupResponse -> ShowS
[UpdateBillingGroupResponse] -> ShowS
UpdateBillingGroupResponse -> String
(Int -> UpdateBillingGroupResponse -> ShowS)
-> (UpdateBillingGroupResponse -> String)
-> ([UpdateBillingGroupResponse] -> ShowS)
-> Show UpdateBillingGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateBillingGroupResponse] -> ShowS
$cshowList :: [UpdateBillingGroupResponse] -> ShowS
show :: UpdateBillingGroupResponse -> String
$cshow :: UpdateBillingGroupResponse -> String
showsPrec :: Int -> UpdateBillingGroupResponse -> ShowS
$cshowsPrec :: Int -> UpdateBillingGroupResponse -> ShowS
Prelude.Show, (forall x.
UpdateBillingGroupResponse -> Rep UpdateBillingGroupResponse x)
-> (forall x.
Rep UpdateBillingGroupResponse x -> UpdateBillingGroupResponse)
-> Generic UpdateBillingGroupResponse
forall x.
Rep UpdateBillingGroupResponse x -> UpdateBillingGroupResponse
forall x.
UpdateBillingGroupResponse -> Rep UpdateBillingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateBillingGroupResponse x -> UpdateBillingGroupResponse
$cfrom :: forall x.
UpdateBillingGroupResponse -> Rep UpdateBillingGroupResponse x
Prelude.Generic)
newUpdateBillingGroupResponse ::
Prelude.Int ->
UpdateBillingGroupResponse
newUpdateBillingGroupResponse :: Int -> UpdateBillingGroupResponse
newUpdateBillingGroupResponse Int
pHttpStatus_ =
UpdateBillingGroupResponse' :: Maybe Integer -> Int -> UpdateBillingGroupResponse
UpdateBillingGroupResponse'
{ $sel:version:UpdateBillingGroupResponse' :: Maybe Integer
version =
Maybe Integer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateBillingGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateBillingGroupResponse_version :: Lens.Lens' UpdateBillingGroupResponse (Prelude.Maybe Prelude.Integer)
updateBillingGroupResponse_version :: (Maybe Integer -> f (Maybe Integer))
-> UpdateBillingGroupResponse -> f UpdateBillingGroupResponse
updateBillingGroupResponse_version = (UpdateBillingGroupResponse -> Maybe Integer)
-> (UpdateBillingGroupResponse
-> Maybe Integer -> UpdateBillingGroupResponse)
-> Lens
UpdateBillingGroupResponse
UpdateBillingGroupResponse
(Maybe Integer)
(Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBillingGroupResponse' {Maybe Integer
version :: Maybe Integer
$sel:version:UpdateBillingGroupResponse' :: UpdateBillingGroupResponse -> Maybe Integer
version} -> Maybe Integer
version) (\s :: UpdateBillingGroupResponse
s@UpdateBillingGroupResponse' {} Maybe Integer
a -> UpdateBillingGroupResponse
s {$sel:version:UpdateBillingGroupResponse' :: Maybe Integer
version = Maybe Integer
a} :: UpdateBillingGroupResponse)
updateBillingGroupResponse_httpStatus :: Lens.Lens' UpdateBillingGroupResponse Prelude.Int
updateBillingGroupResponse_httpStatus :: (Int -> f Int)
-> UpdateBillingGroupResponse -> f UpdateBillingGroupResponse
updateBillingGroupResponse_httpStatus = (UpdateBillingGroupResponse -> Int)
-> (UpdateBillingGroupResponse
-> Int -> UpdateBillingGroupResponse)
-> Lens
UpdateBillingGroupResponse UpdateBillingGroupResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateBillingGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateBillingGroupResponse' :: UpdateBillingGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateBillingGroupResponse
s@UpdateBillingGroupResponse' {} Int
a -> UpdateBillingGroupResponse
s {$sel:httpStatus:UpdateBillingGroupResponse' :: Int
httpStatus = Int
a} :: UpdateBillingGroupResponse)
instance Prelude.NFData UpdateBillingGroupResponse