{-# 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.BillingConductor.DeleteBillingGroup
-- 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 billing group.
module Amazonka.BillingConductor.DeleteBillingGroup
  ( -- * Creating a Request
    DeleteBillingGroup (..),
    newDeleteBillingGroup,

    -- * Request Lenses
    deleteBillingGroup_arn,

    -- * Destructuring the Response
    DeleteBillingGroupResponse (..),
    newDeleteBillingGroupResponse,

    -- * Response Lenses
    deleteBillingGroupResponse_arn,
    deleteBillingGroupResponse_httpStatus,
  )
where

import Amazonka.BillingConductor.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:/ 'newDeleteBillingGroup' smart constructor.
data DeleteBillingGroup = DeleteBillingGroup'
  { -- | The Amazon Resource Name (ARN) of the billing group that you\'re
    -- deleting.
    DeleteBillingGroup -> Text
arn :: Prelude.Text
  }
  deriving (DeleteBillingGroup -> DeleteBillingGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBillingGroup -> DeleteBillingGroup -> Bool
$c/= :: DeleteBillingGroup -> DeleteBillingGroup -> Bool
== :: DeleteBillingGroup -> DeleteBillingGroup -> Bool
$c== :: DeleteBillingGroup -> DeleteBillingGroup -> Bool
Prelude.Eq, ReadPrec [DeleteBillingGroup]
ReadPrec DeleteBillingGroup
Int -> ReadS DeleteBillingGroup
ReadS [DeleteBillingGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBillingGroup]
$creadListPrec :: ReadPrec [DeleteBillingGroup]
readPrec :: ReadPrec DeleteBillingGroup
$creadPrec :: ReadPrec DeleteBillingGroup
readList :: ReadS [DeleteBillingGroup]
$creadList :: ReadS [DeleteBillingGroup]
readsPrec :: Int -> ReadS DeleteBillingGroup
$creadsPrec :: Int -> ReadS DeleteBillingGroup
Prelude.Read, Int -> DeleteBillingGroup -> ShowS
[DeleteBillingGroup] -> ShowS
DeleteBillingGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBillingGroup] -> ShowS
$cshowList :: [DeleteBillingGroup] -> ShowS
show :: DeleteBillingGroup -> String
$cshow :: DeleteBillingGroup -> String
showsPrec :: Int -> DeleteBillingGroup -> ShowS
$cshowsPrec :: Int -> DeleteBillingGroup -> ShowS
Prelude.Show, forall x. Rep DeleteBillingGroup x -> DeleteBillingGroup
forall x. DeleteBillingGroup -> Rep DeleteBillingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBillingGroup x -> DeleteBillingGroup
$cfrom :: forall x. DeleteBillingGroup -> Rep DeleteBillingGroup x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBillingGroup' 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', 'deleteBillingGroup_arn' - The Amazon Resource Name (ARN) of the billing group that you\'re
-- deleting.
newDeleteBillingGroup ::
  -- | 'arn'
  Prelude.Text ->
  DeleteBillingGroup
newDeleteBillingGroup :: Text -> DeleteBillingGroup
newDeleteBillingGroup Text
pArn_ =
  DeleteBillingGroup' {$sel:arn:DeleteBillingGroup' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the billing group that you\'re
-- deleting.
deleteBillingGroup_arn :: Lens.Lens' DeleteBillingGroup Prelude.Text
deleteBillingGroup_arn :: Lens' DeleteBillingGroup Text
deleteBillingGroup_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBillingGroup' {Text
arn :: Text
$sel:arn:DeleteBillingGroup' :: DeleteBillingGroup -> Text
arn} -> Text
arn) (\s :: DeleteBillingGroup
s@DeleteBillingGroup' {} Text
a -> DeleteBillingGroup
s {$sel:arn:DeleteBillingGroup' :: Text
arn = Text
a} :: DeleteBillingGroup)

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

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

instance Data.ToHeaders DeleteBillingGroup where
  toHeaders :: DeleteBillingGroup -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DeleteBillingGroup where
  toJSON :: DeleteBillingGroup -> Value
toJSON DeleteBillingGroup' {Text
arn :: Text
$sel:arn:DeleteBillingGroup' :: DeleteBillingGroup -> 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 DeleteBillingGroup where
  toPath :: DeleteBillingGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/delete-billing-group"

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

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

-- |
-- Create a value of 'DeleteBillingGroupResponse' 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', 'deleteBillingGroupResponse_arn' - The Amazon Resource Name (ARN) of the deleted billing group.
--
-- 'httpStatus', 'deleteBillingGroupResponse_httpStatus' - The response's http status code.
newDeleteBillingGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteBillingGroupResponse
newDeleteBillingGroupResponse :: Int -> DeleteBillingGroupResponse
newDeleteBillingGroupResponse Int
pHttpStatus_ =
  DeleteBillingGroupResponse'
    { $sel:arn:DeleteBillingGroupResponse' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteBillingGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData DeleteBillingGroupResponse where
  rnf :: DeleteBillingGroupResponse -> ()
rnf DeleteBillingGroupResponse' {Int
Maybe Text
httpStatus :: Int
arn :: Maybe Text
$sel:httpStatus:DeleteBillingGroupResponse' :: DeleteBillingGroupResponse -> Int
$sel:arn:DeleteBillingGroupResponse' :: DeleteBillingGroupResponse -> 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