{-# 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.IoTWireless.Types.Destinations
-- 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.IoTWireless.Types.Destinations where

import qualified Amazonka.Core as Core
import Amazonka.IoTWireless.Types.ExpressionType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes a destination.
--
-- /See:/ 'newDestinations' smart constructor.
data Destinations = Destinations'
  { -- | The type of value in @Expression@.
    Destinations -> Maybe ExpressionType
expressionType :: Prelude.Maybe ExpressionType,
    -- | The Amazon Resource Name of the resource.
    Destinations -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the resource.
    Destinations -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The rule name or topic rule to send messages to.
    Destinations -> Maybe Text
expression :: Prelude.Maybe Prelude.Text,
    -- | The description of the resource.
    Destinations -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the IAM Role that authorizes the destination.
    Destinations -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text
  }
  deriving (Destinations -> Destinations -> Bool
(Destinations -> Destinations -> Bool)
-> (Destinations -> Destinations -> Bool) -> Eq Destinations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Destinations -> Destinations -> Bool
$c/= :: Destinations -> Destinations -> Bool
== :: Destinations -> Destinations -> Bool
$c== :: Destinations -> Destinations -> Bool
Prelude.Eq, ReadPrec [Destinations]
ReadPrec Destinations
Int -> ReadS Destinations
ReadS [Destinations]
(Int -> ReadS Destinations)
-> ReadS [Destinations]
-> ReadPrec Destinations
-> ReadPrec [Destinations]
-> Read Destinations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Destinations]
$creadListPrec :: ReadPrec [Destinations]
readPrec :: ReadPrec Destinations
$creadPrec :: ReadPrec Destinations
readList :: ReadS [Destinations]
$creadList :: ReadS [Destinations]
readsPrec :: Int -> ReadS Destinations
$creadsPrec :: Int -> ReadS Destinations
Prelude.Read, Int -> Destinations -> ShowS
[Destinations] -> ShowS
Destinations -> String
(Int -> Destinations -> ShowS)
-> (Destinations -> String)
-> ([Destinations] -> ShowS)
-> Show Destinations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Destinations] -> ShowS
$cshowList :: [Destinations] -> ShowS
show :: Destinations -> String
$cshow :: Destinations -> String
showsPrec :: Int -> Destinations -> ShowS
$cshowsPrec :: Int -> Destinations -> ShowS
Prelude.Show, (forall x. Destinations -> Rep Destinations x)
-> (forall x. Rep Destinations x -> Destinations)
-> Generic Destinations
forall x. Rep Destinations x -> Destinations
forall x. Destinations -> Rep Destinations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Destinations x -> Destinations
$cfrom :: forall x. Destinations -> Rep Destinations x
Prelude.Generic)

-- |
-- Create a value of 'Destinations' 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:
--
-- 'expressionType', 'destinations_expressionType' - The type of value in @Expression@.
--
-- 'arn', 'destinations_arn' - The Amazon Resource Name of the resource.
--
-- 'name', 'destinations_name' - The name of the resource.
--
-- 'expression', 'destinations_expression' - The rule name or topic rule to send messages to.
--
-- 'description', 'destinations_description' - The description of the resource.
--
-- 'roleArn', 'destinations_roleArn' - The ARN of the IAM Role that authorizes the destination.
newDestinations ::
  Destinations
newDestinations :: Destinations
newDestinations =
  Destinations' :: Maybe ExpressionType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Destinations
Destinations'
    { $sel:expressionType:Destinations' :: Maybe ExpressionType
expressionType = Maybe ExpressionType
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:Destinations' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:Destinations' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expression:Destinations' :: Maybe Text
expression = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:Destinations' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:roleArn:Destinations' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of value in @Expression@.
destinations_expressionType :: Lens.Lens' Destinations (Prelude.Maybe ExpressionType)
destinations_expressionType :: (Maybe ExpressionType -> f (Maybe ExpressionType))
-> Destinations -> f Destinations
destinations_expressionType = (Destinations -> Maybe ExpressionType)
-> (Destinations -> Maybe ExpressionType -> Destinations)
-> Lens
     Destinations
     Destinations
     (Maybe ExpressionType)
     (Maybe ExpressionType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destinations' {Maybe ExpressionType
expressionType :: Maybe ExpressionType
$sel:expressionType:Destinations' :: Destinations -> Maybe ExpressionType
expressionType} -> Maybe ExpressionType
expressionType) (\s :: Destinations
s@Destinations' {} Maybe ExpressionType
a -> Destinations
s {$sel:expressionType:Destinations' :: Maybe ExpressionType
expressionType = Maybe ExpressionType
a} :: Destinations)

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

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

-- | The rule name or topic rule to send messages to.
destinations_expression :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_expression :: (Maybe Text -> f (Maybe Text)) -> Destinations -> f Destinations
destinations_expression = (Destinations -> Maybe Text)
-> (Destinations -> Maybe Text -> Destinations)
-> Lens Destinations Destinations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destinations' {Maybe Text
expression :: Maybe Text
$sel:expression:Destinations' :: Destinations -> Maybe Text
expression} -> Maybe Text
expression) (\s :: Destinations
s@Destinations' {} Maybe Text
a -> Destinations
s {$sel:expression:Destinations' :: Maybe Text
expression = Maybe Text
a} :: Destinations)

-- | The description of the resource.
destinations_description :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_description :: (Maybe Text -> f (Maybe Text)) -> Destinations -> f Destinations
destinations_description = (Destinations -> Maybe Text)
-> (Destinations -> Maybe Text -> Destinations)
-> Lens Destinations Destinations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destinations' {Maybe Text
description :: Maybe Text
$sel:description:Destinations' :: Destinations -> Maybe Text
description} -> Maybe Text
description) (\s :: Destinations
s@Destinations' {} Maybe Text
a -> Destinations
s {$sel:description:Destinations' :: Maybe Text
description = Maybe Text
a} :: Destinations)

-- | The ARN of the IAM Role that authorizes the destination.
destinations_roleArn :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_roleArn :: (Maybe Text -> f (Maybe Text)) -> Destinations -> f Destinations
destinations_roleArn = (Destinations -> Maybe Text)
-> (Destinations -> Maybe Text -> Destinations)
-> Lens Destinations Destinations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destinations' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:Destinations' :: Destinations -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: Destinations
s@Destinations' {} Maybe Text
a -> Destinations
s {$sel:roleArn:Destinations' :: Maybe Text
roleArn = Maybe Text
a} :: Destinations)

instance Core.FromJSON Destinations where
  parseJSON :: Value -> Parser Destinations
parseJSON =
    String
-> (Object -> Parser Destinations) -> Value -> Parser Destinations
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Destinations"
      ( \Object
x ->
          Maybe ExpressionType
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Destinations
Destinations'
            (Maybe ExpressionType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Destinations)
-> Parser (Maybe ExpressionType)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Destinations)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ExpressionType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ExpressionType")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Destinations)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> Destinations)
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
"Arn")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> Destinations)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Destinations)
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")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> Destinations)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Destinations)
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
"Expression")
            Parser (Maybe Text -> Maybe Text -> Destinations)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Destinations)
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
"Description")
            Parser (Maybe Text -> Destinations)
-> Parser (Maybe Text) -> Parser Destinations
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
"RoleArn")
      )

instance Prelude.Hashable Destinations

instance Prelude.NFData Destinations