{-# 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.DeleteMetricStream
-- 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)
--
-- Permanently deletes the metric stream that you specify.
module Amazonka.CloudWatch.DeleteMetricStream
  ( -- * Creating a Request
    DeleteMetricStream (..),
    newDeleteMetricStream,

    -- * Request Lenses
    deleteMetricStream_name,

    -- * Destructuring the Response
    DeleteMetricStreamResponse (..),
    newDeleteMetricStreamResponse,

    -- * Response Lenses
    deleteMetricStreamResponse_httpStatus,
  )
where

import Amazonka.CloudWatch.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:/ 'newDeleteMetricStream' smart constructor.
data DeleteMetricStream = DeleteMetricStream'
  { -- | The name of the metric stream to delete.
    DeleteMetricStream -> Text
name :: Prelude.Text
  }
  deriving (DeleteMetricStream -> DeleteMetricStream -> Bool
(DeleteMetricStream -> DeleteMetricStream -> Bool)
-> (DeleteMetricStream -> DeleteMetricStream -> Bool)
-> Eq DeleteMetricStream
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMetricStream -> DeleteMetricStream -> Bool
$c/= :: DeleteMetricStream -> DeleteMetricStream -> Bool
== :: DeleteMetricStream -> DeleteMetricStream -> Bool
$c== :: DeleteMetricStream -> DeleteMetricStream -> Bool
Prelude.Eq, ReadPrec [DeleteMetricStream]
ReadPrec DeleteMetricStream
Int -> ReadS DeleteMetricStream
ReadS [DeleteMetricStream]
(Int -> ReadS DeleteMetricStream)
-> ReadS [DeleteMetricStream]
-> ReadPrec DeleteMetricStream
-> ReadPrec [DeleteMetricStream]
-> Read DeleteMetricStream
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMetricStream]
$creadListPrec :: ReadPrec [DeleteMetricStream]
readPrec :: ReadPrec DeleteMetricStream
$creadPrec :: ReadPrec DeleteMetricStream
readList :: ReadS [DeleteMetricStream]
$creadList :: ReadS [DeleteMetricStream]
readsPrec :: Int -> ReadS DeleteMetricStream
$creadsPrec :: Int -> ReadS DeleteMetricStream
Prelude.Read, Int -> DeleteMetricStream -> ShowS
[DeleteMetricStream] -> ShowS
DeleteMetricStream -> String
(Int -> DeleteMetricStream -> ShowS)
-> (DeleteMetricStream -> String)
-> ([DeleteMetricStream] -> ShowS)
-> Show DeleteMetricStream
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMetricStream] -> ShowS
$cshowList :: [DeleteMetricStream] -> ShowS
show :: DeleteMetricStream -> String
$cshow :: DeleteMetricStream -> String
showsPrec :: Int -> DeleteMetricStream -> ShowS
$cshowsPrec :: Int -> DeleteMetricStream -> ShowS
Prelude.Show, (forall x. DeleteMetricStream -> Rep DeleteMetricStream x)
-> (forall x. Rep DeleteMetricStream x -> DeleteMetricStream)
-> Generic DeleteMetricStream
forall x. Rep DeleteMetricStream x -> DeleteMetricStream
forall x. DeleteMetricStream -> Rep DeleteMetricStream x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteMetricStream x -> DeleteMetricStream
$cfrom :: forall x. DeleteMetricStream -> Rep DeleteMetricStream x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMetricStream' 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:
--
-- 'name', 'deleteMetricStream_name' - The name of the metric stream to delete.
newDeleteMetricStream ::
  -- | 'name'
  Prelude.Text ->
  DeleteMetricStream
newDeleteMetricStream :: Text -> DeleteMetricStream
newDeleteMetricStream Text
pName_ =
  DeleteMetricStream' :: Text -> DeleteMetricStream
DeleteMetricStream' {$sel:name:DeleteMetricStream' :: Text
name = Text
pName_}

-- | The name of the metric stream to delete.
deleteMetricStream_name :: Lens.Lens' DeleteMetricStream Prelude.Text
deleteMetricStream_name :: (Text -> f Text) -> DeleteMetricStream -> f DeleteMetricStream
deleteMetricStream_name = (DeleteMetricStream -> Text)
-> (DeleteMetricStream -> Text -> DeleteMetricStream)
-> Lens DeleteMetricStream DeleteMetricStream Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMetricStream' {Text
name :: Text
$sel:name:DeleteMetricStream' :: DeleteMetricStream -> Text
name} -> Text
name) (\s :: DeleteMetricStream
s@DeleteMetricStream' {} Text
a -> DeleteMetricStream
s {$sel:name:DeleteMetricStream' :: Text
name = Text
a} :: DeleteMetricStream)

instance Core.AWSRequest DeleteMetricStream where
  type
    AWSResponse DeleteMetricStream =
      DeleteMetricStreamResponse
  request :: DeleteMetricStream -> Request DeleteMetricStream
request = Service -> DeleteMetricStream -> Request DeleteMetricStream
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMetricStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMetricStream)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DeleteMetricStream))
-> Logger
-> Service
-> Proxy DeleteMetricStream
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMetricStream)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DeleteMetricStreamResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> DeleteMetricStreamResponse
DeleteMetricStreamResponse'
            (Int -> DeleteMetricStreamResponse)
-> Either String Int -> Either String DeleteMetricStreamResponse
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 DeleteMetricStream

instance Prelude.NFData DeleteMetricStream

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

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

instance Core.ToQuery DeleteMetricStream where
  toQuery :: DeleteMetricStream -> QueryString
toQuery DeleteMetricStream' {Text
name :: Text
$sel:name:DeleteMetricStream' :: DeleteMetricStream -> Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"DeleteMetricStream" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-08-01" :: Prelude.ByteString),
        ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
name
      ]

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

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

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

instance Prelude.NFData DeleteMetricStreamResponse