{-# 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.CostAndUsageReport.DeleteReportDefinition
-- 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 report.
module Amazonka.CostAndUsageReport.DeleteReportDefinition
  ( -- * Creating a Request
    DeleteReportDefinition (..),
    newDeleteReportDefinition,

    -- * Request Lenses
    deleteReportDefinition_reportName,

    -- * Destructuring the Response
    DeleteReportDefinitionResponse (..),
    newDeleteReportDefinitionResponse,

    -- * Response Lenses
    deleteReportDefinitionResponse_responseMessage,
    deleteReportDefinitionResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CostAndUsageReport.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Deletes the specified report.
--
-- /See:/ 'newDeleteReportDefinition' smart constructor.
data DeleteReportDefinition = DeleteReportDefinition'
  { -- | The name of the report that you want to delete. The name must be unique,
    -- is case sensitive, and can\'t include spaces.
    DeleteReportDefinition -> Maybe Text
reportName :: Prelude.Maybe Prelude.Text
  }
  deriving (DeleteReportDefinition -> DeleteReportDefinition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReportDefinition -> DeleteReportDefinition -> Bool
$c/= :: DeleteReportDefinition -> DeleteReportDefinition -> Bool
== :: DeleteReportDefinition -> DeleteReportDefinition -> Bool
$c== :: DeleteReportDefinition -> DeleteReportDefinition -> Bool
Prelude.Eq, ReadPrec [DeleteReportDefinition]
ReadPrec DeleteReportDefinition
Int -> ReadS DeleteReportDefinition
ReadS [DeleteReportDefinition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReportDefinition]
$creadListPrec :: ReadPrec [DeleteReportDefinition]
readPrec :: ReadPrec DeleteReportDefinition
$creadPrec :: ReadPrec DeleteReportDefinition
readList :: ReadS [DeleteReportDefinition]
$creadList :: ReadS [DeleteReportDefinition]
readsPrec :: Int -> ReadS DeleteReportDefinition
$creadsPrec :: Int -> ReadS DeleteReportDefinition
Prelude.Read, Int -> DeleteReportDefinition -> ShowS
[DeleteReportDefinition] -> ShowS
DeleteReportDefinition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReportDefinition] -> ShowS
$cshowList :: [DeleteReportDefinition] -> ShowS
show :: DeleteReportDefinition -> String
$cshow :: DeleteReportDefinition -> String
showsPrec :: Int -> DeleteReportDefinition -> ShowS
$cshowsPrec :: Int -> DeleteReportDefinition -> ShowS
Prelude.Show, forall x. Rep DeleteReportDefinition x -> DeleteReportDefinition
forall x. DeleteReportDefinition -> Rep DeleteReportDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteReportDefinition x -> DeleteReportDefinition
$cfrom :: forall x. DeleteReportDefinition -> Rep DeleteReportDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReportDefinition' 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:
--
-- 'reportName', 'deleteReportDefinition_reportName' - The name of the report that you want to delete. The name must be unique,
-- is case sensitive, and can\'t include spaces.
newDeleteReportDefinition ::
  DeleteReportDefinition
newDeleteReportDefinition :: DeleteReportDefinition
newDeleteReportDefinition =
  DeleteReportDefinition'
    { $sel:reportName:DeleteReportDefinition' :: Maybe Text
reportName =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the report that you want to delete. The name must be unique,
-- is case sensitive, and can\'t include spaces.
deleteReportDefinition_reportName :: Lens.Lens' DeleteReportDefinition (Prelude.Maybe Prelude.Text)
deleteReportDefinition_reportName :: Lens' DeleteReportDefinition (Maybe Text)
deleteReportDefinition_reportName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReportDefinition' {Maybe Text
reportName :: Maybe Text
$sel:reportName:DeleteReportDefinition' :: DeleteReportDefinition -> Maybe Text
reportName} -> Maybe Text
reportName) (\s :: DeleteReportDefinition
s@DeleteReportDefinition' {} Maybe Text
a -> DeleteReportDefinition
s {$sel:reportName:DeleteReportDefinition' :: Maybe Text
reportName = Maybe Text
a} :: DeleteReportDefinition)

instance Core.AWSRequest DeleteReportDefinition where
  type
    AWSResponse DeleteReportDefinition =
      DeleteReportDefinitionResponse
  request :: (Service -> Service)
-> DeleteReportDefinition -> Request DeleteReportDefinition
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 DeleteReportDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteReportDefinition)))
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 -> DeleteReportDefinitionResponse
DeleteReportDefinitionResponse'
            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
"ResponseMessage")
            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 DeleteReportDefinition where
  hashWithSalt :: Int -> DeleteReportDefinition -> Int
hashWithSalt Int
_salt DeleteReportDefinition' {Maybe Text
reportName :: Maybe Text
$sel:reportName:DeleteReportDefinition' :: DeleteReportDefinition -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
reportName

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

instance Data.ToHeaders DeleteReportDefinition where
  toHeaders :: DeleteReportDefinition -> 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
"AWSOrigamiServiceGatewayService.DeleteReportDefinition" ::
                          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 DeleteReportDefinition where
  toJSON :: DeleteReportDefinition -> Value
toJSON DeleteReportDefinition' {Maybe Text
reportName :: Maybe Text
$sel:reportName:DeleteReportDefinition' :: DeleteReportDefinition -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"ReportName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
reportName]
      )

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

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

-- | If the action is successful, the service sends back an HTTP 200
-- response.
--
-- /See:/ 'newDeleteReportDefinitionResponse' smart constructor.
data DeleteReportDefinitionResponse = DeleteReportDefinitionResponse'
  { DeleteReportDefinitionResponse -> Maybe Text
responseMessage :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DeleteReportDefinitionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteReportDefinitionResponse
-> DeleteReportDefinitionResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteReportDefinitionResponse
-> DeleteReportDefinitionResponse -> Bool
$c/= :: DeleteReportDefinitionResponse
-> DeleteReportDefinitionResponse -> Bool
== :: DeleteReportDefinitionResponse
-> DeleteReportDefinitionResponse -> Bool
$c== :: DeleteReportDefinitionResponse
-> DeleteReportDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [DeleteReportDefinitionResponse]
ReadPrec DeleteReportDefinitionResponse
Int -> ReadS DeleteReportDefinitionResponse
ReadS [DeleteReportDefinitionResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteReportDefinitionResponse]
$creadListPrec :: ReadPrec [DeleteReportDefinitionResponse]
readPrec :: ReadPrec DeleteReportDefinitionResponse
$creadPrec :: ReadPrec DeleteReportDefinitionResponse
readList :: ReadS [DeleteReportDefinitionResponse]
$creadList :: ReadS [DeleteReportDefinitionResponse]
readsPrec :: Int -> ReadS DeleteReportDefinitionResponse
$creadsPrec :: Int -> ReadS DeleteReportDefinitionResponse
Prelude.Read, Int -> DeleteReportDefinitionResponse -> ShowS
[DeleteReportDefinitionResponse] -> ShowS
DeleteReportDefinitionResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteReportDefinitionResponse] -> ShowS
$cshowList :: [DeleteReportDefinitionResponse] -> ShowS
show :: DeleteReportDefinitionResponse -> String
$cshow :: DeleteReportDefinitionResponse -> String
showsPrec :: Int -> DeleteReportDefinitionResponse -> ShowS
$cshowsPrec :: Int -> DeleteReportDefinitionResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteReportDefinitionResponse x
-> DeleteReportDefinitionResponse
forall x.
DeleteReportDefinitionResponse
-> Rep DeleteReportDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteReportDefinitionResponse x
-> DeleteReportDefinitionResponse
$cfrom :: forall x.
DeleteReportDefinitionResponse
-> Rep DeleteReportDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteReportDefinitionResponse' 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:
--
-- 'responseMessage', 'deleteReportDefinitionResponse_responseMessage' - Undocumented member.
--
-- 'httpStatus', 'deleteReportDefinitionResponse_httpStatus' - The response's http status code.
newDeleteReportDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteReportDefinitionResponse
newDeleteReportDefinitionResponse :: Int -> DeleteReportDefinitionResponse
newDeleteReportDefinitionResponse Int
pHttpStatus_ =
  DeleteReportDefinitionResponse'
    { $sel:responseMessage:DeleteReportDefinitionResponse' :: Maybe Text
responseMessage =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteReportDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
deleteReportDefinitionResponse_responseMessage :: Lens.Lens' DeleteReportDefinitionResponse (Prelude.Maybe Prelude.Text)
deleteReportDefinitionResponse_responseMessage :: Lens' DeleteReportDefinitionResponse (Maybe Text)
deleteReportDefinitionResponse_responseMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteReportDefinitionResponse' {Maybe Text
responseMessage :: Maybe Text
$sel:responseMessage:DeleteReportDefinitionResponse' :: DeleteReportDefinitionResponse -> Maybe Text
responseMessage} -> Maybe Text
responseMessage) (\s :: DeleteReportDefinitionResponse
s@DeleteReportDefinitionResponse' {} Maybe Text
a -> DeleteReportDefinitionResponse
s {$sel:responseMessage:DeleteReportDefinitionResponse' :: Maybe Text
responseMessage = Maybe Text
a} :: DeleteReportDefinitionResponse)

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

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