{-# 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.DescribeRuleGroupsNamespace
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Describe a rule groups namespace.
module Amazonka.AMP.DescribeRuleGroupsNamespace
  ( -- * Creating a Request
    DescribeRuleGroupsNamespace (..),
    newDescribeRuleGroupsNamespace,

    -- * Request Lenses
    describeRuleGroupsNamespace_name,
    describeRuleGroupsNamespace_workspaceId,

    -- * Destructuring the Response
    DescribeRuleGroupsNamespaceResponse (..),
    newDescribeRuleGroupsNamespaceResponse,

    -- * Response Lenses
    describeRuleGroupsNamespaceResponse_httpStatus,
    describeRuleGroupsNamespaceResponse_ruleGroupsNamespace,
  )
where

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

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

-- |
-- Create a value of 'DescribeRuleGroupsNamespace' 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', 'describeRuleGroupsNamespace_name' - The rule groups namespace.
--
-- 'workspaceId', 'describeRuleGroupsNamespace_workspaceId' - The ID of the workspace to describe.
newDescribeRuleGroupsNamespace ::
  -- | 'name'
  Prelude.Text ->
  -- | 'workspaceId'
  Prelude.Text ->
  DescribeRuleGroupsNamespace
newDescribeRuleGroupsNamespace :: Text -> Text -> DescribeRuleGroupsNamespace
newDescribeRuleGroupsNamespace Text
pName_ Text
pWorkspaceId_ =
  DescribeRuleGroupsNamespace'
    { $sel:name:DescribeRuleGroupsNamespace' :: Text
name = Text
pName_,
      $sel:workspaceId:DescribeRuleGroupsNamespace' :: Text
workspaceId = Text
pWorkspaceId_
    }

-- | The rule groups namespace.
describeRuleGroupsNamespace_name :: Lens.Lens' DescribeRuleGroupsNamespace Prelude.Text
describeRuleGroupsNamespace_name :: Lens' DescribeRuleGroupsNamespace Text
describeRuleGroupsNamespace_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroupsNamespace' {Text
name :: Text
$sel:name:DescribeRuleGroupsNamespace' :: DescribeRuleGroupsNamespace -> Text
name} -> Text
name) (\s :: DescribeRuleGroupsNamespace
s@DescribeRuleGroupsNamespace' {} Text
a -> DescribeRuleGroupsNamespace
s {$sel:name:DescribeRuleGroupsNamespace' :: Text
name = Text
a} :: DescribeRuleGroupsNamespace)

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

instance Core.AWSRequest DescribeRuleGroupsNamespace where
  type
    AWSResponse DescribeRuleGroupsNamespace =
      DescribeRuleGroupsNamespaceResponse
  request :: (Service -> Service)
-> DescribeRuleGroupsNamespace
-> Request DescribeRuleGroupsNamespace
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 DescribeRuleGroupsNamespace
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeRuleGroupsNamespace)))
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 ->
          Int
-> RuleGroupsNamespaceDescription
-> DescribeRuleGroupsNamespaceResponse
DescribeRuleGroupsNamespaceResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ruleGroupsNamespace")
      )

instance Prelude.Hashable DescribeRuleGroupsNamespace where
  hashWithSalt :: Int -> DescribeRuleGroupsNamespace -> Int
hashWithSalt Int
_salt DescribeRuleGroupsNamespace' {Text
workspaceId :: Text
name :: Text
$sel:workspaceId:DescribeRuleGroupsNamespace' :: DescribeRuleGroupsNamespace -> Text
$sel:name:DescribeRuleGroupsNamespace' :: DescribeRuleGroupsNamespace -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId

instance Prelude.NFData DescribeRuleGroupsNamespace where
  rnf :: DescribeRuleGroupsNamespace -> ()
rnf DescribeRuleGroupsNamespace' {Text
workspaceId :: Text
name :: Text
$sel:workspaceId:DescribeRuleGroupsNamespace' :: DescribeRuleGroupsNamespace -> Text
$sel:name:DescribeRuleGroupsNamespace' :: DescribeRuleGroupsNamespace -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId

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

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

-- | Represents the output of a DescribeRuleGroupsNamespace operation.
--
-- /See:/ 'newDescribeRuleGroupsNamespaceResponse' smart constructor.
data DescribeRuleGroupsNamespaceResponse = DescribeRuleGroupsNamespaceResponse'
  { -- | The response's http status code.
    DescribeRuleGroupsNamespaceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The selected rule groups namespace.
    DescribeRuleGroupsNamespaceResponse
-> RuleGroupsNamespaceDescription
ruleGroupsNamespace :: RuleGroupsNamespaceDescription
  }
  deriving (DescribeRuleGroupsNamespaceResponse
-> DescribeRuleGroupsNamespaceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeRuleGroupsNamespaceResponse
-> DescribeRuleGroupsNamespaceResponse -> Bool
$c/= :: DescribeRuleGroupsNamespaceResponse
-> DescribeRuleGroupsNamespaceResponse -> Bool
== :: DescribeRuleGroupsNamespaceResponse
-> DescribeRuleGroupsNamespaceResponse -> Bool
$c== :: DescribeRuleGroupsNamespaceResponse
-> DescribeRuleGroupsNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeRuleGroupsNamespaceResponse]
ReadPrec DescribeRuleGroupsNamespaceResponse
Int -> ReadS DescribeRuleGroupsNamespaceResponse
ReadS [DescribeRuleGroupsNamespaceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeRuleGroupsNamespaceResponse]
$creadListPrec :: ReadPrec [DescribeRuleGroupsNamespaceResponse]
readPrec :: ReadPrec DescribeRuleGroupsNamespaceResponse
$creadPrec :: ReadPrec DescribeRuleGroupsNamespaceResponse
readList :: ReadS [DescribeRuleGroupsNamespaceResponse]
$creadList :: ReadS [DescribeRuleGroupsNamespaceResponse]
readsPrec :: Int -> ReadS DescribeRuleGroupsNamespaceResponse
$creadsPrec :: Int -> ReadS DescribeRuleGroupsNamespaceResponse
Prelude.Read, Int -> DescribeRuleGroupsNamespaceResponse -> ShowS
[DescribeRuleGroupsNamespaceResponse] -> ShowS
DescribeRuleGroupsNamespaceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeRuleGroupsNamespaceResponse] -> ShowS
$cshowList :: [DescribeRuleGroupsNamespaceResponse] -> ShowS
show :: DescribeRuleGroupsNamespaceResponse -> String
$cshow :: DescribeRuleGroupsNamespaceResponse -> String
showsPrec :: Int -> DescribeRuleGroupsNamespaceResponse -> ShowS
$cshowsPrec :: Int -> DescribeRuleGroupsNamespaceResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeRuleGroupsNamespaceResponse x
-> DescribeRuleGroupsNamespaceResponse
forall x.
DescribeRuleGroupsNamespaceResponse
-> Rep DescribeRuleGroupsNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeRuleGroupsNamespaceResponse x
-> DescribeRuleGroupsNamespaceResponse
$cfrom :: forall x.
DescribeRuleGroupsNamespaceResponse
-> Rep DescribeRuleGroupsNamespaceResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeRuleGroupsNamespaceResponse' 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', 'describeRuleGroupsNamespaceResponse_httpStatus' - The response's http status code.
--
-- 'ruleGroupsNamespace', 'describeRuleGroupsNamespaceResponse_ruleGroupsNamespace' - The selected rule groups namespace.
newDescribeRuleGroupsNamespaceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'ruleGroupsNamespace'
  RuleGroupsNamespaceDescription ->
  DescribeRuleGroupsNamespaceResponse
newDescribeRuleGroupsNamespaceResponse :: Int
-> RuleGroupsNamespaceDescription
-> DescribeRuleGroupsNamespaceResponse
newDescribeRuleGroupsNamespaceResponse
  Int
pHttpStatus_
  RuleGroupsNamespaceDescription
pRuleGroupsNamespace_ =
    DescribeRuleGroupsNamespaceResponse'
      { $sel:httpStatus:DescribeRuleGroupsNamespaceResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:ruleGroupsNamespace:DescribeRuleGroupsNamespaceResponse' :: RuleGroupsNamespaceDescription
ruleGroupsNamespace =
          RuleGroupsNamespaceDescription
pRuleGroupsNamespace_
      }

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

-- | The selected rule groups namespace.
describeRuleGroupsNamespaceResponse_ruleGroupsNamespace :: Lens.Lens' DescribeRuleGroupsNamespaceResponse RuleGroupsNamespaceDescription
describeRuleGroupsNamespaceResponse_ruleGroupsNamespace :: Lens'
  DescribeRuleGroupsNamespaceResponse RuleGroupsNamespaceDescription
describeRuleGroupsNamespaceResponse_ruleGroupsNamespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeRuleGroupsNamespaceResponse' {RuleGroupsNamespaceDescription
ruleGroupsNamespace :: RuleGroupsNamespaceDescription
$sel:ruleGroupsNamespace:DescribeRuleGroupsNamespaceResponse' :: DescribeRuleGroupsNamespaceResponse
-> RuleGroupsNamespaceDescription
ruleGroupsNamespace} -> RuleGroupsNamespaceDescription
ruleGroupsNamespace) (\s :: DescribeRuleGroupsNamespaceResponse
s@DescribeRuleGroupsNamespaceResponse' {} RuleGroupsNamespaceDescription
a -> DescribeRuleGroupsNamespaceResponse
s {$sel:ruleGroupsNamespace:DescribeRuleGroupsNamespaceResponse' :: RuleGroupsNamespaceDescription
ruleGroupsNamespace = RuleGroupsNamespaceDescription
a} :: DescribeRuleGroupsNamespaceResponse)

instance
  Prelude.NFData
    DescribeRuleGroupsNamespaceResponse
  where
  rnf :: DescribeRuleGroupsNamespaceResponse -> ()
rnf DescribeRuleGroupsNamespaceResponse' {Int
RuleGroupsNamespaceDescription
ruleGroupsNamespace :: RuleGroupsNamespaceDescription
httpStatus :: Int
$sel:ruleGroupsNamespace:DescribeRuleGroupsNamespaceResponse' :: DescribeRuleGroupsNamespaceResponse
-> RuleGroupsNamespaceDescription
$sel:httpStatus:DescribeRuleGroupsNamespaceResponse' :: DescribeRuleGroupsNamespaceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RuleGroupsNamespaceDescription
ruleGroupsNamespace