{-# 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.StopMetricStreams
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops the streaming of metrics for one or more of your metric streams.
module Amazonka.CloudWatch.StopMetricStreams
  ( -- * Creating a Request
    StopMetricStreams (..),
    newStopMetricStreams,

    -- * Request Lenses
    stopMetricStreams_names,

    -- * Destructuring the Response
    StopMetricStreamsResponse (..),
    newStopMetricStreamsResponse,

    -- * Response Lenses
    stopMetricStreamsResponse_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:/ 'newStopMetricStreams' smart constructor.
data StopMetricStreams = StopMetricStreams'
  { -- | The array of the names of metric streams to stop streaming.
    --
    -- This is an \"all or nothing\" operation. If you do not have permission
    -- to access all of the metric streams that you list here, then none of the
    -- streams that you list in the operation will stop streaming.
    StopMetricStreams -> [Text]
names :: [Prelude.Text]
  }
  deriving (StopMetricStreams -> StopMetricStreams -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopMetricStreams -> StopMetricStreams -> Bool
$c/= :: StopMetricStreams -> StopMetricStreams -> Bool
== :: StopMetricStreams -> StopMetricStreams -> Bool
$c== :: StopMetricStreams -> StopMetricStreams -> Bool
Prelude.Eq, ReadPrec [StopMetricStreams]
ReadPrec StopMetricStreams
Int -> ReadS StopMetricStreams
ReadS [StopMetricStreams]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopMetricStreams]
$creadListPrec :: ReadPrec [StopMetricStreams]
readPrec :: ReadPrec StopMetricStreams
$creadPrec :: ReadPrec StopMetricStreams
readList :: ReadS [StopMetricStreams]
$creadList :: ReadS [StopMetricStreams]
readsPrec :: Int -> ReadS StopMetricStreams
$creadsPrec :: Int -> ReadS StopMetricStreams
Prelude.Read, Int -> StopMetricStreams -> ShowS
[StopMetricStreams] -> ShowS
StopMetricStreams -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopMetricStreams] -> ShowS
$cshowList :: [StopMetricStreams] -> ShowS
show :: StopMetricStreams -> String
$cshow :: StopMetricStreams -> String
showsPrec :: Int -> StopMetricStreams -> ShowS
$cshowsPrec :: Int -> StopMetricStreams -> ShowS
Prelude.Show, forall x. Rep StopMetricStreams x -> StopMetricStreams
forall x. StopMetricStreams -> Rep StopMetricStreams x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopMetricStreams x -> StopMetricStreams
$cfrom :: forall x. StopMetricStreams -> Rep StopMetricStreams x
Prelude.Generic)

-- |
-- Create a value of 'StopMetricStreams' 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:
--
-- 'names', 'stopMetricStreams_names' - The array of the names of metric streams to stop streaming.
--
-- This is an \"all or nothing\" operation. If you do not have permission
-- to access all of the metric streams that you list here, then none of the
-- streams that you list in the operation will stop streaming.
newStopMetricStreams ::
  StopMetricStreams
newStopMetricStreams :: StopMetricStreams
newStopMetricStreams =
  StopMetricStreams' {$sel:names:StopMetricStreams' :: [Text]
names = forall a. Monoid a => a
Prelude.mempty}

-- | The array of the names of metric streams to stop streaming.
--
-- This is an \"all or nothing\" operation. If you do not have permission
-- to access all of the metric streams that you list here, then none of the
-- streams that you list in the operation will stop streaming.
stopMetricStreams_names :: Lens.Lens' StopMetricStreams [Prelude.Text]
stopMetricStreams_names :: Lens' StopMetricStreams [Text]
stopMetricStreams_names = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopMetricStreams' {[Text]
names :: [Text]
$sel:names:StopMetricStreams' :: StopMetricStreams -> [Text]
names} -> [Text]
names) (\s :: StopMetricStreams
s@StopMetricStreams' {} [Text]
a -> StopMetricStreams
s {$sel:names:StopMetricStreams' :: [Text]
names = [Text]
a} :: StopMetricStreams) 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 StopMetricStreams where
  type
    AWSResponse StopMetricStreams =
      StopMetricStreamsResponse
  request :: (Service -> Service)
-> StopMetricStreams -> Request StopMetricStreams
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 StopMetricStreams
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopMetricStreams)))
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
"StopMetricStreamsResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> StopMetricStreamsResponse
StopMetricStreamsResponse'
            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 StopMetricStreams where
  hashWithSalt :: Int -> StopMetricStreams -> Int
hashWithSalt Int
_salt StopMetricStreams' {[Text]
names :: [Text]
$sel:names:StopMetricStreams' :: StopMetricStreams -> [Text]
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
names

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

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

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

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

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

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

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

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