{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.DeleteCodeRepository
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified Git repository from your account.
module Amazonka.SageMaker.DeleteCodeRepository
  ( -- * Creating a Request
    DeleteCodeRepository (..),
    newDeleteCodeRepository,

    -- * Request Lenses
    deleteCodeRepository_codeRepositoryName,

    -- * Destructuring the Response
    DeleteCodeRepositoryResponse (..),
    newDeleteCodeRepositoryResponse,
  )
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

-- | /See:/ 'newDeleteCodeRepository' smart constructor.
data DeleteCodeRepository = DeleteCodeRepository'
  { -- | The name of the Git repository to delete.
    DeleteCodeRepository -> Text
codeRepositoryName :: Prelude.Text
  }
  deriving (DeleteCodeRepository -> DeleteCodeRepository -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCodeRepository -> DeleteCodeRepository -> Bool
$c/= :: DeleteCodeRepository -> DeleteCodeRepository -> Bool
== :: DeleteCodeRepository -> DeleteCodeRepository -> Bool
$c== :: DeleteCodeRepository -> DeleteCodeRepository -> Bool
Prelude.Eq, ReadPrec [DeleteCodeRepository]
ReadPrec DeleteCodeRepository
Int -> ReadS DeleteCodeRepository
ReadS [DeleteCodeRepository]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCodeRepository]
$creadListPrec :: ReadPrec [DeleteCodeRepository]
readPrec :: ReadPrec DeleteCodeRepository
$creadPrec :: ReadPrec DeleteCodeRepository
readList :: ReadS [DeleteCodeRepository]
$creadList :: ReadS [DeleteCodeRepository]
readsPrec :: Int -> ReadS DeleteCodeRepository
$creadsPrec :: Int -> ReadS DeleteCodeRepository
Prelude.Read, Int -> DeleteCodeRepository -> ShowS
[DeleteCodeRepository] -> ShowS
DeleteCodeRepository -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCodeRepository] -> ShowS
$cshowList :: [DeleteCodeRepository] -> ShowS
show :: DeleteCodeRepository -> String
$cshow :: DeleteCodeRepository -> String
showsPrec :: Int -> DeleteCodeRepository -> ShowS
$cshowsPrec :: Int -> DeleteCodeRepository -> ShowS
Prelude.Show, forall x. Rep DeleteCodeRepository x -> DeleteCodeRepository
forall x. DeleteCodeRepository -> Rep DeleteCodeRepository x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteCodeRepository x -> DeleteCodeRepository
$cfrom :: forall x. DeleteCodeRepository -> Rep DeleteCodeRepository x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCodeRepository' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'codeRepositoryName', 'deleteCodeRepository_codeRepositoryName' - The name of the Git repository to delete.
newDeleteCodeRepository ::
  -- | 'codeRepositoryName'
  Prelude.Text ->
  DeleteCodeRepository
newDeleteCodeRepository :: Text -> DeleteCodeRepository
newDeleteCodeRepository Text
pCodeRepositoryName_ =
  DeleteCodeRepository'
    { $sel:codeRepositoryName:DeleteCodeRepository' :: Text
codeRepositoryName =
        Text
pCodeRepositoryName_
    }

-- | The name of the Git repository to delete.
deleteCodeRepository_codeRepositoryName :: Lens.Lens' DeleteCodeRepository Prelude.Text
deleteCodeRepository_codeRepositoryName :: Lens' DeleteCodeRepository Text
deleteCodeRepository_codeRepositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:DeleteCodeRepository' :: DeleteCodeRepository -> Text
codeRepositoryName} -> Text
codeRepositoryName) (\s :: DeleteCodeRepository
s@DeleteCodeRepository' {} Text
a -> DeleteCodeRepository
s {$sel:codeRepositoryName:DeleteCodeRepository' :: Text
codeRepositoryName = Text
a} :: DeleteCodeRepository)

instance Core.AWSRequest DeleteCodeRepository where
  type
    AWSResponse DeleteCodeRepository =
      DeleteCodeRepositoryResponse
  request :: (Service -> Service)
-> DeleteCodeRepository -> Request DeleteCodeRepository
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 DeleteCodeRepository
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCodeRepository)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull DeleteCodeRepositoryResponse
DeleteCodeRepositoryResponse'

instance Prelude.Hashable DeleteCodeRepository where
  hashWithSalt :: Int -> DeleteCodeRepository -> Int
hashWithSalt Int
_salt DeleteCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:DeleteCodeRepository' :: DeleteCodeRepository -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
codeRepositoryName

instance Prelude.NFData DeleteCodeRepository where
  rnf :: DeleteCodeRepository -> ()
rnf DeleteCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:DeleteCodeRepository' :: DeleteCodeRepository -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
codeRepositoryName

instance Data.ToHeaders DeleteCodeRepository where
  toHeaders :: DeleteCodeRepository -> [Header]
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 -> [Header]
Data.=# ( ByteString
"SageMaker.DeleteCodeRepository" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteCodeRepository where
  toJSON :: DeleteCodeRepository -> Value
toJSON DeleteCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:DeleteCodeRepository' :: DeleteCodeRepository -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"CodeRepositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
codeRepositoryName)
          ]
      )

instance Data.ToPath DeleteCodeRepository where
  toPath :: DeleteCodeRepository -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DeleteCodeRepository where
  toQuery :: DeleteCodeRepository -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDeleteCodeRepositoryResponse' smart constructor.
data DeleteCodeRepositoryResponse = DeleteCodeRepositoryResponse'
  {
  }
  deriving (DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
$c/= :: DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
== :: DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
$c== :: DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
Prelude.Eq, ReadPrec [DeleteCodeRepositoryResponse]
ReadPrec DeleteCodeRepositoryResponse
Int -> ReadS DeleteCodeRepositoryResponse
ReadS [DeleteCodeRepositoryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteCodeRepositoryResponse]
$creadListPrec :: ReadPrec [DeleteCodeRepositoryResponse]
readPrec :: ReadPrec DeleteCodeRepositoryResponse
$creadPrec :: ReadPrec DeleteCodeRepositoryResponse
readList :: ReadS [DeleteCodeRepositoryResponse]
$creadList :: ReadS [DeleteCodeRepositoryResponse]
readsPrec :: Int -> ReadS DeleteCodeRepositoryResponse
$creadsPrec :: Int -> ReadS DeleteCodeRepositoryResponse
Prelude.Read, Int -> DeleteCodeRepositoryResponse -> ShowS
[DeleteCodeRepositoryResponse] -> ShowS
DeleteCodeRepositoryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteCodeRepositoryResponse] -> ShowS
$cshowList :: [DeleteCodeRepositoryResponse] -> ShowS
show :: DeleteCodeRepositoryResponse -> String
$cshow :: DeleteCodeRepositoryResponse -> String
showsPrec :: Int -> DeleteCodeRepositoryResponse -> ShowS
$cshowsPrec :: Int -> DeleteCodeRepositoryResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteCodeRepositoryResponse x -> DeleteCodeRepositoryResponse
forall x.
DeleteCodeRepositoryResponse -> Rep DeleteCodeRepositoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteCodeRepositoryResponse x -> DeleteCodeRepositoryResponse
$cfrom :: forall x.
DeleteCodeRepositoryResponse -> Rep DeleteCodeRepositoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteCodeRepositoryResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newDeleteCodeRepositoryResponse ::
  DeleteCodeRepositoryResponse
newDeleteCodeRepositoryResponse :: DeleteCodeRepositoryResponse
newDeleteCodeRepositoryResponse =
  DeleteCodeRepositoryResponse
DeleteCodeRepositoryResponse'

instance Prelude.NFData DeleteCodeRepositoryResponse where
  rnf :: DeleteCodeRepositoryResponse -> ()
rnf DeleteCodeRepositoryResponse
_ = ()