{-# 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.CreateBroker
-- 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 broker. Note: This API is asynchronous.
--
-- To create a broker, you must either use the AmazonMQFullAccess IAM
-- policy or include the following EC2 permissions in your IAM policy.
--
-- -   ec2:CreateNetworkInterface
--
--     This permission is required to allow Amazon MQ to create an elastic
--     network interface (ENI) on behalf of your account.
--
-- -   ec2:CreateNetworkInterfacePermission
--
--     This permission is required to attach the ENI to the broker
--     instance.
--
-- -   ec2:DeleteNetworkInterface
--
-- -   ec2:DeleteNetworkInterfacePermission
--
-- -   ec2:DetachNetworkInterface
--
-- -   ec2:DescribeInternetGateways
--
-- -   ec2:DescribeNetworkInterfaces
--
-- -   ec2:DescribeNetworkInterfacePermissions
--
-- -   ec2:DescribeRouteTables
--
-- -   ec2:DescribeSecurityGroups
--
-- -   ec2:DescribeSubnets
--
-- -   ec2:DescribeVpcs
--
-- For more information, see
-- <https://docs.aws.amazon.com//amazon-mq/latest/developer-guide/amazon-mq-setting-up.html#create-iam-user Create an IAM User and Get Your AWS Credentials>
-- and
-- <https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/connecting-to-amazon-mq.html#never-modify-delete-elastic-network-interface Never Modify or Delete the Amazon MQ Elastic Network Interface>
-- in the /Amazon MQ Developer Guide/.
module Amazonka.MQ.CreateBroker
  ( -- * Creating a Request
    CreateBroker (..),
    newCreateBroker,

    -- * Request Lenses
    createBroker_securityGroups,
    createBroker_subnetIds,
    createBroker_creatorRequestId,
    createBroker_authenticationStrategy,
    createBroker_ldapServerMetadata,
    createBroker_maintenanceWindowStartTime,
    createBroker_logs,
    createBroker_encryptionOptions,
    createBroker_configuration,
    createBroker_tags,
    createBroker_storageType,
    createBroker_engineVersion,
    createBroker_hostInstanceType,
    createBroker_autoMinorVersionUpgrade,
    createBroker_users,
    createBroker_brokerName,
    createBroker_deploymentMode,
    createBroker_engineType,
    createBroker_publiclyAccessible,

    -- * Destructuring the Response
    CreateBrokerResponse (..),
    newCreateBrokerResponse,

    -- * Response Lenses
    createBrokerResponse_brokerId,
    createBrokerResponse_brokerArn,
    createBrokerResponse_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 broker using the specified properties.
--
-- /See:/ 'newCreateBroker' smart constructor.
data CreateBroker = CreateBroker'
  { -- | The list of rules (1 minimum, 125 maximum) that authorize connections to
    -- brokers.
    CreateBroker -> Maybe [Text]
securityGroups :: Prelude.Maybe [Prelude.Text],
    -- | The list of groups that define which subnets and IP ranges the broker
    -- can use from different Availability Zones. If you specify more than one
    -- subnet, the subnets must be in different Availability Zones. Amazon MQ
    -- will not be able to create VPC endpoints for your broker with multiple
    -- subnets in the same Availability Zone. A SINGLE_INSTANCE deployment
    -- requires one subnet (for example, the default subnet). An
    -- ACTIVE_STANDBY_MULTI_AZ Amazon MQ for ActiveMQ deployment requires two
    -- subnets. A CLUSTER_MULTI_AZ Amazon MQ for RabbitMQ deployment has no
    -- subnet requirements when deployed with public accessibility. Deployment
    -- without public accessibility requires at least one subnet.
    --
    -- If you specify subnets in a
    -- <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html shared VPC>
    -- for a RabbitMQ broker, the associated VPC to which the specified subnets
    -- belong must be owned by your AWS account. Amazon MQ will not be able to
    -- create VPC endpoints in VPCs that are not owned by your AWS account.
    CreateBroker -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The unique ID that the requester receives for the created broker. Amazon
    -- MQ passes your ID with the API action. Note: We recommend using a
    -- Universally Unique Identifier (UUID) for the creatorRequestId. You may
    -- omit the creatorRequestId if your application doesn\'t require
    -- idempotency.
    CreateBroker -> Maybe Text
creatorRequestId :: Prelude.Maybe Prelude.Text,
    -- | Optional. The authentication strategy used to secure the broker. The
    -- default is SIMPLE.
    CreateBroker -> Maybe AuthenticationStrategy
authenticationStrategy :: Prelude.Maybe AuthenticationStrategy,
    -- | Optional. The metadata of the LDAP server used to authenticate and
    -- authorize connections to the broker. Does not apply to RabbitMQ brokers.
    CreateBroker -> Maybe LdapServerMetadataInput
ldapServerMetadata :: Prelude.Maybe LdapServerMetadataInput,
    -- | The parameters that determine the WeeklyStartTime.
    CreateBroker -> Maybe WeeklyStartTime
maintenanceWindowStartTime :: Prelude.Maybe WeeklyStartTime,
    -- | Enables Amazon CloudWatch logging for brokers.
    CreateBroker -> Maybe Logs
logs :: Prelude.Maybe Logs,
    -- | Encryption options for the broker. Does not apply to RabbitMQ brokers.
    CreateBroker -> Maybe EncryptionOptions
encryptionOptions :: Prelude.Maybe EncryptionOptions,
    -- | A list of information about the configuration.
    CreateBroker -> Maybe ConfigurationId
configuration :: Prelude.Maybe ConfigurationId,
    -- | Create tags when creating the broker.
    CreateBroker -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The broker\'s storage type.
    CreateBroker -> Maybe BrokerStorageType
storageType :: Prelude.Maybe BrokerStorageType,
    -- | 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>.
    CreateBroker -> Text
engineVersion :: Prelude.Text,
    -- | Required. The broker\'s instance type.
    CreateBroker -> Text
hostInstanceType :: Prelude.Text,
    -- | Enables automatic upgrades to new minor versions for brokers, as new
    -- versions are released and supported by Amazon MQ. Automatic upgrades
    -- occur during the scheduled maintenance window of the broker or after a
    -- manual broker reboot. Set to true by default, if no value is specified.
    CreateBroker -> Bool
autoMinorVersionUpgrade :: Prelude.Bool,
    -- | Required. The list of broker users (persons or applications) who can
    -- access queues and topics. This value can contain only alphanumeric
    -- characters, dashes, periods, underscores, and tildes (- . _ ~). This
    -- value must be 2-100 characters long.
    --
    -- Amazon MQ for RabbitMQ
    --
    -- When you create an Amazon MQ for RabbitMQ broker, one and only one
    -- administrative user is accepted and created when a broker is first
    -- provisioned. All subsequent broker users are created by making RabbitMQ
    -- API calls directly to brokers or via the RabbitMQ web console.
    CreateBroker -> [User]
users :: [User],
    -- | Required. The broker\'s name. This value must be unique in your AWS
    -- account, 1-50 characters long, must contain only letters, numbers,
    -- dashes, and underscores, and must not contain white spaces, brackets,
    -- wildcard characters, or special characters.
    CreateBroker -> Text
brokerName :: Prelude.Text,
    -- | Required. The broker\'s deployment mode.
    CreateBroker -> DeploymentMode
deploymentMode :: DeploymentMode,
    -- | Required. The type of broker engine. Currently, Amazon MQ supports
    -- ACTIVEMQ and RABBITMQ.
    CreateBroker -> EngineType
engineType :: EngineType,
    -- | Enables connections from applications outside of the VPC that hosts the
    -- broker\'s subnets. Set to false by default, if no value is provided.
    CreateBroker -> Bool
publiclyAccessible :: Prelude.Bool
  }
  deriving (CreateBroker -> CreateBroker -> Bool
(CreateBroker -> CreateBroker -> Bool)
-> (CreateBroker -> CreateBroker -> Bool) -> Eq CreateBroker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBroker -> CreateBroker -> Bool
$c/= :: CreateBroker -> CreateBroker -> Bool
== :: CreateBroker -> CreateBroker -> Bool
$c== :: CreateBroker -> CreateBroker -> Bool
Prelude.Eq, ReadPrec [CreateBroker]
ReadPrec CreateBroker
Int -> ReadS CreateBroker
ReadS [CreateBroker]
(Int -> ReadS CreateBroker)
-> ReadS [CreateBroker]
-> ReadPrec CreateBroker
-> ReadPrec [CreateBroker]
-> Read CreateBroker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBroker]
$creadListPrec :: ReadPrec [CreateBroker]
readPrec :: ReadPrec CreateBroker
$creadPrec :: ReadPrec CreateBroker
readList :: ReadS [CreateBroker]
$creadList :: ReadS [CreateBroker]
readsPrec :: Int -> ReadS CreateBroker
$creadsPrec :: Int -> ReadS CreateBroker
Prelude.Read, Int -> CreateBroker -> ShowS
[CreateBroker] -> ShowS
CreateBroker -> String
(Int -> CreateBroker -> ShowS)
-> (CreateBroker -> String)
-> ([CreateBroker] -> ShowS)
-> Show CreateBroker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBroker] -> ShowS
$cshowList :: [CreateBroker] -> ShowS
show :: CreateBroker -> String
$cshow :: CreateBroker -> String
showsPrec :: Int -> CreateBroker -> ShowS
$cshowsPrec :: Int -> CreateBroker -> ShowS
Prelude.Show, (forall x. CreateBroker -> Rep CreateBroker x)
-> (forall x. Rep CreateBroker x -> CreateBroker)
-> Generic CreateBroker
forall x. Rep CreateBroker x -> CreateBroker
forall x. CreateBroker -> Rep CreateBroker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBroker x -> CreateBroker
$cfrom :: forall x. CreateBroker -> Rep CreateBroker x
Prelude.Generic)

-- |
-- Create a value of 'CreateBroker' 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:
--
-- 'securityGroups', 'createBroker_securityGroups' - The list of rules (1 minimum, 125 maximum) that authorize connections to
-- brokers.
--
-- 'subnetIds', 'createBroker_subnetIds' - The list of groups that define which subnets and IP ranges the broker
-- can use from different Availability Zones. If you specify more than one
-- subnet, the subnets must be in different Availability Zones. Amazon MQ
-- will not be able to create VPC endpoints for your broker with multiple
-- subnets in the same Availability Zone. A SINGLE_INSTANCE deployment
-- requires one subnet (for example, the default subnet). An
-- ACTIVE_STANDBY_MULTI_AZ Amazon MQ for ActiveMQ deployment requires two
-- subnets. A CLUSTER_MULTI_AZ Amazon MQ for RabbitMQ deployment has no
-- subnet requirements when deployed with public accessibility. Deployment
-- without public accessibility requires at least one subnet.
--
-- If you specify subnets in a
-- <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html shared VPC>
-- for a RabbitMQ broker, the associated VPC to which the specified subnets
-- belong must be owned by your AWS account. Amazon MQ will not be able to
-- create VPC endpoints in VPCs that are not owned by your AWS account.
--
-- 'creatorRequestId', 'createBroker_creatorRequestId' - The unique ID that the requester receives for the created broker. Amazon
-- MQ passes your ID with the API action. Note: We recommend using a
-- Universally Unique Identifier (UUID) for the creatorRequestId. You may
-- omit the creatorRequestId if your application doesn\'t require
-- idempotency.
--
-- 'authenticationStrategy', 'createBroker_authenticationStrategy' - Optional. The authentication strategy used to secure the broker. The
-- default is SIMPLE.
--
-- 'ldapServerMetadata', 'createBroker_ldapServerMetadata' - Optional. The metadata of the LDAP server used to authenticate and
-- authorize connections to the broker. Does not apply to RabbitMQ brokers.
--
-- 'maintenanceWindowStartTime', 'createBroker_maintenanceWindowStartTime' - The parameters that determine the WeeklyStartTime.
--
-- 'logs', 'createBroker_logs' - Enables Amazon CloudWatch logging for brokers.
--
-- 'encryptionOptions', 'createBroker_encryptionOptions' - Encryption options for the broker. Does not apply to RabbitMQ brokers.
--
-- 'configuration', 'createBroker_configuration' - A list of information about the configuration.
--
-- 'tags', 'createBroker_tags' - Create tags when creating the broker.
--
-- 'storageType', 'createBroker_storageType' - The broker\'s storage type.
--
-- 'engineVersion', 'createBroker_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>.
--
-- 'hostInstanceType', 'createBroker_hostInstanceType' - Required. The broker\'s instance type.
--
-- 'autoMinorVersionUpgrade', 'createBroker_autoMinorVersionUpgrade' - Enables automatic upgrades to new minor versions for brokers, as new
-- versions are released and supported by Amazon MQ. Automatic upgrades
-- occur during the scheduled maintenance window of the broker or after a
-- manual broker reboot. Set to true by default, if no value is specified.
--
-- 'users', 'createBroker_users' - Required. The list of broker users (persons or applications) who can
-- access queues and topics. This value can contain only alphanumeric
-- characters, dashes, periods, underscores, and tildes (- . _ ~). This
-- value must be 2-100 characters long.
--
-- Amazon MQ for RabbitMQ
--
-- When you create an Amazon MQ for RabbitMQ broker, one and only one
-- administrative user is accepted and created when a broker is first
-- provisioned. All subsequent broker users are created by making RabbitMQ
-- API calls directly to brokers or via the RabbitMQ web console.
--
-- 'brokerName', 'createBroker_brokerName' - Required. The broker\'s name. This value must be unique in your AWS
-- account, 1-50 characters long, must contain only letters, numbers,
-- dashes, and underscores, and must not contain white spaces, brackets,
-- wildcard characters, or special characters.
--
-- 'deploymentMode', 'createBroker_deploymentMode' - Required. The broker\'s deployment mode.
--
-- 'engineType', 'createBroker_engineType' - Required. The type of broker engine. Currently, Amazon MQ supports
-- ACTIVEMQ and RABBITMQ.
--
-- 'publiclyAccessible', 'createBroker_publiclyAccessible' - Enables connections from applications outside of the VPC that hosts the
-- broker\'s subnets. Set to false by default, if no value is provided.
newCreateBroker ::
  -- | 'engineVersion'
  Prelude.Text ->
  -- | 'hostInstanceType'
  Prelude.Text ->
  -- | 'autoMinorVersionUpgrade'
  Prelude.Bool ->
  -- | 'brokerName'
  Prelude.Text ->
  -- | 'deploymentMode'
  DeploymentMode ->
  -- | 'engineType'
  EngineType ->
  -- | 'publiclyAccessible'
  Prelude.Bool ->
  CreateBroker
newCreateBroker :: Text
-> Text
-> Bool
-> Text
-> DeploymentMode
-> EngineType
-> Bool
-> CreateBroker
newCreateBroker
  Text
pEngineVersion_
  Text
pHostInstanceType_
  Bool
pAutoMinorVersionUpgrade_
  Text
pBrokerName_
  DeploymentMode
pDeploymentMode_
  EngineType
pEngineType_
  Bool
pPubliclyAccessible_ =
    CreateBroker' :: Maybe [Text]
-> Maybe [Text]
-> Maybe Text
-> Maybe AuthenticationStrategy
-> Maybe LdapServerMetadataInput
-> Maybe WeeklyStartTime
-> Maybe Logs
-> Maybe EncryptionOptions
-> Maybe ConfigurationId
-> Maybe (HashMap Text Text)
-> Maybe BrokerStorageType
-> Text
-> Text
-> Bool
-> [User]
-> Text
-> DeploymentMode
-> EngineType
-> Bool
-> CreateBroker
CreateBroker'
      { $sel:securityGroups:CreateBroker' :: Maybe [Text]
securityGroups = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:subnetIds:CreateBroker' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:creatorRequestId:CreateBroker' :: Maybe Text
creatorRequestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:authenticationStrategy:CreateBroker' :: Maybe AuthenticationStrategy
authenticationStrategy = Maybe AuthenticationStrategy
forall a. Maybe a
Prelude.Nothing,
        $sel:ldapServerMetadata:CreateBroker' :: Maybe LdapServerMetadataInput
ldapServerMetadata = Maybe LdapServerMetadataInput
forall a. Maybe a
Prelude.Nothing,
        $sel:maintenanceWindowStartTime:CreateBroker' :: Maybe WeeklyStartTime
maintenanceWindowStartTime = Maybe WeeklyStartTime
forall a. Maybe a
Prelude.Nothing,
        $sel:logs:CreateBroker' :: Maybe Logs
logs = Maybe Logs
forall a. Maybe a
Prelude.Nothing,
        $sel:encryptionOptions:CreateBroker' :: Maybe EncryptionOptions
encryptionOptions = Maybe EncryptionOptions
forall a. Maybe a
Prelude.Nothing,
        $sel:configuration:CreateBroker' :: Maybe ConfigurationId
configuration = Maybe ConfigurationId
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateBroker' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:storageType:CreateBroker' :: Maybe BrokerStorageType
storageType = Maybe BrokerStorageType
forall a. Maybe a
Prelude.Nothing,
        $sel:engineVersion:CreateBroker' :: Text
engineVersion = Text
pEngineVersion_,
        $sel:hostInstanceType:CreateBroker' :: Text
hostInstanceType = Text
pHostInstanceType_,
        $sel:autoMinorVersionUpgrade:CreateBroker' :: Bool
autoMinorVersionUpgrade = Bool
pAutoMinorVersionUpgrade_,
        $sel:users:CreateBroker' :: [User]
users = [User]
forall a. Monoid a => a
Prelude.mempty,
        $sel:brokerName:CreateBroker' :: Text
brokerName = Text
pBrokerName_,
        $sel:deploymentMode:CreateBroker' :: DeploymentMode
deploymentMode = DeploymentMode
pDeploymentMode_,
        $sel:engineType:CreateBroker' :: EngineType
engineType = EngineType
pEngineType_,
        $sel:publiclyAccessible:CreateBroker' :: Bool
publiclyAccessible = Bool
pPubliclyAccessible_
      }

-- | The list of rules (1 minimum, 125 maximum) that authorize connections to
-- brokers.
createBroker_securityGroups :: Lens.Lens' CreateBroker (Prelude.Maybe [Prelude.Text])
createBroker_securityGroups :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateBroker -> f CreateBroker
createBroker_securityGroups = (CreateBroker -> Maybe [Text])
-> (CreateBroker -> Maybe [Text] -> CreateBroker)
-> Lens CreateBroker CreateBroker (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe [Text]
securityGroups :: Maybe [Text]
$sel:securityGroups:CreateBroker' :: CreateBroker -> Maybe [Text]
securityGroups} -> Maybe [Text]
securityGroups) (\s :: CreateBroker
s@CreateBroker' {} Maybe [Text]
a -> CreateBroker
s {$sel:securityGroups:CreateBroker' :: Maybe [Text]
securityGroups = Maybe [Text]
a} :: CreateBroker) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateBroker -> f CreateBroker)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateBroker
-> f CreateBroker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The list of groups that define which subnets and IP ranges the broker
-- can use from different Availability Zones. If you specify more than one
-- subnet, the subnets must be in different Availability Zones. Amazon MQ
-- will not be able to create VPC endpoints for your broker with multiple
-- subnets in the same Availability Zone. A SINGLE_INSTANCE deployment
-- requires one subnet (for example, the default subnet). An
-- ACTIVE_STANDBY_MULTI_AZ Amazon MQ for ActiveMQ deployment requires two
-- subnets. A CLUSTER_MULTI_AZ Amazon MQ for RabbitMQ deployment has no
-- subnet requirements when deployed with public accessibility. Deployment
-- without public accessibility requires at least one subnet.
--
-- If you specify subnets in a
-- <https://docs.aws.amazon.com/vpc/latest/userguide/vpc-sharing.html shared VPC>
-- for a RabbitMQ broker, the associated VPC to which the specified subnets
-- belong must be owned by your AWS account. Amazon MQ will not be able to
-- create VPC endpoints in VPCs that are not owned by your AWS account.
createBroker_subnetIds :: Lens.Lens' CreateBroker (Prelude.Maybe [Prelude.Text])
createBroker_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateBroker -> f CreateBroker
createBroker_subnetIds = (CreateBroker -> Maybe [Text])
-> (CreateBroker -> Maybe [Text] -> CreateBroker)
-> Lens CreateBroker CreateBroker (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:CreateBroker' :: CreateBroker -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: CreateBroker
s@CreateBroker' {} Maybe [Text]
a -> CreateBroker
s {$sel:subnetIds:CreateBroker' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: CreateBroker) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateBroker -> f CreateBroker)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateBroker
-> f CreateBroker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The unique ID that the requester receives for the created broker. Amazon
-- MQ passes your ID with the API action. Note: We recommend using a
-- Universally Unique Identifier (UUID) for the creatorRequestId. You may
-- omit the creatorRequestId if your application doesn\'t require
-- idempotency.
createBroker_creatorRequestId :: Lens.Lens' CreateBroker (Prelude.Maybe Prelude.Text)
createBroker_creatorRequestId :: (Maybe Text -> f (Maybe Text)) -> CreateBroker -> f CreateBroker
createBroker_creatorRequestId = (CreateBroker -> Maybe Text)
-> (CreateBroker -> Maybe Text -> CreateBroker)
-> Lens CreateBroker CreateBroker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe Text
creatorRequestId :: Maybe Text
$sel:creatorRequestId:CreateBroker' :: CreateBroker -> Maybe Text
creatorRequestId} -> Maybe Text
creatorRequestId) (\s :: CreateBroker
s@CreateBroker' {} Maybe Text
a -> CreateBroker
s {$sel:creatorRequestId:CreateBroker' :: Maybe Text
creatorRequestId = Maybe Text
a} :: CreateBroker)

-- | Optional. The authentication strategy used to secure the broker. The
-- default is SIMPLE.
createBroker_authenticationStrategy :: Lens.Lens' CreateBroker (Prelude.Maybe AuthenticationStrategy)
createBroker_authenticationStrategy :: (Maybe AuthenticationStrategy -> f (Maybe AuthenticationStrategy))
-> CreateBroker -> f CreateBroker
createBroker_authenticationStrategy = (CreateBroker -> Maybe AuthenticationStrategy)
-> (CreateBroker -> Maybe AuthenticationStrategy -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe AuthenticationStrategy)
     (Maybe AuthenticationStrategy)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe AuthenticationStrategy
authenticationStrategy :: Maybe AuthenticationStrategy
$sel:authenticationStrategy:CreateBroker' :: CreateBroker -> Maybe AuthenticationStrategy
authenticationStrategy} -> Maybe AuthenticationStrategy
authenticationStrategy) (\s :: CreateBroker
s@CreateBroker' {} Maybe AuthenticationStrategy
a -> CreateBroker
s {$sel:authenticationStrategy:CreateBroker' :: Maybe AuthenticationStrategy
authenticationStrategy = Maybe AuthenticationStrategy
a} :: CreateBroker)

-- | Optional. The metadata of the LDAP server used to authenticate and
-- authorize connections to the broker. Does not apply to RabbitMQ brokers.
createBroker_ldapServerMetadata :: Lens.Lens' CreateBroker (Prelude.Maybe LdapServerMetadataInput)
createBroker_ldapServerMetadata :: (Maybe LdapServerMetadataInput
 -> f (Maybe LdapServerMetadataInput))
-> CreateBroker -> f CreateBroker
createBroker_ldapServerMetadata = (CreateBroker -> Maybe LdapServerMetadataInput)
-> (CreateBroker -> Maybe LdapServerMetadataInput -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe LdapServerMetadataInput)
     (Maybe LdapServerMetadataInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe LdapServerMetadataInput
ldapServerMetadata :: Maybe LdapServerMetadataInput
$sel:ldapServerMetadata:CreateBroker' :: CreateBroker -> Maybe LdapServerMetadataInput
ldapServerMetadata} -> Maybe LdapServerMetadataInput
ldapServerMetadata) (\s :: CreateBroker
s@CreateBroker' {} Maybe LdapServerMetadataInput
a -> CreateBroker
s {$sel:ldapServerMetadata:CreateBroker' :: Maybe LdapServerMetadataInput
ldapServerMetadata = Maybe LdapServerMetadataInput
a} :: CreateBroker)

-- | The parameters that determine the WeeklyStartTime.
createBroker_maintenanceWindowStartTime :: Lens.Lens' CreateBroker (Prelude.Maybe WeeklyStartTime)
createBroker_maintenanceWindowStartTime :: (Maybe WeeklyStartTime -> f (Maybe WeeklyStartTime))
-> CreateBroker -> f CreateBroker
createBroker_maintenanceWindowStartTime = (CreateBroker -> Maybe WeeklyStartTime)
-> (CreateBroker -> Maybe WeeklyStartTime -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe WeeklyStartTime)
     (Maybe WeeklyStartTime)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe WeeklyStartTime
maintenanceWindowStartTime :: Maybe WeeklyStartTime
$sel:maintenanceWindowStartTime:CreateBroker' :: CreateBroker -> Maybe WeeklyStartTime
maintenanceWindowStartTime} -> Maybe WeeklyStartTime
maintenanceWindowStartTime) (\s :: CreateBroker
s@CreateBroker' {} Maybe WeeklyStartTime
a -> CreateBroker
s {$sel:maintenanceWindowStartTime:CreateBroker' :: Maybe WeeklyStartTime
maintenanceWindowStartTime = Maybe WeeklyStartTime
a} :: CreateBroker)

-- | Enables Amazon CloudWatch logging for brokers.
createBroker_logs :: Lens.Lens' CreateBroker (Prelude.Maybe Logs)
createBroker_logs :: (Maybe Logs -> f (Maybe Logs)) -> CreateBroker -> f CreateBroker
createBroker_logs = (CreateBroker -> Maybe Logs)
-> (CreateBroker -> Maybe Logs -> CreateBroker)
-> Lens CreateBroker CreateBroker (Maybe Logs) (Maybe Logs)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe Logs
logs :: Maybe Logs
$sel:logs:CreateBroker' :: CreateBroker -> Maybe Logs
logs} -> Maybe Logs
logs) (\s :: CreateBroker
s@CreateBroker' {} Maybe Logs
a -> CreateBroker
s {$sel:logs:CreateBroker' :: Maybe Logs
logs = Maybe Logs
a} :: CreateBroker)

-- | Encryption options for the broker. Does not apply to RabbitMQ brokers.
createBroker_encryptionOptions :: Lens.Lens' CreateBroker (Prelude.Maybe EncryptionOptions)
createBroker_encryptionOptions :: (Maybe EncryptionOptions -> f (Maybe EncryptionOptions))
-> CreateBroker -> f CreateBroker
createBroker_encryptionOptions = (CreateBroker -> Maybe EncryptionOptions)
-> (CreateBroker -> Maybe EncryptionOptions -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe EncryptionOptions)
     (Maybe EncryptionOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe EncryptionOptions
encryptionOptions :: Maybe EncryptionOptions
$sel:encryptionOptions:CreateBroker' :: CreateBroker -> Maybe EncryptionOptions
encryptionOptions} -> Maybe EncryptionOptions
encryptionOptions) (\s :: CreateBroker
s@CreateBroker' {} Maybe EncryptionOptions
a -> CreateBroker
s {$sel:encryptionOptions:CreateBroker' :: Maybe EncryptionOptions
encryptionOptions = Maybe EncryptionOptions
a} :: CreateBroker)

-- | A list of information about the configuration.
createBroker_configuration :: Lens.Lens' CreateBroker (Prelude.Maybe ConfigurationId)
createBroker_configuration :: (Maybe ConfigurationId -> f (Maybe ConfigurationId))
-> CreateBroker -> f CreateBroker
createBroker_configuration = (CreateBroker -> Maybe ConfigurationId)
-> (CreateBroker -> Maybe ConfigurationId -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe ConfigurationId)
     (Maybe ConfigurationId)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe ConfigurationId
configuration :: Maybe ConfigurationId
$sel:configuration:CreateBroker' :: CreateBroker -> Maybe ConfigurationId
configuration} -> Maybe ConfigurationId
configuration) (\s :: CreateBroker
s@CreateBroker' {} Maybe ConfigurationId
a -> CreateBroker
s {$sel:configuration:CreateBroker' :: Maybe ConfigurationId
configuration = Maybe ConfigurationId
a} :: CreateBroker)

-- | Create tags when creating the broker.
createBroker_tags :: Lens.Lens' CreateBroker (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createBroker_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateBroker -> f CreateBroker
createBroker_tags = (CreateBroker -> Maybe (HashMap Text Text))
-> (CreateBroker -> Maybe (HashMap Text Text) -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (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 (\CreateBroker' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateBroker' :: CreateBroker -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateBroker
s@CreateBroker' {} Maybe (HashMap Text Text)
a -> CreateBroker
s {$sel:tags:CreateBroker' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateBroker) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateBroker -> f CreateBroker)
-> ((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)))
-> CreateBroker
-> f CreateBroker
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 broker\'s storage type.
createBroker_storageType :: Lens.Lens' CreateBroker (Prelude.Maybe BrokerStorageType)
createBroker_storageType :: (Maybe BrokerStorageType -> f (Maybe BrokerStorageType))
-> CreateBroker -> f CreateBroker
createBroker_storageType = (CreateBroker -> Maybe BrokerStorageType)
-> (CreateBroker -> Maybe BrokerStorageType -> CreateBroker)
-> Lens
     CreateBroker
     CreateBroker
     (Maybe BrokerStorageType)
     (Maybe BrokerStorageType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Maybe BrokerStorageType
storageType :: Maybe BrokerStorageType
$sel:storageType:CreateBroker' :: CreateBroker -> Maybe BrokerStorageType
storageType} -> Maybe BrokerStorageType
storageType) (\s :: CreateBroker
s@CreateBroker' {} Maybe BrokerStorageType
a -> CreateBroker
s {$sel:storageType:CreateBroker' :: Maybe BrokerStorageType
storageType = Maybe BrokerStorageType
a} :: CreateBroker)

-- | 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>.
createBroker_engineVersion :: Lens.Lens' CreateBroker Prelude.Text
createBroker_engineVersion :: (Text -> f Text) -> CreateBroker -> f CreateBroker
createBroker_engineVersion = (CreateBroker -> Text)
-> (CreateBroker -> Text -> CreateBroker)
-> Lens CreateBroker CreateBroker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Text
engineVersion :: Text
$sel:engineVersion:CreateBroker' :: CreateBroker -> Text
engineVersion} -> Text
engineVersion) (\s :: CreateBroker
s@CreateBroker' {} Text
a -> CreateBroker
s {$sel:engineVersion:CreateBroker' :: Text
engineVersion = Text
a} :: CreateBroker)

-- | Required. The broker\'s instance type.
createBroker_hostInstanceType :: Lens.Lens' CreateBroker Prelude.Text
createBroker_hostInstanceType :: (Text -> f Text) -> CreateBroker -> f CreateBroker
createBroker_hostInstanceType = (CreateBroker -> Text)
-> (CreateBroker -> Text -> CreateBroker)
-> Lens CreateBroker CreateBroker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Text
hostInstanceType :: Text
$sel:hostInstanceType:CreateBroker' :: CreateBroker -> Text
hostInstanceType} -> Text
hostInstanceType) (\s :: CreateBroker
s@CreateBroker' {} Text
a -> CreateBroker
s {$sel:hostInstanceType:CreateBroker' :: Text
hostInstanceType = Text
a} :: CreateBroker)

-- | Enables automatic upgrades to new minor versions for brokers, as new
-- versions are released and supported by Amazon MQ. Automatic upgrades
-- occur during the scheduled maintenance window of the broker or after a
-- manual broker reboot. Set to true by default, if no value is specified.
createBroker_autoMinorVersionUpgrade :: Lens.Lens' CreateBroker Prelude.Bool
createBroker_autoMinorVersionUpgrade :: (Bool -> f Bool) -> CreateBroker -> f CreateBroker
createBroker_autoMinorVersionUpgrade = (CreateBroker -> Bool)
-> (CreateBroker -> Bool -> CreateBroker)
-> Lens CreateBroker CreateBroker Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Bool
autoMinorVersionUpgrade :: Bool
$sel:autoMinorVersionUpgrade:CreateBroker' :: CreateBroker -> Bool
autoMinorVersionUpgrade} -> Bool
autoMinorVersionUpgrade) (\s :: CreateBroker
s@CreateBroker' {} Bool
a -> CreateBroker
s {$sel:autoMinorVersionUpgrade:CreateBroker' :: Bool
autoMinorVersionUpgrade = Bool
a} :: CreateBroker)

-- | Required. The list of broker users (persons or applications) who can
-- access queues and topics. This value can contain only alphanumeric
-- characters, dashes, periods, underscores, and tildes (- . _ ~). This
-- value must be 2-100 characters long.
--
-- Amazon MQ for RabbitMQ
--
-- When you create an Amazon MQ for RabbitMQ broker, one and only one
-- administrative user is accepted and created when a broker is first
-- provisioned. All subsequent broker users are created by making RabbitMQ
-- API calls directly to brokers or via the RabbitMQ web console.
createBroker_users :: Lens.Lens' CreateBroker [User]
createBroker_users :: ([User] -> f [User]) -> CreateBroker -> f CreateBroker
createBroker_users = (CreateBroker -> [User])
-> (CreateBroker -> [User] -> CreateBroker)
-> Lens CreateBroker CreateBroker [User] [User]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {[User]
users :: [User]
$sel:users:CreateBroker' :: CreateBroker -> [User]
users} -> [User]
users) (\s :: CreateBroker
s@CreateBroker' {} [User]
a -> CreateBroker
s {$sel:users:CreateBroker' :: [User]
users = [User]
a} :: CreateBroker) (([User] -> f [User]) -> CreateBroker -> f CreateBroker)
-> (([User] -> f [User]) -> [User] -> f [User])
-> ([User] -> f [User])
-> CreateBroker
-> f CreateBroker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([User] -> f [User]) -> [User] -> f [User]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Required. The broker\'s name. This value must be unique in your AWS
-- account, 1-50 characters long, must contain only letters, numbers,
-- dashes, and underscores, and must not contain white spaces, brackets,
-- wildcard characters, or special characters.
createBroker_brokerName :: Lens.Lens' CreateBroker Prelude.Text
createBroker_brokerName :: (Text -> f Text) -> CreateBroker -> f CreateBroker
createBroker_brokerName = (CreateBroker -> Text)
-> (CreateBroker -> Text -> CreateBroker)
-> Lens CreateBroker CreateBroker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Text
brokerName :: Text
$sel:brokerName:CreateBroker' :: CreateBroker -> Text
brokerName} -> Text
brokerName) (\s :: CreateBroker
s@CreateBroker' {} Text
a -> CreateBroker
s {$sel:brokerName:CreateBroker' :: Text
brokerName = Text
a} :: CreateBroker)

-- | Required. The broker\'s deployment mode.
createBroker_deploymentMode :: Lens.Lens' CreateBroker DeploymentMode
createBroker_deploymentMode :: (DeploymentMode -> f DeploymentMode)
-> CreateBroker -> f CreateBroker
createBroker_deploymentMode = (CreateBroker -> DeploymentMode)
-> (CreateBroker -> DeploymentMode -> CreateBroker)
-> Lens CreateBroker CreateBroker DeploymentMode DeploymentMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {DeploymentMode
deploymentMode :: DeploymentMode
$sel:deploymentMode:CreateBroker' :: CreateBroker -> DeploymentMode
deploymentMode} -> DeploymentMode
deploymentMode) (\s :: CreateBroker
s@CreateBroker' {} DeploymentMode
a -> CreateBroker
s {$sel:deploymentMode:CreateBroker' :: DeploymentMode
deploymentMode = DeploymentMode
a} :: CreateBroker)

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

-- | Enables connections from applications outside of the VPC that hosts the
-- broker\'s subnets. Set to false by default, if no value is provided.
createBroker_publiclyAccessible :: Lens.Lens' CreateBroker Prelude.Bool
createBroker_publiclyAccessible :: (Bool -> f Bool) -> CreateBroker -> f CreateBroker
createBroker_publiclyAccessible = (CreateBroker -> Bool)
-> (CreateBroker -> Bool -> CreateBroker)
-> Lens CreateBroker CreateBroker Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBroker' {Bool
publiclyAccessible :: Bool
$sel:publiclyAccessible:CreateBroker' :: CreateBroker -> Bool
publiclyAccessible} -> Bool
publiclyAccessible) (\s :: CreateBroker
s@CreateBroker' {} Bool
a -> CreateBroker
s {$sel:publiclyAccessible:CreateBroker' :: Bool
publiclyAccessible = Bool
a} :: CreateBroker)

instance Core.AWSRequest CreateBroker where
  type AWSResponse CreateBroker = CreateBrokerResponse
  request :: CreateBroker -> Request CreateBroker
request = Service -> CreateBroker -> Request CreateBroker
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateBroker
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBroker)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateBroker))
-> Logger
-> Service
-> Proxy CreateBroker
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateBroker)))
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 Text -> Int -> CreateBrokerResponse
CreateBrokerResponse'
            (Maybe Text -> Maybe Text -> Int -> CreateBrokerResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateBrokerResponse)
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
"brokerId")
            Either String (Maybe Text -> Int -> CreateBrokerResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateBrokerResponse)
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
"brokerArn")
            Either String (Int -> CreateBrokerResponse)
-> Either String Int -> Either String CreateBrokerResponse
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 CreateBroker

instance Prelude.NFData CreateBroker

instance Core.ToHeaders CreateBroker where
  toHeaders :: CreateBroker -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateBroker -> 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 CreateBroker where
  toJSON :: CreateBroker -> Value
toJSON CreateBroker' {Bool
[User]
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe AuthenticationStrategy
Maybe BrokerStorageType
Maybe ConfigurationId
Maybe EncryptionOptions
Maybe LdapServerMetadataInput
Maybe Logs
Maybe WeeklyStartTime
Text
DeploymentMode
EngineType
publiclyAccessible :: Bool
engineType :: EngineType
deploymentMode :: DeploymentMode
brokerName :: Text
users :: [User]
autoMinorVersionUpgrade :: Bool
hostInstanceType :: Text
engineVersion :: Text
storageType :: Maybe BrokerStorageType
tags :: Maybe (HashMap Text Text)
configuration :: Maybe ConfigurationId
encryptionOptions :: Maybe EncryptionOptions
logs :: Maybe Logs
maintenanceWindowStartTime :: Maybe WeeklyStartTime
ldapServerMetadata :: Maybe LdapServerMetadataInput
authenticationStrategy :: Maybe AuthenticationStrategy
creatorRequestId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroups :: Maybe [Text]
$sel:publiclyAccessible:CreateBroker' :: CreateBroker -> Bool
$sel:engineType:CreateBroker' :: CreateBroker -> EngineType
$sel:deploymentMode:CreateBroker' :: CreateBroker -> DeploymentMode
$sel:brokerName:CreateBroker' :: CreateBroker -> Text
$sel:users:CreateBroker' :: CreateBroker -> [User]
$sel:autoMinorVersionUpgrade:CreateBroker' :: CreateBroker -> Bool
$sel:hostInstanceType:CreateBroker' :: CreateBroker -> Text
$sel:engineVersion:CreateBroker' :: CreateBroker -> Text
$sel:storageType:CreateBroker' :: CreateBroker -> Maybe BrokerStorageType
$sel:tags:CreateBroker' :: CreateBroker -> Maybe (HashMap Text Text)
$sel:configuration:CreateBroker' :: CreateBroker -> Maybe ConfigurationId
$sel:encryptionOptions:CreateBroker' :: CreateBroker -> Maybe EncryptionOptions
$sel:logs:CreateBroker' :: CreateBroker -> Maybe Logs
$sel:maintenanceWindowStartTime:CreateBroker' :: CreateBroker -> Maybe WeeklyStartTime
$sel:ldapServerMetadata:CreateBroker' :: CreateBroker -> Maybe LdapServerMetadataInput
$sel:authenticationStrategy:CreateBroker' :: CreateBroker -> Maybe AuthenticationStrategy
$sel:creatorRequestId:CreateBroker' :: CreateBroker -> Maybe Text
$sel:subnetIds:CreateBroker' :: CreateBroker -> Maybe [Text]
$sel:securityGroups:CreateBroker' :: CreateBroker -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"securityGroups" 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]
securityGroups,
            (Text
"subnetIds" 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]
subnetIds,
            (Text
"creatorRequestId" 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
creatorRequestId,
            (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
"ldapServerMetadata" Text -> LdapServerMetadataInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LdapServerMetadataInput -> Pair)
-> Maybe LdapServerMetadataInput -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LdapServerMetadataInput
ldapServerMetadata,
            (Text
"maintenanceWindowStartTime" Text -> WeeklyStartTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (WeeklyStartTime -> Pair) -> Maybe WeeklyStartTime -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe WeeklyStartTime
maintenanceWindowStartTime,
            (Text
"logs" Text -> Logs -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Logs -> Pair) -> Maybe Logs -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Logs
logs,
            (Text
"encryptionOptions" Text -> EncryptionOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncryptionOptions -> Pair)
-> Maybe EncryptionOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionOptions
encryptionOptions,
            (Text
"configuration" Text -> ConfigurationId -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ConfigurationId -> Pair) -> Maybe ConfigurationId -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationId
configuration,
            (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,
            (Text
"storageType" Text -> BrokerStorageType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (BrokerStorageType -> Pair)
-> Maybe BrokerStorageType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe BrokerStorageType
storageType,
            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
"hostInstanceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hostInstanceType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"autoMinorVersionUpgrade"
                  Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
autoMinorVersionUpgrade
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"users" Text -> [User] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [User]
users),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"brokerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
brokerName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"deploymentMode" Text -> DeploymentMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DeploymentMode
deploymentMode),
            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
"publiclyAccessible" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
publiclyAccessible)
          ]
      )

instance Core.ToPath CreateBroker where
  toPath :: CreateBroker -> ByteString
toPath = ByteString -> CreateBroker -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/brokers"

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

-- | /See:/ 'newCreateBrokerResponse' smart constructor.
data CreateBrokerResponse = CreateBrokerResponse'
  { -- | The unique ID that Amazon MQ generates for the broker.
    CreateBrokerResponse -> Maybe Text
brokerId :: Prelude.Maybe Prelude.Text,
    -- | The broker\'s Amazon Resource Name (ARN).
    CreateBrokerResponse -> Maybe Text
brokerArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateBrokerResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateBrokerResponse -> CreateBrokerResponse -> Bool
(CreateBrokerResponse -> CreateBrokerResponse -> Bool)
-> (CreateBrokerResponse -> CreateBrokerResponse -> Bool)
-> Eq CreateBrokerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBrokerResponse -> CreateBrokerResponse -> Bool
$c/= :: CreateBrokerResponse -> CreateBrokerResponse -> Bool
== :: CreateBrokerResponse -> CreateBrokerResponse -> Bool
$c== :: CreateBrokerResponse -> CreateBrokerResponse -> Bool
Prelude.Eq, ReadPrec [CreateBrokerResponse]
ReadPrec CreateBrokerResponse
Int -> ReadS CreateBrokerResponse
ReadS [CreateBrokerResponse]
(Int -> ReadS CreateBrokerResponse)
-> ReadS [CreateBrokerResponse]
-> ReadPrec CreateBrokerResponse
-> ReadPrec [CreateBrokerResponse]
-> Read CreateBrokerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBrokerResponse]
$creadListPrec :: ReadPrec [CreateBrokerResponse]
readPrec :: ReadPrec CreateBrokerResponse
$creadPrec :: ReadPrec CreateBrokerResponse
readList :: ReadS [CreateBrokerResponse]
$creadList :: ReadS [CreateBrokerResponse]
readsPrec :: Int -> ReadS CreateBrokerResponse
$creadsPrec :: Int -> ReadS CreateBrokerResponse
Prelude.Read, Int -> CreateBrokerResponse -> ShowS
[CreateBrokerResponse] -> ShowS
CreateBrokerResponse -> String
(Int -> CreateBrokerResponse -> ShowS)
-> (CreateBrokerResponse -> String)
-> ([CreateBrokerResponse] -> ShowS)
-> Show CreateBrokerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBrokerResponse] -> ShowS
$cshowList :: [CreateBrokerResponse] -> ShowS
show :: CreateBrokerResponse -> String
$cshow :: CreateBrokerResponse -> String
showsPrec :: Int -> CreateBrokerResponse -> ShowS
$cshowsPrec :: Int -> CreateBrokerResponse -> ShowS
Prelude.Show, (forall x. CreateBrokerResponse -> Rep CreateBrokerResponse x)
-> (forall x. Rep CreateBrokerResponse x -> CreateBrokerResponse)
-> Generic CreateBrokerResponse
forall x. Rep CreateBrokerResponse x -> CreateBrokerResponse
forall x. CreateBrokerResponse -> Rep CreateBrokerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateBrokerResponse x -> CreateBrokerResponse
$cfrom :: forall x. CreateBrokerResponse -> Rep CreateBrokerResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateBrokerResponse' 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:
--
-- 'brokerId', 'createBrokerResponse_brokerId' - The unique ID that Amazon MQ generates for the broker.
--
-- 'brokerArn', 'createBrokerResponse_brokerArn' - The broker\'s Amazon Resource Name (ARN).
--
-- 'httpStatus', 'createBrokerResponse_httpStatus' - The response's http status code.
newCreateBrokerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateBrokerResponse
newCreateBrokerResponse :: Int -> CreateBrokerResponse
newCreateBrokerResponse Int
pHttpStatus_ =
  CreateBrokerResponse' :: Maybe Text -> Maybe Text -> Int -> CreateBrokerResponse
CreateBrokerResponse'
    { $sel:brokerId:CreateBrokerResponse' :: Maybe Text
brokerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:brokerArn:CreateBrokerResponse' :: Maybe Text
brokerArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateBrokerResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The unique ID that Amazon MQ generates for the broker.
createBrokerResponse_brokerId :: Lens.Lens' CreateBrokerResponse (Prelude.Maybe Prelude.Text)
createBrokerResponse_brokerId :: (Maybe Text -> f (Maybe Text))
-> CreateBrokerResponse -> f CreateBrokerResponse
createBrokerResponse_brokerId = (CreateBrokerResponse -> Maybe Text)
-> (CreateBrokerResponse -> Maybe Text -> CreateBrokerResponse)
-> Lens
     CreateBrokerResponse CreateBrokerResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBrokerResponse' {Maybe Text
brokerId :: Maybe Text
$sel:brokerId:CreateBrokerResponse' :: CreateBrokerResponse -> Maybe Text
brokerId} -> Maybe Text
brokerId) (\s :: CreateBrokerResponse
s@CreateBrokerResponse' {} Maybe Text
a -> CreateBrokerResponse
s {$sel:brokerId:CreateBrokerResponse' :: Maybe Text
brokerId = Maybe Text
a} :: CreateBrokerResponse)

-- | The broker\'s Amazon Resource Name (ARN).
createBrokerResponse_brokerArn :: Lens.Lens' CreateBrokerResponse (Prelude.Maybe Prelude.Text)
createBrokerResponse_brokerArn :: (Maybe Text -> f (Maybe Text))
-> CreateBrokerResponse -> f CreateBrokerResponse
createBrokerResponse_brokerArn = (CreateBrokerResponse -> Maybe Text)
-> (CreateBrokerResponse -> Maybe Text -> CreateBrokerResponse)
-> Lens
     CreateBrokerResponse CreateBrokerResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBrokerResponse' {Maybe Text
brokerArn :: Maybe Text
$sel:brokerArn:CreateBrokerResponse' :: CreateBrokerResponse -> Maybe Text
brokerArn} -> Maybe Text
brokerArn) (\s :: CreateBrokerResponse
s@CreateBrokerResponse' {} Maybe Text
a -> CreateBrokerResponse
s {$sel:brokerArn:CreateBrokerResponse' :: Maybe Text
brokerArn = Maybe Text
a} :: CreateBrokerResponse)

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

instance Prelude.NFData CreateBrokerResponse