{-# 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-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 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.Lens as Lens
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
(DeleteSourceCredentials -> DeleteSourceCredentials -> Bool)
-> (DeleteSourceCredentials -> DeleteSourceCredentials -> Bool)
-> Eq DeleteSourceCredentials
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]
(Int -> ReadS DeleteSourceCredentials)
-> ReadS [DeleteSourceCredentials]
-> ReadPrec DeleteSourceCredentials
-> ReadPrec [DeleteSourceCredentials]
-> Read 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
(Int -> DeleteSourceCredentials -> ShowS)
-> (DeleteSourceCredentials -> String)
-> ([DeleteSourceCredentials] -> ShowS)
-> Show DeleteSourceCredentials
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.
 DeleteSourceCredentials -> Rep DeleteSourceCredentials x)
-> (forall x.
    Rep DeleteSourceCredentials x -> DeleteSourceCredentials)
-> Generic DeleteSourceCredentials
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' :: Text -> DeleteSourceCredentials
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 :: (Text -> f Text)
-> DeleteSourceCredentials -> f DeleteSourceCredentials
deleteSourceCredentials_arn = (DeleteSourceCredentials -> Text)
-> (DeleteSourceCredentials -> Text -> DeleteSourceCredentials)
-> Lens DeleteSourceCredentials DeleteSourceCredentials Text Text
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 :: DeleteSourceCredentials -> Request DeleteSourceCredentials
request = Service
-> DeleteSourceCredentials -> Request DeleteSourceCredentials
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSourceCredentials
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceCredentials)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteSourceCredentials))
-> Logger
-> Service
-> Proxy DeleteSourceCredentials
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSourceCredentials)))
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 ->
          Maybe Text -> Int -> DeleteSourceCredentialsResponse
DeleteSourceCredentialsResponse'
            (Maybe Text -> Int -> DeleteSourceCredentialsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteSourceCredentialsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"arn")
            Either String (Int -> DeleteSourceCredentialsResponse)
-> Either String Int
-> Either String DeleteSourceCredentialsResponse
forall (f :: * -> *) a b. Applicative f => 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))
      )

instance Prelude.Hashable DeleteSourceCredentials

instance Prelude.NFData DeleteSourceCredentials

instance Core.ToHeaders DeleteSourceCredentials where
  toHeaders :: DeleteSourceCredentials -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteSourceCredentials -> 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
"CodeBuild_20161006.DeleteSourceCredentials" ::
                          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 DeleteSourceCredentials where
  toJSON :: DeleteSourceCredentials -> Value
toJSON DeleteSourceCredentials' {Text
arn :: Text
$sel:arn:DeleteSourceCredentials' :: DeleteSourceCredentials -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
      )

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

instance Core.ToQuery DeleteSourceCredentials where
  toQuery :: DeleteSourceCredentials -> QueryString
toQuery = QueryString -> DeleteSourceCredentials -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteSourceCredentialsResponse
 -> DeleteSourceCredentialsResponse -> Bool)
-> (DeleteSourceCredentialsResponse
    -> DeleteSourceCredentialsResponse -> Bool)
-> Eq DeleteSourceCredentialsResponse
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]
(Int -> ReadS DeleteSourceCredentialsResponse)
-> ReadS [DeleteSourceCredentialsResponse]
-> ReadPrec DeleteSourceCredentialsResponse
-> ReadPrec [DeleteSourceCredentialsResponse]
-> Read 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
(Int -> DeleteSourceCredentialsResponse -> ShowS)
-> (DeleteSourceCredentialsResponse -> String)
-> ([DeleteSourceCredentialsResponse] -> ShowS)
-> Show DeleteSourceCredentialsResponse
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.
 DeleteSourceCredentialsResponse
 -> Rep DeleteSourceCredentialsResponse x)
-> (forall x.
    Rep DeleteSourceCredentialsResponse x
    -> DeleteSourceCredentialsResponse)
-> Generic DeleteSourceCredentialsResponse
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' :: Maybe Text -> Int -> DeleteSourceCredentialsResponse
DeleteSourceCredentialsResponse'
    { $sel:arn:DeleteSourceCredentialsResponse' :: Maybe Text
arn =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> DeleteSourceCredentialsResponse
-> f DeleteSourceCredentialsResponse
deleteSourceCredentialsResponse_arn = (DeleteSourceCredentialsResponse -> Maybe Text)
-> (DeleteSourceCredentialsResponse
    -> Maybe Text -> DeleteSourceCredentialsResponse)
-> Lens
     DeleteSourceCredentialsResponse
     DeleteSourceCredentialsResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> DeleteSourceCredentialsResponse
-> f DeleteSourceCredentialsResponse
deleteSourceCredentialsResponse_httpStatus = (DeleteSourceCredentialsResponse -> Int)
-> (DeleteSourceCredentialsResponse
    -> Int -> DeleteSourceCredentialsResponse)
-> Lens
     DeleteSourceCredentialsResponse
     DeleteSourceCredentialsResponse
     Int
     Int
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