{-# 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.UpdateContext
(
UpdateContext (..),
newUpdateContext,
updateContext_propertiesToRemove,
updateContext_description,
updateContext_properties,
updateContext_contextName,
UpdateContextResponse (..),
newUpdateContextResponse,
updateContextResponse_contextArn,
updateContextResponse_httpStatus,
)
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 UpdateContext = UpdateContext'
{
UpdateContext -> Maybe [Text]
propertiesToRemove :: Prelude.Maybe [Prelude.Text],
UpdateContext -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
UpdateContext -> Maybe (HashMap Text Text)
properties :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
UpdateContext -> Text
contextName :: Prelude.Text
}
deriving (UpdateContext -> UpdateContext -> Bool
(UpdateContext -> UpdateContext -> Bool)
-> (UpdateContext -> UpdateContext -> Bool) -> Eq UpdateContext
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContext -> UpdateContext -> Bool
$c/= :: UpdateContext -> UpdateContext -> Bool
== :: UpdateContext -> UpdateContext -> Bool
$c== :: UpdateContext -> UpdateContext -> Bool
Prelude.Eq, ReadPrec [UpdateContext]
ReadPrec UpdateContext
Int -> ReadS UpdateContext
ReadS [UpdateContext]
(Int -> ReadS UpdateContext)
-> ReadS [UpdateContext]
-> ReadPrec UpdateContext
-> ReadPrec [UpdateContext]
-> Read UpdateContext
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContext]
$creadListPrec :: ReadPrec [UpdateContext]
readPrec :: ReadPrec UpdateContext
$creadPrec :: ReadPrec UpdateContext
readList :: ReadS [UpdateContext]
$creadList :: ReadS [UpdateContext]
readsPrec :: Int -> ReadS UpdateContext
$creadsPrec :: Int -> ReadS UpdateContext
Prelude.Read, Int -> UpdateContext -> ShowS
[UpdateContext] -> ShowS
UpdateContext -> String
(Int -> UpdateContext -> ShowS)
-> (UpdateContext -> String)
-> ([UpdateContext] -> ShowS)
-> Show UpdateContext
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContext] -> ShowS
$cshowList :: [UpdateContext] -> ShowS
show :: UpdateContext -> String
$cshow :: UpdateContext -> String
showsPrec :: Int -> UpdateContext -> ShowS
$cshowsPrec :: Int -> UpdateContext -> ShowS
Prelude.Show, (forall x. UpdateContext -> Rep UpdateContext x)
-> (forall x. Rep UpdateContext x -> UpdateContext)
-> Generic UpdateContext
forall x. Rep UpdateContext x -> UpdateContext
forall x. UpdateContext -> Rep UpdateContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContext x -> UpdateContext
$cfrom :: forall x. UpdateContext -> Rep UpdateContext x
Prelude.Generic)
newUpdateContext ::
Prelude.Text ->
UpdateContext
newUpdateContext :: Text -> UpdateContext
newUpdateContext Text
pContextName_ =
UpdateContext' :: Maybe [Text]
-> Maybe Text -> Maybe (HashMap Text Text) -> Text -> UpdateContext
UpdateContext'
{ $sel:propertiesToRemove:UpdateContext' :: Maybe [Text]
propertiesToRemove =
Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:description:UpdateContext' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:properties:UpdateContext' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:contextName:UpdateContext' :: Text
contextName = Text
pContextName_
}
updateContext_propertiesToRemove :: Lens.Lens' UpdateContext (Prelude.Maybe [Prelude.Text])
updateContext_propertiesToRemove :: (Maybe [Text] -> f (Maybe [Text]))
-> UpdateContext -> f UpdateContext
updateContext_propertiesToRemove = (UpdateContext -> Maybe [Text])
-> (UpdateContext -> Maybe [Text] -> UpdateContext)
-> Lens UpdateContext UpdateContext (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContext' {Maybe [Text]
propertiesToRemove :: Maybe [Text]
$sel:propertiesToRemove:UpdateContext' :: UpdateContext -> Maybe [Text]
propertiesToRemove} -> Maybe [Text]
propertiesToRemove) (\s :: UpdateContext
s@UpdateContext' {} Maybe [Text]
a -> UpdateContext
s {$sel:propertiesToRemove:UpdateContext' :: Maybe [Text]
propertiesToRemove = Maybe [Text]
a} :: UpdateContext) ((Maybe [Text] -> f (Maybe [Text]))
-> UpdateContext -> f UpdateContext)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UpdateContext
-> f UpdateContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateContext_description :: Lens.Lens' UpdateContext (Prelude.Maybe Prelude.Text)
updateContext_description :: (Maybe Text -> f (Maybe Text)) -> UpdateContext -> f UpdateContext
updateContext_description = (UpdateContext -> Maybe Text)
-> (UpdateContext -> Maybe Text -> UpdateContext)
-> Lens UpdateContext UpdateContext (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContext' {Maybe Text
description :: Maybe Text
$sel:description:UpdateContext' :: UpdateContext -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateContext
s@UpdateContext' {} Maybe Text
a -> UpdateContext
s {$sel:description:UpdateContext' :: Maybe Text
description = Maybe Text
a} :: UpdateContext)
updateContext_properties :: Lens.Lens' UpdateContext (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
updateContext_properties :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdateContext -> f UpdateContext
updateContext_properties = (UpdateContext -> Maybe (HashMap Text Text))
-> (UpdateContext -> Maybe (HashMap Text Text) -> UpdateContext)
-> Lens
UpdateContext
UpdateContext
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContext' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:UpdateContext' :: UpdateContext -> Maybe (HashMap Text Text)
properties} -> Maybe (HashMap Text Text)
properties) (\s :: UpdateContext
s@UpdateContext' {} Maybe (HashMap Text Text)
a -> UpdateContext
s {$sel:properties:UpdateContext' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
a} :: UpdateContext) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdateContext -> f UpdateContext)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> UpdateContext
-> f UpdateContext
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
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
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateContext_contextName :: Lens.Lens' UpdateContext Prelude.Text
updateContext_contextName :: (Text -> f Text) -> UpdateContext -> f UpdateContext
updateContext_contextName = (UpdateContext -> Text)
-> (UpdateContext -> Text -> UpdateContext)
-> Lens UpdateContext UpdateContext Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContext' {Text
contextName :: Text
$sel:contextName:UpdateContext' :: UpdateContext -> Text
contextName} -> Text
contextName) (\s :: UpdateContext
s@UpdateContext' {} Text
a -> UpdateContext
s {$sel:contextName:UpdateContext' :: Text
contextName = Text
a} :: UpdateContext)
instance Core.AWSRequest UpdateContext where
type
AWSResponse UpdateContext =
UpdateContextResponse
request :: UpdateContext -> Request UpdateContext
request = Service -> UpdateContext -> Request UpdateContext
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateContext
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateContext)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateContext))
-> Logger
-> Service
-> Proxy UpdateContext
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateContext)))
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 ->
Maybe Text -> Int -> UpdateContextResponse
UpdateContextResponse'
(Maybe Text -> Int -> UpdateContextResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateContextResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ContextArn")
Either String (Int -> UpdateContextResponse)
-> Either String Int -> Either String UpdateContextResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable UpdateContext
instance Prelude.NFData UpdateContext
instance Core.ToHeaders UpdateContext where
toHeaders :: UpdateContext -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateContext -> 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.UpdateContext" :: 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 UpdateContext where
toJSON :: UpdateContext -> Value
toJSON UpdateContext' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Text
contextName :: Text
properties :: Maybe (HashMap Text Text)
description :: Maybe Text
propertiesToRemove :: Maybe [Text]
$sel:contextName:UpdateContext' :: UpdateContext -> Text
$sel:properties:UpdateContext' :: UpdateContext -> Maybe (HashMap Text Text)
$sel:description:UpdateContext' :: UpdateContext -> Maybe Text
$sel:propertiesToRemove:UpdateContext' :: UpdateContext -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"PropertiesToRemove" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
propertiesToRemove,
(Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Text
"Properties" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
properties,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ContextName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contextName)
]
)
instance Core.ToPath UpdateContext where
toPath :: UpdateContext -> ByteString
toPath = ByteString -> UpdateContext -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateContext where
toQuery :: UpdateContext -> QueryString
toQuery = QueryString -> UpdateContext -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateContextResponse = UpdateContextResponse'
{
UpdateContextResponse -> Maybe Text
contextArn :: Prelude.Maybe Prelude.Text,
UpdateContextResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateContextResponse -> UpdateContextResponse -> Bool
(UpdateContextResponse -> UpdateContextResponse -> Bool)
-> (UpdateContextResponse -> UpdateContextResponse -> Bool)
-> Eq UpdateContextResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContextResponse -> UpdateContextResponse -> Bool
$c/= :: UpdateContextResponse -> UpdateContextResponse -> Bool
== :: UpdateContextResponse -> UpdateContextResponse -> Bool
$c== :: UpdateContextResponse -> UpdateContextResponse -> Bool
Prelude.Eq, ReadPrec [UpdateContextResponse]
ReadPrec UpdateContextResponse
Int -> ReadS UpdateContextResponse
ReadS [UpdateContextResponse]
(Int -> ReadS UpdateContextResponse)
-> ReadS [UpdateContextResponse]
-> ReadPrec UpdateContextResponse
-> ReadPrec [UpdateContextResponse]
-> Read UpdateContextResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContextResponse]
$creadListPrec :: ReadPrec [UpdateContextResponse]
readPrec :: ReadPrec UpdateContextResponse
$creadPrec :: ReadPrec UpdateContextResponse
readList :: ReadS [UpdateContextResponse]
$creadList :: ReadS [UpdateContextResponse]
readsPrec :: Int -> ReadS UpdateContextResponse
$creadsPrec :: Int -> ReadS UpdateContextResponse
Prelude.Read, Int -> UpdateContextResponse -> ShowS
[UpdateContextResponse] -> ShowS
UpdateContextResponse -> String
(Int -> UpdateContextResponse -> ShowS)
-> (UpdateContextResponse -> String)
-> ([UpdateContextResponse] -> ShowS)
-> Show UpdateContextResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContextResponse] -> ShowS
$cshowList :: [UpdateContextResponse] -> ShowS
show :: UpdateContextResponse -> String
$cshow :: UpdateContextResponse -> String
showsPrec :: Int -> UpdateContextResponse -> ShowS
$cshowsPrec :: Int -> UpdateContextResponse -> ShowS
Prelude.Show, (forall x. UpdateContextResponse -> Rep UpdateContextResponse x)
-> (forall x. Rep UpdateContextResponse x -> UpdateContextResponse)
-> Generic UpdateContextResponse
forall x. Rep UpdateContextResponse x -> UpdateContextResponse
forall x. UpdateContextResponse -> Rep UpdateContextResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContextResponse x -> UpdateContextResponse
$cfrom :: forall x. UpdateContextResponse -> Rep UpdateContextResponse x
Prelude.Generic)
newUpdateContextResponse ::
Prelude.Int ->
UpdateContextResponse
newUpdateContextResponse :: Int -> UpdateContextResponse
newUpdateContextResponse Int
pHttpStatus_ =
UpdateContextResponse' :: Maybe Text -> Int -> UpdateContextResponse
UpdateContextResponse'
{ $sel:contextArn:UpdateContextResponse' :: Maybe Text
contextArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateContextResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateContextResponse_contextArn :: Lens.Lens' UpdateContextResponse (Prelude.Maybe Prelude.Text)
updateContextResponse_contextArn :: (Maybe Text -> f (Maybe Text))
-> UpdateContextResponse -> f UpdateContextResponse
updateContextResponse_contextArn = (UpdateContextResponse -> Maybe Text)
-> (UpdateContextResponse -> Maybe Text -> UpdateContextResponse)
-> Lens
UpdateContextResponse
UpdateContextResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContextResponse' {Maybe Text
contextArn :: Maybe Text
$sel:contextArn:UpdateContextResponse' :: UpdateContextResponse -> Maybe Text
contextArn} -> Maybe Text
contextArn) (\s :: UpdateContextResponse
s@UpdateContextResponse' {} Maybe Text
a -> UpdateContextResponse
s {$sel:contextArn:UpdateContextResponse' :: Maybe Text
contextArn = Maybe Text
a} :: UpdateContextResponse)
updateContextResponse_httpStatus :: Lens.Lens' UpdateContextResponse Prelude.Int
updateContextResponse_httpStatus :: (Int -> f Int) -> UpdateContextResponse -> f UpdateContextResponse
updateContextResponse_httpStatus = (UpdateContextResponse -> Int)
-> (UpdateContextResponse -> Int -> UpdateContextResponse)
-> Lens UpdateContextResponse UpdateContextResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContextResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateContextResponse' :: UpdateContextResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateContextResponse
s@UpdateContextResponse' {} Int
a -> UpdateContextResponse
s {$sel:httpStatus:UpdateContextResponse' :: Int
httpStatus = Int
a} :: UpdateContextResponse)
instance Prelude.NFData UpdateContextResponse