{-# 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.LookoutMetrics.DeactivateAnomalyDetector
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deactivates an anomaly detector.
module Amazonka.LookoutMetrics.DeactivateAnomalyDetector
  ( -- * Creating a Request
    DeactivateAnomalyDetector (..),
    newDeactivateAnomalyDetector,

    -- * Request Lenses
    deactivateAnomalyDetector_anomalyDetectorArn,

    -- * Destructuring the Response
    DeactivateAnomalyDetectorResponse (..),
    newDeactivateAnomalyDetectorResponse,

    -- * Response Lenses
    deactivateAnomalyDetectorResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeactivateAnomalyDetector' smart constructor.
data DeactivateAnomalyDetector = DeactivateAnomalyDetector'
  { -- | The Amazon Resource Name (ARN) of the anomaly detector.
    DeactivateAnomalyDetector -> Text
anomalyDetectorArn :: Prelude.Text
  }
  deriving (DeactivateAnomalyDetector -> DeactivateAnomalyDetector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeactivateAnomalyDetector -> DeactivateAnomalyDetector -> Bool
$c/= :: DeactivateAnomalyDetector -> DeactivateAnomalyDetector -> Bool
== :: DeactivateAnomalyDetector -> DeactivateAnomalyDetector -> Bool
$c== :: DeactivateAnomalyDetector -> DeactivateAnomalyDetector -> Bool
Prelude.Eq, ReadPrec [DeactivateAnomalyDetector]
ReadPrec DeactivateAnomalyDetector
Int -> ReadS DeactivateAnomalyDetector
ReadS [DeactivateAnomalyDetector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeactivateAnomalyDetector]
$creadListPrec :: ReadPrec [DeactivateAnomalyDetector]
readPrec :: ReadPrec DeactivateAnomalyDetector
$creadPrec :: ReadPrec DeactivateAnomalyDetector
readList :: ReadS [DeactivateAnomalyDetector]
$creadList :: ReadS [DeactivateAnomalyDetector]
readsPrec :: Int -> ReadS DeactivateAnomalyDetector
$creadsPrec :: Int -> ReadS DeactivateAnomalyDetector
Prelude.Read, Int -> DeactivateAnomalyDetector -> ShowS
[DeactivateAnomalyDetector] -> ShowS
DeactivateAnomalyDetector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeactivateAnomalyDetector] -> ShowS
$cshowList :: [DeactivateAnomalyDetector] -> ShowS
show :: DeactivateAnomalyDetector -> String
$cshow :: DeactivateAnomalyDetector -> String
showsPrec :: Int -> DeactivateAnomalyDetector -> ShowS
$cshowsPrec :: Int -> DeactivateAnomalyDetector -> ShowS
Prelude.Show, forall x.
Rep DeactivateAnomalyDetector x -> DeactivateAnomalyDetector
forall x.
DeactivateAnomalyDetector -> Rep DeactivateAnomalyDetector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeactivateAnomalyDetector x -> DeactivateAnomalyDetector
$cfrom :: forall x.
DeactivateAnomalyDetector -> Rep DeactivateAnomalyDetector x
Prelude.Generic)

-- |
-- Create a value of 'DeactivateAnomalyDetector' 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:
--
-- 'anomalyDetectorArn', 'deactivateAnomalyDetector_anomalyDetectorArn' - The Amazon Resource Name (ARN) of the anomaly detector.
newDeactivateAnomalyDetector ::
  -- | 'anomalyDetectorArn'
  Prelude.Text ->
  DeactivateAnomalyDetector
newDeactivateAnomalyDetector :: Text -> DeactivateAnomalyDetector
newDeactivateAnomalyDetector Text
pAnomalyDetectorArn_ =
  DeactivateAnomalyDetector'
    { $sel:anomalyDetectorArn:DeactivateAnomalyDetector' :: Text
anomalyDetectorArn =
        Text
pAnomalyDetectorArn_
    }

-- | The Amazon Resource Name (ARN) of the anomaly detector.
deactivateAnomalyDetector_anomalyDetectorArn :: Lens.Lens' DeactivateAnomalyDetector Prelude.Text
deactivateAnomalyDetector_anomalyDetectorArn :: Lens' DeactivateAnomalyDetector Text
deactivateAnomalyDetector_anomalyDetectorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateAnomalyDetector' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:DeactivateAnomalyDetector' :: DeactivateAnomalyDetector -> Text
anomalyDetectorArn} -> Text
anomalyDetectorArn) (\s :: DeactivateAnomalyDetector
s@DeactivateAnomalyDetector' {} Text
a -> DeactivateAnomalyDetector
s {$sel:anomalyDetectorArn:DeactivateAnomalyDetector' :: Text
anomalyDetectorArn = Text
a} :: DeactivateAnomalyDetector)

instance Core.AWSRequest DeactivateAnomalyDetector where
  type
    AWSResponse DeactivateAnomalyDetector =
      DeactivateAnomalyDetectorResponse
  request :: (Service -> Service)
-> DeactivateAnomalyDetector -> Request DeactivateAnomalyDetector
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 DeactivateAnomalyDetector
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateAnomalyDetector)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeactivateAnomalyDetectorResponse
DeactivateAnomalyDetectorResponse'
            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 DeactivateAnomalyDetector where
  hashWithSalt :: Int -> DeactivateAnomalyDetector -> Int
hashWithSalt Int
_salt DeactivateAnomalyDetector' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:DeactivateAnomalyDetector' :: DeactivateAnomalyDetector -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
anomalyDetectorArn

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

instance Data.ToHeaders DeactivateAnomalyDetector where
  toHeaders :: DeactivateAnomalyDetector -> 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 DeactivateAnomalyDetector where
  toJSON :: DeactivateAnomalyDetector -> Value
toJSON DeactivateAnomalyDetector' {Text
anomalyDetectorArn :: Text
$sel:anomalyDetectorArn:DeactivateAnomalyDetector' :: DeactivateAnomalyDetector -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"AnomalyDetectorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
anomalyDetectorArn)
          ]
      )

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

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

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

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

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

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