{-# 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.SageMaker.CreateWorkforce
(
CreateWorkforce (..),
newCreateWorkforce,
createWorkforce_sourceIpConfig,
createWorkforce_cognitoConfig,
createWorkforce_oidcConfig,
createWorkforce_tags,
createWorkforce_workforceName,
CreateWorkforceResponse (..),
newCreateWorkforceResponse,
createWorkforceResponse_httpStatus,
createWorkforceResponse_workforceArn,
)
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
data CreateWorkforce = CreateWorkforce'
{ CreateWorkforce -> Maybe SourceIpConfig
sourceIpConfig :: Prelude.Maybe SourceIpConfig,
CreateWorkforce -> Maybe CognitoConfig
cognitoConfig :: Prelude.Maybe CognitoConfig,
CreateWorkforce -> Maybe OidcConfig
oidcConfig :: Prelude.Maybe OidcConfig,
CreateWorkforce -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateWorkforce -> Text
workforceName :: Prelude.Text
}
deriving (CreateWorkforce -> CreateWorkforce -> Bool
(CreateWorkforce -> CreateWorkforce -> Bool)
-> (CreateWorkforce -> CreateWorkforce -> Bool)
-> Eq CreateWorkforce
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkforce -> CreateWorkforce -> Bool
$c/= :: CreateWorkforce -> CreateWorkforce -> Bool
== :: CreateWorkforce -> CreateWorkforce -> Bool
$c== :: CreateWorkforce -> CreateWorkforce -> Bool
Prelude.Eq, Int -> CreateWorkforce -> ShowS
[CreateWorkforce] -> ShowS
CreateWorkforce -> String
(Int -> CreateWorkforce -> ShowS)
-> (CreateWorkforce -> String)
-> ([CreateWorkforce] -> ShowS)
-> Show CreateWorkforce
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkforce] -> ShowS
$cshowList :: [CreateWorkforce] -> ShowS
show :: CreateWorkforce -> String
$cshow :: CreateWorkforce -> String
showsPrec :: Int -> CreateWorkforce -> ShowS
$cshowsPrec :: Int -> CreateWorkforce -> ShowS
Prelude.Show, (forall x. CreateWorkforce -> Rep CreateWorkforce x)
-> (forall x. Rep CreateWorkforce x -> CreateWorkforce)
-> Generic CreateWorkforce
forall x. Rep CreateWorkforce x -> CreateWorkforce
forall x. CreateWorkforce -> Rep CreateWorkforce x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkforce x -> CreateWorkforce
$cfrom :: forall x. CreateWorkforce -> Rep CreateWorkforce x
Prelude.Generic)
newCreateWorkforce ::
Prelude.Text ->
CreateWorkforce
newCreateWorkforce :: Text -> CreateWorkforce
newCreateWorkforce Text
pWorkforceName_ =
CreateWorkforce' :: Maybe SourceIpConfig
-> Maybe CognitoConfig
-> Maybe OidcConfig
-> Maybe [Tag]
-> Text
-> CreateWorkforce
CreateWorkforce'
{ $sel:sourceIpConfig:CreateWorkforce' :: Maybe SourceIpConfig
sourceIpConfig = Maybe SourceIpConfig
forall a. Maybe a
Prelude.Nothing,
$sel:cognitoConfig:CreateWorkforce' :: Maybe CognitoConfig
cognitoConfig = Maybe CognitoConfig
forall a. Maybe a
Prelude.Nothing,
$sel:oidcConfig:CreateWorkforce' :: Maybe OidcConfig
oidcConfig = Maybe OidcConfig
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateWorkforce' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:workforceName:CreateWorkforce' :: Text
workforceName = Text
pWorkforceName_
}
createWorkforce_sourceIpConfig :: Lens.Lens' CreateWorkforce (Prelude.Maybe SourceIpConfig)
createWorkforce_sourceIpConfig :: (Maybe SourceIpConfig -> f (Maybe SourceIpConfig))
-> CreateWorkforce -> f CreateWorkforce
createWorkforce_sourceIpConfig = (CreateWorkforce -> Maybe SourceIpConfig)
-> (CreateWorkforce -> Maybe SourceIpConfig -> CreateWorkforce)
-> Lens
CreateWorkforce
CreateWorkforce
(Maybe SourceIpConfig)
(Maybe SourceIpConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforce' {Maybe SourceIpConfig
sourceIpConfig :: Maybe SourceIpConfig
$sel:sourceIpConfig:CreateWorkforce' :: CreateWorkforce -> Maybe SourceIpConfig
sourceIpConfig} -> Maybe SourceIpConfig
sourceIpConfig) (\s :: CreateWorkforce
s@CreateWorkforce' {} Maybe SourceIpConfig
a -> CreateWorkforce
s {$sel:sourceIpConfig:CreateWorkforce' :: Maybe SourceIpConfig
sourceIpConfig = Maybe SourceIpConfig
a} :: CreateWorkforce)
createWorkforce_cognitoConfig :: Lens.Lens' CreateWorkforce (Prelude.Maybe CognitoConfig)
createWorkforce_cognitoConfig :: (Maybe CognitoConfig -> f (Maybe CognitoConfig))
-> CreateWorkforce -> f CreateWorkforce
createWorkforce_cognitoConfig = (CreateWorkforce -> Maybe CognitoConfig)
-> (CreateWorkforce -> Maybe CognitoConfig -> CreateWorkforce)
-> Lens
CreateWorkforce
CreateWorkforce
(Maybe CognitoConfig)
(Maybe CognitoConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforce' {Maybe CognitoConfig
cognitoConfig :: Maybe CognitoConfig
$sel:cognitoConfig:CreateWorkforce' :: CreateWorkforce -> Maybe CognitoConfig
cognitoConfig} -> Maybe CognitoConfig
cognitoConfig) (\s :: CreateWorkforce
s@CreateWorkforce' {} Maybe CognitoConfig
a -> CreateWorkforce
s {$sel:cognitoConfig:CreateWorkforce' :: Maybe CognitoConfig
cognitoConfig = Maybe CognitoConfig
a} :: CreateWorkforce)
createWorkforce_oidcConfig :: Lens.Lens' CreateWorkforce (Prelude.Maybe OidcConfig)
createWorkforce_oidcConfig :: (Maybe OidcConfig -> f (Maybe OidcConfig))
-> CreateWorkforce -> f CreateWorkforce
createWorkforce_oidcConfig = (CreateWorkforce -> Maybe OidcConfig)
-> (CreateWorkforce -> Maybe OidcConfig -> CreateWorkforce)
-> Lens
CreateWorkforce
CreateWorkforce
(Maybe OidcConfig)
(Maybe OidcConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforce' {Maybe OidcConfig
oidcConfig :: Maybe OidcConfig
$sel:oidcConfig:CreateWorkforce' :: CreateWorkforce -> Maybe OidcConfig
oidcConfig} -> Maybe OidcConfig
oidcConfig) (\s :: CreateWorkforce
s@CreateWorkforce' {} Maybe OidcConfig
a -> CreateWorkforce
s {$sel:oidcConfig:CreateWorkforce' :: Maybe OidcConfig
oidcConfig = Maybe OidcConfig
a} :: CreateWorkforce)
createWorkforce_tags :: Lens.Lens' CreateWorkforce (Prelude.Maybe [Tag])
createWorkforce_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkforce -> f CreateWorkforce
createWorkforce_tags = (CreateWorkforce -> Maybe [Tag])
-> (CreateWorkforce -> Maybe [Tag] -> CreateWorkforce)
-> Lens CreateWorkforce CreateWorkforce (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforce' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateWorkforce' :: CreateWorkforce -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateWorkforce
s@CreateWorkforce' {} Maybe [Tag]
a -> CreateWorkforce
s {$sel:tags:CreateWorkforce' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateWorkforce) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkforce -> f CreateWorkforce)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateWorkforce
-> f CreateWorkforce
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createWorkforce_workforceName :: Lens.Lens' CreateWorkforce Prelude.Text
createWorkforce_workforceName :: (Text -> f Text) -> CreateWorkforce -> f CreateWorkforce
createWorkforce_workforceName = (CreateWorkforce -> Text)
-> (CreateWorkforce -> Text -> CreateWorkforce)
-> Lens CreateWorkforce CreateWorkforce Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforce' {Text
workforceName :: Text
$sel:workforceName:CreateWorkforce' :: CreateWorkforce -> Text
workforceName} -> Text
workforceName) (\s :: CreateWorkforce
s@CreateWorkforce' {} Text
a -> CreateWorkforce
s {$sel:workforceName:CreateWorkforce' :: Text
workforceName = Text
a} :: CreateWorkforce)
instance Core.AWSRequest CreateWorkforce where
type
AWSResponse CreateWorkforce =
CreateWorkforceResponse
request :: CreateWorkforce -> Request CreateWorkforce
request = Service -> CreateWorkforce -> Request CreateWorkforce
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateWorkforce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkforce)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateWorkforce))
-> Logger
-> Service
-> Proxy CreateWorkforce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkforce)))
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 -> Text -> CreateWorkforceResponse
CreateWorkforceResponse'
(Int -> Text -> CreateWorkforceResponse)
-> Either String Int
-> Either String (Text -> CreateWorkforceResponse)
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 (Text -> CreateWorkforceResponse)
-> Either String Text -> Either String CreateWorkforceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"WorkforceArn")
)
instance Prelude.Hashable CreateWorkforce
instance Prelude.NFData CreateWorkforce
instance Core.ToHeaders CreateWorkforce where
toHeaders :: CreateWorkforce -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateWorkforce -> 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.CreateWorkforce" :: 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 CreateWorkforce where
toJSON :: CreateWorkforce -> Value
toJSON CreateWorkforce' {Maybe [Tag]
Maybe CognitoConfig
Maybe OidcConfig
Maybe SourceIpConfig
Text
workforceName :: Text
tags :: Maybe [Tag]
oidcConfig :: Maybe OidcConfig
cognitoConfig :: Maybe CognitoConfig
sourceIpConfig :: Maybe SourceIpConfig
$sel:workforceName:CreateWorkforce' :: CreateWorkforce -> Text
$sel:tags:CreateWorkforce' :: CreateWorkforce -> Maybe [Tag]
$sel:oidcConfig:CreateWorkforce' :: CreateWorkforce -> Maybe OidcConfig
$sel:cognitoConfig:CreateWorkforce' :: CreateWorkforce -> Maybe CognitoConfig
$sel:sourceIpConfig:CreateWorkforce' :: CreateWorkforce -> Maybe SourceIpConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"SourceIpConfig" Text -> SourceIpConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(SourceIpConfig -> Pair) -> Maybe SourceIpConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SourceIpConfig
sourceIpConfig,
(Text
"CognitoConfig" Text -> CognitoConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (CognitoConfig -> Pair) -> Maybe CognitoConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CognitoConfig
cognitoConfig,
(Text
"OidcConfig" Text -> OidcConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OidcConfig -> Pair) -> Maybe OidcConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OidcConfig
oidcConfig,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"WorkforceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workforceName)
]
)
instance Core.ToPath CreateWorkforce where
toPath :: CreateWorkforce -> ByteString
toPath = ByteString -> CreateWorkforce -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateWorkforce where
toQuery :: CreateWorkforce -> QueryString
toQuery = QueryString -> CreateWorkforce -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateWorkforceResponse = CreateWorkforceResponse'
{
CreateWorkforceResponse -> Int
httpStatus :: Prelude.Int,
CreateWorkforceResponse -> Text
workforceArn :: Prelude.Text
}
deriving (CreateWorkforceResponse -> CreateWorkforceResponse -> Bool
(CreateWorkforceResponse -> CreateWorkforceResponse -> Bool)
-> (CreateWorkforceResponse -> CreateWorkforceResponse -> Bool)
-> Eq CreateWorkforceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkforceResponse -> CreateWorkforceResponse -> Bool
$c/= :: CreateWorkforceResponse -> CreateWorkforceResponse -> Bool
== :: CreateWorkforceResponse -> CreateWorkforceResponse -> Bool
$c== :: CreateWorkforceResponse -> CreateWorkforceResponse -> Bool
Prelude.Eq, ReadPrec [CreateWorkforceResponse]
ReadPrec CreateWorkforceResponse
Int -> ReadS CreateWorkforceResponse
ReadS [CreateWorkforceResponse]
(Int -> ReadS CreateWorkforceResponse)
-> ReadS [CreateWorkforceResponse]
-> ReadPrec CreateWorkforceResponse
-> ReadPrec [CreateWorkforceResponse]
-> Read CreateWorkforceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateWorkforceResponse]
$creadListPrec :: ReadPrec [CreateWorkforceResponse]
readPrec :: ReadPrec CreateWorkforceResponse
$creadPrec :: ReadPrec CreateWorkforceResponse
readList :: ReadS [CreateWorkforceResponse]
$creadList :: ReadS [CreateWorkforceResponse]
readsPrec :: Int -> ReadS CreateWorkforceResponse
$creadsPrec :: Int -> ReadS CreateWorkforceResponse
Prelude.Read, Int -> CreateWorkforceResponse -> ShowS
[CreateWorkforceResponse] -> ShowS
CreateWorkforceResponse -> String
(Int -> CreateWorkforceResponse -> ShowS)
-> (CreateWorkforceResponse -> String)
-> ([CreateWorkforceResponse] -> ShowS)
-> Show CreateWorkforceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkforceResponse] -> ShowS
$cshowList :: [CreateWorkforceResponse] -> ShowS
show :: CreateWorkforceResponse -> String
$cshow :: CreateWorkforceResponse -> String
showsPrec :: Int -> CreateWorkforceResponse -> ShowS
$cshowsPrec :: Int -> CreateWorkforceResponse -> ShowS
Prelude.Show, (forall x.
CreateWorkforceResponse -> Rep CreateWorkforceResponse x)
-> (forall x.
Rep CreateWorkforceResponse x -> CreateWorkforceResponse)
-> Generic CreateWorkforceResponse
forall x. Rep CreateWorkforceResponse x -> CreateWorkforceResponse
forall x. CreateWorkforceResponse -> Rep CreateWorkforceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkforceResponse x -> CreateWorkforceResponse
$cfrom :: forall x. CreateWorkforceResponse -> Rep CreateWorkforceResponse x
Prelude.Generic)
newCreateWorkforceResponse ::
Prelude.Int ->
Prelude.Text ->
CreateWorkforceResponse
newCreateWorkforceResponse :: Int -> Text -> CreateWorkforceResponse
newCreateWorkforceResponse
Int
pHttpStatus_
Text
pWorkforceArn_ =
CreateWorkforceResponse' :: Int -> Text -> CreateWorkforceResponse
CreateWorkforceResponse'
{ $sel:httpStatus:CreateWorkforceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:workforceArn:CreateWorkforceResponse' :: Text
workforceArn = Text
pWorkforceArn_
}
createWorkforceResponse_httpStatus :: Lens.Lens' CreateWorkforceResponse Prelude.Int
createWorkforceResponse_httpStatus :: (Int -> f Int)
-> CreateWorkforceResponse -> f CreateWorkforceResponse
createWorkforceResponse_httpStatus = (CreateWorkforceResponse -> Int)
-> (CreateWorkforceResponse -> Int -> CreateWorkforceResponse)
-> Lens CreateWorkforceResponse CreateWorkforceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforceResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateWorkforceResponse' :: CreateWorkforceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateWorkforceResponse
s@CreateWorkforceResponse' {} Int
a -> CreateWorkforceResponse
s {$sel:httpStatus:CreateWorkforceResponse' :: Int
httpStatus = Int
a} :: CreateWorkforceResponse)
createWorkforceResponse_workforceArn :: Lens.Lens' CreateWorkforceResponse Prelude.Text
createWorkforceResponse_workforceArn :: (Text -> f Text)
-> CreateWorkforceResponse -> f CreateWorkforceResponse
createWorkforceResponse_workforceArn = (CreateWorkforceResponse -> Text)
-> (CreateWorkforceResponse -> Text -> CreateWorkforceResponse)
-> Lens CreateWorkforceResponse CreateWorkforceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkforceResponse' {Text
workforceArn :: Text
$sel:workforceArn:CreateWorkforceResponse' :: CreateWorkforceResponse -> Text
workforceArn} -> Text
workforceArn) (\s :: CreateWorkforceResponse
s@CreateWorkforceResponse' {} Text
a -> CreateWorkforceResponse
s {$sel:workforceArn:CreateWorkforceResponse' :: Text
workforceArn = Text
a} :: CreateWorkforceResponse)
instance Prelude.NFData CreateWorkforceResponse