{-# 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.AddThingToBillingGroup
(
AddThingToBillingGroup (..),
newAddThingToBillingGroup,
addThingToBillingGroup_thingArn,
addThingToBillingGroup_billingGroupArn,
addThingToBillingGroup_thingName,
addThingToBillingGroup_billingGroupName,
AddThingToBillingGroupResponse (..),
newAddThingToBillingGroupResponse,
addThingToBillingGroupResponse_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 AddThingToBillingGroup = AddThingToBillingGroup'
{
AddThingToBillingGroup -> Maybe Text
thingArn :: Prelude.Maybe Prelude.Text,
AddThingToBillingGroup -> Maybe Text
billingGroupArn :: Prelude.Maybe Prelude.Text,
AddThingToBillingGroup -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text,
AddThingToBillingGroup -> Maybe Text
billingGroupName :: Prelude.Maybe Prelude.Text
}
deriving (AddThingToBillingGroup -> AddThingToBillingGroup -> Bool
(AddThingToBillingGroup -> AddThingToBillingGroup -> Bool)
-> (AddThingToBillingGroup -> AddThingToBillingGroup -> Bool)
-> Eq AddThingToBillingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddThingToBillingGroup -> AddThingToBillingGroup -> Bool
$c/= :: AddThingToBillingGroup -> AddThingToBillingGroup -> Bool
== :: AddThingToBillingGroup -> AddThingToBillingGroup -> Bool
$c== :: AddThingToBillingGroup -> AddThingToBillingGroup -> Bool
Prelude.Eq, ReadPrec [AddThingToBillingGroup]
ReadPrec AddThingToBillingGroup
Int -> ReadS AddThingToBillingGroup
ReadS [AddThingToBillingGroup]
(Int -> ReadS AddThingToBillingGroup)
-> ReadS [AddThingToBillingGroup]
-> ReadPrec AddThingToBillingGroup
-> ReadPrec [AddThingToBillingGroup]
-> Read AddThingToBillingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddThingToBillingGroup]
$creadListPrec :: ReadPrec [AddThingToBillingGroup]
readPrec :: ReadPrec AddThingToBillingGroup
$creadPrec :: ReadPrec AddThingToBillingGroup
readList :: ReadS [AddThingToBillingGroup]
$creadList :: ReadS [AddThingToBillingGroup]
readsPrec :: Int -> ReadS AddThingToBillingGroup
$creadsPrec :: Int -> ReadS AddThingToBillingGroup
Prelude.Read, Int -> AddThingToBillingGroup -> ShowS
[AddThingToBillingGroup] -> ShowS
AddThingToBillingGroup -> String
(Int -> AddThingToBillingGroup -> ShowS)
-> (AddThingToBillingGroup -> String)
-> ([AddThingToBillingGroup] -> ShowS)
-> Show AddThingToBillingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddThingToBillingGroup] -> ShowS
$cshowList :: [AddThingToBillingGroup] -> ShowS
show :: AddThingToBillingGroup -> String
$cshow :: AddThingToBillingGroup -> String
showsPrec :: Int -> AddThingToBillingGroup -> ShowS
$cshowsPrec :: Int -> AddThingToBillingGroup -> ShowS
Prelude.Show, (forall x. AddThingToBillingGroup -> Rep AddThingToBillingGroup x)
-> (forall x.
Rep AddThingToBillingGroup x -> AddThingToBillingGroup)
-> Generic AddThingToBillingGroup
forall x. Rep AddThingToBillingGroup x -> AddThingToBillingGroup
forall x. AddThingToBillingGroup -> Rep AddThingToBillingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddThingToBillingGroup x -> AddThingToBillingGroup
$cfrom :: forall x. AddThingToBillingGroup -> Rep AddThingToBillingGroup x
Prelude.Generic)
newAddThingToBillingGroup ::
AddThingToBillingGroup
newAddThingToBillingGroup :: AddThingToBillingGroup
newAddThingToBillingGroup =
AddThingToBillingGroup' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> AddThingToBillingGroup
AddThingToBillingGroup'
{ $sel:thingArn:AddThingToBillingGroup' :: Maybe Text
thingArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:billingGroupArn:AddThingToBillingGroup' :: Maybe Text
billingGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:thingName:AddThingToBillingGroup' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:billingGroupName:AddThingToBillingGroup' :: Maybe Text
billingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
addThingToBillingGroup_thingArn :: Lens.Lens' AddThingToBillingGroup (Prelude.Maybe Prelude.Text)
addThingToBillingGroup_thingArn :: (Maybe Text -> f (Maybe Text))
-> AddThingToBillingGroup -> f AddThingToBillingGroup
addThingToBillingGroup_thingArn = (AddThingToBillingGroup -> Maybe Text)
-> (AddThingToBillingGroup -> Maybe Text -> AddThingToBillingGroup)
-> Lens
AddThingToBillingGroup
AddThingToBillingGroup
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToBillingGroup' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: AddThingToBillingGroup
s@AddThingToBillingGroup' {} Maybe Text
a -> AddThingToBillingGroup
s {$sel:thingArn:AddThingToBillingGroup' :: Maybe Text
thingArn = Maybe Text
a} :: AddThingToBillingGroup)
addThingToBillingGroup_billingGroupArn :: Lens.Lens' AddThingToBillingGroup (Prelude.Maybe Prelude.Text)
addThingToBillingGroup_billingGroupArn :: (Maybe Text -> f (Maybe Text))
-> AddThingToBillingGroup -> f AddThingToBillingGroup
addThingToBillingGroup_billingGroupArn = (AddThingToBillingGroup -> Maybe Text)
-> (AddThingToBillingGroup -> Maybe Text -> AddThingToBillingGroup)
-> Lens
AddThingToBillingGroup
AddThingToBillingGroup
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToBillingGroup' {Maybe Text
billingGroupArn :: Maybe Text
$sel:billingGroupArn:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
billingGroupArn} -> Maybe Text
billingGroupArn) (\s :: AddThingToBillingGroup
s@AddThingToBillingGroup' {} Maybe Text
a -> AddThingToBillingGroup
s {$sel:billingGroupArn:AddThingToBillingGroup' :: Maybe Text
billingGroupArn = Maybe Text
a} :: AddThingToBillingGroup)
addThingToBillingGroup_thingName :: Lens.Lens' AddThingToBillingGroup (Prelude.Maybe Prelude.Text)
addThingToBillingGroup_thingName :: (Maybe Text -> f (Maybe Text))
-> AddThingToBillingGroup -> f AddThingToBillingGroup
addThingToBillingGroup_thingName = (AddThingToBillingGroup -> Maybe Text)
-> (AddThingToBillingGroup -> Maybe Text -> AddThingToBillingGroup)
-> Lens
AddThingToBillingGroup
AddThingToBillingGroup
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToBillingGroup' {Maybe Text
thingName :: Maybe Text
$sel:thingName:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: AddThingToBillingGroup
s@AddThingToBillingGroup' {} Maybe Text
a -> AddThingToBillingGroup
s {$sel:thingName:AddThingToBillingGroup' :: Maybe Text
thingName = Maybe Text
a} :: AddThingToBillingGroup)
addThingToBillingGroup_billingGroupName :: Lens.Lens' AddThingToBillingGroup (Prelude.Maybe Prelude.Text)
addThingToBillingGroup_billingGroupName :: (Maybe Text -> f (Maybe Text))
-> AddThingToBillingGroup -> f AddThingToBillingGroup
addThingToBillingGroup_billingGroupName = (AddThingToBillingGroup -> Maybe Text)
-> (AddThingToBillingGroup -> Maybe Text -> AddThingToBillingGroup)
-> Lens
AddThingToBillingGroup
AddThingToBillingGroup
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToBillingGroup' {Maybe Text
billingGroupName :: Maybe Text
$sel:billingGroupName:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
billingGroupName} -> Maybe Text
billingGroupName) (\s :: AddThingToBillingGroup
s@AddThingToBillingGroup' {} Maybe Text
a -> AddThingToBillingGroup
s {$sel:billingGroupName:AddThingToBillingGroup' :: Maybe Text
billingGroupName = Maybe Text
a} :: AddThingToBillingGroup)
instance Core.AWSRequest AddThingToBillingGroup where
type
AWSResponse AddThingToBillingGroup =
AddThingToBillingGroupResponse
request :: AddThingToBillingGroup -> Request AddThingToBillingGroup
request = Service -> AddThingToBillingGroup -> Request AddThingToBillingGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddThingToBillingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddThingToBillingGroup)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AddThingToBillingGroup))
-> Logger
-> Service
-> Proxy AddThingToBillingGroup
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddThingToBillingGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AddThingToBillingGroupResponse
AddThingToBillingGroupResponse'
(Int -> AddThingToBillingGroupResponse)
-> Either String Int
-> Either String AddThingToBillingGroupResponse
forall (f :: * -> *) a b. Functor 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 AddThingToBillingGroup
instance Prelude.NFData AddThingToBillingGroup
instance Core.ToHeaders AddThingToBillingGroup where
toHeaders :: AddThingToBillingGroup -> ResponseHeaders
toHeaders = ResponseHeaders -> AddThingToBillingGroup -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON AddThingToBillingGroup where
toJSON :: AddThingToBillingGroup -> Value
toJSON AddThingToBillingGroup' {Maybe Text
billingGroupName :: Maybe Text
thingName :: Maybe Text
billingGroupArn :: Maybe Text
thingArn :: Maybe Text
$sel:billingGroupName:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
$sel:thingName:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
$sel:billingGroupArn:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
$sel:thingArn:AddThingToBillingGroup' :: AddThingToBillingGroup -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"thingArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
thingArn,
(Text
"billingGroupArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingGroupArn,
(Text
"thingName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
thingName,
(Text
"billingGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
billingGroupName
]
)
instance Core.ToPath AddThingToBillingGroup where
toPath :: AddThingToBillingGroup -> ByteString
toPath =
ByteString -> AddThingToBillingGroup -> ByteString
forall a b. a -> b -> a
Prelude.const
ByteString
"/billing-groups/addThingToBillingGroup"
instance Core.ToQuery AddThingToBillingGroup where
toQuery :: AddThingToBillingGroup -> QueryString
toQuery = QueryString -> AddThingToBillingGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddThingToBillingGroupResponse = AddThingToBillingGroupResponse'
{
AddThingToBillingGroupResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool
(AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool)
-> (AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool)
-> Eq AddThingToBillingGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool
$c/= :: AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool
== :: AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool
$c== :: AddThingToBillingGroupResponse
-> AddThingToBillingGroupResponse -> Bool
Prelude.Eq, ReadPrec [AddThingToBillingGroupResponse]
ReadPrec AddThingToBillingGroupResponse
Int -> ReadS AddThingToBillingGroupResponse
ReadS [AddThingToBillingGroupResponse]
(Int -> ReadS AddThingToBillingGroupResponse)
-> ReadS [AddThingToBillingGroupResponse]
-> ReadPrec AddThingToBillingGroupResponse
-> ReadPrec [AddThingToBillingGroupResponse]
-> Read AddThingToBillingGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddThingToBillingGroupResponse]
$creadListPrec :: ReadPrec [AddThingToBillingGroupResponse]
readPrec :: ReadPrec AddThingToBillingGroupResponse
$creadPrec :: ReadPrec AddThingToBillingGroupResponse
readList :: ReadS [AddThingToBillingGroupResponse]
$creadList :: ReadS [AddThingToBillingGroupResponse]
readsPrec :: Int -> ReadS AddThingToBillingGroupResponse
$creadsPrec :: Int -> ReadS AddThingToBillingGroupResponse
Prelude.Read, Int -> AddThingToBillingGroupResponse -> ShowS
[AddThingToBillingGroupResponse] -> ShowS
AddThingToBillingGroupResponse -> String
(Int -> AddThingToBillingGroupResponse -> ShowS)
-> (AddThingToBillingGroupResponse -> String)
-> ([AddThingToBillingGroupResponse] -> ShowS)
-> Show AddThingToBillingGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddThingToBillingGroupResponse] -> ShowS
$cshowList :: [AddThingToBillingGroupResponse] -> ShowS
show :: AddThingToBillingGroupResponse -> String
$cshow :: AddThingToBillingGroupResponse -> String
showsPrec :: Int -> AddThingToBillingGroupResponse -> ShowS
$cshowsPrec :: Int -> AddThingToBillingGroupResponse -> ShowS
Prelude.Show, (forall x.
AddThingToBillingGroupResponse
-> Rep AddThingToBillingGroupResponse x)
-> (forall x.
Rep AddThingToBillingGroupResponse x
-> AddThingToBillingGroupResponse)
-> Generic AddThingToBillingGroupResponse
forall x.
Rep AddThingToBillingGroupResponse x
-> AddThingToBillingGroupResponse
forall x.
AddThingToBillingGroupResponse
-> Rep AddThingToBillingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddThingToBillingGroupResponse x
-> AddThingToBillingGroupResponse
$cfrom :: forall x.
AddThingToBillingGroupResponse
-> Rep AddThingToBillingGroupResponse x
Prelude.Generic)
newAddThingToBillingGroupResponse ::
Prelude.Int ->
AddThingToBillingGroupResponse
newAddThingToBillingGroupResponse :: Int -> AddThingToBillingGroupResponse
newAddThingToBillingGroupResponse Int
pHttpStatus_ =
AddThingToBillingGroupResponse' :: Int -> AddThingToBillingGroupResponse
AddThingToBillingGroupResponse'
{ $sel:httpStatus:AddThingToBillingGroupResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
addThingToBillingGroupResponse_httpStatus :: Lens.Lens' AddThingToBillingGroupResponse Prelude.Int
addThingToBillingGroupResponse_httpStatus :: (Int -> f Int)
-> AddThingToBillingGroupResponse
-> f AddThingToBillingGroupResponse
addThingToBillingGroupResponse_httpStatus = (AddThingToBillingGroupResponse -> Int)
-> (AddThingToBillingGroupResponse
-> Int -> AddThingToBillingGroupResponse)
-> Lens
AddThingToBillingGroupResponse
AddThingToBillingGroupResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddThingToBillingGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddThingToBillingGroupResponse' :: AddThingToBillingGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddThingToBillingGroupResponse
s@AddThingToBillingGroupResponse' {} Int
a -> AddThingToBillingGroupResponse
s {$sel:httpStatus:AddThingToBillingGroupResponse' :: Int
httpStatus = Int
a} :: AddThingToBillingGroupResponse)
instance
Prelude.NFData
AddThingToBillingGroupResponse