{-# 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.CloudWatch.DeleteDashboards
-- 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 all dashboards that you specify. You can specify up to 100
-- dashboards to delete. If there is an error during this call, no
-- dashboards are deleted.
module Amazonka.CloudWatch.DeleteDashboards
  ( -- * Creating a Request
    DeleteDashboards (..),
    newDeleteDashboards,

    -- * Request Lenses
    deleteDashboards_dashboardNames,

    -- * Destructuring the Response
    DeleteDashboardsResponse (..),
    newDeleteDashboardsResponse,

    -- * Response Lenses
    deleteDashboardsResponse_httpStatus,
  )
where

import Amazonka.CloudWatch.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:/ 'newDeleteDashboards' smart constructor.
data DeleteDashboards = DeleteDashboards'
  { -- | The dashboards to be deleted. This parameter is required.
    DeleteDashboards -> [Text]
dashboardNames :: [Prelude.Text]
  }
  deriving (DeleteDashboards -> DeleteDashboards -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDashboards -> DeleteDashboards -> Bool
$c/= :: DeleteDashboards -> DeleteDashboards -> Bool
== :: DeleteDashboards -> DeleteDashboards -> Bool
$c== :: DeleteDashboards -> DeleteDashboards -> Bool
Prelude.Eq, ReadPrec [DeleteDashboards]
ReadPrec DeleteDashboards
Int -> ReadS DeleteDashboards
ReadS [DeleteDashboards]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDashboards]
$creadListPrec :: ReadPrec [DeleteDashboards]
readPrec :: ReadPrec DeleteDashboards
$creadPrec :: ReadPrec DeleteDashboards
readList :: ReadS [DeleteDashboards]
$creadList :: ReadS [DeleteDashboards]
readsPrec :: Int -> ReadS DeleteDashboards
$creadsPrec :: Int -> ReadS DeleteDashboards
Prelude.Read, Int -> DeleteDashboards -> ShowS
[DeleteDashboards] -> ShowS
DeleteDashboards -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDashboards] -> ShowS
$cshowList :: [DeleteDashboards] -> ShowS
show :: DeleteDashboards -> String
$cshow :: DeleteDashboards -> String
showsPrec :: Int -> DeleteDashboards -> ShowS
$cshowsPrec :: Int -> DeleteDashboards -> ShowS
Prelude.Show, forall x. Rep DeleteDashboards x -> DeleteDashboards
forall x. DeleteDashboards -> Rep DeleteDashboards x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDashboards x -> DeleteDashboards
$cfrom :: forall x. DeleteDashboards -> Rep DeleteDashboards x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDashboards' 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:
--
-- 'dashboardNames', 'deleteDashboards_dashboardNames' - The dashboards to be deleted. This parameter is required.
newDeleteDashboards ::
  DeleteDashboards
newDeleteDashboards :: DeleteDashboards
newDeleteDashboards =
  DeleteDashboards' {$sel:dashboardNames:DeleteDashboards' :: [Text]
dashboardNames = forall a. Monoid a => a
Prelude.mempty}

-- | The dashboards to be deleted. This parameter is required.
deleteDashboards_dashboardNames :: Lens.Lens' DeleteDashboards [Prelude.Text]
deleteDashboards_dashboardNames :: Lens' DeleteDashboards [Text]
deleteDashboards_dashboardNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDashboards' {[Text]
dashboardNames :: [Text]
$sel:dashboardNames:DeleteDashboards' :: DeleteDashboards -> [Text]
dashboardNames} -> [Text]
dashboardNames) (\s :: DeleteDashboards
s@DeleteDashboards' {} [Text]
a -> DeleteDashboards
s {$sel:dashboardNames:DeleteDashboards' :: [Text]
dashboardNames = [Text]
a} :: DeleteDashboards) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest DeleteDashboards where
  type
    AWSResponse DeleteDashboards =
      DeleteDashboardsResponse
  request :: (Service -> Service)
-> DeleteDashboards -> Request DeleteDashboards
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteDashboards
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDashboards)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteDashboardsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteDashboardsResponse
DeleteDashboardsResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteDashboards where
  hashWithSalt :: Int -> DeleteDashboards -> Int
hashWithSalt Int
_salt DeleteDashboards' {[Text]
dashboardNames :: [Text]
$sel:dashboardNames:DeleteDashboards' :: DeleteDashboards -> [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
dashboardNames

instance Prelude.NFData DeleteDashboards where
  rnf :: DeleteDashboards -> ()
rnf DeleteDashboards' {[Text]
dashboardNames :: [Text]
$sel:dashboardNames:DeleteDashboards' :: DeleteDashboards -> [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf [Text]
dashboardNames

instance Data.ToHeaders DeleteDashboards where
  toHeaders :: DeleteDashboards -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery DeleteDashboards where
  toQuery :: DeleteDashboards -> QueryString
toQuery DeleteDashboards' {[Text]
dashboardNames :: [Text]
$sel:dashboardNames:DeleteDashboards' :: DeleteDashboards -> [Text]
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"DeleteDashboards" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"DashboardNames"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [Text]
dashboardNames
      ]

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

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

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

instance Prelude.NFData DeleteDashboardsResponse where
  rnf :: DeleteDashboardsResponse -> ()
rnf DeleteDashboardsResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDashboardsResponse' :: DeleteDashboardsResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus