{-# 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.AMP.DescribeAlertManagerDefinition
-- 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)
--
-- Describes an alert manager definition.
module Amazonka.AMP.DescribeAlertManagerDefinition
  ( -- * Creating a Request
    DescribeAlertManagerDefinition (..),
    newDescribeAlertManagerDefinition,

    -- * Request Lenses
    describeAlertManagerDefinition_workspaceId,

    -- * Destructuring the Response
    DescribeAlertManagerDefinitionResponse (..),
    newDescribeAlertManagerDefinitionResponse,

    -- * Response Lenses
    describeAlertManagerDefinitionResponse_httpStatus,
    describeAlertManagerDefinitionResponse_alertManagerDefinition,
  )
where

import Amazonka.AMP.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

-- | Represents the input of a DescribeAlertManagerDefinition operation.
--
-- /See:/ 'newDescribeAlertManagerDefinition' smart constructor.
data DescribeAlertManagerDefinition = DescribeAlertManagerDefinition'
  { -- | The ID of the workspace to describe.
    DescribeAlertManagerDefinition -> Text
workspaceId :: Prelude.Text
  }
  deriving (DescribeAlertManagerDefinition
-> DescribeAlertManagerDefinition -> Bool
(DescribeAlertManagerDefinition
 -> DescribeAlertManagerDefinition -> Bool)
-> (DescribeAlertManagerDefinition
    -> DescribeAlertManagerDefinition -> Bool)
-> Eq DescribeAlertManagerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlertManagerDefinition
-> DescribeAlertManagerDefinition -> Bool
$c/= :: DescribeAlertManagerDefinition
-> DescribeAlertManagerDefinition -> Bool
== :: DescribeAlertManagerDefinition
-> DescribeAlertManagerDefinition -> Bool
$c== :: DescribeAlertManagerDefinition
-> DescribeAlertManagerDefinition -> Bool
Prelude.Eq, ReadPrec [DescribeAlertManagerDefinition]
ReadPrec DescribeAlertManagerDefinition
Int -> ReadS DescribeAlertManagerDefinition
ReadS [DescribeAlertManagerDefinition]
(Int -> ReadS DescribeAlertManagerDefinition)
-> ReadS [DescribeAlertManagerDefinition]
-> ReadPrec DescribeAlertManagerDefinition
-> ReadPrec [DescribeAlertManagerDefinition]
-> Read DescribeAlertManagerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlertManagerDefinition]
$creadListPrec :: ReadPrec [DescribeAlertManagerDefinition]
readPrec :: ReadPrec DescribeAlertManagerDefinition
$creadPrec :: ReadPrec DescribeAlertManagerDefinition
readList :: ReadS [DescribeAlertManagerDefinition]
$creadList :: ReadS [DescribeAlertManagerDefinition]
readsPrec :: Int -> ReadS DescribeAlertManagerDefinition
$creadsPrec :: Int -> ReadS DescribeAlertManagerDefinition
Prelude.Read, Int -> DescribeAlertManagerDefinition -> ShowS
[DescribeAlertManagerDefinition] -> ShowS
DescribeAlertManagerDefinition -> String
(Int -> DescribeAlertManagerDefinition -> ShowS)
-> (DescribeAlertManagerDefinition -> String)
-> ([DescribeAlertManagerDefinition] -> ShowS)
-> Show DescribeAlertManagerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlertManagerDefinition] -> ShowS
$cshowList :: [DescribeAlertManagerDefinition] -> ShowS
show :: DescribeAlertManagerDefinition -> String
$cshow :: DescribeAlertManagerDefinition -> String
showsPrec :: Int -> DescribeAlertManagerDefinition -> ShowS
$cshowsPrec :: Int -> DescribeAlertManagerDefinition -> ShowS
Prelude.Show, (forall x.
 DescribeAlertManagerDefinition
 -> Rep DescribeAlertManagerDefinition x)
-> (forall x.
    Rep DescribeAlertManagerDefinition x
    -> DescribeAlertManagerDefinition)
-> Generic DescribeAlertManagerDefinition
forall x.
Rep DescribeAlertManagerDefinition x
-> DescribeAlertManagerDefinition
forall x.
DescribeAlertManagerDefinition
-> Rep DescribeAlertManagerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAlertManagerDefinition x
-> DescribeAlertManagerDefinition
$cfrom :: forall x.
DescribeAlertManagerDefinition
-> Rep DescribeAlertManagerDefinition x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlertManagerDefinition' 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:
--
-- 'workspaceId', 'describeAlertManagerDefinition_workspaceId' - The ID of the workspace to describe.
newDescribeAlertManagerDefinition ::
  -- | 'workspaceId'
  Prelude.Text ->
  DescribeAlertManagerDefinition
newDescribeAlertManagerDefinition :: Text -> DescribeAlertManagerDefinition
newDescribeAlertManagerDefinition Text
pWorkspaceId_ =
  DescribeAlertManagerDefinition' :: Text -> DescribeAlertManagerDefinition
DescribeAlertManagerDefinition'
    { $sel:workspaceId:DescribeAlertManagerDefinition' :: Text
workspaceId =
        Text
pWorkspaceId_
    }

-- | The ID of the workspace to describe.
describeAlertManagerDefinition_workspaceId :: Lens.Lens' DescribeAlertManagerDefinition Prelude.Text
describeAlertManagerDefinition_workspaceId :: (Text -> f Text)
-> DescribeAlertManagerDefinition
-> f DescribeAlertManagerDefinition
describeAlertManagerDefinition_workspaceId = (DescribeAlertManagerDefinition -> Text)
-> (DescribeAlertManagerDefinition
    -> Text -> DescribeAlertManagerDefinition)
-> Lens
     DescribeAlertManagerDefinition
     DescribeAlertManagerDefinition
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlertManagerDefinition' {Text
workspaceId :: Text
$sel:workspaceId:DescribeAlertManagerDefinition' :: DescribeAlertManagerDefinition -> Text
workspaceId} -> Text
workspaceId) (\s :: DescribeAlertManagerDefinition
s@DescribeAlertManagerDefinition' {} Text
a -> DescribeAlertManagerDefinition
s {$sel:workspaceId:DescribeAlertManagerDefinition' :: Text
workspaceId = Text
a} :: DescribeAlertManagerDefinition)

instance
  Core.AWSRequest
    DescribeAlertManagerDefinition
  where
  type
    AWSResponse DescribeAlertManagerDefinition =
      DescribeAlertManagerDefinitionResponse
  request :: DescribeAlertManagerDefinition
-> Request DescribeAlertManagerDefinition
request = Service
-> DescribeAlertManagerDefinition
-> Request DescribeAlertManagerDefinition
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeAlertManagerDefinition
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeAlertManagerDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeAlertManagerDefinition))
-> Logger
-> Service
-> Proxy DescribeAlertManagerDefinition
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeAlertManagerDefinition)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int
-> AlertManagerDefinitionDescription
-> DescribeAlertManagerDefinitionResponse
DescribeAlertManagerDefinitionResponse'
            (Int
 -> AlertManagerDefinitionDescription
 -> DescribeAlertManagerDefinitionResponse)
-> Either String Int
-> Either
     String
     (AlertManagerDefinitionDescription
      -> DescribeAlertManagerDefinitionResponse)
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))
            Either
  String
  (AlertManagerDefinitionDescription
   -> DescribeAlertManagerDefinitionResponse)
-> Either String AlertManagerDefinitionDescription
-> Either String DescribeAlertManagerDefinitionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String AlertManagerDefinitionDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"alertManagerDefinition")
      )

instance
  Prelude.Hashable
    DescribeAlertManagerDefinition

instance
  Prelude.NFData
    DescribeAlertManagerDefinition

instance
  Core.ToHeaders
    DescribeAlertManagerDefinition
  where
  toHeaders :: DescribeAlertManagerDefinition -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DescribeAlertManagerDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath DescribeAlertManagerDefinition where
  toPath :: DescribeAlertManagerDefinition -> ByteString
toPath DescribeAlertManagerDefinition' {Text
workspaceId :: Text
$sel:workspaceId:DescribeAlertManagerDefinition' :: DescribeAlertManagerDefinition -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
workspaceId,
        ByteString
"/alertmanager/definition"
      ]

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

-- | Represents the output of a DescribeAlertManagerDefinition operation.
--
-- /See:/ 'newDescribeAlertManagerDefinitionResponse' smart constructor.
data DescribeAlertManagerDefinitionResponse = DescribeAlertManagerDefinitionResponse'
  { -- | The response's http status code.
    DescribeAlertManagerDefinitionResponse -> Int
httpStatus :: Prelude.Int,
    -- | The properties of the selected workspace\'s alert manager definition.
    DescribeAlertManagerDefinitionResponse
-> AlertManagerDefinitionDescription
alertManagerDefinition :: AlertManagerDefinitionDescription
  }
  deriving (DescribeAlertManagerDefinitionResponse
-> DescribeAlertManagerDefinitionResponse -> Bool
(DescribeAlertManagerDefinitionResponse
 -> DescribeAlertManagerDefinitionResponse -> Bool)
-> (DescribeAlertManagerDefinitionResponse
    -> DescribeAlertManagerDefinitionResponse -> Bool)
-> Eq DescribeAlertManagerDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeAlertManagerDefinitionResponse
-> DescribeAlertManagerDefinitionResponse -> Bool
$c/= :: DescribeAlertManagerDefinitionResponse
-> DescribeAlertManagerDefinitionResponse -> Bool
== :: DescribeAlertManagerDefinitionResponse
-> DescribeAlertManagerDefinitionResponse -> Bool
$c== :: DescribeAlertManagerDefinitionResponse
-> DescribeAlertManagerDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [DescribeAlertManagerDefinitionResponse]
ReadPrec DescribeAlertManagerDefinitionResponse
Int -> ReadS DescribeAlertManagerDefinitionResponse
ReadS [DescribeAlertManagerDefinitionResponse]
(Int -> ReadS DescribeAlertManagerDefinitionResponse)
-> ReadS [DescribeAlertManagerDefinitionResponse]
-> ReadPrec DescribeAlertManagerDefinitionResponse
-> ReadPrec [DescribeAlertManagerDefinitionResponse]
-> Read DescribeAlertManagerDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeAlertManagerDefinitionResponse]
$creadListPrec :: ReadPrec [DescribeAlertManagerDefinitionResponse]
readPrec :: ReadPrec DescribeAlertManagerDefinitionResponse
$creadPrec :: ReadPrec DescribeAlertManagerDefinitionResponse
readList :: ReadS [DescribeAlertManagerDefinitionResponse]
$creadList :: ReadS [DescribeAlertManagerDefinitionResponse]
readsPrec :: Int -> ReadS DescribeAlertManagerDefinitionResponse
$creadsPrec :: Int -> ReadS DescribeAlertManagerDefinitionResponse
Prelude.Read, Int -> DescribeAlertManagerDefinitionResponse -> ShowS
[DescribeAlertManagerDefinitionResponse] -> ShowS
DescribeAlertManagerDefinitionResponse -> String
(Int -> DescribeAlertManagerDefinitionResponse -> ShowS)
-> (DescribeAlertManagerDefinitionResponse -> String)
-> ([DescribeAlertManagerDefinitionResponse] -> ShowS)
-> Show DescribeAlertManagerDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeAlertManagerDefinitionResponse] -> ShowS
$cshowList :: [DescribeAlertManagerDefinitionResponse] -> ShowS
show :: DescribeAlertManagerDefinitionResponse -> String
$cshow :: DescribeAlertManagerDefinitionResponse -> String
showsPrec :: Int -> DescribeAlertManagerDefinitionResponse -> ShowS
$cshowsPrec :: Int -> DescribeAlertManagerDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 DescribeAlertManagerDefinitionResponse
 -> Rep DescribeAlertManagerDefinitionResponse x)
-> (forall x.
    Rep DescribeAlertManagerDefinitionResponse x
    -> DescribeAlertManagerDefinitionResponse)
-> Generic DescribeAlertManagerDefinitionResponse
forall x.
Rep DescribeAlertManagerDefinitionResponse x
-> DescribeAlertManagerDefinitionResponse
forall x.
DescribeAlertManagerDefinitionResponse
-> Rep DescribeAlertManagerDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeAlertManagerDefinitionResponse x
-> DescribeAlertManagerDefinitionResponse
$cfrom :: forall x.
DescribeAlertManagerDefinitionResponse
-> Rep DescribeAlertManagerDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeAlertManagerDefinitionResponse' 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', 'describeAlertManagerDefinitionResponse_httpStatus' - The response's http status code.
--
-- 'alertManagerDefinition', 'describeAlertManagerDefinitionResponse_alertManagerDefinition' - The properties of the selected workspace\'s alert manager definition.
newDescribeAlertManagerDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'alertManagerDefinition'
  AlertManagerDefinitionDescription ->
  DescribeAlertManagerDefinitionResponse
newDescribeAlertManagerDefinitionResponse :: Int
-> AlertManagerDefinitionDescription
-> DescribeAlertManagerDefinitionResponse
newDescribeAlertManagerDefinitionResponse
  Int
pHttpStatus_
  AlertManagerDefinitionDescription
pAlertManagerDefinition_ =
    DescribeAlertManagerDefinitionResponse' :: Int
-> AlertManagerDefinitionDescription
-> DescribeAlertManagerDefinitionResponse
DescribeAlertManagerDefinitionResponse'
      { $sel:httpStatus:DescribeAlertManagerDefinitionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:alertManagerDefinition:DescribeAlertManagerDefinitionResponse' :: AlertManagerDefinitionDescription
alertManagerDefinition =
          AlertManagerDefinitionDescription
pAlertManagerDefinition_
      }

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

-- | The properties of the selected workspace\'s alert manager definition.
describeAlertManagerDefinitionResponse_alertManagerDefinition :: Lens.Lens' DescribeAlertManagerDefinitionResponse AlertManagerDefinitionDescription
describeAlertManagerDefinitionResponse_alertManagerDefinition :: (AlertManagerDefinitionDescription
 -> f AlertManagerDefinitionDescription)
-> DescribeAlertManagerDefinitionResponse
-> f DescribeAlertManagerDefinitionResponse
describeAlertManagerDefinitionResponse_alertManagerDefinition = (DescribeAlertManagerDefinitionResponse
 -> AlertManagerDefinitionDescription)
-> (DescribeAlertManagerDefinitionResponse
    -> AlertManagerDefinitionDescription
    -> DescribeAlertManagerDefinitionResponse)
-> Lens
     DescribeAlertManagerDefinitionResponse
     DescribeAlertManagerDefinitionResponse
     AlertManagerDefinitionDescription
     AlertManagerDefinitionDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeAlertManagerDefinitionResponse' {AlertManagerDefinitionDescription
alertManagerDefinition :: AlertManagerDefinitionDescription
$sel:alertManagerDefinition:DescribeAlertManagerDefinitionResponse' :: DescribeAlertManagerDefinitionResponse
-> AlertManagerDefinitionDescription
alertManagerDefinition} -> AlertManagerDefinitionDescription
alertManagerDefinition) (\s :: DescribeAlertManagerDefinitionResponse
s@DescribeAlertManagerDefinitionResponse' {} AlertManagerDefinitionDescription
a -> DescribeAlertManagerDefinitionResponse
s {$sel:alertManagerDefinition:DescribeAlertManagerDefinitionResponse' :: AlertManagerDefinitionDescription
alertManagerDefinition = AlertManagerDefinitionDescription
a} :: DescribeAlertManagerDefinitionResponse)

instance
  Prelude.NFData
    DescribeAlertManagerDefinitionResponse