{-# 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.Rum.GetAppMonitor
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves the complete configuration information for one app monitor.
module Amazonka.Rum.GetAppMonitor
  ( -- * Creating a Request
    GetAppMonitor (..),
    newGetAppMonitor,

    -- * Request Lenses
    getAppMonitor_name,

    -- * Destructuring the Response
    GetAppMonitorResponse (..),
    newGetAppMonitorResponse,

    -- * Response Lenses
    getAppMonitorResponse_appMonitor,
    getAppMonitorResponse_httpStatus,
  )
where

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
import Amazonka.Rum.Types

-- | /See:/ 'newGetAppMonitor' smart constructor.
data GetAppMonitor = GetAppMonitor'
  { -- | The app monitor to retrieve information for.
    GetAppMonitor -> Text
name :: Prelude.Text
  }
  deriving (GetAppMonitor -> GetAppMonitor -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAppMonitor -> GetAppMonitor -> Bool
$c/= :: GetAppMonitor -> GetAppMonitor -> Bool
== :: GetAppMonitor -> GetAppMonitor -> Bool
$c== :: GetAppMonitor -> GetAppMonitor -> Bool
Prelude.Eq, ReadPrec [GetAppMonitor]
ReadPrec GetAppMonitor
Int -> ReadS GetAppMonitor
ReadS [GetAppMonitor]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAppMonitor]
$creadListPrec :: ReadPrec [GetAppMonitor]
readPrec :: ReadPrec GetAppMonitor
$creadPrec :: ReadPrec GetAppMonitor
readList :: ReadS [GetAppMonitor]
$creadList :: ReadS [GetAppMonitor]
readsPrec :: Int -> ReadS GetAppMonitor
$creadsPrec :: Int -> ReadS GetAppMonitor
Prelude.Read, Int -> GetAppMonitor -> ShowS
[GetAppMonitor] -> ShowS
GetAppMonitor -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAppMonitor] -> ShowS
$cshowList :: [GetAppMonitor] -> ShowS
show :: GetAppMonitor -> String
$cshow :: GetAppMonitor -> String
showsPrec :: Int -> GetAppMonitor -> ShowS
$cshowsPrec :: Int -> GetAppMonitor -> ShowS
Prelude.Show, forall x. Rep GetAppMonitor x -> GetAppMonitor
forall x. GetAppMonitor -> Rep GetAppMonitor x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAppMonitor x -> GetAppMonitor
$cfrom :: forall x. GetAppMonitor -> Rep GetAppMonitor x
Prelude.Generic)

-- |
-- Create a value of 'GetAppMonitor' 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', 'getAppMonitor_name' - The app monitor to retrieve information for.
newGetAppMonitor ::
  -- | 'name'
  Prelude.Text ->
  GetAppMonitor
newGetAppMonitor :: Text -> GetAppMonitor
newGetAppMonitor Text
pName_ =
  GetAppMonitor' {$sel:name:GetAppMonitor' :: Text
name = Text
pName_}

-- | The app monitor to retrieve information for.
getAppMonitor_name :: Lens.Lens' GetAppMonitor Prelude.Text
getAppMonitor_name :: Lens' GetAppMonitor Text
getAppMonitor_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAppMonitor' {Text
name :: Text
$sel:name:GetAppMonitor' :: GetAppMonitor -> Text
name} -> Text
name) (\s :: GetAppMonitor
s@GetAppMonitor' {} Text
a -> GetAppMonitor
s {$sel:name:GetAppMonitor' :: Text
name = Text
a} :: GetAppMonitor)

instance Core.AWSRequest GetAppMonitor where
  type
    AWSResponse GetAppMonitor =
      GetAppMonitorResponse
  request :: (Service -> Service) -> GetAppMonitor -> Request GetAppMonitor
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetAppMonitor
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAppMonitor)))
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 AppMonitor -> Int -> GetAppMonitorResponse
GetAppMonitorResponse'
            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
"AppMonitor")
            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 GetAppMonitor where
  hashWithSalt :: Int -> GetAppMonitor -> Int
hashWithSalt Int
_salt GetAppMonitor' {Text
name :: Text
$sel:name:GetAppMonitor' :: GetAppMonitor -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

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

instance Data.ToHeaders GetAppMonitor where
  toHeaders :: GetAppMonitor -> 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.ToPath GetAppMonitor where
  toPath :: GetAppMonitor -> ByteString
toPath GetAppMonitor' {Text
name :: Text
$sel:name:GetAppMonitor' :: GetAppMonitor -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/appmonitor/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

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

-- | /See:/ 'newGetAppMonitorResponse' smart constructor.
data GetAppMonitorResponse = GetAppMonitorResponse'
  { -- | A structure containing all the configuration information for the app
    -- monitor.
    GetAppMonitorResponse -> Maybe AppMonitor
appMonitor :: Prelude.Maybe AppMonitor,
    -- | The response's http status code.
    GetAppMonitorResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAppMonitorResponse -> GetAppMonitorResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAppMonitorResponse -> GetAppMonitorResponse -> Bool
$c/= :: GetAppMonitorResponse -> GetAppMonitorResponse -> Bool
== :: GetAppMonitorResponse -> GetAppMonitorResponse -> Bool
$c== :: GetAppMonitorResponse -> GetAppMonitorResponse -> Bool
Prelude.Eq, ReadPrec [GetAppMonitorResponse]
ReadPrec GetAppMonitorResponse
Int -> ReadS GetAppMonitorResponse
ReadS [GetAppMonitorResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAppMonitorResponse]
$creadListPrec :: ReadPrec [GetAppMonitorResponse]
readPrec :: ReadPrec GetAppMonitorResponse
$creadPrec :: ReadPrec GetAppMonitorResponse
readList :: ReadS [GetAppMonitorResponse]
$creadList :: ReadS [GetAppMonitorResponse]
readsPrec :: Int -> ReadS GetAppMonitorResponse
$creadsPrec :: Int -> ReadS GetAppMonitorResponse
Prelude.Read, Int -> GetAppMonitorResponse -> ShowS
[GetAppMonitorResponse] -> ShowS
GetAppMonitorResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAppMonitorResponse] -> ShowS
$cshowList :: [GetAppMonitorResponse] -> ShowS
show :: GetAppMonitorResponse -> String
$cshow :: GetAppMonitorResponse -> String
showsPrec :: Int -> GetAppMonitorResponse -> ShowS
$cshowsPrec :: Int -> GetAppMonitorResponse -> ShowS
Prelude.Show, forall x. Rep GetAppMonitorResponse x -> GetAppMonitorResponse
forall x. GetAppMonitorResponse -> Rep GetAppMonitorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAppMonitorResponse x -> GetAppMonitorResponse
$cfrom :: forall x. GetAppMonitorResponse -> Rep GetAppMonitorResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAppMonitorResponse' 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:
--
-- 'appMonitor', 'getAppMonitorResponse_appMonitor' - A structure containing all the configuration information for the app
-- monitor.
--
-- 'httpStatus', 'getAppMonitorResponse_httpStatus' - The response's http status code.
newGetAppMonitorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAppMonitorResponse
newGetAppMonitorResponse :: Int -> GetAppMonitorResponse
newGetAppMonitorResponse Int
pHttpStatus_ =
  GetAppMonitorResponse'
    { $sel:appMonitor:GetAppMonitorResponse' :: Maybe AppMonitor
appMonitor =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAppMonitorResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A structure containing all the configuration information for the app
-- monitor.
getAppMonitorResponse_appMonitor :: Lens.Lens' GetAppMonitorResponse (Prelude.Maybe AppMonitor)
getAppMonitorResponse_appMonitor :: Lens' GetAppMonitorResponse (Maybe AppMonitor)
getAppMonitorResponse_appMonitor = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAppMonitorResponse' {Maybe AppMonitor
appMonitor :: Maybe AppMonitor
$sel:appMonitor:GetAppMonitorResponse' :: GetAppMonitorResponse -> Maybe AppMonitor
appMonitor} -> Maybe AppMonitor
appMonitor) (\s :: GetAppMonitorResponse
s@GetAppMonitorResponse' {} Maybe AppMonitor
a -> GetAppMonitorResponse
s {$sel:appMonitor:GetAppMonitorResponse' :: Maybe AppMonitor
appMonitor = Maybe AppMonitor
a} :: GetAppMonitorResponse)

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

instance Prelude.NFData GetAppMonitorResponse where
  rnf :: GetAppMonitorResponse -> ()
rnf GetAppMonitorResponse' {Int
Maybe AppMonitor
httpStatus :: Int
appMonitor :: Maybe AppMonitor
$sel:httpStatus:GetAppMonitorResponse' :: GetAppMonitorResponse -> Int
$sel:appMonitor:GetAppMonitorResponse' :: GetAppMonitorResponse -> Maybe AppMonitor
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe AppMonitor
appMonitor
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus