{-# 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.IoTEvents.Types.RoutedResource
-- 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.IoTEvents.Types.RoutedResource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the routed resource.
--
-- /See:/ 'newRoutedResource' smart constructor.
data RoutedResource = RoutedResource'
  { -- | The ARN of the routed resource. For more information, see
    -- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
    -- in the /AWS General Reference/.
    RoutedResource -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the routed resource.
    RoutedResource -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (RoutedResource -> RoutedResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RoutedResource -> RoutedResource -> Bool
$c/= :: RoutedResource -> RoutedResource -> Bool
== :: RoutedResource -> RoutedResource -> Bool
$c== :: RoutedResource -> RoutedResource -> Bool
Prelude.Eq, ReadPrec [RoutedResource]
ReadPrec RoutedResource
Int -> ReadS RoutedResource
ReadS [RoutedResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RoutedResource]
$creadListPrec :: ReadPrec [RoutedResource]
readPrec :: ReadPrec RoutedResource
$creadPrec :: ReadPrec RoutedResource
readList :: ReadS [RoutedResource]
$creadList :: ReadS [RoutedResource]
readsPrec :: Int -> ReadS RoutedResource
$creadsPrec :: Int -> ReadS RoutedResource
Prelude.Read, Int -> RoutedResource -> ShowS
[RoutedResource] -> ShowS
RoutedResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RoutedResource] -> ShowS
$cshowList :: [RoutedResource] -> ShowS
show :: RoutedResource -> String
$cshow :: RoutedResource -> String
showsPrec :: Int -> RoutedResource -> ShowS
$cshowsPrec :: Int -> RoutedResource -> ShowS
Prelude.Show, forall x. Rep RoutedResource x -> RoutedResource
forall x. RoutedResource -> Rep RoutedResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RoutedResource x -> RoutedResource
$cfrom :: forall x. RoutedResource -> Rep RoutedResource x
Prelude.Generic)

-- |
-- Create a value of 'RoutedResource' 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', 'routedResource_arn' - The ARN of the routed resource. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
--
-- 'name', 'routedResource_name' - The name of the routed resource.
newRoutedResource ::
  RoutedResource
newRoutedResource :: RoutedResource
newRoutedResource =
  RoutedResource'
    { $sel:arn:RoutedResource' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:name:RoutedResource' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the routed resource. For more information, see
-- <https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs)>
-- in the /AWS General Reference/.
routedResource_arn :: Lens.Lens' RoutedResource (Prelude.Maybe Prelude.Text)
routedResource_arn :: Lens' RoutedResource (Maybe Text)
routedResource_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutedResource' {Maybe Text
arn :: Maybe Text
$sel:arn:RoutedResource' :: RoutedResource -> Maybe Text
arn} -> Maybe Text
arn) (\s :: RoutedResource
s@RoutedResource' {} Maybe Text
a -> RoutedResource
s {$sel:arn:RoutedResource' :: Maybe Text
arn = Maybe Text
a} :: RoutedResource)

-- | The name of the routed resource.
routedResource_name :: Lens.Lens' RoutedResource (Prelude.Maybe Prelude.Text)
routedResource_name :: Lens' RoutedResource (Maybe Text)
routedResource_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RoutedResource' {Maybe Text
name :: Maybe Text
$sel:name:RoutedResource' :: RoutedResource -> Maybe Text
name} -> Maybe Text
name) (\s :: RoutedResource
s@RoutedResource' {} Maybe Text
a -> RoutedResource
s {$sel:name:RoutedResource' :: Maybe Text
name = Maybe Text
a} :: RoutedResource)

instance Data.FromJSON RoutedResource where
  parseJSON :: Value -> Parser RoutedResource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RoutedResource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RoutedResource
RoutedResource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"name")
      )

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

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