{-# 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.CreateRuleGroupsNamespace
-- 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)
--
-- Create a rule group namespace.
module Amazonka.AMP.CreateRuleGroupsNamespace
  ( -- * Creating a Request
    CreateRuleGroupsNamespace (..),
    newCreateRuleGroupsNamespace,

    -- * Request Lenses
    createRuleGroupsNamespace_clientToken,
    createRuleGroupsNamespace_tags,
    createRuleGroupsNamespace_data,
    createRuleGroupsNamespace_name,
    createRuleGroupsNamespace_workspaceId,

    -- * Destructuring the Response
    CreateRuleGroupsNamespaceResponse (..),
    newCreateRuleGroupsNamespaceResponse,

    -- * Response Lenses
    createRuleGroupsNamespaceResponse_tags,
    createRuleGroupsNamespaceResponse_httpStatus,
    createRuleGroupsNamespaceResponse_arn,
    createRuleGroupsNamespaceResponse_name,
    createRuleGroupsNamespaceResponse_status,
  )
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 CreateRuleGroupsNamespace operation.
--
-- /See:/ 'newCreateRuleGroupsNamespace' smart constructor.
data CreateRuleGroupsNamespace = CreateRuleGroupsNamespace'
  { -- | Optional, unique, case-sensitive, user-provided identifier to ensure the
    -- idempotency of the request.
    CreateRuleGroupsNamespace -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Optional, user-provided tags for this rule groups namespace.
    CreateRuleGroupsNamespace -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The namespace data that define the rule groups.
    CreateRuleGroupsNamespace -> Base64
data' :: Core.Base64,
    -- | The rule groups namespace name.
    CreateRuleGroupsNamespace -> Text
name :: Prelude.Text,
    -- | The ID of the workspace in which to create the rule group namespace.
    CreateRuleGroupsNamespace -> Text
workspaceId :: Prelude.Text
  }
  deriving (CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool
(CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool)
-> (CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool)
-> Eq CreateRuleGroupsNamespace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool
$c/= :: CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool
== :: CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool
$c== :: CreateRuleGroupsNamespace -> CreateRuleGroupsNamespace -> Bool
Prelude.Eq, ReadPrec [CreateRuleGroupsNamespace]
ReadPrec CreateRuleGroupsNamespace
Int -> ReadS CreateRuleGroupsNamespace
ReadS [CreateRuleGroupsNamespace]
(Int -> ReadS CreateRuleGroupsNamespace)
-> ReadS [CreateRuleGroupsNamespace]
-> ReadPrec CreateRuleGroupsNamespace
-> ReadPrec [CreateRuleGroupsNamespace]
-> Read CreateRuleGroupsNamespace
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRuleGroupsNamespace]
$creadListPrec :: ReadPrec [CreateRuleGroupsNamespace]
readPrec :: ReadPrec CreateRuleGroupsNamespace
$creadPrec :: ReadPrec CreateRuleGroupsNamespace
readList :: ReadS [CreateRuleGroupsNamespace]
$creadList :: ReadS [CreateRuleGroupsNamespace]
readsPrec :: Int -> ReadS CreateRuleGroupsNamespace
$creadsPrec :: Int -> ReadS CreateRuleGroupsNamespace
Prelude.Read, Int -> CreateRuleGroupsNamespace -> ShowS
[CreateRuleGroupsNamespace] -> ShowS
CreateRuleGroupsNamespace -> String
(Int -> CreateRuleGroupsNamespace -> ShowS)
-> (CreateRuleGroupsNamespace -> String)
-> ([CreateRuleGroupsNamespace] -> ShowS)
-> Show CreateRuleGroupsNamespace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRuleGroupsNamespace] -> ShowS
$cshowList :: [CreateRuleGroupsNamespace] -> ShowS
show :: CreateRuleGroupsNamespace -> String
$cshow :: CreateRuleGroupsNamespace -> String
showsPrec :: Int -> CreateRuleGroupsNamespace -> ShowS
$cshowsPrec :: Int -> CreateRuleGroupsNamespace -> ShowS
Prelude.Show, (forall x.
 CreateRuleGroupsNamespace -> Rep CreateRuleGroupsNamespace x)
-> (forall x.
    Rep CreateRuleGroupsNamespace x -> CreateRuleGroupsNamespace)
-> Generic CreateRuleGroupsNamespace
forall x.
Rep CreateRuleGroupsNamespace x -> CreateRuleGroupsNamespace
forall x.
CreateRuleGroupsNamespace -> Rep CreateRuleGroupsNamespace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRuleGroupsNamespace x -> CreateRuleGroupsNamespace
$cfrom :: forall x.
CreateRuleGroupsNamespace -> Rep CreateRuleGroupsNamespace x
Prelude.Generic)

-- |
-- Create a value of 'CreateRuleGroupsNamespace' 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:
--
-- 'clientToken', 'createRuleGroupsNamespace_clientToken' - Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
--
-- 'tags', 'createRuleGroupsNamespace_tags' - Optional, user-provided tags for this rule groups namespace.
--
-- 'data'', 'createRuleGroupsNamespace_data' - The namespace data that define the rule groups.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
--
-- 'name', 'createRuleGroupsNamespace_name' - The rule groups namespace name.
--
-- 'workspaceId', 'createRuleGroupsNamespace_workspaceId' - The ID of the workspace in which to create the rule group namespace.
newCreateRuleGroupsNamespace ::
  -- | 'data''
  Prelude.ByteString ->
  -- | 'name'
  Prelude.Text ->
  -- | 'workspaceId'
  Prelude.Text ->
  CreateRuleGroupsNamespace
newCreateRuleGroupsNamespace :: ByteString -> Text -> Text -> CreateRuleGroupsNamespace
newCreateRuleGroupsNamespace
  ByteString
pData_
  Text
pName_
  Text
pWorkspaceId_ =
    CreateRuleGroupsNamespace' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Base64
-> Text
-> Text
-> CreateRuleGroupsNamespace
CreateRuleGroupsNamespace'
      { $sel:clientToken:CreateRuleGroupsNamespace' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateRuleGroupsNamespace' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:data':CreateRuleGroupsNamespace' :: Base64
data' = Tagged ByteString (Identity ByteString)
-> Tagged Base64 (Identity Base64)
Iso' Base64 ByteString
Core._Base64 (Tagged ByteString (Identity ByteString)
 -> Tagged Base64 (Identity Base64))
-> ByteString -> Base64
forall t b. AReview t b -> b -> t
Lens.# ByteString
pData_,
        $sel:name:CreateRuleGroupsNamespace' :: Text
name = Text
pName_,
        $sel:workspaceId:CreateRuleGroupsNamespace' :: Text
workspaceId = Text
pWorkspaceId_
      }

-- | Optional, unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
createRuleGroupsNamespace_clientToken :: Lens.Lens' CreateRuleGroupsNamespace (Prelude.Maybe Prelude.Text)
createRuleGroupsNamespace_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace
createRuleGroupsNamespace_clientToken = (CreateRuleGroupsNamespace -> Maybe Text)
-> (CreateRuleGroupsNamespace
    -> Maybe Text -> CreateRuleGroupsNamespace)
-> Lens
     CreateRuleGroupsNamespace
     CreateRuleGroupsNamespace
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespace' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateRuleGroupsNamespace
s@CreateRuleGroupsNamespace' {} Maybe Text
a -> CreateRuleGroupsNamespace
s {$sel:clientToken:CreateRuleGroupsNamespace' :: Maybe Text
clientToken = Maybe Text
a} :: CreateRuleGroupsNamespace)

-- | Optional, user-provided tags for this rule groups namespace.
createRuleGroupsNamespace_tags :: Lens.Lens' CreateRuleGroupsNamespace (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRuleGroupsNamespace_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace
createRuleGroupsNamespace_tags = (CreateRuleGroupsNamespace -> Maybe (HashMap Text Text))
-> (CreateRuleGroupsNamespace
    -> Maybe (HashMap Text Text) -> CreateRuleGroupsNamespace)
-> Lens
     CreateRuleGroupsNamespace
     CreateRuleGroupsNamespace
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespace' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateRuleGroupsNamespace
s@CreateRuleGroupsNamespace' {} Maybe (HashMap Text Text)
a -> CreateRuleGroupsNamespace
s {$sel:tags:CreateRuleGroupsNamespace' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateRuleGroupsNamespace) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRuleGroupsNamespace
-> f CreateRuleGroupsNamespace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The namespace data that define the rule groups.--
-- -- /Note:/ This 'Lens' automatically encodes and decodes Base64 data.
-- -- The underlying isomorphism will encode to Base64 representation during
-- -- serialisation, and decode from Base64 representation during deserialisation.
-- -- This 'Lens' accepts and returns only raw unencoded data.
createRuleGroupsNamespace_data :: Lens.Lens' CreateRuleGroupsNamespace Prelude.ByteString
createRuleGroupsNamespace_data :: (ByteString -> f ByteString)
-> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace
createRuleGroupsNamespace_data = (CreateRuleGroupsNamespace -> Base64)
-> (CreateRuleGroupsNamespace
    -> Base64 -> CreateRuleGroupsNamespace)
-> Lens
     CreateRuleGroupsNamespace CreateRuleGroupsNamespace Base64 Base64
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespace' {Base64
data' :: Base64
$sel:data':CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Base64
data'} -> Base64
data') (\s :: CreateRuleGroupsNamespace
s@CreateRuleGroupsNamespace' {} Base64
a -> CreateRuleGroupsNamespace
s {$sel:data':CreateRuleGroupsNamespace' :: Base64
data' = Base64
a} :: CreateRuleGroupsNamespace) ((Base64 -> f Base64)
 -> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace)
-> ((ByteString -> f ByteString) -> Base64 -> f Base64)
-> (ByteString -> f ByteString)
-> CreateRuleGroupsNamespace
-> f CreateRuleGroupsNamespace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ByteString -> f ByteString) -> Base64 -> f Base64
Iso' Base64 ByteString
Core._Base64

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

-- | The ID of the workspace in which to create the rule group namespace.
createRuleGroupsNamespace_workspaceId :: Lens.Lens' CreateRuleGroupsNamespace Prelude.Text
createRuleGroupsNamespace_workspaceId :: (Text -> f Text)
-> CreateRuleGroupsNamespace -> f CreateRuleGroupsNamespace
createRuleGroupsNamespace_workspaceId = (CreateRuleGroupsNamespace -> Text)
-> (CreateRuleGroupsNamespace -> Text -> CreateRuleGroupsNamespace)
-> Lens
     CreateRuleGroupsNamespace CreateRuleGroupsNamespace Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespace' {Text
workspaceId :: Text
$sel:workspaceId:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Text
workspaceId} -> Text
workspaceId) (\s :: CreateRuleGroupsNamespace
s@CreateRuleGroupsNamespace' {} Text
a -> CreateRuleGroupsNamespace
s {$sel:workspaceId:CreateRuleGroupsNamespace' :: Text
workspaceId = Text
a} :: CreateRuleGroupsNamespace)

instance Core.AWSRequest CreateRuleGroupsNamespace where
  type
    AWSResponse CreateRuleGroupsNamespace =
      CreateRuleGroupsNamespaceResponse
  request :: CreateRuleGroupsNamespace -> Request CreateRuleGroupsNamespace
request = Service
-> CreateRuleGroupsNamespace -> Request CreateRuleGroupsNamespace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRuleGroupsNamespace
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRuleGroupsNamespace)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRuleGroupsNamespace))
-> Logger
-> Service
-> Proxy CreateRuleGroupsNamespace
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRuleGroupsNamespace)))
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 ->
          Maybe (HashMap Text Text)
-> Int
-> Text
-> Text
-> RuleGroupsNamespaceStatus
-> CreateRuleGroupsNamespaceResponse
CreateRuleGroupsNamespaceResponse'
            (Maybe (HashMap Text Text)
 -> Int
 -> Text
 -> Text
 -> RuleGroupsNamespaceStatus
 -> CreateRuleGroupsNamespaceResponse)
-> Either String (Maybe (HashMap Text Text))
-> Either
     String
     (Int
      -> Text
      -> Text
      -> RuleGroupsNamespaceStatus
      -> CreateRuleGroupsNamespaceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"tags" Either String (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text)
-> Either String (Maybe (HashMap Text Text))
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (Int
   -> Text
   -> Text
   -> RuleGroupsNamespaceStatus
   -> CreateRuleGroupsNamespaceResponse)
-> Either String Int
-> Either
     String
     (Text
      -> Text
      -> RuleGroupsNamespaceStatus
      -> CreateRuleGroupsNamespaceResponse)
forall (f :: * -> *) a b. Applicative f => 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
  (Text
   -> Text
   -> RuleGroupsNamespaceStatus
   -> CreateRuleGroupsNamespaceResponse)
-> Either String Text
-> Either
     String
     (Text
      -> RuleGroupsNamespaceStatus -> CreateRuleGroupsNamespaceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"arn")
            Either
  String
  (Text
   -> RuleGroupsNamespaceStatus -> CreateRuleGroupsNamespaceResponse)
-> Either String Text
-> Either
     String
     (RuleGroupsNamespaceStatus -> CreateRuleGroupsNamespaceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"name")
            Either
  String
  (RuleGroupsNamespaceStatus -> CreateRuleGroupsNamespaceResponse)
-> Either String RuleGroupsNamespaceStatus
-> Either String CreateRuleGroupsNamespaceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String RuleGroupsNamespaceStatus
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"status")
      )

instance Prelude.Hashable CreateRuleGroupsNamespace

instance Prelude.NFData CreateRuleGroupsNamespace

instance Core.ToHeaders CreateRuleGroupsNamespace where
  toHeaders :: CreateRuleGroupsNamespace -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateRuleGroupsNamespace -> 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.ToJSON CreateRuleGroupsNamespace where
  toJSON :: CreateRuleGroupsNamespace -> Value
toJSON CreateRuleGroupsNamespace' {Maybe Text
Maybe (HashMap Text Text)
Text
Base64
workspaceId :: Text
name :: Text
data' :: Base64
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:workspaceId:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Text
$sel:name:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Text
$sel:data':CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Base64
$sel:tags:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe (HashMap Text Text)
$sel:clientToken:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"data" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Base64
data'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

instance Core.ToPath CreateRuleGroupsNamespace where
  toPath :: CreateRuleGroupsNamespace -> ByteString
toPath CreateRuleGroupsNamespace' {Maybe Text
Maybe (HashMap Text Text)
Text
Base64
workspaceId :: Text
name :: Text
data' :: Base64
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
$sel:workspaceId:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Text
$sel:name:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Text
$sel:data':CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Base64
$sel:tags:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe (HashMap Text Text)
$sel:clientToken:CreateRuleGroupsNamespace' :: CreateRuleGroupsNamespace -> Maybe 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
"/rulegroupsnamespaces"
      ]

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

-- | Represents the output of a CreateRuleGroupsNamespace operation.
--
-- /See:/ 'newCreateRuleGroupsNamespaceResponse' smart constructor.
data CreateRuleGroupsNamespaceResponse = CreateRuleGroupsNamespaceResponse'
  { -- | The tags of this rule groups namespace.
    CreateRuleGroupsNamespaceResponse -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The response's http status code.
    CreateRuleGroupsNamespaceResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) of this rule groups namespace.
    CreateRuleGroupsNamespaceResponse -> Text
arn :: Prelude.Text,
    -- | The rule groups namespace name.
    CreateRuleGroupsNamespaceResponse -> Text
name :: Prelude.Text,
    -- | The status of rule groups namespace.
    CreateRuleGroupsNamespaceResponse -> RuleGroupsNamespaceStatus
status :: RuleGroupsNamespaceStatus
  }
  deriving (CreateRuleGroupsNamespaceResponse
-> CreateRuleGroupsNamespaceResponse -> Bool
(CreateRuleGroupsNamespaceResponse
 -> CreateRuleGroupsNamespaceResponse -> Bool)
-> (CreateRuleGroupsNamespaceResponse
    -> CreateRuleGroupsNamespaceResponse -> Bool)
-> Eq CreateRuleGroupsNamespaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRuleGroupsNamespaceResponse
-> CreateRuleGroupsNamespaceResponse -> Bool
$c/= :: CreateRuleGroupsNamespaceResponse
-> CreateRuleGroupsNamespaceResponse -> Bool
== :: CreateRuleGroupsNamespaceResponse
-> CreateRuleGroupsNamespaceResponse -> Bool
$c== :: CreateRuleGroupsNamespaceResponse
-> CreateRuleGroupsNamespaceResponse -> Bool
Prelude.Eq, ReadPrec [CreateRuleGroupsNamespaceResponse]
ReadPrec CreateRuleGroupsNamespaceResponse
Int -> ReadS CreateRuleGroupsNamespaceResponse
ReadS [CreateRuleGroupsNamespaceResponse]
(Int -> ReadS CreateRuleGroupsNamespaceResponse)
-> ReadS [CreateRuleGroupsNamespaceResponse]
-> ReadPrec CreateRuleGroupsNamespaceResponse
-> ReadPrec [CreateRuleGroupsNamespaceResponse]
-> Read CreateRuleGroupsNamespaceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRuleGroupsNamespaceResponse]
$creadListPrec :: ReadPrec [CreateRuleGroupsNamespaceResponse]
readPrec :: ReadPrec CreateRuleGroupsNamespaceResponse
$creadPrec :: ReadPrec CreateRuleGroupsNamespaceResponse
readList :: ReadS [CreateRuleGroupsNamespaceResponse]
$creadList :: ReadS [CreateRuleGroupsNamespaceResponse]
readsPrec :: Int -> ReadS CreateRuleGroupsNamespaceResponse
$creadsPrec :: Int -> ReadS CreateRuleGroupsNamespaceResponse
Prelude.Read, Int -> CreateRuleGroupsNamespaceResponse -> ShowS
[CreateRuleGroupsNamespaceResponse] -> ShowS
CreateRuleGroupsNamespaceResponse -> String
(Int -> CreateRuleGroupsNamespaceResponse -> ShowS)
-> (CreateRuleGroupsNamespaceResponse -> String)
-> ([CreateRuleGroupsNamespaceResponse] -> ShowS)
-> Show CreateRuleGroupsNamespaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRuleGroupsNamespaceResponse] -> ShowS
$cshowList :: [CreateRuleGroupsNamespaceResponse] -> ShowS
show :: CreateRuleGroupsNamespaceResponse -> String
$cshow :: CreateRuleGroupsNamespaceResponse -> String
showsPrec :: Int -> CreateRuleGroupsNamespaceResponse -> ShowS
$cshowsPrec :: Int -> CreateRuleGroupsNamespaceResponse -> ShowS
Prelude.Show, (forall x.
 CreateRuleGroupsNamespaceResponse
 -> Rep CreateRuleGroupsNamespaceResponse x)
-> (forall x.
    Rep CreateRuleGroupsNamespaceResponse x
    -> CreateRuleGroupsNamespaceResponse)
-> Generic CreateRuleGroupsNamespaceResponse
forall x.
Rep CreateRuleGroupsNamespaceResponse x
-> CreateRuleGroupsNamespaceResponse
forall x.
CreateRuleGroupsNamespaceResponse
-> Rep CreateRuleGroupsNamespaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRuleGroupsNamespaceResponse x
-> CreateRuleGroupsNamespaceResponse
$cfrom :: forall x.
CreateRuleGroupsNamespaceResponse
-> Rep CreateRuleGroupsNamespaceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRuleGroupsNamespaceResponse' 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:
--
-- 'tags', 'createRuleGroupsNamespaceResponse_tags' - The tags of this rule groups namespace.
--
-- 'httpStatus', 'createRuleGroupsNamespaceResponse_httpStatus' - The response's http status code.
--
-- 'arn', 'createRuleGroupsNamespaceResponse_arn' - The Amazon Resource Name (ARN) of this rule groups namespace.
--
-- 'name', 'createRuleGroupsNamespaceResponse_name' - The rule groups namespace name.
--
-- 'status', 'createRuleGroupsNamespaceResponse_status' - The status of rule groups namespace.
newCreateRuleGroupsNamespaceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'status'
  RuleGroupsNamespaceStatus ->
  CreateRuleGroupsNamespaceResponse
newCreateRuleGroupsNamespaceResponse :: Int
-> Text
-> Text
-> RuleGroupsNamespaceStatus
-> CreateRuleGroupsNamespaceResponse
newCreateRuleGroupsNamespaceResponse
  Int
pHttpStatus_
  Text
pArn_
  Text
pName_
  RuleGroupsNamespaceStatus
pStatus_ =
    CreateRuleGroupsNamespaceResponse' :: Maybe (HashMap Text Text)
-> Int
-> Text
-> Text
-> RuleGroupsNamespaceStatus
-> CreateRuleGroupsNamespaceResponse
CreateRuleGroupsNamespaceResponse'
      { $sel:tags:CreateRuleGroupsNamespaceResponse' :: Maybe (HashMap Text Text)
tags =
          Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateRuleGroupsNamespaceResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:arn:CreateRuleGroupsNamespaceResponse' :: Text
arn = Text
pArn_,
        $sel:name:CreateRuleGroupsNamespaceResponse' :: Text
name = Text
pName_,
        $sel:status:CreateRuleGroupsNamespaceResponse' :: RuleGroupsNamespaceStatus
status = RuleGroupsNamespaceStatus
pStatus_
      }

-- | The tags of this rule groups namespace.
createRuleGroupsNamespaceResponse_tags :: Lens.Lens' CreateRuleGroupsNamespaceResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRuleGroupsNamespaceResponse_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRuleGroupsNamespaceResponse
-> f CreateRuleGroupsNamespaceResponse
createRuleGroupsNamespaceResponse_tags = (CreateRuleGroupsNamespaceResponse -> Maybe (HashMap Text Text))
-> (CreateRuleGroupsNamespaceResponse
    -> Maybe (HashMap Text Text) -> CreateRuleGroupsNamespaceResponse)
-> Lens
     CreateRuleGroupsNamespaceResponse
     CreateRuleGroupsNamespaceResponse
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespaceResponse' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateRuleGroupsNamespaceResponse' :: CreateRuleGroupsNamespaceResponse -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateRuleGroupsNamespaceResponse
s@CreateRuleGroupsNamespaceResponse' {} Maybe (HashMap Text Text)
a -> CreateRuleGroupsNamespaceResponse
s {$sel:tags:CreateRuleGroupsNamespaceResponse' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateRuleGroupsNamespaceResponse) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRuleGroupsNamespaceResponse
 -> f CreateRuleGroupsNamespaceResponse)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRuleGroupsNamespaceResponse
-> f CreateRuleGroupsNamespaceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | The Amazon Resource Name (ARN) of this rule groups namespace.
createRuleGroupsNamespaceResponse_arn :: Lens.Lens' CreateRuleGroupsNamespaceResponse Prelude.Text
createRuleGroupsNamespaceResponse_arn :: (Text -> f Text)
-> CreateRuleGroupsNamespaceResponse
-> f CreateRuleGroupsNamespaceResponse
createRuleGroupsNamespaceResponse_arn = (CreateRuleGroupsNamespaceResponse -> Text)
-> (CreateRuleGroupsNamespaceResponse
    -> Text -> CreateRuleGroupsNamespaceResponse)
-> Lens
     CreateRuleGroupsNamespaceResponse
     CreateRuleGroupsNamespaceResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespaceResponse' {Text
arn :: Text
$sel:arn:CreateRuleGroupsNamespaceResponse' :: CreateRuleGroupsNamespaceResponse -> Text
arn} -> Text
arn) (\s :: CreateRuleGroupsNamespaceResponse
s@CreateRuleGroupsNamespaceResponse' {} Text
a -> CreateRuleGroupsNamespaceResponse
s {$sel:arn:CreateRuleGroupsNamespaceResponse' :: Text
arn = Text
a} :: CreateRuleGroupsNamespaceResponse)

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

-- | The status of rule groups namespace.
createRuleGroupsNamespaceResponse_status :: Lens.Lens' CreateRuleGroupsNamespaceResponse RuleGroupsNamespaceStatus
createRuleGroupsNamespaceResponse_status :: (RuleGroupsNamespaceStatus -> f RuleGroupsNamespaceStatus)
-> CreateRuleGroupsNamespaceResponse
-> f CreateRuleGroupsNamespaceResponse
createRuleGroupsNamespaceResponse_status = (CreateRuleGroupsNamespaceResponse -> RuleGroupsNamespaceStatus)
-> (CreateRuleGroupsNamespaceResponse
    -> RuleGroupsNamespaceStatus -> CreateRuleGroupsNamespaceResponse)
-> Lens
     CreateRuleGroupsNamespaceResponse
     CreateRuleGroupsNamespaceResponse
     RuleGroupsNamespaceStatus
     RuleGroupsNamespaceStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRuleGroupsNamespaceResponse' {RuleGroupsNamespaceStatus
status :: RuleGroupsNamespaceStatus
$sel:status:CreateRuleGroupsNamespaceResponse' :: CreateRuleGroupsNamespaceResponse -> RuleGroupsNamespaceStatus
status} -> RuleGroupsNamespaceStatus
status) (\s :: CreateRuleGroupsNamespaceResponse
s@CreateRuleGroupsNamespaceResponse' {} RuleGroupsNamespaceStatus
a -> CreateRuleGroupsNamespaceResponse
s {$sel:status:CreateRuleGroupsNamespaceResponse' :: RuleGroupsNamespaceStatus
status = RuleGroupsNamespaceStatus
a} :: CreateRuleGroupsNamespaceResponse)

instance
  Prelude.NFData
    CreateRuleGroupsNamespaceResponse