{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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.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

-- | /See:/ 'newDeleteCodeRepository' smart constructor.
data DeleteCodeRepository = DeleteCodeRepository'
  { -- | The name of the Git repository to delete.
    DeleteCodeRepository -> Text
codeRepositoryName :: Prelude.Text
  }
  deriving (DeleteCodeRepository -> DeleteCodeRepository -> Bool
(DeleteCodeRepository -> DeleteCodeRepository -> Bool)
-> (DeleteCodeRepository -> DeleteCodeRepository -> Bool)
-> Eq DeleteCodeRepository
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]
(Int -> ReadS DeleteCodeRepository)
-> ReadS [DeleteCodeRepository]
-> ReadPrec DeleteCodeRepository
-> ReadPrec [DeleteCodeRepository]
-> Read 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
(Int -> DeleteCodeRepository -> ShowS)
-> (DeleteCodeRepository -> String)
-> ([DeleteCodeRepository] -> ShowS)
-> Show DeleteCodeRepository
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. DeleteCodeRepository -> Rep DeleteCodeRepository x)
-> (forall x. Rep DeleteCodeRepository x -> DeleteCodeRepository)
-> Generic DeleteCodeRepository
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' :: Text -> DeleteCodeRepository
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 :: (Text -> f Text) -> DeleteCodeRepository -> f DeleteCodeRepository
deleteCodeRepository_codeRepositoryName = (DeleteCodeRepository -> Text)
-> (DeleteCodeRepository -> Text -> DeleteCodeRepository)
-> Lens DeleteCodeRepository DeleteCodeRepository Text Text
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 :: DeleteCodeRepository -> Request DeleteCodeRepository
request = Service -> DeleteCodeRepository -> Request DeleteCodeRepository
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteCodeRepository
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCodeRepository)))
response =
    AWSResponse DeleteCodeRepository
-> Logger
-> Service
-> Proxy DeleteCodeRepository
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteCodeRepository)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeleteCodeRepository
DeleteCodeRepositoryResponse
DeleteCodeRepositoryResponse'

instance Prelude.Hashable DeleteCodeRepository

instance Prelude.NFData DeleteCodeRepository

instance Core.ToHeaders DeleteCodeRepository where
  toHeaders :: DeleteCodeRepository -> [Header]
toHeaders =
    [Header] -> DeleteCodeRepository -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"SageMaker.DeleteCodeRepository" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteCodeRepository where
  toJSON :: DeleteCodeRepository -> Value
toJSON DeleteCodeRepository' {Text
codeRepositoryName :: Text
$sel:codeRepositoryName:DeleteCodeRepository' :: DeleteCodeRepository -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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)
          ]
      )

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

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

-- | /See:/ 'newDeleteCodeRepositoryResponse' smart constructor.
data DeleteCodeRepositoryResponse = DeleteCodeRepositoryResponse'
  {
  }
  deriving (DeleteCodeRepositoryResponse
-> DeleteCodeRepositoryResponse -> Bool
(DeleteCodeRepositoryResponse
 -> DeleteCodeRepositoryResponse -> Bool)
-> (DeleteCodeRepositoryResponse
    -> DeleteCodeRepositoryResponse -> Bool)
-> Eq DeleteCodeRepositoryResponse
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]
(Int -> ReadS DeleteCodeRepositoryResponse)
-> ReadS [DeleteCodeRepositoryResponse]
-> ReadPrec DeleteCodeRepositoryResponse
-> ReadPrec [DeleteCodeRepositoryResponse]
-> Read 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
(Int -> DeleteCodeRepositoryResponse -> ShowS)
-> (DeleteCodeRepositoryResponse -> String)
-> ([DeleteCodeRepositoryResponse] -> ShowS)
-> Show DeleteCodeRepositoryResponse
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.
 DeleteCodeRepositoryResponse -> Rep DeleteCodeRepositoryResponse x)
-> (forall x.
    Rep DeleteCodeRepositoryResponse x -> DeleteCodeRepositoryResponse)
-> Generic DeleteCodeRepositoryResponse
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