{-# 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.CreateCodeRepository
(
CreateCodeRepository (..),
newCreateCodeRepository,
createCodeRepository_tags,
createCodeRepository_codeRepositoryName,
createCodeRepository_gitConfig,
CreateCodeRepositoryResponse (..),
newCreateCodeRepositoryResponse,
createCodeRepositoryResponse_httpStatus,
createCodeRepositoryResponse_codeRepositoryArn,
)
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 CreateCodeRepository = CreateCodeRepository'
{
CreateCodeRepository -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCodeRepository -> Text
codeRepositoryName :: Prelude.Text,
CreateCodeRepository -> GitConfig
gitConfig :: GitConfig
}
deriving (CreateCodeRepository -> CreateCodeRepository -> Bool
(CreateCodeRepository -> CreateCodeRepository -> Bool)
-> (CreateCodeRepository -> CreateCodeRepository -> Bool)
-> Eq CreateCodeRepository
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCodeRepository -> CreateCodeRepository -> Bool
$c/= :: CreateCodeRepository -> CreateCodeRepository -> Bool
== :: CreateCodeRepository -> CreateCodeRepository -> Bool
$c== :: CreateCodeRepository -> CreateCodeRepository -> Bool
Prelude.Eq, ReadPrec [CreateCodeRepository]
ReadPrec CreateCodeRepository
Int -> ReadS CreateCodeRepository
ReadS [CreateCodeRepository]
(Int -> ReadS CreateCodeRepository)
-> ReadS [CreateCodeRepository]
-> ReadPrec CreateCodeRepository
-> ReadPrec [CreateCodeRepository]
-> Read CreateCodeRepository
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCodeRepository]
$creadListPrec :: ReadPrec [CreateCodeRepository]
readPrec :: ReadPrec CreateCodeRepository
$creadPrec :: ReadPrec CreateCodeRepository
readList :: ReadS [CreateCodeRepository]
$creadList :: ReadS [CreateCodeRepository]
readsPrec :: Int -> ReadS CreateCodeRepository
$creadsPrec :: Int -> ReadS CreateCodeRepository
Prelude.Read, Int -> CreateCodeRepository -> ShowS
[CreateCodeRepository] -> ShowS
CreateCodeRepository -> String
(Int -> CreateCodeRepository -> ShowS)
-> (CreateCodeRepository -> String)
-> ([CreateCodeRepository] -> ShowS)
-> Show CreateCodeRepository
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCodeRepository] -> ShowS
$cshowList :: [CreateCodeRepository] -> ShowS
show :: CreateCodeRepository -> String
$cshow :: CreateCodeRepository -> String
showsPrec :: Int -> CreateCodeRepository -> ShowS
$cshowsPrec :: Int -> CreateCodeRepository -> ShowS
Prelude.Show, (forall x. CreateCodeRepository -> Rep CreateCodeRepository x)
-> (forall x. Rep CreateCodeRepository x -> CreateCodeRepository)
-> Generic CreateCodeRepository
forall x. Rep CreateCodeRepository x -> CreateCodeRepository
forall x. CreateCodeRepository -> Rep CreateCodeRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCodeRepository x -> CreateCodeRepository
$cfrom :: forall x. CreateCodeRepository -> Rep CreateCodeRepository x
Prelude.Generic)
newCreateCodeRepository ::
Prelude.Text ->
GitConfig ->
CreateCodeRepository
newCreateCodeRepository :: Text -> GitConfig -> CreateCodeRepository
newCreateCodeRepository
Text
pCodeRepositoryName_
GitConfig
pGitConfig_ =
CreateCodeRepository' :: Maybe [Tag] -> Text -> GitConfig -> CreateCodeRepository
CreateCodeRepository'
{ $sel:tags:CreateCodeRepository' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:codeRepositoryName:CreateCodeRepository' :: Text
codeRepositoryName = Text
pCodeRepositoryName_,
$sel:gitConfig:CreateCodeRepository' :: GitConfig
gitConfig = GitConfig
pGitConfig_
}
createCodeRepository_tags :: Lens.Lens' CreateCodeRepository (Prelude.Maybe [Tag])
createCodeRepository_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCodeRepository -> f CreateCodeRepository
createCodeRepository_tags = (CreateCodeRepository -> Maybe [Tag])
-> (CreateCodeRepository -> Maybe [Tag] -> CreateCodeRepository)
-> Lens
CreateCodeRepository
CreateCodeRepository
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeRepository' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCodeRepository' :: CreateCodeRepository -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCodeRepository
s@CreateCodeRepository' {} Maybe [Tag]
a -> CreateCodeRepository
s {$sel:tags:CreateCodeRepository' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCodeRepository) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCodeRepository -> f CreateCodeRepository)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCodeRepository
-> f CreateCodeRepository
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
createCodeRepository_codeRepositoryName :: Lens.Lens' CreateCodeRepository Prelude.Text
createCodeRepository_codeRepositoryName :: (Text -> f Text) -> CreateCodeRepository -> f CreateCodeRepository
createCodeRepository_codeRepositoryName = (CreateCodeRepository -> Text)
-> (CreateCodeRepository -> Text -> CreateCodeRepository)
-> Lens CreateCodeRepository CreateCodeRepository Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:CreateCodeRepository' :: CreateCodeRepository -> Text
codeRepositoryName} -> Text
codeRepositoryName) (\s :: CreateCodeRepository
s@CreateCodeRepository' {} Text
a -> CreateCodeRepository
s {$sel:codeRepositoryName:CreateCodeRepository' :: Text
codeRepositoryName = Text
a} :: CreateCodeRepository)
createCodeRepository_gitConfig :: Lens.Lens' CreateCodeRepository GitConfig
createCodeRepository_gitConfig :: (GitConfig -> f GitConfig)
-> CreateCodeRepository -> f CreateCodeRepository
createCodeRepository_gitConfig = (CreateCodeRepository -> GitConfig)
-> (CreateCodeRepository -> GitConfig -> CreateCodeRepository)
-> Lens
CreateCodeRepository CreateCodeRepository GitConfig GitConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeRepository' {GitConfig
gitConfig :: GitConfig
$sel:gitConfig:CreateCodeRepository' :: CreateCodeRepository -> GitConfig
gitConfig} -> GitConfig
gitConfig) (\s :: CreateCodeRepository
s@CreateCodeRepository' {} GitConfig
a -> CreateCodeRepository
s {$sel:gitConfig:CreateCodeRepository' :: GitConfig
gitConfig = GitConfig
a} :: CreateCodeRepository)
instance Core.AWSRequest CreateCodeRepository where
type
AWSResponse CreateCodeRepository =
CreateCodeRepositoryResponse
request :: CreateCodeRepository -> Request CreateCodeRepository
request = Service -> CreateCodeRepository -> Request CreateCodeRepository
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCodeRepository
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCodeRepository)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCodeRepository))
-> Logger
-> Service
-> Proxy CreateCodeRepository
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCodeRepository)))
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 -> CreateCodeRepositoryResponse
CreateCodeRepositoryResponse'
(Int -> Text -> CreateCodeRepositoryResponse)
-> Either String Int
-> Either String (Text -> CreateCodeRepositoryResponse)
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 -> CreateCodeRepositoryResponse)
-> Either String Text -> Either String CreateCodeRepositoryResponse
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
"CodeRepositoryArn")
)
instance Prelude.Hashable CreateCodeRepository
instance Prelude.NFData CreateCodeRepository
instance Core.ToHeaders CreateCodeRepository where
toHeaders :: CreateCodeRepository -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCodeRepository -> 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.CreateCodeRepository" ::
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 CreateCodeRepository where
toJSON :: CreateCodeRepository -> Value
toJSON CreateCodeRepository' {Maybe [Tag]
Text
GitConfig
gitConfig :: GitConfig
codeRepositoryName :: Text
tags :: Maybe [Tag]
$sel:gitConfig:CreateCodeRepository' :: CreateCodeRepository -> GitConfig
$sel:codeRepositoryName:CreateCodeRepository' :: CreateCodeRepository -> Text
$sel:tags:CreateCodeRepository' :: CreateCodeRepository -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"CodeRepositoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
codeRepositoryName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GitConfig" Text -> GitConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= GitConfig
gitConfig)
]
)
instance Core.ToPath CreateCodeRepository where
toPath :: CreateCodeRepository -> ByteString
toPath = ByteString -> CreateCodeRepository -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCodeRepository where
toQuery :: CreateCodeRepository -> QueryString
toQuery = QueryString -> CreateCodeRepository -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCodeRepositoryResponse = CreateCodeRepositoryResponse'
{
CreateCodeRepositoryResponse -> Int
httpStatus :: Prelude.Int,
CreateCodeRepositoryResponse -> Text
codeRepositoryArn :: Prelude.Text
}
deriving (CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
(CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool)
-> (CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool)
-> Eq CreateCodeRepositoryResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
$c/= :: CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
== :: CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
$c== :: CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [CreateCodeRepositoryResponse]
ReadPrec CreateCodeRepositoryResponse
Int -> ReadS CreateCodeRepositoryResponse
ReadS [CreateCodeRepositoryResponse]
(Int -> ReadS CreateCodeRepositoryResponse)
-> ReadS [CreateCodeRepositoryResponse]
-> ReadPrec CreateCodeRepositoryResponse
-> ReadPrec [CreateCodeRepositoryResponse]
-> Read CreateCodeRepositoryResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCodeRepositoryResponse]
$creadListPrec :: ReadPrec [CreateCodeRepositoryResponse]
readPrec :: ReadPrec CreateCodeRepositoryResponse
$creadPrec :: ReadPrec CreateCodeRepositoryResponse
readList :: ReadS [CreateCodeRepositoryResponse]
$creadList :: ReadS [CreateCodeRepositoryResponse]
readsPrec :: Int -> ReadS CreateCodeRepositoryResponse
$creadsPrec :: Int -> ReadS CreateCodeRepositoryResponse
Prelude.Read, Int -> CreateCodeRepositoryResponse -> ShowS
[CreateCodeRepositoryResponse] -> ShowS
CreateCodeRepositoryResponse -> String
(Int -> CreateCodeRepositoryResponse -> ShowS)
-> (CreateCodeRepositoryResponse -> String)
-> ([CreateCodeRepositoryResponse] -> ShowS)
-> Show CreateCodeRepositoryResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCodeRepositoryResponse] -> ShowS
$cshowList :: [CreateCodeRepositoryResponse] -> ShowS
show :: CreateCodeRepositoryResponse -> String
$cshow :: CreateCodeRepositoryResponse -> String
showsPrec :: Int -> CreateCodeRepositoryResponse -> ShowS
$cshowsPrec :: Int -> CreateCodeRepositoryResponse -> ShowS
Prelude.Show, (forall x.
CreateCodeRepositoryResponse -> Rep CreateCodeRepositoryResponse x)
-> (forall x.
Rep CreateCodeRepositoryResponse x -> CreateCodeRepositoryResponse)
-> Generic CreateCodeRepositoryResponse
forall x.
Rep CreateCodeRepositoryResponse x -> CreateCodeRepositoryResponse
forall x.
CreateCodeRepositoryResponse -> Rep CreateCodeRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCodeRepositoryResponse x -> CreateCodeRepositoryResponse
$cfrom :: forall x.
CreateCodeRepositoryResponse -> Rep CreateCodeRepositoryResponse x
Prelude.Generic)
newCreateCodeRepositoryResponse ::
Prelude.Int ->
Prelude.Text ->
CreateCodeRepositoryResponse
newCreateCodeRepositoryResponse :: Int -> Text -> CreateCodeRepositoryResponse
newCreateCodeRepositoryResponse
Int
pHttpStatus_
Text
pCodeRepositoryArn_ =
CreateCodeRepositoryResponse' :: Int -> Text -> CreateCodeRepositoryResponse
CreateCodeRepositoryResponse'
{ $sel:httpStatus:CreateCodeRepositoryResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:codeRepositoryArn:CreateCodeRepositoryResponse' :: Text
codeRepositoryArn = Text
pCodeRepositoryArn_
}
createCodeRepositoryResponse_httpStatus :: Lens.Lens' CreateCodeRepositoryResponse Prelude.Int
createCodeRepositoryResponse_httpStatus :: (Int -> f Int)
-> CreateCodeRepositoryResponse -> f CreateCodeRepositoryResponse
createCodeRepositoryResponse_httpStatus = (CreateCodeRepositoryResponse -> Int)
-> (CreateCodeRepositoryResponse
-> Int -> CreateCodeRepositoryResponse)
-> Lens
CreateCodeRepositoryResponse CreateCodeRepositoryResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeRepositoryResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCodeRepositoryResponse' :: CreateCodeRepositoryResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCodeRepositoryResponse
s@CreateCodeRepositoryResponse' {} Int
a -> CreateCodeRepositoryResponse
s {$sel:httpStatus:CreateCodeRepositoryResponse' :: Int
httpStatus = Int
a} :: CreateCodeRepositoryResponse)
createCodeRepositoryResponse_codeRepositoryArn :: Lens.Lens' CreateCodeRepositoryResponse Prelude.Text
createCodeRepositoryResponse_codeRepositoryArn :: (Text -> f Text)
-> CreateCodeRepositoryResponse -> f CreateCodeRepositoryResponse
createCodeRepositoryResponse_codeRepositoryArn = (CreateCodeRepositoryResponse -> Text)
-> (CreateCodeRepositoryResponse
-> Text -> CreateCodeRepositoryResponse)
-> Lens
CreateCodeRepositoryResponse CreateCodeRepositoryResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCodeRepositoryResponse' {Text
codeRepositoryArn :: Text
$sel:codeRepositoryArn:CreateCodeRepositoryResponse' :: CreateCodeRepositoryResponse -> Text
codeRepositoryArn} -> Text
codeRepositoryArn) (\s :: CreateCodeRepositoryResponse
s@CreateCodeRepositoryResponse' {} Text
a -> CreateCodeRepositoryResponse
s {$sel:codeRepositoryArn:CreateCodeRepositoryResponse' :: Text
codeRepositoryArn = Text
a} :: CreateCodeRepositoryResponse)
instance Prelude.NFData CreateCodeRepositoryResponse