{-# 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.WorkSpacesWeb.GetPortal
(
GetPortal (..),
newGetPortal,
getPortal_portalArn,
GetPortalResponse (..),
newGetPortalResponse,
getPortalResponse_portal,
getPortalResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkSpacesWeb.Types
data GetPortal = GetPortal'
{
GetPortal -> Text
portalArn :: Prelude.Text
}
deriving (GetPortal -> GetPortal -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPortal -> GetPortal -> Bool
$c/= :: GetPortal -> GetPortal -> Bool
== :: GetPortal -> GetPortal -> Bool
$c== :: GetPortal -> GetPortal -> Bool
Prelude.Eq, ReadPrec [GetPortal]
ReadPrec GetPortal
Int -> ReadS GetPortal
ReadS [GetPortal]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetPortal]
$creadListPrec :: ReadPrec [GetPortal]
readPrec :: ReadPrec GetPortal
$creadPrec :: ReadPrec GetPortal
readList :: ReadS [GetPortal]
$creadList :: ReadS [GetPortal]
readsPrec :: Int -> ReadS GetPortal
$creadsPrec :: Int -> ReadS GetPortal
Prelude.Read, Int -> GetPortal -> ShowS
[GetPortal] -> ShowS
GetPortal -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPortal] -> ShowS
$cshowList :: [GetPortal] -> ShowS
show :: GetPortal -> String
$cshow :: GetPortal -> String
showsPrec :: Int -> GetPortal -> ShowS
$cshowsPrec :: Int -> GetPortal -> ShowS
Prelude.Show, forall x. Rep GetPortal x -> GetPortal
forall x. GetPortal -> Rep GetPortal x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPortal x -> GetPortal
$cfrom :: forall x. GetPortal -> Rep GetPortal x
Prelude.Generic)
newGetPortal ::
Prelude.Text ->
GetPortal
newGetPortal :: Text -> GetPortal
newGetPortal Text
pPortalArn_ =
GetPortal' {$sel:portalArn:GetPortal' :: Text
portalArn = Text
pPortalArn_}
getPortal_portalArn :: Lens.Lens' GetPortal Prelude.Text
getPortal_portalArn :: Lens' GetPortal Text
getPortal_portalArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPortal' {Text
portalArn :: Text
$sel:portalArn:GetPortal' :: GetPortal -> Text
portalArn} -> Text
portalArn) (\s :: GetPortal
s@GetPortal' {} Text
a -> GetPortal
s {$sel:portalArn:GetPortal' :: Text
portalArn = Text
a} :: GetPortal)
instance Core.AWSRequest GetPortal where
type AWSResponse GetPortal = GetPortalResponse
request :: (Service -> Service) -> GetPortal -> Request GetPortal
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetPortal
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetPortal)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Portal -> Int -> GetPortalResponse
GetPortalResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"portal")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetPortal where
hashWithSalt :: Int -> GetPortal -> Int
hashWithSalt Int
_salt GetPortal' {Text
portalArn :: Text
$sel:portalArn:GetPortal' :: GetPortal -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
portalArn
instance Prelude.NFData GetPortal where
rnf :: GetPortal -> ()
rnf GetPortal' {Text
portalArn :: Text
$sel:portalArn:GetPortal' :: GetPortal -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
portalArn
instance Data.ToHeaders GetPortal where
toHeaders :: GetPortal -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetPortal where
toPath :: GetPortal -> ByteString
toPath GetPortal' {Text
portalArn :: Text
$sel:portalArn:GetPortal' :: GetPortal -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/portals/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
portalArn]
instance Data.ToQuery GetPortal where
toQuery :: GetPortal -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetPortalResponse = GetPortalResponse'
{
GetPortalResponse -> Maybe Portal
portal :: Prelude.Maybe Portal,
GetPortalResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetPortalResponse -> GetPortalResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetPortalResponse -> GetPortalResponse -> Bool
$c/= :: GetPortalResponse -> GetPortalResponse -> Bool
== :: GetPortalResponse -> GetPortalResponse -> Bool
$c== :: GetPortalResponse -> GetPortalResponse -> Bool
Prelude.Eq, Int -> GetPortalResponse -> ShowS
[GetPortalResponse] -> ShowS
GetPortalResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetPortalResponse] -> ShowS
$cshowList :: [GetPortalResponse] -> ShowS
show :: GetPortalResponse -> String
$cshow :: GetPortalResponse -> String
showsPrec :: Int -> GetPortalResponse -> ShowS
$cshowsPrec :: Int -> GetPortalResponse -> ShowS
Prelude.Show, forall x. Rep GetPortalResponse x -> GetPortalResponse
forall x. GetPortalResponse -> Rep GetPortalResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetPortalResponse x -> GetPortalResponse
$cfrom :: forall x. GetPortalResponse -> Rep GetPortalResponse x
Prelude.Generic)
newGetPortalResponse ::
Prelude.Int ->
GetPortalResponse
newGetPortalResponse :: Int -> GetPortalResponse
newGetPortalResponse Int
pHttpStatus_ =
GetPortalResponse'
{ $sel:portal:GetPortalResponse' :: Maybe Portal
portal = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetPortalResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getPortalResponse_portal :: Lens.Lens' GetPortalResponse (Prelude.Maybe Portal)
getPortalResponse_portal :: Lens' GetPortalResponse (Maybe Portal)
getPortalResponse_portal = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPortalResponse' {Maybe Portal
portal :: Maybe Portal
$sel:portal:GetPortalResponse' :: GetPortalResponse -> Maybe Portal
portal} -> Maybe Portal
portal) (\s :: GetPortalResponse
s@GetPortalResponse' {} Maybe Portal
a -> GetPortalResponse
s {$sel:portal:GetPortalResponse' :: Maybe Portal
portal = Maybe Portal
a} :: GetPortalResponse)
getPortalResponse_httpStatus :: Lens.Lens' GetPortalResponse Prelude.Int
getPortalResponse_httpStatus :: Lens' GetPortalResponse Int
getPortalResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetPortalResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetPortalResponse' :: GetPortalResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetPortalResponse
s@GetPortalResponse' {} Int
a -> GetPortalResponse
s {$sel:httpStatus:GetPortalResponse' :: Int
httpStatus = Int
a} :: GetPortalResponse)
instance Prelude.NFData GetPortalResponse where
rnf :: GetPortalResponse -> ()
rnf GetPortalResponse' {Int
Maybe Portal
httpStatus :: Int
portal :: Maybe Portal
$sel:httpStatus:GetPortalResponse' :: GetPortalResponse -> Int
$sel:portal:GetPortalResponse' :: GetPortalResponse -> Maybe Portal
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Portal
portal
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus