{-# 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.DetachThingPrincipal
(
DetachThingPrincipal (..),
newDetachThingPrincipal,
detachThingPrincipal_thingName,
detachThingPrincipal_principal,
DetachThingPrincipalResponse (..),
newDetachThingPrincipalResponse,
detachThingPrincipalResponse_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 DetachThingPrincipal = DetachThingPrincipal'
{
DetachThingPrincipal -> Text
thingName :: Prelude.Text,
DetachThingPrincipal -> Text
principal :: Prelude.Text
}
deriving (DetachThingPrincipal -> DetachThingPrincipal -> Bool
(DetachThingPrincipal -> DetachThingPrincipal -> Bool)
-> (DetachThingPrincipal -> DetachThingPrincipal -> Bool)
-> Eq DetachThingPrincipal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachThingPrincipal -> DetachThingPrincipal -> Bool
$c/= :: DetachThingPrincipal -> DetachThingPrincipal -> Bool
== :: DetachThingPrincipal -> DetachThingPrincipal -> Bool
$c== :: DetachThingPrincipal -> DetachThingPrincipal -> Bool
Prelude.Eq, ReadPrec [DetachThingPrincipal]
ReadPrec DetachThingPrincipal
Int -> ReadS DetachThingPrincipal
ReadS [DetachThingPrincipal]
(Int -> ReadS DetachThingPrincipal)
-> ReadS [DetachThingPrincipal]
-> ReadPrec DetachThingPrincipal
-> ReadPrec [DetachThingPrincipal]
-> Read DetachThingPrincipal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachThingPrincipal]
$creadListPrec :: ReadPrec [DetachThingPrincipal]
readPrec :: ReadPrec DetachThingPrincipal
$creadPrec :: ReadPrec DetachThingPrincipal
readList :: ReadS [DetachThingPrincipal]
$creadList :: ReadS [DetachThingPrincipal]
readsPrec :: Int -> ReadS DetachThingPrincipal
$creadsPrec :: Int -> ReadS DetachThingPrincipal
Prelude.Read, Int -> DetachThingPrincipal -> ShowS
[DetachThingPrincipal] -> ShowS
DetachThingPrincipal -> String
(Int -> DetachThingPrincipal -> ShowS)
-> (DetachThingPrincipal -> String)
-> ([DetachThingPrincipal] -> ShowS)
-> Show DetachThingPrincipal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachThingPrincipal] -> ShowS
$cshowList :: [DetachThingPrincipal] -> ShowS
show :: DetachThingPrincipal -> String
$cshow :: DetachThingPrincipal -> String
showsPrec :: Int -> DetachThingPrincipal -> ShowS
$cshowsPrec :: Int -> DetachThingPrincipal -> ShowS
Prelude.Show, (forall x. DetachThingPrincipal -> Rep DetachThingPrincipal x)
-> (forall x. Rep DetachThingPrincipal x -> DetachThingPrincipal)
-> Generic DetachThingPrincipal
forall x. Rep DetachThingPrincipal x -> DetachThingPrincipal
forall x. DetachThingPrincipal -> Rep DetachThingPrincipal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DetachThingPrincipal x -> DetachThingPrincipal
$cfrom :: forall x. DetachThingPrincipal -> Rep DetachThingPrincipal x
Prelude.Generic)
newDetachThingPrincipal ::
Prelude.Text ->
Prelude.Text ->
DetachThingPrincipal
newDetachThingPrincipal :: Text -> Text -> DetachThingPrincipal
newDetachThingPrincipal Text
pThingName_ Text
pPrincipal_ =
DetachThingPrincipal' :: Text -> Text -> DetachThingPrincipal
DetachThingPrincipal'
{ $sel:thingName:DetachThingPrincipal' :: Text
thingName = Text
pThingName_,
$sel:principal:DetachThingPrincipal' :: Text
principal = Text
pPrincipal_
}
detachThingPrincipal_thingName :: Lens.Lens' DetachThingPrincipal Prelude.Text
detachThingPrincipal_thingName :: (Text -> f Text) -> DetachThingPrincipal -> f DetachThingPrincipal
detachThingPrincipal_thingName = (DetachThingPrincipal -> Text)
-> (DetachThingPrincipal -> Text -> DetachThingPrincipal)
-> Lens DetachThingPrincipal DetachThingPrincipal Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachThingPrincipal' {Text
thingName :: Text
$sel:thingName:DetachThingPrincipal' :: DetachThingPrincipal -> Text
thingName} -> Text
thingName) (\s :: DetachThingPrincipal
s@DetachThingPrincipal' {} Text
a -> DetachThingPrincipal
s {$sel:thingName:DetachThingPrincipal' :: Text
thingName = Text
a} :: DetachThingPrincipal)
detachThingPrincipal_principal :: Lens.Lens' DetachThingPrincipal Prelude.Text
detachThingPrincipal_principal :: (Text -> f Text) -> DetachThingPrincipal -> f DetachThingPrincipal
detachThingPrincipal_principal = (DetachThingPrincipal -> Text)
-> (DetachThingPrincipal -> Text -> DetachThingPrincipal)
-> Lens DetachThingPrincipal DetachThingPrincipal Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachThingPrincipal' {Text
principal :: Text
$sel:principal:DetachThingPrincipal' :: DetachThingPrincipal -> Text
principal} -> Text
principal) (\s :: DetachThingPrincipal
s@DetachThingPrincipal' {} Text
a -> DetachThingPrincipal
s {$sel:principal:DetachThingPrincipal' :: Text
principal = Text
a} :: DetachThingPrincipal)
instance Core.AWSRequest DetachThingPrincipal where
type
AWSResponse DetachThingPrincipal =
DetachThingPrincipalResponse
request :: DetachThingPrincipal -> Request DetachThingPrincipal
request = Service -> DetachThingPrincipal -> Request DetachThingPrincipal
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DetachThingPrincipal
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DetachThingPrincipal)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse DetachThingPrincipal))
-> Logger
-> Service
-> Proxy DetachThingPrincipal
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DetachThingPrincipal)))
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 -> DetachThingPrincipalResponse
DetachThingPrincipalResponse'
(Int -> DetachThingPrincipalResponse)
-> Either String Int -> Either String DetachThingPrincipalResponse
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 DetachThingPrincipal
instance Prelude.NFData DetachThingPrincipal
instance Core.ToHeaders DetachThingPrincipal where
toHeaders :: DetachThingPrincipal -> ResponseHeaders
toHeaders DetachThingPrincipal' {Text
principal :: Text
thingName :: Text
$sel:principal:DetachThingPrincipal' :: DetachThingPrincipal -> Text
$sel:thingName:DetachThingPrincipal' :: DetachThingPrincipal -> Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[HeaderName
"x-amzn-principal" HeaderName -> Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Text
principal]
instance Core.ToPath DetachThingPrincipal where
toPath :: DetachThingPrincipal -> ByteString
toPath DetachThingPrincipal' {Text
principal :: Text
thingName :: Text
$sel:principal:DetachThingPrincipal' :: DetachThingPrincipal -> Text
$sel:thingName:DetachThingPrincipal' :: DetachThingPrincipal -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/things/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingName, ByteString
"/principals"]
instance Core.ToQuery DetachThingPrincipal where
toQuery :: DetachThingPrincipal -> QueryString
toQuery = QueryString -> DetachThingPrincipal -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DetachThingPrincipalResponse = DetachThingPrincipalResponse'
{
DetachThingPrincipalResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool
(DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool)
-> (DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool)
-> Eq DetachThingPrincipalResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool
$c/= :: DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool
== :: DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool
$c== :: DetachThingPrincipalResponse
-> DetachThingPrincipalResponse -> Bool
Prelude.Eq, ReadPrec [DetachThingPrincipalResponse]
ReadPrec DetachThingPrincipalResponse
Int -> ReadS DetachThingPrincipalResponse
ReadS [DetachThingPrincipalResponse]
(Int -> ReadS DetachThingPrincipalResponse)
-> ReadS [DetachThingPrincipalResponse]
-> ReadPrec DetachThingPrincipalResponse
-> ReadPrec [DetachThingPrincipalResponse]
-> Read DetachThingPrincipalResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DetachThingPrincipalResponse]
$creadListPrec :: ReadPrec [DetachThingPrincipalResponse]
readPrec :: ReadPrec DetachThingPrincipalResponse
$creadPrec :: ReadPrec DetachThingPrincipalResponse
readList :: ReadS [DetachThingPrincipalResponse]
$creadList :: ReadS [DetachThingPrincipalResponse]
readsPrec :: Int -> ReadS DetachThingPrincipalResponse
$creadsPrec :: Int -> ReadS DetachThingPrincipalResponse
Prelude.Read, Int -> DetachThingPrincipalResponse -> ShowS
[DetachThingPrincipalResponse] -> ShowS
DetachThingPrincipalResponse -> String
(Int -> DetachThingPrincipalResponse -> ShowS)
-> (DetachThingPrincipalResponse -> String)
-> ([DetachThingPrincipalResponse] -> ShowS)
-> Show DetachThingPrincipalResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DetachThingPrincipalResponse] -> ShowS
$cshowList :: [DetachThingPrincipalResponse] -> ShowS
show :: DetachThingPrincipalResponse -> String
$cshow :: DetachThingPrincipalResponse -> String
showsPrec :: Int -> DetachThingPrincipalResponse -> ShowS
$cshowsPrec :: Int -> DetachThingPrincipalResponse -> ShowS
Prelude.Show, (forall x.
DetachThingPrincipalResponse -> Rep DetachThingPrincipalResponse x)
-> (forall x.
Rep DetachThingPrincipalResponse x -> DetachThingPrincipalResponse)
-> Generic DetachThingPrincipalResponse
forall x.
Rep DetachThingPrincipalResponse x -> DetachThingPrincipalResponse
forall x.
DetachThingPrincipalResponse -> Rep DetachThingPrincipalResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DetachThingPrincipalResponse x -> DetachThingPrincipalResponse
$cfrom :: forall x.
DetachThingPrincipalResponse -> Rep DetachThingPrincipalResponse x
Prelude.Generic)
newDetachThingPrincipalResponse ::
Prelude.Int ->
DetachThingPrincipalResponse
newDetachThingPrincipalResponse :: Int -> DetachThingPrincipalResponse
newDetachThingPrincipalResponse Int
pHttpStatus_ =
DetachThingPrincipalResponse' :: Int -> DetachThingPrincipalResponse
DetachThingPrincipalResponse'
{ $sel:httpStatus:DetachThingPrincipalResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
detachThingPrincipalResponse_httpStatus :: Lens.Lens' DetachThingPrincipalResponse Prelude.Int
detachThingPrincipalResponse_httpStatus :: (Int -> f Int)
-> DetachThingPrincipalResponse -> f DetachThingPrincipalResponse
detachThingPrincipalResponse_httpStatus = (DetachThingPrincipalResponse -> Int)
-> (DetachThingPrincipalResponse
-> Int -> DetachThingPrincipalResponse)
-> Lens
DetachThingPrincipalResponse DetachThingPrincipalResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DetachThingPrincipalResponse' {Int
httpStatus :: Int
$sel:httpStatus:DetachThingPrincipalResponse' :: DetachThingPrincipalResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DetachThingPrincipalResponse
s@DetachThingPrincipalResponse' {} Int
a -> DetachThingPrincipalResponse
s {$sel:httpStatus:DetachThingPrincipalResponse' :: Int
httpStatus = Int
a} :: DetachThingPrincipalResponse)
instance Prelude.NFData DetachThingPrincipalResponse