{-# 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.SageMaker.DescribeWorkteam
-- 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)
--
-- Gets information about a specific work team. You can see information
-- such as the create date, the last updated date, membership information,
-- and the work team\'s Amazon Resource Name (ARN).
module Amazonka.SageMaker.DescribeWorkteam
  ( -- * Creating a Request
    DescribeWorkteam (..),
    newDescribeWorkteam,

    -- * Request Lenses
    describeWorkteam_workteamName,

    -- * Destructuring the Response
    DescribeWorkteamResponse (..),
    newDescribeWorkteamResponse,

    -- * Response Lenses
    describeWorkteamResponse_httpStatus,
    describeWorkteamResponse_workteam,
  )
where

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
import Amazonka.SageMaker.Types

-- | /See:/ 'newDescribeWorkteam' smart constructor.
data DescribeWorkteam = DescribeWorkteam'
  { -- | The name of the work team to return a description of.
    DescribeWorkteam -> Text
workteamName :: Prelude.Text
  }
  deriving (DescribeWorkteam -> DescribeWorkteam -> Bool
(DescribeWorkteam -> DescribeWorkteam -> Bool)
-> (DescribeWorkteam -> DescribeWorkteam -> Bool)
-> Eq DescribeWorkteam
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkteam -> DescribeWorkteam -> Bool
$c/= :: DescribeWorkteam -> DescribeWorkteam -> Bool
== :: DescribeWorkteam -> DescribeWorkteam -> Bool
$c== :: DescribeWorkteam -> DescribeWorkteam -> Bool
Prelude.Eq, ReadPrec [DescribeWorkteam]
ReadPrec DescribeWorkteam
Int -> ReadS DescribeWorkteam
ReadS [DescribeWorkteam]
(Int -> ReadS DescribeWorkteam)
-> ReadS [DescribeWorkteam]
-> ReadPrec DescribeWorkteam
-> ReadPrec [DescribeWorkteam]
-> Read DescribeWorkteam
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkteam]
$creadListPrec :: ReadPrec [DescribeWorkteam]
readPrec :: ReadPrec DescribeWorkteam
$creadPrec :: ReadPrec DescribeWorkteam
readList :: ReadS [DescribeWorkteam]
$creadList :: ReadS [DescribeWorkteam]
readsPrec :: Int -> ReadS DescribeWorkteam
$creadsPrec :: Int -> ReadS DescribeWorkteam
Prelude.Read, Int -> DescribeWorkteam -> ShowS
[DescribeWorkteam] -> ShowS
DescribeWorkteam -> String
(Int -> DescribeWorkteam -> ShowS)
-> (DescribeWorkteam -> String)
-> ([DescribeWorkteam] -> ShowS)
-> Show DescribeWorkteam
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkteam] -> ShowS
$cshowList :: [DescribeWorkteam] -> ShowS
show :: DescribeWorkteam -> String
$cshow :: DescribeWorkteam -> String
showsPrec :: Int -> DescribeWorkteam -> ShowS
$cshowsPrec :: Int -> DescribeWorkteam -> ShowS
Prelude.Show, (forall x. DescribeWorkteam -> Rep DescribeWorkteam x)
-> (forall x. Rep DescribeWorkteam x -> DescribeWorkteam)
-> Generic DescribeWorkteam
forall x. Rep DescribeWorkteam x -> DescribeWorkteam
forall x. DescribeWorkteam -> Rep DescribeWorkteam x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeWorkteam x -> DescribeWorkteam
$cfrom :: forall x. DescribeWorkteam -> Rep DescribeWorkteam x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkteam' 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:
--
-- 'workteamName', 'describeWorkteam_workteamName' - The name of the work team to return a description of.
newDescribeWorkteam ::
  -- | 'workteamName'
  Prelude.Text ->
  DescribeWorkteam
newDescribeWorkteam :: Text -> DescribeWorkteam
newDescribeWorkteam Text
pWorkteamName_ =
  DescribeWorkteam' :: Text -> DescribeWorkteam
DescribeWorkteam' {$sel:workteamName:DescribeWorkteam' :: Text
workteamName = Text
pWorkteamName_}

-- | The name of the work team to return a description of.
describeWorkteam_workteamName :: Lens.Lens' DescribeWorkteam Prelude.Text
describeWorkteam_workteamName :: (Text -> f Text) -> DescribeWorkteam -> f DescribeWorkteam
describeWorkteam_workteamName = (DescribeWorkteam -> Text)
-> (DescribeWorkteam -> Text -> DescribeWorkteam)
-> Lens DescribeWorkteam DescribeWorkteam Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkteam' {Text
workteamName :: Text
$sel:workteamName:DescribeWorkteam' :: DescribeWorkteam -> Text
workteamName} -> Text
workteamName) (\s :: DescribeWorkteam
s@DescribeWorkteam' {} Text
a -> DescribeWorkteam
s {$sel:workteamName:DescribeWorkteam' :: Text
workteamName = Text
a} :: DescribeWorkteam)

instance Core.AWSRequest DescribeWorkteam where
  type
    AWSResponse DescribeWorkteam =
      DescribeWorkteamResponse
  request :: DescribeWorkteam -> Request DescribeWorkteam
request = Service -> DescribeWorkteam -> Request DescribeWorkteam
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeWorkteam
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeWorkteam)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeWorkteam))
-> Logger
-> Service
-> Proxy DescribeWorkteam
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DescribeWorkteam)))
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 -> Workteam -> DescribeWorkteamResponse
DescribeWorkteamResponse'
            (Int -> Workteam -> DescribeWorkteamResponse)
-> Either String Int
-> Either String (Workteam -> DescribeWorkteamResponse)
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 (Workteam -> DescribeWorkteamResponse)
-> Either String Workteam -> Either String DescribeWorkteamResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Workteam
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Workteam")
      )

instance Prelude.Hashable DescribeWorkteam

instance Prelude.NFData DescribeWorkteam

instance Core.ToHeaders DescribeWorkteam where
  toHeaders :: DescribeWorkteam -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeWorkteam -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"SageMaker.DescribeWorkteam" :: Prelude.ByteString),
            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.ToJSON DescribeWorkteam where
  toJSON :: DescribeWorkteam -> Value
toJSON DescribeWorkteam' {Text
workteamName :: Text
$sel:workteamName:DescribeWorkteam' :: DescribeWorkteam -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"WorkteamName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workteamName)]
      )

instance Core.ToPath DescribeWorkteam where
  toPath :: DescribeWorkteam -> ByteString
toPath = ByteString -> DescribeWorkteam -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery DescribeWorkteam where
  toQuery :: DescribeWorkteam -> QueryString
toQuery = QueryString -> DescribeWorkteam -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeWorkteamResponse' smart constructor.
data DescribeWorkteamResponse = DescribeWorkteamResponse'
  { -- | The response's http status code.
    DescribeWorkteamResponse -> Int
httpStatus :: Prelude.Int,
    -- | A @Workteam@ instance that contains information about the work team.
    DescribeWorkteamResponse -> Workteam
workteam :: Workteam
  }
  deriving (DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool
(DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool)
-> (DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool)
-> Eq DescribeWorkteamResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool
$c/= :: DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool
== :: DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool
$c== :: DescribeWorkteamResponse -> DescribeWorkteamResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkteamResponse]
ReadPrec DescribeWorkteamResponse
Int -> ReadS DescribeWorkteamResponse
ReadS [DescribeWorkteamResponse]
(Int -> ReadS DescribeWorkteamResponse)
-> ReadS [DescribeWorkteamResponse]
-> ReadPrec DescribeWorkteamResponse
-> ReadPrec [DescribeWorkteamResponse]
-> Read DescribeWorkteamResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkteamResponse]
$creadListPrec :: ReadPrec [DescribeWorkteamResponse]
readPrec :: ReadPrec DescribeWorkteamResponse
$creadPrec :: ReadPrec DescribeWorkteamResponse
readList :: ReadS [DescribeWorkteamResponse]
$creadList :: ReadS [DescribeWorkteamResponse]
readsPrec :: Int -> ReadS DescribeWorkteamResponse
$creadsPrec :: Int -> ReadS DescribeWorkteamResponse
Prelude.Read, Int -> DescribeWorkteamResponse -> ShowS
[DescribeWorkteamResponse] -> ShowS
DescribeWorkteamResponse -> String
(Int -> DescribeWorkteamResponse -> ShowS)
-> (DescribeWorkteamResponse -> String)
-> ([DescribeWorkteamResponse] -> ShowS)
-> Show DescribeWorkteamResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkteamResponse] -> ShowS
$cshowList :: [DescribeWorkteamResponse] -> ShowS
show :: DescribeWorkteamResponse -> String
$cshow :: DescribeWorkteamResponse -> String
showsPrec :: Int -> DescribeWorkteamResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkteamResponse -> ShowS
Prelude.Show, (forall x.
 DescribeWorkteamResponse -> Rep DescribeWorkteamResponse x)
-> (forall x.
    Rep DescribeWorkteamResponse x -> DescribeWorkteamResponse)
-> Generic DescribeWorkteamResponse
forall x.
Rep DescribeWorkteamResponse x -> DescribeWorkteamResponse
forall x.
DescribeWorkteamResponse -> Rep DescribeWorkteamResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkteamResponse x -> DescribeWorkteamResponse
$cfrom :: forall x.
DescribeWorkteamResponse -> Rep DescribeWorkteamResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkteamResponse' 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', 'describeWorkteamResponse_httpStatus' - The response's http status code.
--
-- 'workteam', 'describeWorkteamResponse_workteam' - A @Workteam@ instance that contains information about the work team.
newDescribeWorkteamResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workteam'
  Workteam ->
  DescribeWorkteamResponse
newDescribeWorkteamResponse :: Int -> Workteam -> DescribeWorkteamResponse
newDescribeWorkteamResponse Int
pHttpStatus_ Workteam
pWorkteam_ =
  DescribeWorkteamResponse' :: Int -> Workteam -> DescribeWorkteamResponse
DescribeWorkteamResponse'
    { $sel:httpStatus:DescribeWorkteamResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:workteam:DescribeWorkteamResponse' :: Workteam
workteam = Workteam
pWorkteam_
    }

-- | The response's http status code.
describeWorkteamResponse_httpStatus :: Lens.Lens' DescribeWorkteamResponse Prelude.Int
describeWorkteamResponse_httpStatus :: (Int -> f Int)
-> DescribeWorkteamResponse -> f DescribeWorkteamResponse
describeWorkteamResponse_httpStatus = (DescribeWorkteamResponse -> Int)
-> (DescribeWorkteamResponse -> Int -> DescribeWorkteamResponse)
-> Lens DescribeWorkteamResponse DescribeWorkteamResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkteamResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeWorkteamResponse' :: DescribeWorkteamResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeWorkteamResponse
s@DescribeWorkteamResponse' {} Int
a -> DescribeWorkteamResponse
s {$sel:httpStatus:DescribeWorkteamResponse' :: Int
httpStatus = Int
a} :: DescribeWorkteamResponse)

-- | A @Workteam@ instance that contains information about the work team.
describeWorkteamResponse_workteam :: Lens.Lens' DescribeWorkteamResponse Workteam
describeWorkteamResponse_workteam :: (Workteam -> f Workteam)
-> DescribeWorkteamResponse -> f DescribeWorkteamResponse
describeWorkteamResponse_workteam = (DescribeWorkteamResponse -> Workteam)
-> (DescribeWorkteamResponse
    -> Workteam -> DescribeWorkteamResponse)
-> Lens
     DescribeWorkteamResponse DescribeWorkteamResponse Workteam Workteam
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkteamResponse' {Workteam
workteam :: Workteam
$sel:workteam:DescribeWorkteamResponse' :: DescribeWorkteamResponse -> Workteam
workteam} -> Workteam
workteam) (\s :: DescribeWorkteamResponse
s@DescribeWorkteamResponse' {} Workteam
a -> DescribeWorkteamResponse
s {$sel:workteam:DescribeWorkteamResponse' :: Workteam
workteam = Workteam
a} :: DescribeWorkteamResponse)

instance Prelude.NFData DescribeWorkteamResponse