{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoT.Types.TopicRuleDestinationConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoT.Types.TopicRuleDestinationConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoT.Types.HttpUrlDestinationConfiguration
import Amazonka.IoT.Types.VpcDestinationConfiguration
import qualified Amazonka.Prelude as Prelude

-- | Configuration of the topic rule destination.
--
-- /See:/ 'newTopicRuleDestinationConfiguration' smart constructor.
data TopicRuleDestinationConfiguration = TopicRuleDestinationConfiguration'
  { -- | Configuration of the HTTP URL.
    TopicRuleDestinationConfiguration
-> Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration :: Prelude.Maybe HttpUrlDestinationConfiguration,
    -- | Configuration of the virtual private cloud (VPC) connection.
    TopicRuleDestinationConfiguration
-> Maybe VpcDestinationConfiguration
vpcConfiguration :: Prelude.Maybe VpcDestinationConfiguration
  }
  deriving (TopicRuleDestinationConfiguration
-> TopicRuleDestinationConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TopicRuleDestinationConfiguration
-> TopicRuleDestinationConfiguration -> Bool
$c/= :: TopicRuleDestinationConfiguration
-> TopicRuleDestinationConfiguration -> Bool
== :: TopicRuleDestinationConfiguration
-> TopicRuleDestinationConfiguration -> Bool
$c== :: TopicRuleDestinationConfiguration
-> TopicRuleDestinationConfiguration -> Bool
Prelude.Eq, ReadPrec [TopicRuleDestinationConfiguration]
ReadPrec TopicRuleDestinationConfiguration
Int -> ReadS TopicRuleDestinationConfiguration
ReadS [TopicRuleDestinationConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TopicRuleDestinationConfiguration]
$creadListPrec :: ReadPrec [TopicRuleDestinationConfiguration]
readPrec :: ReadPrec TopicRuleDestinationConfiguration
$creadPrec :: ReadPrec TopicRuleDestinationConfiguration
readList :: ReadS [TopicRuleDestinationConfiguration]
$creadList :: ReadS [TopicRuleDestinationConfiguration]
readsPrec :: Int -> ReadS TopicRuleDestinationConfiguration
$creadsPrec :: Int -> ReadS TopicRuleDestinationConfiguration
Prelude.Read, Int -> TopicRuleDestinationConfiguration -> ShowS
[TopicRuleDestinationConfiguration] -> ShowS
TopicRuleDestinationConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TopicRuleDestinationConfiguration] -> ShowS
$cshowList :: [TopicRuleDestinationConfiguration] -> ShowS
show :: TopicRuleDestinationConfiguration -> String
$cshow :: TopicRuleDestinationConfiguration -> String
showsPrec :: Int -> TopicRuleDestinationConfiguration -> ShowS
$cshowsPrec :: Int -> TopicRuleDestinationConfiguration -> ShowS
Prelude.Show, forall x.
Rep TopicRuleDestinationConfiguration x
-> TopicRuleDestinationConfiguration
forall x.
TopicRuleDestinationConfiguration
-> Rep TopicRuleDestinationConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TopicRuleDestinationConfiguration x
-> TopicRuleDestinationConfiguration
$cfrom :: forall x.
TopicRuleDestinationConfiguration
-> Rep TopicRuleDestinationConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'TopicRuleDestinationConfiguration' 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:
--
-- 'httpUrlConfiguration', 'topicRuleDestinationConfiguration_httpUrlConfiguration' - Configuration of the HTTP URL.
--
-- 'vpcConfiguration', 'topicRuleDestinationConfiguration_vpcConfiguration' - Configuration of the virtual private cloud (VPC) connection.
newTopicRuleDestinationConfiguration ::
  TopicRuleDestinationConfiguration
newTopicRuleDestinationConfiguration :: TopicRuleDestinationConfiguration
newTopicRuleDestinationConfiguration =
  TopicRuleDestinationConfiguration'
    { $sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration =
        forall a. Maybe a
Prelude.Nothing,
      $sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: Maybe VpcDestinationConfiguration
vpcConfiguration = forall a. Maybe a
Prelude.Nothing
    }

-- | Configuration of the HTTP URL.
topicRuleDestinationConfiguration_httpUrlConfiguration :: Lens.Lens' TopicRuleDestinationConfiguration (Prelude.Maybe HttpUrlDestinationConfiguration)
topicRuleDestinationConfiguration_httpUrlConfiguration :: Lens'
  TopicRuleDestinationConfiguration
  (Maybe HttpUrlDestinationConfiguration)
topicRuleDestinationConfiguration_httpUrlConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleDestinationConfiguration' {Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration :: Maybe HttpUrlDestinationConfiguration
$sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration} -> Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration) (\s :: TopicRuleDestinationConfiguration
s@TopicRuleDestinationConfiguration' {} Maybe HttpUrlDestinationConfiguration
a -> TopicRuleDestinationConfiguration
s {$sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration = Maybe HttpUrlDestinationConfiguration
a} :: TopicRuleDestinationConfiguration)

-- | Configuration of the virtual private cloud (VPC) connection.
topicRuleDestinationConfiguration_vpcConfiguration :: Lens.Lens' TopicRuleDestinationConfiguration (Prelude.Maybe VpcDestinationConfiguration)
topicRuleDestinationConfiguration_vpcConfiguration :: Lens'
  TopicRuleDestinationConfiguration
  (Maybe VpcDestinationConfiguration)
topicRuleDestinationConfiguration_vpcConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TopicRuleDestinationConfiguration' {Maybe VpcDestinationConfiguration
vpcConfiguration :: Maybe VpcDestinationConfiguration
$sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe VpcDestinationConfiguration
vpcConfiguration} -> Maybe VpcDestinationConfiguration
vpcConfiguration) (\s :: TopicRuleDestinationConfiguration
s@TopicRuleDestinationConfiguration' {} Maybe VpcDestinationConfiguration
a -> TopicRuleDestinationConfiguration
s {$sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: Maybe VpcDestinationConfiguration
vpcConfiguration = Maybe VpcDestinationConfiguration
a} :: TopicRuleDestinationConfiguration)

instance
  Prelude.Hashable
    TopicRuleDestinationConfiguration
  where
  hashWithSalt :: Int -> TopicRuleDestinationConfiguration -> Int
hashWithSalt
    Int
_salt
    TopicRuleDestinationConfiguration' {Maybe HttpUrlDestinationConfiguration
Maybe VpcDestinationConfiguration
vpcConfiguration :: Maybe VpcDestinationConfiguration
httpUrlConfiguration :: Maybe HttpUrlDestinationConfiguration
$sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe VpcDestinationConfiguration
$sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe HttpUrlDestinationConfiguration
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcDestinationConfiguration
vpcConfiguration

instance
  Prelude.NFData
    TopicRuleDestinationConfiguration
  where
  rnf :: TopicRuleDestinationConfiguration -> ()
rnf TopicRuleDestinationConfiguration' {Maybe HttpUrlDestinationConfiguration
Maybe VpcDestinationConfiguration
vpcConfiguration :: Maybe VpcDestinationConfiguration
httpUrlConfiguration :: Maybe HttpUrlDestinationConfiguration
$sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe VpcDestinationConfiguration
$sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe HttpUrlDestinationConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcDestinationConfiguration
vpcConfiguration

instance
  Data.ToJSON
    TopicRuleDestinationConfiguration
  where
  toJSON :: TopicRuleDestinationConfiguration -> Value
toJSON TopicRuleDestinationConfiguration' {Maybe HttpUrlDestinationConfiguration
Maybe VpcDestinationConfiguration
vpcConfiguration :: Maybe VpcDestinationConfiguration
httpUrlConfiguration :: Maybe HttpUrlDestinationConfiguration
$sel:vpcConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe VpcDestinationConfiguration
$sel:httpUrlConfiguration:TopicRuleDestinationConfiguration' :: TopicRuleDestinationConfiguration
-> Maybe HttpUrlDestinationConfiguration
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"httpUrlConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HttpUrlDestinationConfiguration
httpUrlConfiguration,
            (Key
"vpcConfiguration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VpcDestinationConfiguration
vpcConfiguration
          ]
      )