{-# 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.DeleteReport
-- 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 report.
module Amazonka.CodeBuild.DeleteReport
  ( -- * Creating a Request
    DeleteReport (..),
    newDeleteReport,

    -- * Request Lenses
    deleteReport_arn,

    -- * Destructuring the Response
    DeleteReportResponse (..),
    newDeleteReportResponse,

    -- * Response Lenses
    deleteReportResponse_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:/ 'newDeleteReport' smart constructor.
data DeleteReport = DeleteReport'
  { -- | The ARN of the report to delete.
    DeleteReport -> Text
arn :: Prelude.Text
  }
  deriving (DeleteReport -> DeleteReport -> Bool
(DeleteReport -> DeleteReport -> Bool)
-> (DeleteReport -> DeleteReport -> Bool) -> Eq DeleteReport
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReport -> DeleteReport -> Bool
$c/= :: DeleteReport -> DeleteReport -> Bool
== :: DeleteReport -> DeleteReport -> Bool
$c== :: DeleteReport -> DeleteReport -> Bool
Prelude.Eq, ReadPrec [DeleteReport]
ReadPrec DeleteReport
Int -> ReadS DeleteReport
ReadS [DeleteReport]
(Int -> ReadS DeleteReport)
-> ReadS [DeleteReport]
-> ReadPrec DeleteReport
-> ReadPrec [DeleteReport]
-> Read DeleteReport
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReport]
$creadListPrec :: ReadPrec [DeleteReport]
readPrec :: ReadPrec DeleteReport
$creadPrec :: ReadPrec DeleteReport
readList :: ReadS [DeleteReport]
$creadList :: ReadS [DeleteReport]
readsPrec :: Int -> ReadS DeleteReport
$creadsPrec :: Int -> ReadS DeleteReport
Prelude.Read, Int -> DeleteReport -> ShowS
[DeleteReport] -> ShowS
DeleteReport -> String
(Int -> DeleteReport -> ShowS)
-> (DeleteReport -> String)
-> ([DeleteReport] -> ShowS)
-> Show DeleteReport
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReport] -> ShowS
$cshowList :: [DeleteReport] -> ShowS
show :: DeleteReport -> String
$cshow :: DeleteReport -> String
showsPrec :: Int -> DeleteReport -> ShowS
$cshowsPrec :: Int -> DeleteReport -> ShowS
Prelude.Show, (forall x. DeleteReport -> Rep DeleteReport x)
-> (forall x. Rep DeleteReport x -> DeleteReport)
-> Generic DeleteReport
forall x. Rep DeleteReport x -> DeleteReport
forall x. DeleteReport -> Rep DeleteReport x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteReport x -> DeleteReport
$cfrom :: forall x. DeleteReport -> Rep DeleteReport x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReport' 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', 'deleteReport_arn' - The ARN of the report to delete.
newDeleteReport ::
  -- | 'arn'
  Prelude.Text ->
  DeleteReport
newDeleteReport :: Text -> DeleteReport
newDeleteReport Text
pArn_ = DeleteReport' :: Text -> DeleteReport
DeleteReport' {$sel:arn:DeleteReport' :: Text
arn = Text
pArn_}

-- | The ARN of the report to delete.
deleteReport_arn :: Lens.Lens' DeleteReport Prelude.Text
deleteReport_arn :: (Text -> f Text) -> DeleteReport -> f DeleteReport
deleteReport_arn = (DeleteReport -> Text)
-> (DeleteReport -> Text -> DeleteReport)
-> Lens DeleteReport DeleteReport Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReport' {Text
arn :: Text
$sel:arn:DeleteReport' :: DeleteReport -> Text
arn} -> Text
arn) (\s :: DeleteReport
s@DeleteReport' {} Text
a -> DeleteReport
s {$sel:arn:DeleteReport' :: Text
arn = Text
a} :: DeleteReport)

instance Core.AWSRequest DeleteReport where
  type AWSResponse DeleteReport = DeleteReportResponse
  request :: DeleteReport -> Request DeleteReport
request = Service -> DeleteReport -> Request DeleteReport
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteReport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteReport)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteReport))
-> Logger
-> Service
-> Proxy DeleteReport
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteReport)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteReportResponse
DeleteReportResponse'
            (Int -> DeleteReportResponse)
-> Either String Int -> Either String DeleteReportResponse
forall (f :: * -> *) a b. Functor 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 DeleteReport

instance Prelude.NFData DeleteReport

instance Core.ToHeaders DeleteReport where
  toHeaders :: DeleteReport -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteReport -> 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.DeleteReport" ::
                          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 DeleteReport where
  toJSON :: DeleteReport -> Value
toJSON DeleteReport' {Text
arn :: Text
$sel:arn:DeleteReport' :: DeleteReport -> 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 DeleteReport where
  toPath :: DeleteReport -> ByteString
toPath = ByteString -> DeleteReport -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DeleteReportResponse' 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:
--
-- 'httpStatus', 'deleteReportResponse_httpStatus' - The response's http status code.
newDeleteReportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteReportResponse
newDeleteReportResponse :: Int -> DeleteReportResponse
newDeleteReportResponse Int
pHttpStatus_ =
  DeleteReportResponse' :: Int -> DeleteReportResponse
DeleteReportResponse' {$sel:httpStatus:DeleteReportResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteReportResponse