{-# 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.CreateImage
(
CreateImage (..),
newCreateImage,
createImage_displayName,
createImage_description,
createImage_tags,
createImage_imageName,
createImage_roleArn,
CreateImageResponse (..),
newCreateImageResponse,
createImageResponse_imageArn,
createImageResponse_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 CreateImage = CreateImage'
{
CreateImage -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
CreateImage -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateImage -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateImage -> Text
imageName :: Prelude.Text,
CreateImage -> Text
roleArn :: Prelude.Text
}
deriving (CreateImage -> CreateImage -> Bool
(CreateImage -> CreateImage -> Bool)
-> (CreateImage -> CreateImage -> Bool) -> Eq CreateImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateImage -> CreateImage -> Bool
$c/= :: CreateImage -> CreateImage -> Bool
== :: CreateImage -> CreateImage -> Bool
$c== :: CreateImage -> CreateImage -> Bool
Prelude.Eq, ReadPrec [CreateImage]
ReadPrec CreateImage
Int -> ReadS CreateImage
ReadS [CreateImage]
(Int -> ReadS CreateImage)
-> ReadS [CreateImage]
-> ReadPrec CreateImage
-> ReadPrec [CreateImage]
-> Read CreateImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateImage]
$creadListPrec :: ReadPrec [CreateImage]
readPrec :: ReadPrec CreateImage
$creadPrec :: ReadPrec CreateImage
readList :: ReadS [CreateImage]
$creadList :: ReadS [CreateImage]
readsPrec :: Int -> ReadS CreateImage
$creadsPrec :: Int -> ReadS CreateImage
Prelude.Read, Int -> CreateImage -> ShowS
[CreateImage] -> ShowS
CreateImage -> String
(Int -> CreateImage -> ShowS)
-> (CreateImage -> String)
-> ([CreateImage] -> ShowS)
-> Show CreateImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateImage] -> ShowS
$cshowList :: [CreateImage] -> ShowS
show :: CreateImage -> String
$cshow :: CreateImage -> String
showsPrec :: Int -> CreateImage -> ShowS
$cshowsPrec :: Int -> CreateImage -> ShowS
Prelude.Show, (forall x. CreateImage -> Rep CreateImage x)
-> (forall x. Rep CreateImage x -> CreateImage)
-> Generic CreateImage
forall x. Rep CreateImage x -> CreateImage
forall x. CreateImage -> Rep CreateImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateImage x -> CreateImage
$cfrom :: forall x. CreateImage -> Rep CreateImage x
Prelude.Generic)
newCreateImage ::
Prelude.Text ->
Prelude.Text ->
CreateImage
newCreateImage :: Text -> Text -> CreateImage
newCreateImage Text
pImageName_ Text
pRoleArn_ =
CreateImage' :: Maybe Text
-> Maybe Text -> Maybe [Tag] -> Text -> Text -> CreateImage
CreateImage'
{ $sel:displayName:CreateImage' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateImage' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateImage' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:imageName:CreateImage' :: Text
imageName = Text
pImageName_,
$sel:roleArn:CreateImage' :: Text
roleArn = Text
pRoleArn_
}
createImage_displayName :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Text)
createImage_displayName :: (Maybe Text -> f (Maybe Text)) -> CreateImage -> f CreateImage
createImage_displayName = (CreateImage -> Maybe Text)
-> (CreateImage -> Maybe Text -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateImage' :: CreateImage -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateImage
s@CreateImage' {} Maybe Text
a -> CreateImage
s {$sel:displayName:CreateImage' :: Maybe Text
displayName = Maybe Text
a} :: CreateImage)
createImage_description :: Lens.Lens' CreateImage (Prelude.Maybe Prelude.Text)
createImage_description :: (Maybe Text -> f (Maybe Text)) -> CreateImage -> f CreateImage
createImage_description = (CreateImage -> Maybe Text)
-> (CreateImage -> Maybe Text -> CreateImage)
-> Lens CreateImage CreateImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe Text
description :: Maybe Text
$sel:description:CreateImage' :: CreateImage -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateImage
s@CreateImage' {} Maybe Text
a -> CreateImage
s {$sel:description:CreateImage' :: Maybe Text
description = Maybe Text
a} :: CreateImage)
createImage_tags :: Lens.Lens' CreateImage (Prelude.Maybe [Tag])
createImage_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateImage -> f CreateImage
createImage_tags = (CreateImage -> Maybe [Tag])
-> (CreateImage -> Maybe [Tag] -> CreateImage)
-> Lens CreateImage CreateImage (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateImage' :: CreateImage -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateImage
s@CreateImage' {} Maybe [Tag]
a -> CreateImage
s {$sel:tags:CreateImage' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateImage) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateImage -> f CreateImage)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateImage
-> f CreateImage
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
createImage_imageName :: Lens.Lens' CreateImage Prelude.Text
createImage_imageName :: (Text -> f Text) -> CreateImage -> f CreateImage
createImage_imageName = (CreateImage -> Text)
-> (CreateImage -> Text -> CreateImage)
-> Lens CreateImage CreateImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Text
imageName :: Text
$sel:imageName:CreateImage' :: CreateImage -> Text
imageName} -> Text
imageName) (\s :: CreateImage
s@CreateImage' {} Text
a -> CreateImage
s {$sel:imageName:CreateImage' :: Text
imageName = Text
a} :: CreateImage)
createImage_roleArn :: Lens.Lens' CreateImage Prelude.Text
createImage_roleArn :: (Text -> f Text) -> CreateImage -> f CreateImage
createImage_roleArn = (CreateImage -> Text)
-> (CreateImage -> Text -> CreateImage)
-> Lens CreateImage CreateImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImage' {Text
roleArn :: Text
$sel:roleArn:CreateImage' :: CreateImage -> Text
roleArn} -> Text
roleArn) (\s :: CreateImage
s@CreateImage' {} Text
a -> CreateImage
s {$sel:roleArn:CreateImage' :: Text
roleArn = Text
a} :: CreateImage)
instance Core.AWSRequest CreateImage where
type AWSResponse CreateImage = CreateImageResponse
request :: CreateImage -> Request CreateImage
request = Service -> CreateImage -> Request CreateImage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateImage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateImage))
-> Logger
-> Service
-> Proxy CreateImage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateImage)))
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 -> CreateImageResponse
CreateImageResponse'
(Maybe Text -> Int -> CreateImageResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateImageResponse)
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
"ImageArn")
Either String (Int -> CreateImageResponse)
-> Either String Int -> Either String CreateImageResponse
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 CreateImage
instance Prelude.NFData CreateImage
instance Core.ToHeaders CreateImage where
toHeaders :: CreateImage -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateImage -> 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.CreateImage" :: 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 CreateImage where
toJSON :: CreateImage -> Value
toJSON CreateImage' {Maybe [Tag]
Maybe Text
Text
roleArn :: Text
imageName :: Text
tags :: Maybe [Tag]
description :: Maybe Text
displayName :: Maybe Text
$sel:roleArn:CreateImage' :: CreateImage -> Text
$sel:imageName:CreateImage' :: CreateImage -> Text
$sel:tags:CreateImage' :: CreateImage -> Maybe [Tag]
$sel:description:CreateImage' :: CreateImage -> Maybe Text
$sel:displayName:CreateImage' :: CreateImage -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DisplayName" 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
displayName,
(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
"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
"ImageName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
imageName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn)
]
)
instance Core.ToPath CreateImage where
toPath :: CreateImage -> ByteString
toPath = ByteString -> CreateImage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateImage where
toQuery :: CreateImage -> QueryString
toQuery = QueryString -> CreateImage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateImageResponse = CreateImageResponse'
{
CreateImageResponse -> Maybe Text
imageArn :: Prelude.Maybe Prelude.Text,
CreateImageResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateImageResponse -> CreateImageResponse -> Bool
(CreateImageResponse -> CreateImageResponse -> Bool)
-> (CreateImageResponse -> CreateImageResponse -> Bool)
-> Eq CreateImageResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateImageResponse -> CreateImageResponse -> Bool
$c/= :: CreateImageResponse -> CreateImageResponse -> Bool
== :: CreateImageResponse -> CreateImageResponse -> Bool
$c== :: CreateImageResponse -> CreateImageResponse -> Bool
Prelude.Eq, ReadPrec [CreateImageResponse]
ReadPrec CreateImageResponse
Int -> ReadS CreateImageResponse
ReadS [CreateImageResponse]
(Int -> ReadS CreateImageResponse)
-> ReadS [CreateImageResponse]
-> ReadPrec CreateImageResponse
-> ReadPrec [CreateImageResponse]
-> Read CreateImageResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateImageResponse]
$creadListPrec :: ReadPrec [CreateImageResponse]
readPrec :: ReadPrec CreateImageResponse
$creadPrec :: ReadPrec CreateImageResponse
readList :: ReadS [CreateImageResponse]
$creadList :: ReadS [CreateImageResponse]
readsPrec :: Int -> ReadS CreateImageResponse
$creadsPrec :: Int -> ReadS CreateImageResponse
Prelude.Read, Int -> CreateImageResponse -> ShowS
[CreateImageResponse] -> ShowS
CreateImageResponse -> String
(Int -> CreateImageResponse -> ShowS)
-> (CreateImageResponse -> String)
-> ([CreateImageResponse] -> ShowS)
-> Show CreateImageResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateImageResponse] -> ShowS
$cshowList :: [CreateImageResponse] -> ShowS
show :: CreateImageResponse -> String
$cshow :: CreateImageResponse -> String
showsPrec :: Int -> CreateImageResponse -> ShowS
$cshowsPrec :: Int -> CreateImageResponse -> ShowS
Prelude.Show, (forall x. CreateImageResponse -> Rep CreateImageResponse x)
-> (forall x. Rep CreateImageResponse x -> CreateImageResponse)
-> Generic CreateImageResponse
forall x. Rep CreateImageResponse x -> CreateImageResponse
forall x. CreateImageResponse -> Rep CreateImageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateImageResponse x -> CreateImageResponse
$cfrom :: forall x. CreateImageResponse -> Rep CreateImageResponse x
Prelude.Generic)
newCreateImageResponse ::
Prelude.Int ->
CreateImageResponse
newCreateImageResponse :: Int -> CreateImageResponse
newCreateImageResponse Int
pHttpStatus_ =
CreateImageResponse' :: Maybe Text -> Int -> CreateImageResponse
CreateImageResponse'
{ $sel:imageArn:CreateImageResponse' :: Maybe Text
imageArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateImageResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createImageResponse_imageArn :: Lens.Lens' CreateImageResponse (Prelude.Maybe Prelude.Text)
createImageResponse_imageArn :: (Maybe Text -> f (Maybe Text))
-> CreateImageResponse -> f CreateImageResponse
createImageResponse_imageArn = (CreateImageResponse -> Maybe Text)
-> (CreateImageResponse -> Maybe Text -> CreateImageResponse)
-> Lens
CreateImageResponse CreateImageResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImageResponse' {Maybe Text
imageArn :: Maybe Text
$sel:imageArn:CreateImageResponse' :: CreateImageResponse -> Maybe Text
imageArn} -> Maybe Text
imageArn) (\s :: CreateImageResponse
s@CreateImageResponse' {} Maybe Text
a -> CreateImageResponse
s {$sel:imageArn:CreateImageResponse' :: Maybe Text
imageArn = Maybe Text
a} :: CreateImageResponse)
createImageResponse_httpStatus :: Lens.Lens' CreateImageResponse Prelude.Int
createImageResponse_httpStatus :: (Int -> f Int) -> CreateImageResponse -> f CreateImageResponse
createImageResponse_httpStatus = (CreateImageResponse -> Int)
-> (CreateImageResponse -> Int -> CreateImageResponse)
-> Lens CreateImageResponse CreateImageResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateImageResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateImageResponse' :: CreateImageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateImageResponse
s@CreateImageResponse' {} Int
a -> CreateImageResponse
s {$sel:httpStatus:CreateImageResponse' :: Int
httpStatus = Int
a} :: CreateImageResponse)
instance Prelude.NFData CreateImageResponse