{-# 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.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 CreateCodeRepository = CreateCodeRepository'
{
CreateCodeRepository -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCodeRepository -> Text
codeRepositoryName :: Prelude.Text,
CreateCodeRepository -> GitConfig
gitConfig :: GitConfig
}
deriving (CreateCodeRepository -> CreateCodeRepository -> Bool
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]
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
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. 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'
{ $sel:tags:CreateCodeRepository' :: Maybe [Tag]
tags = 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 :: Lens' CreateCodeRepository (Maybe [Tag])
createCodeRepository_tags = 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) 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
createCodeRepository_codeRepositoryName :: Lens.Lens' CreateCodeRepository Prelude.Text
createCodeRepository_codeRepositoryName :: Lens' CreateCodeRepository Text
createCodeRepository_codeRepositoryName = 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 :: Lens' CreateCodeRepository GitConfig
createCodeRepository_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 :: (Service -> Service)
-> CreateCodeRepository -> Request CreateCodeRepository
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 CreateCodeRepository
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCodeRepository)))
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 ->
Int -> Text -> CreateCodeRepositoryResponse
CreateCodeRepositoryResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"CodeRepositoryArn")
)
instance Prelude.Hashable CreateCodeRepository where
hashWithSalt :: Int -> CreateCodeRepository -> Int
hashWithSalt Int
_salt 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]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
codeRepositoryName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` GitConfig
gitConfig
instance Prelude.NFData CreateCodeRepository where
rnf :: CreateCodeRepository -> ()
rnf 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]
..} =
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
codeRepositoryName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf GitConfig
gitConfig
instance Data.ToHeaders CreateCodeRepository where
toHeaders :: CreateCodeRepository -> 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.CreateCodeRepository" ::
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 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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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
"CodeRepositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
codeRepositoryName),
forall a. a -> Maybe a
Prelude.Just (Key
"GitConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= GitConfig
gitConfig)
]
)
instance Data.ToPath CreateCodeRepository where
toPath :: CreateCodeRepository -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateCodeRepository where
toQuery :: CreateCodeRepository -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateCodeRepositoryResponse = CreateCodeRepositoryResponse'
{
CreateCodeRepositoryResponse -> Int
httpStatus :: Prelude.Int,
CreateCodeRepositoryResponse -> Text
codeRepositoryArn :: Prelude.Text
}
deriving (CreateCodeRepositoryResponse
-> CreateCodeRepositoryResponse -> Bool
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]
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
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.
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'
{ $sel:httpStatus:CreateCodeRepositoryResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:codeRepositoryArn:CreateCodeRepositoryResponse' :: Text
codeRepositoryArn = Text
pCodeRepositoryArn_
}
createCodeRepositoryResponse_httpStatus :: Lens.Lens' CreateCodeRepositoryResponse Prelude.Int
createCodeRepositoryResponse_httpStatus :: Lens' CreateCodeRepositoryResponse Int
createCodeRepositoryResponse_httpStatus = 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 :: Lens' CreateCodeRepositoryResponse Text
createCodeRepositoryResponse_codeRepositoryArn = 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 where
rnf :: CreateCodeRepositoryResponse -> ()
rnf CreateCodeRepositoryResponse' {Int
Text
codeRepositoryArn :: Text
httpStatus :: Int
$sel:codeRepositoryArn:CreateCodeRepositoryResponse' :: CreateCodeRepositoryResponse -> Text
$sel:httpStatus:CreateCodeRepositoryResponse' :: CreateCodeRepositoryResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
codeRepositoryArn