{-# 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.MQ.CreateConfiguration
-- 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)
--
-- Creates a new configuration for the specified configuration name. Amazon
-- MQ uses the default configuration (the engine type and version).
module Amazonka.MQ.CreateConfiguration
  ( -- * Creating a Request
    CreateConfiguration (..),
    newCreateConfiguration,

    -- * Request Lenses
    createConfiguration_authenticationStrategy,
    createConfiguration_tags,
    createConfiguration_engineVersion,
    createConfiguration_engineType,
    createConfiguration_name,

    -- * Destructuring the Response
    CreateConfigurationResponse (..),
    newCreateConfigurationResponse,

    -- * Response Lenses
    createConfigurationResponse_arn,
    createConfigurationResponse_latestRevision,
    createConfigurationResponse_created,
    createConfigurationResponse_authenticationStrategy,
    createConfigurationResponse_name,
    createConfigurationResponse_id,
    createConfigurationResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MQ.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Creates a new configuration for the specified configuration name. Amazon
-- MQ uses the default configuration (the engine type and version).
--
-- /See:/ 'newCreateConfiguration' smart constructor.
data CreateConfiguration = CreateConfiguration'
  { -- | Optional. The authentication strategy associated with the configuration.
    -- The default is SIMPLE.
    CreateConfiguration -> Maybe AuthenticationStrategy
authenticationStrategy :: Prelude.Maybe AuthenticationStrategy,
    -- | Create tags when creating the configuration.
    CreateConfiguration -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Required. The broker engine\'s version. For a list of supported engine
    -- versions, see
    -- <https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/broker-engine.html Supported engines>.
    CreateConfiguration -> Text
engineVersion :: Prelude.Text,
    -- | Required. The type of broker engine. Currently, Amazon MQ supports
    -- ACTIVEMQ and RABBITMQ.
    CreateConfiguration -> EngineType
engineType :: EngineType,
    -- | Required. The name of the configuration. This value can contain only
    -- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
    -- ~). This value must be 1-150 characters long.
    CreateConfiguration -> Text
name :: Prelude.Text
  }
  deriving (CreateConfiguration -> CreateConfiguration -> Bool
(CreateConfiguration -> CreateConfiguration -> Bool)
-> (CreateConfiguration -> CreateConfiguration -> Bool)
-> Eq CreateConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfiguration -> CreateConfiguration -> Bool
$c/= :: CreateConfiguration -> CreateConfiguration -> Bool
== :: CreateConfiguration -> CreateConfiguration -> Bool
$c== :: CreateConfiguration -> CreateConfiguration -> Bool
Prelude.Eq, ReadPrec [CreateConfiguration]
ReadPrec CreateConfiguration
Int -> ReadS CreateConfiguration
ReadS [CreateConfiguration]
(Int -> ReadS CreateConfiguration)
-> ReadS [CreateConfiguration]
-> ReadPrec CreateConfiguration
-> ReadPrec [CreateConfiguration]
-> Read CreateConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConfiguration]
$creadListPrec :: ReadPrec [CreateConfiguration]
readPrec :: ReadPrec CreateConfiguration
$creadPrec :: ReadPrec CreateConfiguration
readList :: ReadS [CreateConfiguration]
$creadList :: ReadS [CreateConfiguration]
readsPrec :: Int -> ReadS CreateConfiguration
$creadsPrec :: Int -> ReadS CreateConfiguration
Prelude.Read, Int -> CreateConfiguration -> ShowS
[CreateConfiguration] -> ShowS
CreateConfiguration -> String
(Int -> CreateConfiguration -> ShowS)
-> (CreateConfiguration -> String)
-> ([CreateConfiguration] -> ShowS)
-> Show CreateConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConfiguration] -> ShowS
$cshowList :: [CreateConfiguration] -> ShowS
show :: CreateConfiguration -> String
$cshow :: CreateConfiguration -> String
showsPrec :: Int -> CreateConfiguration -> ShowS
$cshowsPrec :: Int -> CreateConfiguration -> ShowS
Prelude.Show, (forall x. CreateConfiguration -> Rep CreateConfiguration x)
-> (forall x. Rep CreateConfiguration x -> CreateConfiguration)
-> Generic CreateConfiguration
forall x. Rep CreateConfiguration x -> CreateConfiguration
forall x. CreateConfiguration -> Rep CreateConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateConfiguration x -> CreateConfiguration
$cfrom :: forall x. CreateConfiguration -> Rep CreateConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'CreateConfiguration' 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:
--
-- 'authenticationStrategy', 'createConfiguration_authenticationStrategy' - Optional. The authentication strategy associated with the configuration.
-- The default is SIMPLE.
--
-- 'tags', 'createConfiguration_tags' - Create tags when creating the configuration.
--
-- 'engineVersion', 'createConfiguration_engineVersion' - Required. The broker engine\'s version. For a list of supported engine
-- versions, see
-- <https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/broker-engine.html Supported engines>.
--
-- 'engineType', 'createConfiguration_engineType' - Required. The type of broker engine. Currently, Amazon MQ supports
-- ACTIVEMQ and RABBITMQ.
--
-- 'name', 'createConfiguration_name' - Required. The name of the configuration. This value can contain only
-- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
-- ~). This value must be 1-150 characters long.
newCreateConfiguration ::
  -- | 'engineVersion'
  Prelude.Text ->
  -- | 'engineType'
  EngineType ->
  -- | 'name'
  Prelude.Text ->
  CreateConfiguration
newCreateConfiguration :: Text -> EngineType -> Text -> CreateConfiguration
newCreateConfiguration
  Text
pEngineVersion_
  EngineType
pEngineType_
  Text
pName_ =
    CreateConfiguration' :: Maybe AuthenticationStrategy
-> Maybe (HashMap Text Text)
-> Text
-> EngineType
-> Text
-> CreateConfiguration
CreateConfiguration'
      { $sel:authenticationStrategy:CreateConfiguration' :: Maybe AuthenticationStrategy
authenticationStrategy =
          Maybe AuthenticationStrategy
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateConfiguration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:engineVersion:CreateConfiguration' :: Text
engineVersion = Text
pEngineVersion_,
        $sel:engineType:CreateConfiguration' :: EngineType
engineType = EngineType
pEngineType_,
        $sel:name:CreateConfiguration' :: Text
name = Text
pName_
      }

-- | Optional. The authentication strategy associated with the configuration.
-- The default is SIMPLE.
createConfiguration_authenticationStrategy :: Lens.Lens' CreateConfiguration (Prelude.Maybe AuthenticationStrategy)
createConfiguration_authenticationStrategy :: (Maybe AuthenticationStrategy -> f (Maybe AuthenticationStrategy))
-> CreateConfiguration -> f CreateConfiguration
createConfiguration_authenticationStrategy = (CreateConfiguration -> Maybe AuthenticationStrategy)
-> (CreateConfiguration
    -> Maybe AuthenticationStrategy -> CreateConfiguration)
-> Lens
     CreateConfiguration
     CreateConfiguration
     (Maybe AuthenticationStrategy)
     (Maybe AuthenticationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfiguration' {Maybe AuthenticationStrategy
authenticationStrategy :: Maybe AuthenticationStrategy
$sel:authenticationStrategy:CreateConfiguration' :: CreateConfiguration -> Maybe AuthenticationStrategy
authenticationStrategy} -> Maybe AuthenticationStrategy
authenticationStrategy) (\s :: CreateConfiguration
s@CreateConfiguration' {} Maybe AuthenticationStrategy
a -> CreateConfiguration
s {$sel:authenticationStrategy:CreateConfiguration' :: Maybe AuthenticationStrategy
authenticationStrategy = Maybe AuthenticationStrategy
a} :: CreateConfiguration)

-- | Create tags when creating the configuration.
createConfiguration_tags :: Lens.Lens' CreateConfiguration (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createConfiguration_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateConfiguration -> f CreateConfiguration
createConfiguration_tags = (CreateConfiguration -> Maybe (HashMap Text Text))
-> (CreateConfiguration
    -> Maybe (HashMap Text Text) -> CreateConfiguration)
-> Lens
     CreateConfiguration
     CreateConfiguration
     (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 (\CreateConfiguration' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateConfiguration' :: CreateConfiguration -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateConfiguration
s@CreateConfiguration' {} Maybe (HashMap Text Text)
a -> CreateConfiguration
s {$sel:tags:CreateConfiguration' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateConfiguration) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateConfiguration -> f CreateConfiguration)
-> ((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)))
-> CreateConfiguration
-> f CreateConfiguration
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

-- | Required. The broker engine\'s version. For a list of supported engine
-- versions, see
-- <https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/broker-engine.html Supported engines>.
createConfiguration_engineVersion :: Lens.Lens' CreateConfiguration Prelude.Text
createConfiguration_engineVersion :: (Text -> f Text) -> CreateConfiguration -> f CreateConfiguration
createConfiguration_engineVersion = (CreateConfiguration -> Text)
-> (CreateConfiguration -> Text -> CreateConfiguration)
-> Lens CreateConfiguration CreateConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfiguration' {Text
engineVersion :: Text
$sel:engineVersion:CreateConfiguration' :: CreateConfiguration -> Text
engineVersion} -> Text
engineVersion) (\s :: CreateConfiguration
s@CreateConfiguration' {} Text
a -> CreateConfiguration
s {$sel:engineVersion:CreateConfiguration' :: Text
engineVersion = Text
a} :: CreateConfiguration)

-- | Required. The type of broker engine. Currently, Amazon MQ supports
-- ACTIVEMQ and RABBITMQ.
createConfiguration_engineType :: Lens.Lens' CreateConfiguration EngineType
createConfiguration_engineType :: (EngineType -> f EngineType)
-> CreateConfiguration -> f CreateConfiguration
createConfiguration_engineType = (CreateConfiguration -> EngineType)
-> (CreateConfiguration -> EngineType -> CreateConfiguration)
-> Lens
     CreateConfiguration CreateConfiguration EngineType EngineType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfiguration' {EngineType
engineType :: EngineType
$sel:engineType:CreateConfiguration' :: CreateConfiguration -> EngineType
engineType} -> EngineType
engineType) (\s :: CreateConfiguration
s@CreateConfiguration' {} EngineType
a -> CreateConfiguration
s {$sel:engineType:CreateConfiguration' :: EngineType
engineType = EngineType
a} :: CreateConfiguration)

-- | Required. The name of the configuration. This value can contain only
-- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
-- ~). This value must be 1-150 characters long.
createConfiguration_name :: Lens.Lens' CreateConfiguration Prelude.Text
createConfiguration_name :: (Text -> f Text) -> CreateConfiguration -> f CreateConfiguration
createConfiguration_name = (CreateConfiguration -> Text)
-> (CreateConfiguration -> Text -> CreateConfiguration)
-> Lens CreateConfiguration CreateConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfiguration' {Text
name :: Text
$sel:name:CreateConfiguration' :: CreateConfiguration -> Text
name} -> Text
name) (\s :: CreateConfiguration
s@CreateConfiguration' {} Text
a -> CreateConfiguration
s {$sel:name:CreateConfiguration' :: Text
name = Text
a} :: CreateConfiguration)

instance Core.AWSRequest CreateConfiguration where
  type
    AWSResponse CreateConfiguration =
      CreateConfigurationResponse
  request :: CreateConfiguration -> Request CreateConfiguration
request = Service -> CreateConfiguration -> Request CreateConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateConfiguration))
-> Logger
-> Service
-> Proxy CreateConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateConfiguration)))
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 Text
-> Maybe ConfigurationRevision
-> Maybe POSIX
-> Maybe AuthenticationStrategy
-> Maybe Text
-> Maybe Text
-> Int
-> CreateConfigurationResponse
CreateConfigurationResponse'
            (Maybe Text
 -> Maybe ConfigurationRevision
 -> Maybe POSIX
 -> Maybe AuthenticationStrategy
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateConfigurationResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe ConfigurationRevision
      -> Maybe POSIX
      -> Maybe AuthenticationStrategy
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"arn")
            Either
  String
  (Maybe ConfigurationRevision
   -> Maybe POSIX
   -> Maybe AuthenticationStrategy
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateConfigurationResponse)
-> Either String (Maybe ConfigurationRevision)
-> Either
     String
     (Maybe POSIX
      -> Maybe AuthenticationStrategy
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ConfigurationRevision)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"latestRevision")
            Either
  String
  (Maybe POSIX
   -> Maybe AuthenticationStrategy
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateConfigurationResponse)
-> Either String (Maybe POSIX)
-> Either
     String
     (Maybe AuthenticationStrategy
      -> Maybe Text -> Maybe Text -> Int -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"created")
            Either
  String
  (Maybe AuthenticationStrategy
   -> Maybe Text -> Maybe Text -> Int -> CreateConfigurationResponse)
-> Either String (Maybe AuthenticationStrategy)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe AuthenticationStrategy)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"authenticationStrategy")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> CreateConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"name")
            Either String (Maybe Text -> Int -> CreateConfigurationResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateConfigurationResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"id")
            Either String (Int -> CreateConfigurationResponse)
-> Either String Int -> Either String CreateConfigurationResponse
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))
      )

instance Prelude.Hashable CreateConfiguration

instance Prelude.NFData CreateConfiguration

instance Core.ToHeaders CreateConfiguration where
  toHeaders :: CreateConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateConfiguration -> 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 CreateConfiguration where
  toJSON :: CreateConfiguration -> Value
toJSON CreateConfiguration' {Maybe (HashMap Text Text)
Maybe AuthenticationStrategy
Text
EngineType
name :: Text
engineType :: EngineType
engineVersion :: Text
tags :: Maybe (HashMap Text Text)
authenticationStrategy :: Maybe AuthenticationStrategy
$sel:name:CreateConfiguration' :: CreateConfiguration -> Text
$sel:engineType:CreateConfiguration' :: CreateConfiguration -> EngineType
$sel:engineVersion:CreateConfiguration' :: CreateConfiguration -> Text
$sel:tags:CreateConfiguration' :: CreateConfiguration -> Maybe (HashMap Text Text)
$sel:authenticationStrategy:CreateConfiguration' :: CreateConfiguration -> Maybe AuthenticationStrategy
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"authenticationStrategy" Text -> AuthenticationStrategy -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AuthenticationStrategy -> Pair)
-> Maybe AuthenticationStrategy -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AuthenticationStrategy
authenticationStrategy,
            (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
"engineVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
engineVersion),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"engineType" Text -> EngineType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= EngineType
engineType),
            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 CreateConfiguration where
  toPath :: CreateConfiguration -> ByteString
toPath = ByteString -> CreateConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/configurations"

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

-- | /See:/ 'newCreateConfigurationResponse' smart constructor.
data CreateConfigurationResponse = CreateConfigurationResponse'
  { -- | Required. The Amazon Resource Name (ARN) of the configuration.
    CreateConfigurationResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The latest revision of the configuration.
    CreateConfigurationResponse -> Maybe ConfigurationRevision
latestRevision :: Prelude.Maybe ConfigurationRevision,
    -- | Required. The date and time of the configuration.
    CreateConfigurationResponse -> Maybe POSIX
created :: Prelude.Maybe Core.POSIX,
    -- | Optional. The authentication strategy associated with the configuration.
    -- The default is SIMPLE.
    CreateConfigurationResponse -> Maybe AuthenticationStrategy
authenticationStrategy :: Prelude.Maybe AuthenticationStrategy,
    -- | Required. The name of the configuration. This value can contain only
    -- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
    -- ~). This value must be 1-150 characters long.
    CreateConfigurationResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Required. The unique ID that Amazon MQ generates for the configuration.
    CreateConfigurationResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateConfigurationResponse -> CreateConfigurationResponse -> Bool
(CreateConfigurationResponse
 -> CreateConfigurationResponse -> Bool)
-> (CreateConfigurationResponse
    -> CreateConfigurationResponse -> Bool)
-> Eq CreateConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateConfigurationResponse -> CreateConfigurationResponse -> Bool
$c/= :: CreateConfigurationResponse -> CreateConfigurationResponse -> Bool
== :: CreateConfigurationResponse -> CreateConfigurationResponse -> Bool
$c== :: CreateConfigurationResponse -> CreateConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [CreateConfigurationResponse]
ReadPrec CreateConfigurationResponse
Int -> ReadS CreateConfigurationResponse
ReadS [CreateConfigurationResponse]
(Int -> ReadS CreateConfigurationResponse)
-> ReadS [CreateConfigurationResponse]
-> ReadPrec CreateConfigurationResponse
-> ReadPrec [CreateConfigurationResponse]
-> Read CreateConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateConfigurationResponse]
$creadListPrec :: ReadPrec [CreateConfigurationResponse]
readPrec :: ReadPrec CreateConfigurationResponse
$creadPrec :: ReadPrec CreateConfigurationResponse
readList :: ReadS [CreateConfigurationResponse]
$creadList :: ReadS [CreateConfigurationResponse]
readsPrec :: Int -> ReadS CreateConfigurationResponse
$creadsPrec :: Int -> ReadS CreateConfigurationResponse
Prelude.Read, Int -> CreateConfigurationResponse -> ShowS
[CreateConfigurationResponse] -> ShowS
CreateConfigurationResponse -> String
(Int -> CreateConfigurationResponse -> ShowS)
-> (CreateConfigurationResponse -> String)
-> ([CreateConfigurationResponse] -> ShowS)
-> Show CreateConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateConfigurationResponse] -> ShowS
$cshowList :: [CreateConfigurationResponse] -> ShowS
show :: CreateConfigurationResponse -> String
$cshow :: CreateConfigurationResponse -> String
showsPrec :: Int -> CreateConfigurationResponse -> ShowS
$cshowsPrec :: Int -> CreateConfigurationResponse -> ShowS
Prelude.Show, (forall x.
 CreateConfigurationResponse -> Rep CreateConfigurationResponse x)
-> (forall x.
    Rep CreateConfigurationResponse x -> CreateConfigurationResponse)
-> Generic CreateConfigurationResponse
forall x.
Rep CreateConfigurationResponse x -> CreateConfigurationResponse
forall x.
CreateConfigurationResponse -> Rep CreateConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateConfigurationResponse x -> CreateConfigurationResponse
$cfrom :: forall x.
CreateConfigurationResponse -> Rep CreateConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateConfigurationResponse' 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:
--
-- 'arn', 'createConfigurationResponse_arn' - Required. The Amazon Resource Name (ARN) of the configuration.
--
-- 'latestRevision', 'createConfigurationResponse_latestRevision' - The latest revision of the configuration.
--
-- 'created', 'createConfigurationResponse_created' - Required. The date and time of the configuration.
--
-- 'authenticationStrategy', 'createConfigurationResponse_authenticationStrategy' - Optional. The authentication strategy associated with the configuration.
-- The default is SIMPLE.
--
-- 'name', 'createConfigurationResponse_name' - Required. The name of the configuration. This value can contain only
-- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
-- ~). This value must be 1-150 characters long.
--
-- 'id', 'createConfigurationResponse_id' - Required. The unique ID that Amazon MQ generates for the configuration.
--
-- 'httpStatus', 'createConfigurationResponse_httpStatus' - The response's http status code.
newCreateConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateConfigurationResponse
newCreateConfigurationResponse :: Int -> CreateConfigurationResponse
newCreateConfigurationResponse Int
pHttpStatus_ =
  CreateConfigurationResponse' :: Maybe Text
-> Maybe ConfigurationRevision
-> Maybe POSIX
-> Maybe AuthenticationStrategy
-> Maybe Text
-> Maybe Text
-> Int
-> CreateConfigurationResponse
CreateConfigurationResponse'
    { $sel:arn:CreateConfigurationResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestRevision:CreateConfigurationResponse' :: Maybe ConfigurationRevision
latestRevision = Maybe ConfigurationRevision
forall a. Maybe a
Prelude.Nothing,
      $sel:created:CreateConfigurationResponse' :: Maybe POSIX
created = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationStrategy:CreateConfigurationResponse' :: Maybe AuthenticationStrategy
authenticationStrategy = Maybe AuthenticationStrategy
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateConfigurationResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateConfigurationResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Required. The Amazon Resource Name (ARN) of the configuration.
createConfigurationResponse_arn :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe Prelude.Text)
createConfigurationResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_arn = (CreateConfigurationResponse -> Maybe Text)
-> (CreateConfigurationResponse
    -> Maybe Text -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe Text
a -> CreateConfigurationResponse
s {$sel:arn:CreateConfigurationResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateConfigurationResponse)

-- | The latest revision of the configuration.
createConfigurationResponse_latestRevision :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe ConfigurationRevision)
createConfigurationResponse_latestRevision :: (Maybe ConfigurationRevision -> f (Maybe ConfigurationRevision))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_latestRevision = (CreateConfigurationResponse -> Maybe ConfigurationRevision)
-> (CreateConfigurationResponse
    -> Maybe ConfigurationRevision -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe ConfigurationRevision)
     (Maybe ConfigurationRevision)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe ConfigurationRevision
latestRevision :: Maybe ConfigurationRevision
$sel:latestRevision:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe ConfigurationRevision
latestRevision} -> Maybe ConfigurationRevision
latestRevision) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe ConfigurationRevision
a -> CreateConfigurationResponse
s {$sel:latestRevision:CreateConfigurationResponse' :: Maybe ConfigurationRevision
latestRevision = Maybe ConfigurationRevision
a} :: CreateConfigurationResponse)

-- | Required. The date and time of the configuration.
createConfigurationResponse_created :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe Prelude.UTCTime)
createConfigurationResponse_created :: (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_created = (CreateConfigurationResponse -> Maybe POSIX)
-> (CreateConfigurationResponse
    -> Maybe POSIX -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe POSIX
created :: Maybe POSIX
$sel:created:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe POSIX
created} -> Maybe POSIX
created) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe POSIX
a -> CreateConfigurationResponse
s {$sel:created:CreateConfigurationResponse' :: Maybe POSIX
created = Maybe POSIX
a} :: CreateConfigurationResponse) ((Maybe POSIX -> f (Maybe POSIX))
 -> CreateConfigurationResponse -> f CreateConfigurationResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> CreateConfigurationResponse
-> f CreateConfigurationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Optional. The authentication strategy associated with the configuration.
-- The default is SIMPLE.
createConfigurationResponse_authenticationStrategy :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe AuthenticationStrategy)
createConfigurationResponse_authenticationStrategy :: (Maybe AuthenticationStrategy -> f (Maybe AuthenticationStrategy))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_authenticationStrategy = (CreateConfigurationResponse -> Maybe AuthenticationStrategy)
-> (CreateConfigurationResponse
    -> Maybe AuthenticationStrategy -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe AuthenticationStrategy)
     (Maybe AuthenticationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe AuthenticationStrategy
authenticationStrategy :: Maybe AuthenticationStrategy
$sel:authenticationStrategy:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe AuthenticationStrategy
authenticationStrategy} -> Maybe AuthenticationStrategy
authenticationStrategy) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe AuthenticationStrategy
a -> CreateConfigurationResponse
s {$sel:authenticationStrategy:CreateConfigurationResponse' :: Maybe AuthenticationStrategy
authenticationStrategy = Maybe AuthenticationStrategy
a} :: CreateConfigurationResponse)

-- | Required. The name of the configuration. This value can contain only
-- alphanumeric characters, dashes, periods, underscores, and tildes (- . _
-- ~). This value must be 1-150 characters long.
createConfigurationResponse_name :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe Prelude.Text)
createConfigurationResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_name = (CreateConfigurationResponse -> Maybe Text)
-> (CreateConfigurationResponse
    -> Maybe Text -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe Text
a -> CreateConfigurationResponse
s {$sel:name:CreateConfigurationResponse' :: Maybe Text
name = Maybe Text
a} :: CreateConfigurationResponse)

-- | Required. The unique ID that Amazon MQ generates for the configuration.
createConfigurationResponse_id :: Lens.Lens' CreateConfigurationResponse (Prelude.Maybe Prelude.Text)
createConfigurationResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateConfigurationResponse -> f CreateConfigurationResponse
createConfigurationResponse_id = (CreateConfigurationResponse -> Maybe Text)
-> (CreateConfigurationResponse
    -> Maybe Text -> CreateConfigurationResponse)
-> Lens
     CreateConfigurationResponse
     CreateConfigurationResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateConfigurationResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateConfigurationResponse' :: CreateConfigurationResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateConfigurationResponse
s@CreateConfigurationResponse' {} Maybe Text
a -> CreateConfigurationResponse
s {$sel:id:CreateConfigurationResponse' :: Maybe Text
id = Maybe Text
a} :: CreateConfigurationResponse)

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

instance Prelude.NFData CreateConfigurationResponse