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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(RoutedResource -> RoutedResource -> Bool)
-> (RoutedResource -> RoutedResource -> Bool) -> Eq RoutedResource
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]
(Int -> ReadS RoutedResource)
-> ReadS [RoutedResource]
-> ReadPrec RoutedResource
-> ReadPrec [RoutedResource]
-> Read 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
(Int -> RoutedResource -> ShowS)
-> (RoutedResource -> String)
-> ([RoutedResource] -> ShowS)
-> Show RoutedResource
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. RoutedResource -> Rep RoutedResource x)
-> (forall x. Rep RoutedResource x -> RoutedResource)
-> Generic RoutedResource
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' :: Maybe Text -> Maybe Text -> RoutedResource
RoutedResource'
    { $sel:arn:RoutedResource' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:RoutedResource' :: Maybe Text
name = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> RoutedResource -> f RoutedResource
routedResource_arn = (RoutedResource -> Maybe Text)
-> (RoutedResource -> Maybe Text -> RoutedResource)
-> Lens RoutedResource RoutedResource (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text))
-> RoutedResource -> f RoutedResource
routedResource_name = (RoutedResource -> Maybe Text)
-> (RoutedResource -> Maybe Text -> RoutedResource)
-> Lens RoutedResource RoutedResource (Maybe Text) (Maybe Text)
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 Core.FromJSON RoutedResource where
  parseJSON :: Value -> Parser RoutedResource
parseJSON =
    String
-> (Object -> Parser RoutedResource)
-> Value
-> Parser RoutedResource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RoutedResource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> RoutedResource
RoutedResource'
            (Maybe Text -> Maybe Text -> RoutedResource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RoutedResource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"arn") Parser (Maybe Text -> RoutedResource)
-> Parser (Maybe Text) -> Parser RoutedResource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
      )

instance Prelude.Hashable RoutedResource

instance Prelude.NFData RoutedResource