{-# 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.UpdateWorkforce
(
UpdateWorkforce (..),
newUpdateWorkforce,
updateWorkforce_sourceIpConfig,
updateWorkforce_oidcConfig,
updateWorkforce_workforceName,
UpdateWorkforceResponse (..),
newUpdateWorkforceResponse,
updateWorkforceResponse_httpStatus,
updateWorkforceResponse_workforce,
)
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 UpdateWorkforce = UpdateWorkforce'
{
UpdateWorkforce -> Maybe SourceIpConfig
sourceIpConfig :: Prelude.Maybe SourceIpConfig,
UpdateWorkforce -> Maybe OidcConfig
oidcConfig :: Prelude.Maybe OidcConfig,
UpdateWorkforce -> Text
workforceName :: Prelude.Text
}
deriving (UpdateWorkforce -> UpdateWorkforce -> Bool
(UpdateWorkforce -> UpdateWorkforce -> Bool)
-> (UpdateWorkforce -> UpdateWorkforce -> Bool)
-> Eq UpdateWorkforce
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkforce -> UpdateWorkforce -> Bool
$c/= :: UpdateWorkforce -> UpdateWorkforce -> Bool
== :: UpdateWorkforce -> UpdateWorkforce -> Bool
$c== :: UpdateWorkforce -> UpdateWorkforce -> Bool
Prelude.Eq, Int -> UpdateWorkforce -> ShowS
[UpdateWorkforce] -> ShowS
UpdateWorkforce -> String
(Int -> UpdateWorkforce -> ShowS)
-> (UpdateWorkforce -> String)
-> ([UpdateWorkforce] -> ShowS)
-> Show UpdateWorkforce
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkforce] -> ShowS
$cshowList :: [UpdateWorkforce] -> ShowS
show :: UpdateWorkforce -> String
$cshow :: UpdateWorkforce -> String
showsPrec :: Int -> UpdateWorkforce -> ShowS
$cshowsPrec :: Int -> UpdateWorkforce -> ShowS
Prelude.Show, (forall x. UpdateWorkforce -> Rep UpdateWorkforce x)
-> (forall x. Rep UpdateWorkforce x -> UpdateWorkforce)
-> Generic UpdateWorkforce
forall x. Rep UpdateWorkforce x -> UpdateWorkforce
forall x. UpdateWorkforce -> Rep UpdateWorkforce x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkforce x -> UpdateWorkforce
$cfrom :: forall x. UpdateWorkforce -> Rep UpdateWorkforce x
Prelude.Generic)
newUpdateWorkforce ::
Prelude.Text ->
UpdateWorkforce
newUpdateWorkforce :: Text -> UpdateWorkforce
newUpdateWorkforce Text
pWorkforceName_ =
UpdateWorkforce' :: Maybe SourceIpConfig -> Maybe OidcConfig -> Text -> UpdateWorkforce
UpdateWorkforce'
{ $sel:sourceIpConfig:UpdateWorkforce' :: Maybe SourceIpConfig
sourceIpConfig = Maybe SourceIpConfig
forall a. Maybe a
Prelude.Nothing,
$sel:oidcConfig:UpdateWorkforce' :: Maybe OidcConfig
oidcConfig = Maybe OidcConfig
forall a. Maybe a
Prelude.Nothing,
$sel:workforceName:UpdateWorkforce' :: Text
workforceName = Text
pWorkforceName_
}
updateWorkforce_sourceIpConfig :: Lens.Lens' UpdateWorkforce (Prelude.Maybe SourceIpConfig)
updateWorkforce_sourceIpConfig :: (Maybe SourceIpConfig -> f (Maybe SourceIpConfig))
-> UpdateWorkforce -> f UpdateWorkforce
updateWorkforce_sourceIpConfig = (UpdateWorkforce -> Maybe SourceIpConfig)
-> (UpdateWorkforce -> Maybe SourceIpConfig -> UpdateWorkforce)
-> Lens
UpdateWorkforce
UpdateWorkforce
(Maybe SourceIpConfig)
(Maybe SourceIpConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkforce' {Maybe SourceIpConfig
sourceIpConfig :: Maybe SourceIpConfig
$sel:sourceIpConfig:UpdateWorkforce' :: UpdateWorkforce -> Maybe SourceIpConfig
sourceIpConfig} -> Maybe SourceIpConfig
sourceIpConfig) (\s :: UpdateWorkforce
s@UpdateWorkforce' {} Maybe SourceIpConfig
a -> UpdateWorkforce
s {$sel:sourceIpConfig:UpdateWorkforce' :: Maybe SourceIpConfig
sourceIpConfig = Maybe SourceIpConfig
a} :: UpdateWorkforce)
updateWorkforce_oidcConfig :: Lens.Lens' UpdateWorkforce (Prelude.Maybe OidcConfig)
updateWorkforce_oidcConfig :: (Maybe OidcConfig -> f (Maybe OidcConfig))
-> UpdateWorkforce -> f UpdateWorkforce
updateWorkforce_oidcConfig = (UpdateWorkforce -> Maybe OidcConfig)
-> (UpdateWorkforce -> Maybe OidcConfig -> UpdateWorkforce)
-> Lens
UpdateWorkforce
UpdateWorkforce
(Maybe OidcConfig)
(Maybe OidcConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkforce' {Maybe OidcConfig
oidcConfig :: Maybe OidcConfig
$sel:oidcConfig:UpdateWorkforce' :: UpdateWorkforce -> Maybe OidcConfig
oidcConfig} -> Maybe OidcConfig
oidcConfig) (\s :: UpdateWorkforce
s@UpdateWorkforce' {} Maybe OidcConfig
a -> UpdateWorkforce
s {$sel:oidcConfig:UpdateWorkforce' :: Maybe OidcConfig
oidcConfig = Maybe OidcConfig
a} :: UpdateWorkforce)
updateWorkforce_workforceName :: Lens.Lens' UpdateWorkforce Prelude.Text
updateWorkforce_workforceName :: (Text -> f Text) -> UpdateWorkforce -> f UpdateWorkforce
updateWorkforce_workforceName = (UpdateWorkforce -> Text)
-> (UpdateWorkforce -> Text -> UpdateWorkforce)
-> Lens UpdateWorkforce UpdateWorkforce Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkforce' {Text
workforceName :: Text
$sel:workforceName:UpdateWorkforce' :: UpdateWorkforce -> Text
workforceName} -> Text
workforceName) (\s :: UpdateWorkforce
s@UpdateWorkforce' {} Text
a -> UpdateWorkforce
s {$sel:workforceName:UpdateWorkforce' :: Text
workforceName = Text
a} :: UpdateWorkforce)
instance Core.AWSRequest UpdateWorkforce where
type
AWSResponse UpdateWorkforce =
UpdateWorkforceResponse
request :: UpdateWorkforce -> Request UpdateWorkforce
request = Service -> UpdateWorkforce -> Request UpdateWorkforce
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateWorkforce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkforce)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateWorkforce))
-> Logger
-> Service
-> Proxy UpdateWorkforce
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateWorkforce)))
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 -> Workforce -> UpdateWorkforceResponse
UpdateWorkforceResponse'
(Int -> Workforce -> UpdateWorkforceResponse)
-> Either String Int
-> Either String (Workforce -> UpdateWorkforceResponse)
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 (Workforce -> UpdateWorkforceResponse)
-> Either String Workforce -> Either String UpdateWorkforceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Workforce
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Workforce")
)
instance Prelude.Hashable UpdateWorkforce
instance Prelude.NFData UpdateWorkforce
instance Core.ToHeaders UpdateWorkforce where
toHeaders :: UpdateWorkforce -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateWorkforce -> 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.UpdateWorkforce" :: 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 UpdateWorkforce where
toJSON :: UpdateWorkforce -> Value
toJSON UpdateWorkforce' {Maybe OidcConfig
Maybe SourceIpConfig
Text
workforceName :: Text
oidcConfig :: Maybe OidcConfig
sourceIpConfig :: Maybe SourceIpConfig
$sel:workforceName:UpdateWorkforce' :: UpdateWorkforce -> Text
$sel:oidcConfig:UpdateWorkforce' :: UpdateWorkforce -> Maybe OidcConfig
$sel:sourceIpConfig:UpdateWorkforce' :: UpdateWorkforce -> 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
"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,
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 UpdateWorkforce where
toPath :: UpdateWorkforce -> ByteString
toPath = ByteString -> UpdateWorkforce -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateWorkforce where
toQuery :: UpdateWorkforce -> QueryString
toQuery = QueryString -> UpdateWorkforce -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateWorkforceResponse = UpdateWorkforceResponse'
{
UpdateWorkforceResponse -> Int
httpStatus :: Prelude.Int,
UpdateWorkforceResponse -> Workforce
workforce :: Workforce
}
deriving (UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool
(UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool)
-> (UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool)
-> Eq UpdateWorkforceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool
$c/= :: UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool
== :: UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool
$c== :: UpdateWorkforceResponse -> UpdateWorkforceResponse -> Bool
Prelude.Eq, ReadPrec [UpdateWorkforceResponse]
ReadPrec UpdateWorkforceResponse
Int -> ReadS UpdateWorkforceResponse
ReadS [UpdateWorkforceResponse]
(Int -> ReadS UpdateWorkforceResponse)
-> ReadS [UpdateWorkforceResponse]
-> ReadPrec UpdateWorkforceResponse
-> ReadPrec [UpdateWorkforceResponse]
-> Read UpdateWorkforceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateWorkforceResponse]
$creadListPrec :: ReadPrec [UpdateWorkforceResponse]
readPrec :: ReadPrec UpdateWorkforceResponse
$creadPrec :: ReadPrec UpdateWorkforceResponse
readList :: ReadS [UpdateWorkforceResponse]
$creadList :: ReadS [UpdateWorkforceResponse]
readsPrec :: Int -> ReadS UpdateWorkforceResponse
$creadsPrec :: Int -> ReadS UpdateWorkforceResponse
Prelude.Read, Int -> UpdateWorkforceResponse -> ShowS
[UpdateWorkforceResponse] -> ShowS
UpdateWorkforceResponse -> String
(Int -> UpdateWorkforceResponse -> ShowS)
-> (UpdateWorkforceResponse -> String)
-> ([UpdateWorkforceResponse] -> ShowS)
-> Show UpdateWorkforceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateWorkforceResponse] -> ShowS
$cshowList :: [UpdateWorkforceResponse] -> ShowS
show :: UpdateWorkforceResponse -> String
$cshow :: UpdateWorkforceResponse -> String
showsPrec :: Int -> UpdateWorkforceResponse -> ShowS
$cshowsPrec :: Int -> UpdateWorkforceResponse -> ShowS
Prelude.Show, (forall x.
UpdateWorkforceResponse -> Rep UpdateWorkforceResponse x)
-> (forall x.
Rep UpdateWorkforceResponse x -> UpdateWorkforceResponse)
-> Generic UpdateWorkforceResponse
forall x. Rep UpdateWorkforceResponse x -> UpdateWorkforceResponse
forall x. UpdateWorkforceResponse -> Rep UpdateWorkforceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateWorkforceResponse x -> UpdateWorkforceResponse
$cfrom :: forall x. UpdateWorkforceResponse -> Rep UpdateWorkforceResponse x
Prelude.Generic)
newUpdateWorkforceResponse ::
Prelude.Int ->
Workforce ->
UpdateWorkforceResponse
newUpdateWorkforceResponse :: Int -> Workforce -> UpdateWorkforceResponse
newUpdateWorkforceResponse Int
pHttpStatus_ Workforce
pWorkforce_ =
UpdateWorkforceResponse' :: Int -> Workforce -> UpdateWorkforceResponse
UpdateWorkforceResponse'
{ $sel:httpStatus:UpdateWorkforceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:workforce:UpdateWorkforceResponse' :: Workforce
workforce = Workforce
pWorkforce_
}
updateWorkforceResponse_httpStatus :: Lens.Lens' UpdateWorkforceResponse Prelude.Int
updateWorkforceResponse_httpStatus :: (Int -> f Int)
-> UpdateWorkforceResponse -> f UpdateWorkforceResponse
updateWorkforceResponse_httpStatus = (UpdateWorkforceResponse -> Int)
-> (UpdateWorkforceResponse -> Int -> UpdateWorkforceResponse)
-> Lens UpdateWorkforceResponse UpdateWorkforceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkforceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateWorkforceResponse' :: UpdateWorkforceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateWorkforceResponse
s@UpdateWorkforceResponse' {} Int
a -> UpdateWorkforceResponse
s {$sel:httpStatus:UpdateWorkforceResponse' :: Int
httpStatus = Int
a} :: UpdateWorkforceResponse)
updateWorkforceResponse_workforce :: Lens.Lens' UpdateWorkforceResponse Workforce
updateWorkforceResponse_workforce :: (Workforce -> f Workforce)
-> UpdateWorkforceResponse -> f UpdateWorkforceResponse
updateWorkforceResponse_workforce = (UpdateWorkforceResponse -> Workforce)
-> (UpdateWorkforceResponse
-> Workforce -> UpdateWorkforceResponse)
-> Lens
UpdateWorkforceResponse UpdateWorkforceResponse Workforce Workforce
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateWorkforceResponse' {Workforce
workforce :: Workforce
$sel:workforce:UpdateWorkforceResponse' :: UpdateWorkforceResponse -> Workforce
workforce} -> Workforce
workforce) (\s :: UpdateWorkforceResponse
s@UpdateWorkforceResponse' {} Workforce
a -> UpdateWorkforceResponse
s {$sel:workforce:UpdateWorkforceResponse' :: Workforce
workforce = Workforce
a} :: UpdateWorkforceResponse)
instance Prelude.NFData UpdateWorkforceResponse