{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AMP.DescribeWorkspace
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describes an existing AMP workspace.
module Amazonka.AMP.DescribeWorkspace
  ( -- * Creating a Request
    DescribeWorkspace (..),
    newDescribeWorkspace,

    -- * Request Lenses
    describeWorkspace_workspaceId,

    -- * Destructuring the Response
    DescribeWorkspaceResponse (..),
    newDescribeWorkspaceResponse,

    -- * Response Lenses
    describeWorkspaceResponse_httpStatus,
    describeWorkspaceResponse_workspace,
  )
where

import Amazonka.AMP.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input of a DescribeWorkspace operation.
--
-- /See:/ 'newDescribeWorkspace' smart constructor.
data DescribeWorkspace = DescribeWorkspace'
  { -- | The ID of the workspace to describe.
    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)

-- |
-- Create a value of 'DescribeWorkspace' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'workspaceId', 'describeWorkspace_workspaceId' - The ID of the workspace to describe.
newDescribeWorkspace ::
  -- | 'workspaceId'
  Prelude.Text ->
  DescribeWorkspace
newDescribeWorkspace :: Text -> DescribeWorkspace
newDescribeWorkspace Text
pWorkspaceId_ =
  DescribeWorkspace' :: Text -> DescribeWorkspace
DescribeWorkspace' {$sel:workspaceId:DescribeWorkspace' :: Text
workspaceId = Text
pWorkspaceId_}

-- | The ID of the workspace to describe.
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

-- | Represents the output of a DescribeWorkspace operation.
--
-- /See:/ 'newDescribeWorkspaceResponse' smart constructor.
data DescribeWorkspaceResponse = DescribeWorkspaceResponse'
  { -- | The response's http status code.
    DescribeWorkspaceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The properties of the selected workspace.
    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, ReadPrec [DescribeWorkspaceResponse]
ReadPrec DescribeWorkspaceResponse
Int -> ReadS DescribeWorkspaceResponse
ReadS [DescribeWorkspaceResponse]
(Int -> ReadS DescribeWorkspaceResponse)
-> ReadS [DescribeWorkspaceResponse]
-> ReadPrec DescribeWorkspaceResponse
-> ReadPrec [DescribeWorkspaceResponse]
-> Read DescribeWorkspaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceResponse]
$creadListPrec :: ReadPrec [DescribeWorkspaceResponse]
readPrec :: ReadPrec DescribeWorkspaceResponse
$creadPrec :: ReadPrec DescribeWorkspaceResponse
readList :: ReadS [DescribeWorkspaceResponse]
$creadList :: ReadS [DescribeWorkspaceResponse]
readsPrec :: Int -> ReadS DescribeWorkspaceResponse
$creadsPrec :: Int -> ReadS DescribeWorkspaceResponse
Prelude.Read, 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)

-- |
-- Create a value of 'DescribeWorkspaceResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'describeWorkspaceResponse_httpStatus' - The response's http status code.
--
-- 'workspace', 'describeWorkspaceResponse_workspace' - The properties of the selected workspace.
newDescribeWorkspaceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workspace'
  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_
    }

-- | The response's http status code.
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)

-- | The properties of the selected workspace.
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