{-# 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.DescribeWorkforce
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists private workforce information, including workforce name, Amazon
-- Resource Name (ARN), and, if applicable, allowed IP address ranges
-- (<https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Subnets.html CIDRs>).
-- Allowable IP address ranges are the IP addresses that workers can use to
-- access tasks.
--
-- This operation applies only to private workforces.
module Amazonka.SageMaker.DescribeWorkforce
  ( -- * Creating a Request
    DescribeWorkforce (..),
    newDescribeWorkforce,

    -- * Request Lenses
    describeWorkforce_workforceName,

    -- * Destructuring the Response
    DescribeWorkforceResponse (..),
    newDescribeWorkforceResponse,

    -- * Response Lenses
    describeWorkforceResponse_httpStatus,
    describeWorkforceResponse_workforce,
  )
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.SageMaker.Types

-- | /See:/ 'newDescribeWorkforce' smart constructor.
data DescribeWorkforce = DescribeWorkforce'
  { -- | The name of the private workforce whose access you want to restrict.
    -- @WorkforceName@ is automatically set to @default@ when a workforce is
    -- created and cannot be modified.
    DescribeWorkforce -> Text
workforceName :: Prelude.Text
  }
  deriving (DescribeWorkforce -> DescribeWorkforce -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkforce -> DescribeWorkforce -> Bool
$c/= :: DescribeWorkforce -> DescribeWorkforce -> Bool
== :: DescribeWorkforce -> DescribeWorkforce -> Bool
$c== :: DescribeWorkforce -> DescribeWorkforce -> Bool
Prelude.Eq, ReadPrec [DescribeWorkforce]
ReadPrec DescribeWorkforce
Int -> ReadS DescribeWorkforce
ReadS [DescribeWorkforce]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkforce]
$creadListPrec :: ReadPrec [DescribeWorkforce]
readPrec :: ReadPrec DescribeWorkforce
$creadPrec :: ReadPrec DescribeWorkforce
readList :: ReadS [DescribeWorkforce]
$creadList :: ReadS [DescribeWorkforce]
readsPrec :: Int -> ReadS DescribeWorkforce
$creadsPrec :: Int -> ReadS DescribeWorkforce
Prelude.Read, Int -> DescribeWorkforce -> ShowS
[DescribeWorkforce] -> ShowS
DescribeWorkforce -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkforce] -> ShowS
$cshowList :: [DescribeWorkforce] -> ShowS
show :: DescribeWorkforce -> String
$cshow :: DescribeWorkforce -> String
showsPrec :: Int -> DescribeWorkforce -> ShowS
$cshowsPrec :: Int -> DescribeWorkforce -> ShowS
Prelude.Show, forall x. Rep DescribeWorkforce x -> DescribeWorkforce
forall x. DescribeWorkforce -> Rep DescribeWorkforce x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeWorkforce x -> DescribeWorkforce
$cfrom :: forall x. DescribeWorkforce -> Rep DescribeWorkforce x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkforce' 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:
--
-- 'workforceName', 'describeWorkforce_workforceName' - The name of the private workforce whose access you want to restrict.
-- @WorkforceName@ is automatically set to @default@ when a workforce is
-- created and cannot be modified.
newDescribeWorkforce ::
  -- | 'workforceName'
  Prelude.Text ->
  DescribeWorkforce
newDescribeWorkforce :: Text -> DescribeWorkforce
newDescribeWorkforce Text
pWorkforceName_ =
  DescribeWorkforce' {$sel:workforceName:DescribeWorkforce' :: Text
workforceName = Text
pWorkforceName_}

-- | The name of the private workforce whose access you want to restrict.
-- @WorkforceName@ is automatically set to @default@ when a workforce is
-- created and cannot be modified.
describeWorkforce_workforceName :: Lens.Lens' DescribeWorkforce Prelude.Text
describeWorkforce_workforceName :: Lens' DescribeWorkforce Text
describeWorkforce_workforceName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkforce' {Text
workforceName :: Text
$sel:workforceName:DescribeWorkforce' :: DescribeWorkforce -> Text
workforceName} -> Text
workforceName) (\s :: DescribeWorkforce
s@DescribeWorkforce' {} Text
a -> DescribeWorkforce
s {$sel:workforceName:DescribeWorkforce' :: Text
workforceName = Text
a} :: DescribeWorkforce)

instance Core.AWSRequest DescribeWorkforce where
  type
    AWSResponse DescribeWorkforce =
      DescribeWorkforceResponse
  request :: (Service -> Service)
-> DescribeWorkforce -> Request DescribeWorkforce
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeWorkforce
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeWorkforce)))
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 ->
          Int -> Workforce -> DescribeWorkforceResponse
DescribeWorkforceResponse'
            forall (f :: * -> *) a b. Functor 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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"Workforce")
      )

instance Prelude.Hashable DescribeWorkforce where
  hashWithSalt :: Int -> DescribeWorkforce -> Int
hashWithSalt Int
_salt DescribeWorkforce' {Text
workforceName :: Text
$sel:workforceName:DescribeWorkforce' :: DescribeWorkforce -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workforceName

instance Prelude.NFData DescribeWorkforce where
  rnf :: DescribeWorkforce -> ()
rnf DescribeWorkforce' {Text
workforceName :: Text
$sel:workforceName:DescribeWorkforce' :: DescribeWorkforce -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
workforceName

instance Data.ToHeaders DescribeWorkforce where
  toHeaders :: DescribeWorkforce -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SageMaker.DescribeWorkforce" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeWorkforce where
  toJSON :: DescribeWorkforce -> Value
toJSON DescribeWorkforce' {Text
workforceName :: Text
$sel:workforceName:DescribeWorkforce' :: DescribeWorkforce -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"WorkforceName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
workforceName)
          ]
      )

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

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

-- | /See:/ 'newDescribeWorkforceResponse' smart constructor.
data DescribeWorkforceResponse = DescribeWorkforceResponse'
  { -- | The response's http status code.
    DescribeWorkforceResponse -> Int
httpStatus :: Prelude.Int,
    -- | A single private workforce, which is automatically created when you
    -- create your first private work team. You can create one private work
    -- force in each Amazon Web Services Region. By default, any
    -- workforce-related API operation used in a specific region will apply to
    -- the workforce created in that region. To learn how to create a private
    -- workforce, see
    -- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private.html Create a Private Workforce>.
    DescribeWorkforceResponse -> Workforce
workforce :: Workforce
  }
  deriving (DescribeWorkforceResponse -> DescribeWorkforceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkforceResponse -> DescribeWorkforceResponse -> Bool
$c/= :: DescribeWorkforceResponse -> DescribeWorkforceResponse -> Bool
== :: DescribeWorkforceResponse -> DescribeWorkforceResponse -> Bool
$c== :: DescribeWorkforceResponse -> DescribeWorkforceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkforceResponse]
ReadPrec DescribeWorkforceResponse
Int -> ReadS DescribeWorkforceResponse
ReadS [DescribeWorkforceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkforceResponse]
$creadListPrec :: ReadPrec [DescribeWorkforceResponse]
readPrec :: ReadPrec DescribeWorkforceResponse
$creadPrec :: ReadPrec DescribeWorkforceResponse
readList :: ReadS [DescribeWorkforceResponse]
$creadList :: ReadS [DescribeWorkforceResponse]
readsPrec :: Int -> ReadS DescribeWorkforceResponse
$creadsPrec :: Int -> ReadS DescribeWorkforceResponse
Prelude.Read, Int -> DescribeWorkforceResponse -> ShowS
[DescribeWorkforceResponse] -> ShowS
DescribeWorkforceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkforceResponse] -> ShowS
$cshowList :: [DescribeWorkforceResponse] -> ShowS
show :: DescribeWorkforceResponse -> String
$cshow :: DescribeWorkforceResponse -> String
showsPrec :: Int -> DescribeWorkforceResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkforceResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeWorkforceResponse x -> DescribeWorkforceResponse
forall x.
DescribeWorkforceResponse -> Rep DescribeWorkforceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkforceResponse x -> DescribeWorkforceResponse
$cfrom :: forall x.
DescribeWorkforceResponse -> Rep DescribeWorkforceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkforceResponse' 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', 'describeWorkforceResponse_httpStatus' - The response's http status code.
--
-- 'workforce', 'describeWorkforceResponse_workforce' - A single private workforce, which is automatically created when you
-- create your first private work team. You can create one private work
-- force in each Amazon Web Services Region. By default, any
-- workforce-related API operation used in a specific region will apply to
-- the workforce created in that region. To learn how to create a private
-- workforce, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private.html Create a Private Workforce>.
newDescribeWorkforceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workforce'
  Workforce ->
  DescribeWorkforceResponse
newDescribeWorkforceResponse :: Int -> Workforce -> DescribeWorkforceResponse
newDescribeWorkforceResponse Int
pHttpStatus_ Workforce
pWorkforce_ =
  DescribeWorkforceResponse'
    { $sel:httpStatus:DescribeWorkforceResponse' :: Int
httpStatus =
        Int
pHttpStatus_,
      $sel:workforce:DescribeWorkforceResponse' :: Workforce
workforce = Workforce
pWorkforce_
    }

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

-- | A single private workforce, which is automatically created when you
-- create your first private work team. You can create one private work
-- force in each Amazon Web Services Region. By default, any
-- workforce-related API operation used in a specific region will apply to
-- the workforce created in that region. To learn how to create a private
-- workforce, see
-- <https://docs.aws.amazon.com/sagemaker/latest/dg/sms-workforce-create-private.html Create a Private Workforce>.
describeWorkforceResponse_workforce :: Lens.Lens' DescribeWorkforceResponse Workforce
describeWorkforceResponse_workforce :: Lens' DescribeWorkforceResponse Workforce
describeWorkforceResponse_workforce = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkforceResponse' {Workforce
workforce :: Workforce
$sel:workforce:DescribeWorkforceResponse' :: DescribeWorkforceResponse -> Workforce
workforce} -> Workforce
workforce) (\s :: DescribeWorkforceResponse
s@DescribeWorkforceResponse' {} Workforce
a -> DescribeWorkforceResponse
s {$sel:workforce:DescribeWorkforceResponse' :: Workforce
workforce = Workforce
a} :: DescribeWorkforceResponse)

instance Prelude.NFData DescribeWorkforceResponse where
  rnf :: DescribeWorkforceResponse -> ()
rnf DescribeWorkforceResponse' {Int
Workforce
workforce :: Workforce
httpStatus :: Int
$sel:workforce:DescribeWorkforceResponse' :: DescribeWorkforceResponse -> Workforce
$sel:httpStatus:DescribeWorkforceResponse' :: DescribeWorkforceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Workforce
workforce