{-# 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.CreateContext
(
CreateContext (..),
newCreateContext,
createContext_description,
createContext_properties,
createContext_tags,
createContext_contextName,
createContext_source,
createContext_contextType,
CreateContextResponse (..),
newCreateContextResponse,
createContextResponse_contextArn,
createContextResponse_httpStatus,
)
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
data CreateContext = CreateContext'
{
CreateContext -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateContext -> Maybe (HashMap Text Text)
properties :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateContext -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateContext -> Text
contextName :: Prelude.Text,
CreateContext -> ContextSource
source :: ContextSource,
CreateContext -> Text
contextType :: Prelude.Text
}
deriving (CreateContext -> CreateContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContext -> CreateContext -> Bool
$c/= :: CreateContext -> CreateContext -> Bool
== :: CreateContext -> CreateContext -> Bool
$c== :: CreateContext -> CreateContext -> Bool
Prelude.Eq, ReadPrec [CreateContext]
ReadPrec CreateContext
Int -> ReadS CreateContext
ReadS [CreateContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContext]
$creadListPrec :: ReadPrec [CreateContext]
readPrec :: ReadPrec CreateContext
$creadPrec :: ReadPrec CreateContext
readList :: ReadS [CreateContext]
$creadList :: ReadS [CreateContext]
readsPrec :: Int -> ReadS CreateContext
$creadsPrec :: Int -> ReadS CreateContext
Prelude.Read, Int -> CreateContext -> ShowS
[CreateContext] -> ShowS
CreateContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContext] -> ShowS
$cshowList :: [CreateContext] -> ShowS
show :: CreateContext -> String
$cshow :: CreateContext -> String
showsPrec :: Int -> CreateContext -> ShowS
$cshowsPrec :: Int -> CreateContext -> ShowS
Prelude.Show, forall x. Rep CreateContext x -> CreateContext
forall x. CreateContext -> Rep CreateContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContext x -> CreateContext
$cfrom :: forall x. CreateContext -> Rep CreateContext x
Prelude.Generic)
newCreateContext ::
Prelude.Text ->
ContextSource ->
Prelude.Text ->
CreateContext
newCreateContext :: Text -> ContextSource -> Text -> CreateContext
newCreateContext Text
pContextName_ ContextSource
pSource_ Text
pContextType_ =
CreateContext'
{ $sel:description:CreateContext' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:properties:CreateContext' :: Maybe (HashMap Text Text)
properties = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateContext' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:contextName:CreateContext' :: Text
contextName = Text
pContextName_,
$sel:source:CreateContext' :: ContextSource
source = ContextSource
pSource_,
$sel:contextType:CreateContext' :: Text
contextType = Text
pContextType_
}
createContext_description :: Lens.Lens' CreateContext (Prelude.Maybe Prelude.Text)
createContext_description :: Lens' CreateContext (Maybe Text)
createContext_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {Maybe Text
description :: Maybe Text
$sel:description:CreateContext' :: CreateContext -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateContext
s@CreateContext' {} Maybe Text
a -> CreateContext
s {$sel:description:CreateContext' :: Maybe Text
description = Maybe Text
a} :: CreateContext)
createContext_properties :: Lens.Lens' CreateContext (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createContext_properties :: Lens' CreateContext (Maybe (HashMap Text Text))
createContext_properties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {Maybe (HashMap Text Text)
properties :: Maybe (HashMap Text Text)
$sel:properties:CreateContext' :: CreateContext -> Maybe (HashMap Text Text)
properties} -> Maybe (HashMap Text Text)
properties) (\s :: CreateContext
s@CreateContext' {} Maybe (HashMap Text Text)
a -> CreateContext
s {$sel:properties:CreateContext' :: Maybe (HashMap Text Text)
properties = Maybe (HashMap Text Text)
a} :: CreateContext) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createContext_tags :: Lens.Lens' CreateContext (Prelude.Maybe [Tag])
createContext_tags :: Lens' CreateContext (Maybe [Tag])
createContext_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateContext' :: CreateContext -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateContext
s@CreateContext' {} Maybe [Tag]
a -> CreateContext
s {$sel:tags:CreateContext' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateContext) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createContext_contextName :: Lens.Lens' CreateContext Prelude.Text
createContext_contextName :: Lens' CreateContext Text
createContext_contextName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {Text
contextName :: Text
$sel:contextName:CreateContext' :: CreateContext -> Text
contextName} -> Text
contextName) (\s :: CreateContext
s@CreateContext' {} Text
a -> CreateContext
s {$sel:contextName:CreateContext' :: Text
contextName = Text
a} :: CreateContext)
createContext_source :: Lens.Lens' CreateContext ContextSource
createContext_source :: Lens' CreateContext ContextSource
createContext_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {ContextSource
source :: ContextSource
$sel:source:CreateContext' :: CreateContext -> ContextSource
source} -> ContextSource
source) (\s :: CreateContext
s@CreateContext' {} ContextSource
a -> CreateContext
s {$sel:source:CreateContext' :: ContextSource
source = ContextSource
a} :: CreateContext)
createContext_contextType :: Lens.Lens' CreateContext Prelude.Text
createContext_contextType :: Lens' CreateContext Text
createContext_contextType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContext' {Text
contextType :: Text
$sel:contextType:CreateContext' :: CreateContext -> Text
contextType} -> Text
contextType) (\s :: CreateContext
s@CreateContext' {} Text
a -> CreateContext
s {$sel:contextType:CreateContext' :: Text
contextType = Text
a} :: CreateContext)
instance Core.AWSRequest CreateContext where
type
AWSResponse CreateContext =
CreateContextResponse
request :: (Service -> Service) -> CreateContext -> Request CreateContext
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 CreateContext
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateContext)))
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 ->
Maybe Text -> Int -> CreateContextResponse
CreateContextResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ContextArn")
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable CreateContext where
hashWithSalt :: Int -> CreateContext -> Int
hashWithSalt Int
_salt CreateContext' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
ContextSource
contextType :: Text
source :: ContextSource
contextName :: Text
tags :: Maybe [Tag]
properties :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:contextType:CreateContext' :: CreateContext -> Text
$sel:source:CreateContext' :: CreateContext -> ContextSource
$sel:contextName:CreateContext' :: CreateContext -> Text
$sel:tags:CreateContext' :: CreateContext -> Maybe [Tag]
$sel:properties:CreateContext' :: CreateContext -> Maybe (HashMap Text Text)
$sel:description:CreateContext' :: CreateContext -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
properties
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contextName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ContextSource
source
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contextType
instance Prelude.NFData CreateContext where
rnf :: CreateContext -> ()
rnf CreateContext' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
ContextSource
contextType :: Text
source :: ContextSource
contextName :: Text
tags :: Maybe [Tag]
properties :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:contextType:CreateContext' :: CreateContext -> Text
$sel:source:CreateContext' :: CreateContext -> ContextSource
$sel:contextName:CreateContext' :: CreateContext -> Text
$sel:tags:CreateContext' :: CreateContext -> Maybe [Tag]
$sel:properties:CreateContext' :: CreateContext -> Maybe (HashMap Text Text)
$sel:description:CreateContext' :: CreateContext -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
properties
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contextName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ContextSource
source
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
contextType
instance Data.ToHeaders CreateContext where
toHeaders :: CreateContext -> 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.CreateContext" :: 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 CreateContext where
toJSON :: CreateContext -> Value
toJSON CreateContext' {Maybe [Tag]
Maybe Text
Maybe (HashMap Text Text)
Text
ContextSource
contextType :: Text
source :: ContextSource
contextName :: Text
tags :: Maybe [Tag]
properties :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:contextType:CreateContext' :: CreateContext -> Text
$sel:source:CreateContext' :: CreateContext -> ContextSource
$sel:contextName:CreateContext' :: CreateContext -> Text
$sel:tags:CreateContext' :: CreateContext -> Maybe [Tag]
$sel:properties:CreateContext' :: CreateContext -> Maybe (HashMap Text Text)
$sel:description:CreateContext' :: CreateContext -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"Properties" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
properties,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"ContextName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contextName),
forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ContextSource
source),
forall a. a -> Maybe a
Prelude.Just (Key
"ContextType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contextType)
]
)
instance Data.ToPath CreateContext where
toPath :: CreateContext -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateContext where
toQuery :: CreateContext -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateContextResponse = CreateContextResponse'
{
CreateContextResponse -> Maybe Text
contextArn :: Prelude.Maybe Prelude.Text,
CreateContextResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateContextResponse -> CreateContextResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContextResponse -> CreateContextResponse -> Bool
$c/= :: CreateContextResponse -> CreateContextResponse -> Bool
== :: CreateContextResponse -> CreateContextResponse -> Bool
$c== :: CreateContextResponse -> CreateContextResponse -> Bool
Prelude.Eq, ReadPrec [CreateContextResponse]
ReadPrec CreateContextResponse
Int -> ReadS CreateContextResponse
ReadS [CreateContextResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContextResponse]
$creadListPrec :: ReadPrec [CreateContextResponse]
readPrec :: ReadPrec CreateContextResponse
$creadPrec :: ReadPrec CreateContextResponse
readList :: ReadS [CreateContextResponse]
$creadList :: ReadS [CreateContextResponse]
readsPrec :: Int -> ReadS CreateContextResponse
$creadsPrec :: Int -> ReadS CreateContextResponse
Prelude.Read, Int -> CreateContextResponse -> ShowS
[CreateContextResponse] -> ShowS
CreateContextResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContextResponse] -> ShowS
$cshowList :: [CreateContextResponse] -> ShowS
show :: CreateContextResponse -> String
$cshow :: CreateContextResponse -> String
showsPrec :: Int -> CreateContextResponse -> ShowS
$cshowsPrec :: Int -> CreateContextResponse -> ShowS
Prelude.Show, forall x. Rep CreateContextResponse x -> CreateContextResponse
forall x. CreateContextResponse -> Rep CreateContextResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContextResponse x -> CreateContextResponse
$cfrom :: forall x. CreateContextResponse -> Rep CreateContextResponse x
Prelude.Generic)
newCreateContextResponse ::
Prelude.Int ->
CreateContextResponse
newCreateContextResponse :: Int -> CreateContextResponse
newCreateContextResponse Int
pHttpStatus_ =
CreateContextResponse'
{ $sel:contextArn:CreateContextResponse' :: Maybe Text
contextArn =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateContextResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createContextResponse_contextArn :: Lens.Lens' CreateContextResponse (Prelude.Maybe Prelude.Text)
createContextResponse_contextArn :: Lens' CreateContextResponse (Maybe Text)
createContextResponse_contextArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContextResponse' {Maybe Text
contextArn :: Maybe Text
$sel:contextArn:CreateContextResponse' :: CreateContextResponse -> Maybe Text
contextArn} -> Maybe Text
contextArn) (\s :: CreateContextResponse
s@CreateContextResponse' {} Maybe Text
a -> CreateContextResponse
s {$sel:contextArn:CreateContextResponse' :: Maybe Text
contextArn = Maybe Text
a} :: CreateContextResponse)
createContextResponse_httpStatus :: Lens.Lens' CreateContextResponse Prelude.Int
createContextResponse_httpStatus :: Lens' CreateContextResponse Int
createContextResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContextResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateContextResponse' :: CreateContextResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateContextResponse
s@CreateContextResponse' {} Int
a -> CreateContextResponse
s {$sel:httpStatus:CreateContextResponse' :: Int
httpStatus = Int
a} :: CreateContextResponse)
instance Prelude.NFData CreateContextResponse where
rnf :: CreateContextResponse -> ()
rnf CreateContextResponse' {Int
Maybe Text
httpStatus :: Int
contextArn :: Maybe Text
$sel:httpStatus:CreateContextResponse' :: CreateContextResponse -> Int
$sel:contextArn:CreateContextResponse' :: CreateContextResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contextArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus