{-# 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.CodeBuild.DeleteSourceCredentials
-- 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 a set of GitHub, GitHub Enterprise, or Bitbucket source
-- credentials.
module Amazonka.CodeBuild.DeleteSourceCredentials
  ( -- * Creating a Request
    DeleteSourceCredentials (..),
    newDeleteSourceCredentials,

    -- * Request Lenses
    deleteSourceCredentials_arn,

    -- * Destructuring the Response
    DeleteSourceCredentialsResponse (..),
    newDeleteSourceCredentialsResponse,

    -- * Response Lenses
    deleteSourceCredentialsResponse_arn,
    deleteSourceCredentialsResponse_httpStatus,
  )
where

import Amazonka.CodeBuild.Types
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

-- | /See:/ 'newDeleteSourceCredentials' smart constructor.
data DeleteSourceCredentials = DeleteSourceCredentials'
  { -- | The Amazon Resource Name (ARN) of the token.
    DeleteSourceCredentials -> Text
arn :: Prelude.Text
  }
  deriving (DeleteSourceCredentials -> DeleteSourceCredentials -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSourceCredentials -> DeleteSourceCredentials -> Bool
$c/= :: DeleteSourceCredentials -> DeleteSourceCredentials -> Bool
== :: DeleteSourceCredentials -> DeleteSourceCredentials -> Bool
$c== :: DeleteSourceCredentials -> DeleteSourceCredentials -> Bool
Prelude.Eq, ReadPrec [DeleteSourceCredentials]
ReadPrec DeleteSourceCredentials
Int -> ReadS DeleteSourceCredentials
ReadS [DeleteSourceCredentials]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSourceCredentials]
$creadListPrec :: ReadPrec [DeleteSourceCredentials]
readPrec :: ReadPrec DeleteSourceCredentials
$creadPrec :: ReadPrec DeleteSourceCredentials
readList :: ReadS [DeleteSourceCredentials]
$creadList :: ReadS [DeleteSourceCredentials]
readsPrec :: Int -> ReadS DeleteSourceCredentials
$creadsPrec :: Int -> ReadS DeleteSourceCredentials
Prelude.Read, Int -> DeleteSourceCredentials -> ShowS
[DeleteSourceCredentials] -> ShowS
DeleteSourceCredentials -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSourceCredentials] -> ShowS
$cshowList :: [DeleteSourceCredentials] -> ShowS
show :: DeleteSourceCredentials -> String
$cshow :: DeleteSourceCredentials -> String
showsPrec :: Int -> DeleteSourceCredentials -> ShowS
$cshowsPrec :: Int -> DeleteSourceCredentials -> ShowS
Prelude.Show, forall x. Rep DeleteSourceCredentials x -> DeleteSourceCredentials
forall x. DeleteSourceCredentials -> Rep DeleteSourceCredentials x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSourceCredentials x -> DeleteSourceCredentials
$cfrom :: forall x. DeleteSourceCredentials -> Rep DeleteSourceCredentials x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSourceCredentials' 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:
--
-- 'arn', 'deleteSourceCredentials_arn' - The Amazon Resource Name (ARN) of the token.
newDeleteSourceCredentials ::
  -- | 'arn'
  Prelude.Text ->
  DeleteSourceCredentials
newDeleteSourceCredentials :: Text -> DeleteSourceCredentials
newDeleteSourceCredentials Text
pArn_ =
  DeleteSourceCredentials' {$sel:arn:DeleteSourceCredentials' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the token.
deleteSourceCredentials_arn :: Lens.Lens' DeleteSourceCredentials Prelude.Text
deleteSourceCredentials_arn :: Lens' DeleteSourceCredentials Text
deleteSourceCredentials_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSourceCredentials' {Text
arn :: Text
$sel:arn:DeleteSourceCredentials' :: DeleteSourceCredentials -> Text
arn} -> Text
arn) (\s :: DeleteSourceCredentials
s@DeleteSourceCredentials' {} Text
a -> DeleteSourceCredentials
s {$sel:arn:DeleteSourceCredentials' :: Text
arn = Text
a} :: DeleteSourceCredentials)

instance Core.AWSRequest DeleteSourceCredentials where
  type
    AWSResponse DeleteSourceCredentials =
      DeleteSourceCredentialsResponse
  request :: (Service -> Service)
-> DeleteSourceCredentials -> Request DeleteSourceCredentials
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 DeleteSourceCredentials
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceCredentials)))
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 ->
          Maybe Text -> Int -> DeleteSourceCredentialsResponse
DeleteSourceCredentialsResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"arn")
            forall (f :: * -> *) a b. Applicative f => 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))
      )

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

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

instance Data.ToHeaders DeleteSourceCredentials where
  toHeaders :: DeleteSourceCredentials -> 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
"CodeBuild_20161006.DeleteSourceCredentials" ::
                          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 DeleteSourceCredentials where
  toJSON :: DeleteSourceCredentials -> Value
toJSON DeleteSourceCredentials' {Text
arn :: Text
$sel:arn:DeleteSourceCredentials' :: DeleteSourceCredentials -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

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

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

-- | /See:/ 'newDeleteSourceCredentialsResponse' smart constructor.
data DeleteSourceCredentialsResponse = DeleteSourceCredentialsResponse'
  { -- | The Amazon Resource Name (ARN) of the token.
    DeleteSourceCredentialsResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteSourceCredentialsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteSourceCredentialsResponse
-> DeleteSourceCredentialsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSourceCredentialsResponse
-> DeleteSourceCredentialsResponse -> Bool
$c/= :: DeleteSourceCredentialsResponse
-> DeleteSourceCredentialsResponse -> Bool
== :: DeleteSourceCredentialsResponse
-> DeleteSourceCredentialsResponse -> Bool
$c== :: DeleteSourceCredentialsResponse
-> DeleteSourceCredentialsResponse -> Bool
Prelude.Eq, ReadPrec [DeleteSourceCredentialsResponse]
ReadPrec DeleteSourceCredentialsResponse
Int -> ReadS DeleteSourceCredentialsResponse
ReadS [DeleteSourceCredentialsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSourceCredentialsResponse]
$creadListPrec :: ReadPrec [DeleteSourceCredentialsResponse]
readPrec :: ReadPrec DeleteSourceCredentialsResponse
$creadPrec :: ReadPrec DeleteSourceCredentialsResponse
readList :: ReadS [DeleteSourceCredentialsResponse]
$creadList :: ReadS [DeleteSourceCredentialsResponse]
readsPrec :: Int -> ReadS DeleteSourceCredentialsResponse
$creadsPrec :: Int -> ReadS DeleteSourceCredentialsResponse
Prelude.Read, Int -> DeleteSourceCredentialsResponse -> ShowS
[DeleteSourceCredentialsResponse] -> ShowS
DeleteSourceCredentialsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSourceCredentialsResponse] -> ShowS
$cshowList :: [DeleteSourceCredentialsResponse] -> ShowS
show :: DeleteSourceCredentialsResponse -> String
$cshow :: DeleteSourceCredentialsResponse -> String
showsPrec :: Int -> DeleteSourceCredentialsResponse -> ShowS
$cshowsPrec :: Int -> DeleteSourceCredentialsResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteSourceCredentialsResponse x
-> DeleteSourceCredentialsResponse
forall x.
DeleteSourceCredentialsResponse
-> Rep DeleteSourceCredentialsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteSourceCredentialsResponse x
-> DeleteSourceCredentialsResponse
$cfrom :: forall x.
DeleteSourceCredentialsResponse
-> Rep DeleteSourceCredentialsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSourceCredentialsResponse' 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:
--
-- 'arn', 'deleteSourceCredentialsResponse_arn' - The Amazon Resource Name (ARN) of the token.
--
-- 'httpStatus', 'deleteSourceCredentialsResponse_httpStatus' - The response's http status code.
newDeleteSourceCredentialsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteSourceCredentialsResponse
newDeleteSourceCredentialsResponse :: Int -> DeleteSourceCredentialsResponse
newDeleteSourceCredentialsResponse Int
pHttpStatus_ =
  DeleteSourceCredentialsResponse'
    { $sel:arn:DeleteSourceCredentialsResponse' :: Maybe Text
arn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteSourceCredentialsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the token.
deleteSourceCredentialsResponse_arn :: Lens.Lens' DeleteSourceCredentialsResponse (Prelude.Maybe Prelude.Text)
deleteSourceCredentialsResponse_arn :: Lens' DeleteSourceCredentialsResponse (Maybe Text)
deleteSourceCredentialsResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSourceCredentialsResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:DeleteSourceCredentialsResponse' :: DeleteSourceCredentialsResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DeleteSourceCredentialsResponse
s@DeleteSourceCredentialsResponse' {} Maybe Text
a -> DeleteSourceCredentialsResponse
s {$sel:arn:DeleteSourceCredentialsResponse' :: Maybe Text
arn = Maybe Text
a} :: DeleteSourceCredentialsResponse)

-- | The response's http status code.
deleteSourceCredentialsResponse_httpStatus :: Lens.Lens' DeleteSourceCredentialsResponse Prelude.Int
deleteSourceCredentialsResponse_httpStatus :: Lens' DeleteSourceCredentialsResponse Int
deleteSourceCredentialsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSourceCredentialsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteSourceCredentialsResponse' :: DeleteSourceCredentialsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteSourceCredentialsResponse
s@DeleteSourceCredentialsResponse' {} Int
a -> DeleteSourceCredentialsResponse
s {$sel:httpStatus:DeleteSourceCredentialsResponse' :: Int
httpStatus = Int
a} :: DeleteSourceCredentialsResponse)

instance
  Prelude.NFData
    DeleteSourceCredentialsResponse
  where
  rnf :: DeleteSourceCredentialsResponse -> ()
rnf DeleteSourceCredentialsResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:DeleteSourceCredentialsResponse' :: DeleteSourceCredentialsResponse -> Int
$sel:arn:DeleteSourceCredentialsResponse' :: DeleteSourceCredentialsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus