{-# 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.Grafana.DescribeWorkspace
(
DescribeWorkspace (..),
newDescribeWorkspace,
describeWorkspace_workspaceId,
DescribeWorkspaceResponse (..),
newDescribeWorkspaceResponse,
describeWorkspaceResponse_httpStatus,
describeWorkspaceResponse_workspace,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Grafana.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 DescribeWorkspace = DescribeWorkspace'
{
DescribeWorkspace -> Text
workspaceId :: Prelude.Text
}
deriving (DescribeWorkspace -> DescribeWorkspace -> Bool
(DescribeWorkspace -> DescribeWorkspace -> Bool)
-> (DescribeWorkspace -> DescribeWorkspace -> Bool)
-> Eq DescribeWorkspace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspace -> DescribeWorkspace -> Bool
$c/= :: DescribeWorkspace -> DescribeWorkspace -> Bool
== :: DescribeWorkspace -> DescribeWorkspace -> Bool
$c== :: DescribeWorkspace -> DescribeWorkspace -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspace]
ReadPrec DescribeWorkspace
Int -> ReadS DescribeWorkspace
ReadS [DescribeWorkspace]
(Int -> ReadS DescribeWorkspace)
-> ReadS [DescribeWorkspace]
-> ReadPrec DescribeWorkspace
-> ReadPrec [DescribeWorkspace]
-> Read DescribeWorkspace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspace]
$creadListPrec :: ReadPrec [DescribeWorkspace]
readPrec :: ReadPrec DescribeWorkspace
$creadPrec :: ReadPrec DescribeWorkspace
readList :: ReadS [DescribeWorkspace]
$creadList :: ReadS [DescribeWorkspace]
readsPrec :: Int -> ReadS DescribeWorkspace
$creadsPrec :: Int -> ReadS DescribeWorkspace
Prelude.Read, Int -> DescribeWorkspace -> ShowS
[DescribeWorkspace] -> ShowS
DescribeWorkspace -> String
(Int -> DescribeWorkspace -> ShowS)
-> (DescribeWorkspace -> String)
-> ([DescribeWorkspace] -> ShowS)
-> Show DescribeWorkspace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspace] -> ShowS
$cshowList :: [DescribeWorkspace] -> ShowS
show :: DescribeWorkspace -> String
$cshow :: DescribeWorkspace -> String
showsPrec :: Int -> DescribeWorkspace -> ShowS
$cshowsPrec :: Int -> DescribeWorkspace -> ShowS
Prelude.Show, (forall x. DescribeWorkspace -> Rep DescribeWorkspace x)
-> (forall x. Rep DescribeWorkspace x -> DescribeWorkspace)
-> Generic DescribeWorkspace
forall x. Rep DescribeWorkspace x -> DescribeWorkspace
forall x. DescribeWorkspace -> Rep DescribeWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeWorkspace x -> DescribeWorkspace
$cfrom :: forall x. DescribeWorkspace -> Rep DescribeWorkspace x
Prelude.Generic)
newDescribeWorkspace ::
Prelude.Text ->
DescribeWorkspace
newDescribeWorkspace :: Text -> DescribeWorkspace
newDescribeWorkspace Text
pWorkspaceId_ =
DescribeWorkspace' :: Text -> DescribeWorkspace
DescribeWorkspace' {$sel:workspaceId:DescribeWorkspace' :: Text
workspaceId = Text
pWorkspaceId_}
describeWorkspace_workspaceId :: Lens.Lens' DescribeWorkspace Prelude.Text
describeWorkspace_workspaceId :: (Text -> f Text) -> DescribeWorkspace -> f DescribeWorkspace
describeWorkspace_workspaceId = (DescribeWorkspace -> Text)
-> (DescribeWorkspace -> Text -> DescribeWorkspace)
-> Lens DescribeWorkspace DescribeWorkspace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspace' {Text
workspaceId :: Text
$sel:workspaceId:DescribeWorkspace' :: DescribeWorkspace -> Text
workspaceId} -> Text
workspaceId) (\s :: DescribeWorkspace
s@DescribeWorkspace' {} Text
a -> DescribeWorkspace
s {$sel:workspaceId:DescribeWorkspace' :: Text
workspaceId = Text
a} :: DescribeWorkspace)
instance Core.AWSRequest DescribeWorkspace where
type
AWSResponse DescribeWorkspace =
DescribeWorkspaceResponse
request :: DescribeWorkspace -> Request DescribeWorkspace
request = Service -> DescribeWorkspace -> Request DescribeWorkspace
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeWorkspace
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeWorkspace)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeWorkspace))
-> Logger
-> Service
-> Proxy DescribeWorkspace
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeWorkspace)))
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 -> WorkspaceDescription -> DescribeWorkspaceResponse
DescribeWorkspaceResponse'
(Int -> WorkspaceDescription -> DescribeWorkspaceResponse)
-> Either String Int
-> Either
String (WorkspaceDescription -> DescribeWorkspaceResponse)
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 (WorkspaceDescription -> DescribeWorkspaceResponse)
-> Either String WorkspaceDescription
-> Either String DescribeWorkspaceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String WorkspaceDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"workspace")
)
instance Prelude.Hashable DescribeWorkspace
instance Prelude.NFData DescribeWorkspace
instance Core.ToHeaders DescribeWorkspace where
toHeaders :: DescribeWorkspace -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeWorkspace -> 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 DescribeWorkspace where
toPath :: DescribeWorkspace -> ByteString
toPath DescribeWorkspace' {Text
workspaceId :: Text
$sel:workspaceId:DescribeWorkspace' :: DescribeWorkspace -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/workspaces/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId]
instance Core.ToQuery DescribeWorkspace where
toQuery :: DescribeWorkspace -> QueryString
toQuery = QueryString -> DescribeWorkspace -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeWorkspaceResponse = DescribeWorkspaceResponse'
{
DescribeWorkspaceResponse -> Int
httpStatus :: Prelude.Int,
DescribeWorkspaceResponse -> WorkspaceDescription
workspace :: WorkspaceDescription
}
deriving (DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool
(DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool)
-> (DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool)
-> Eq DescribeWorkspaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool
$c/= :: DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool
== :: DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool
$c== :: DescribeWorkspaceResponse -> DescribeWorkspaceResponse -> Bool
Prelude.Eq, Int -> DescribeWorkspaceResponse -> ShowS
[DescribeWorkspaceResponse] -> ShowS
DescribeWorkspaceResponse -> String
(Int -> DescribeWorkspaceResponse -> ShowS)
-> (DescribeWorkspaceResponse -> String)
-> ([DescribeWorkspaceResponse] -> ShowS)
-> Show DescribeWorkspaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceResponse] -> ShowS
$cshowList :: [DescribeWorkspaceResponse] -> ShowS
show :: DescribeWorkspaceResponse -> String
$cshow :: DescribeWorkspaceResponse -> String
showsPrec :: Int -> DescribeWorkspaceResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceResponse -> ShowS
Prelude.Show, (forall x.
DescribeWorkspaceResponse -> Rep DescribeWorkspaceResponse x)
-> (forall x.
Rep DescribeWorkspaceResponse x -> DescribeWorkspaceResponse)
-> Generic DescribeWorkspaceResponse
forall x.
Rep DescribeWorkspaceResponse x -> DescribeWorkspaceResponse
forall x.
DescribeWorkspaceResponse -> Rep DescribeWorkspaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceResponse x -> DescribeWorkspaceResponse
$cfrom :: forall x.
DescribeWorkspaceResponse -> Rep DescribeWorkspaceResponse x
Prelude.Generic)
newDescribeWorkspaceResponse ::
Prelude.Int ->
WorkspaceDescription ->
DescribeWorkspaceResponse
newDescribeWorkspaceResponse :: Int -> WorkspaceDescription -> DescribeWorkspaceResponse
newDescribeWorkspaceResponse Int
pHttpStatus_ WorkspaceDescription
pWorkspace_ =
DescribeWorkspaceResponse' :: Int -> WorkspaceDescription -> DescribeWorkspaceResponse
DescribeWorkspaceResponse'
{ $sel:httpStatus:DescribeWorkspaceResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:workspace:DescribeWorkspaceResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
pWorkspace_
}
describeWorkspaceResponse_httpStatus :: Lens.Lens' DescribeWorkspaceResponse Prelude.Int
describeWorkspaceResponse_httpStatus :: (Int -> f Int)
-> DescribeWorkspaceResponse -> f DescribeWorkspaceResponse
describeWorkspaceResponse_httpStatus = (DescribeWorkspaceResponse -> Int)
-> (DescribeWorkspaceResponse -> Int -> DescribeWorkspaceResponse)
-> Lens DescribeWorkspaceResponse DescribeWorkspaceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeWorkspaceResponse' :: DescribeWorkspaceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeWorkspaceResponse
s@DescribeWorkspaceResponse' {} Int
a -> DescribeWorkspaceResponse
s {$sel:httpStatus:DescribeWorkspaceResponse' :: Int
httpStatus = Int
a} :: DescribeWorkspaceResponse)
describeWorkspaceResponse_workspace :: Lens.Lens' DescribeWorkspaceResponse WorkspaceDescription
describeWorkspaceResponse_workspace :: (WorkspaceDescription -> f WorkspaceDescription)
-> DescribeWorkspaceResponse -> f DescribeWorkspaceResponse
describeWorkspaceResponse_workspace = (DescribeWorkspaceResponse -> WorkspaceDescription)
-> (DescribeWorkspaceResponse
-> WorkspaceDescription -> DescribeWorkspaceResponse)
-> Lens
DescribeWorkspaceResponse
DescribeWorkspaceResponse
WorkspaceDescription
WorkspaceDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceResponse' {WorkspaceDescription
workspace :: WorkspaceDescription
$sel:workspace:DescribeWorkspaceResponse' :: DescribeWorkspaceResponse -> WorkspaceDescription
workspace} -> WorkspaceDescription
workspace) (\s :: DescribeWorkspaceResponse
s@DescribeWorkspaceResponse' {} WorkspaceDescription
a -> DescribeWorkspaceResponse
s {$sel:workspace:DescribeWorkspaceResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
a} :: DescribeWorkspaceResponse)
instance Prelude.NFData DescribeWorkspaceResponse