{-# 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.IoTSiteWise.DeletePortal
(
DeletePortal (..),
newDeletePortal,
deletePortal_clientToken,
deletePortal_portalId,
DeletePortalResponse (..),
newDeletePortalResponse,
deletePortalResponse_httpStatus,
deletePortalResponse_portalStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.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 DeletePortal = DeletePortal'
{
DeletePortal -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
DeletePortal -> Text
portalId :: Prelude.Text
}
deriving (DeletePortal -> DeletePortal -> Bool
(DeletePortal -> DeletePortal -> Bool)
-> (DeletePortal -> DeletePortal -> Bool) -> Eq DeletePortal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePortal -> DeletePortal -> Bool
$c/= :: DeletePortal -> DeletePortal -> Bool
== :: DeletePortal -> DeletePortal -> Bool
$c== :: DeletePortal -> DeletePortal -> Bool
Prelude.Eq, ReadPrec [DeletePortal]
ReadPrec DeletePortal
Int -> ReadS DeletePortal
ReadS [DeletePortal]
(Int -> ReadS DeletePortal)
-> ReadS [DeletePortal]
-> ReadPrec DeletePortal
-> ReadPrec [DeletePortal]
-> Read DeletePortal
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePortal]
$creadListPrec :: ReadPrec [DeletePortal]
readPrec :: ReadPrec DeletePortal
$creadPrec :: ReadPrec DeletePortal
readList :: ReadS [DeletePortal]
$creadList :: ReadS [DeletePortal]
readsPrec :: Int -> ReadS DeletePortal
$creadsPrec :: Int -> ReadS DeletePortal
Prelude.Read, Int -> DeletePortal -> ShowS
[DeletePortal] -> ShowS
DeletePortal -> String
(Int -> DeletePortal -> ShowS)
-> (DeletePortal -> String)
-> ([DeletePortal] -> ShowS)
-> Show DeletePortal
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePortal] -> ShowS
$cshowList :: [DeletePortal] -> ShowS
show :: DeletePortal -> String
$cshow :: DeletePortal -> String
showsPrec :: Int -> DeletePortal -> ShowS
$cshowsPrec :: Int -> DeletePortal -> ShowS
Prelude.Show, (forall x. DeletePortal -> Rep DeletePortal x)
-> (forall x. Rep DeletePortal x -> DeletePortal)
-> Generic DeletePortal
forall x. Rep DeletePortal x -> DeletePortal
forall x. DeletePortal -> Rep DeletePortal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePortal x -> DeletePortal
$cfrom :: forall x. DeletePortal -> Rep DeletePortal x
Prelude.Generic)
newDeletePortal ::
Prelude.Text ->
DeletePortal
newDeletePortal :: Text -> DeletePortal
newDeletePortal Text
pPortalId_ =
DeletePortal' :: Maybe Text -> Text -> DeletePortal
DeletePortal'
{ $sel:clientToken:DeletePortal' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:portalId:DeletePortal' :: Text
portalId = Text
pPortalId_
}
deletePortal_clientToken :: Lens.Lens' DeletePortal (Prelude.Maybe Prelude.Text)
deletePortal_clientToken :: (Maybe Text -> f (Maybe Text)) -> DeletePortal -> f DeletePortal
deletePortal_clientToken = (DeletePortal -> Maybe Text)
-> (DeletePortal -> Maybe Text -> DeletePortal)
-> Lens DeletePortal DeletePortal (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePortal' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeletePortal' :: DeletePortal -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeletePortal
s@DeletePortal' {} Maybe Text
a -> DeletePortal
s {$sel:clientToken:DeletePortal' :: Maybe Text
clientToken = Maybe Text
a} :: DeletePortal)
deletePortal_portalId :: Lens.Lens' DeletePortal Prelude.Text
deletePortal_portalId :: (Text -> f Text) -> DeletePortal -> f DeletePortal
deletePortal_portalId = (DeletePortal -> Text)
-> (DeletePortal -> Text -> DeletePortal)
-> Lens DeletePortal DeletePortal Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePortal' {Text
portalId :: Text
$sel:portalId:DeletePortal' :: DeletePortal -> Text
portalId} -> Text
portalId) (\s :: DeletePortal
s@DeletePortal' {} Text
a -> DeletePortal
s {$sel:portalId:DeletePortal' :: Text
portalId = Text
a} :: DeletePortal)
instance Core.AWSRequest DeletePortal where
type AWSResponse DeletePortal = DeletePortalResponse
request :: DeletePortal -> Request DeletePortal
request = Service -> DeletePortal -> Request DeletePortal
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeletePortal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePortal)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeletePortal))
-> Logger
-> Service
-> Proxy DeletePortal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeletePortal)))
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 ->
Int -> PortalStatus -> DeletePortalResponse
DeletePortalResponse'
(Int -> PortalStatus -> DeletePortalResponse)
-> Either String Int
-> Either String (PortalStatus -> DeletePortalResponse)
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))
Either String (PortalStatus -> DeletePortalResponse)
-> Either String PortalStatus -> Either String DeletePortalResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String PortalStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"portalStatus")
)
instance Prelude.Hashable DeletePortal
instance Prelude.NFData DeletePortal
instance Core.ToHeaders DeletePortal where
toHeaders :: DeletePortal -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeletePortal -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToPath DeletePortal where
toPath :: DeletePortal -> ByteString
toPath DeletePortal' {Maybe Text
Text
portalId :: Text
clientToken :: Maybe Text
$sel:portalId:DeletePortal' :: DeletePortal -> Text
$sel:clientToken:DeletePortal' :: DeletePortal -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/portals/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
portalId]
instance Core.ToQuery DeletePortal where
toQuery :: DeletePortal -> QueryString
toQuery DeletePortal' {Maybe Text
Text
portalId :: Text
clientToken :: Maybe Text
$sel:portalId:DeletePortal' :: DeletePortal -> Text
$sel:clientToken:DeletePortal' :: DeletePortal -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"clientToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
clientToken]
data DeletePortalResponse = DeletePortalResponse'
{
DeletePortalResponse -> Int
httpStatus :: Prelude.Int,
DeletePortalResponse -> PortalStatus
portalStatus :: PortalStatus
}
deriving (DeletePortalResponse -> DeletePortalResponse -> Bool
(DeletePortalResponse -> DeletePortalResponse -> Bool)
-> (DeletePortalResponse -> DeletePortalResponse -> Bool)
-> Eq DeletePortalResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeletePortalResponse -> DeletePortalResponse -> Bool
$c/= :: DeletePortalResponse -> DeletePortalResponse -> Bool
== :: DeletePortalResponse -> DeletePortalResponse -> Bool
$c== :: DeletePortalResponse -> DeletePortalResponse -> Bool
Prelude.Eq, ReadPrec [DeletePortalResponse]
ReadPrec DeletePortalResponse
Int -> ReadS DeletePortalResponse
ReadS [DeletePortalResponse]
(Int -> ReadS DeletePortalResponse)
-> ReadS [DeletePortalResponse]
-> ReadPrec DeletePortalResponse
-> ReadPrec [DeletePortalResponse]
-> Read DeletePortalResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeletePortalResponse]
$creadListPrec :: ReadPrec [DeletePortalResponse]
readPrec :: ReadPrec DeletePortalResponse
$creadPrec :: ReadPrec DeletePortalResponse
readList :: ReadS [DeletePortalResponse]
$creadList :: ReadS [DeletePortalResponse]
readsPrec :: Int -> ReadS DeletePortalResponse
$creadsPrec :: Int -> ReadS DeletePortalResponse
Prelude.Read, Int -> DeletePortalResponse -> ShowS
[DeletePortalResponse] -> ShowS
DeletePortalResponse -> String
(Int -> DeletePortalResponse -> ShowS)
-> (DeletePortalResponse -> String)
-> ([DeletePortalResponse] -> ShowS)
-> Show DeletePortalResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeletePortalResponse] -> ShowS
$cshowList :: [DeletePortalResponse] -> ShowS
show :: DeletePortalResponse -> String
$cshow :: DeletePortalResponse -> String
showsPrec :: Int -> DeletePortalResponse -> ShowS
$cshowsPrec :: Int -> DeletePortalResponse -> ShowS
Prelude.Show, (forall x. DeletePortalResponse -> Rep DeletePortalResponse x)
-> (forall x. Rep DeletePortalResponse x -> DeletePortalResponse)
-> Generic DeletePortalResponse
forall x. Rep DeletePortalResponse x -> DeletePortalResponse
forall x. DeletePortalResponse -> Rep DeletePortalResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeletePortalResponse x -> DeletePortalResponse
$cfrom :: forall x. DeletePortalResponse -> Rep DeletePortalResponse x
Prelude.Generic)
newDeletePortalResponse ::
Prelude.Int ->
PortalStatus ->
DeletePortalResponse
newDeletePortalResponse :: Int -> PortalStatus -> DeletePortalResponse
newDeletePortalResponse Int
pHttpStatus_ PortalStatus
pPortalStatus_ =
DeletePortalResponse' :: Int -> PortalStatus -> DeletePortalResponse
DeletePortalResponse'
{ $sel:httpStatus:DeletePortalResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:portalStatus:DeletePortalResponse' :: PortalStatus
portalStatus = PortalStatus
pPortalStatus_
}
deletePortalResponse_httpStatus :: Lens.Lens' DeletePortalResponse Prelude.Int
deletePortalResponse_httpStatus :: (Int -> f Int) -> DeletePortalResponse -> f DeletePortalResponse
deletePortalResponse_httpStatus = (DeletePortalResponse -> Int)
-> (DeletePortalResponse -> Int -> DeletePortalResponse)
-> Lens DeletePortalResponse DeletePortalResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePortalResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeletePortalResponse' :: DeletePortalResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeletePortalResponse
s@DeletePortalResponse' {} Int
a -> DeletePortalResponse
s {$sel:httpStatus:DeletePortalResponse' :: Int
httpStatus = Int
a} :: DeletePortalResponse)
deletePortalResponse_portalStatus :: Lens.Lens' DeletePortalResponse PortalStatus
deletePortalResponse_portalStatus :: (PortalStatus -> f PortalStatus)
-> DeletePortalResponse -> f DeletePortalResponse
deletePortalResponse_portalStatus = (DeletePortalResponse -> PortalStatus)
-> (DeletePortalResponse -> PortalStatus -> DeletePortalResponse)
-> Lens
DeletePortalResponse DeletePortalResponse PortalStatus PortalStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeletePortalResponse' {PortalStatus
portalStatus :: PortalStatus
$sel:portalStatus:DeletePortalResponse' :: DeletePortalResponse -> PortalStatus
portalStatus} -> PortalStatus
portalStatus) (\s :: DeletePortalResponse
s@DeletePortalResponse' {} PortalStatus
a -> DeletePortalResponse
s {$sel:portalStatus:DeletePortalResponse' :: PortalStatus
portalStatus = PortalStatus
a} :: DeletePortalResponse)
instance Prelude.NFData DeletePortalResponse