{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.IoTWireless.Types.Destinations where

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

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

-- | The Amazon Resource Name of the resource.
destinations_arn :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_arn :: Lens' Destinations (Maybe Text)
destinations_arn = 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 description of the resource.
destinations_description :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_description :: Lens' Destinations (Maybe Text)
destinations_description = 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 rule name or topic rule to send messages to.
destinations_expression :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_expression :: Lens' Destinations (Maybe Text)
destinations_expression = 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 type of value in @Expression@.
destinations_expressionType :: Lens.Lens' Destinations (Prelude.Maybe ExpressionType)
destinations_expressionType :: Lens' Destinations (Maybe ExpressionType)
destinations_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 name of the resource.
destinations_name :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_name :: Lens' Destinations (Maybe Text)
destinations_name = 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 ARN of the IAM Role that authorizes the destination.
destinations_roleArn :: Lens.Lens' Destinations (Prelude.Maybe Prelude.Text)
destinations_roleArn :: Lens' Destinations (Maybe Text)
destinations_roleArn = 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 Data.FromJSON Destinations where
  parseJSON :: Value -> Parser Destinations
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Destinations"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ExpressionType
-> Maybe Text
-> Maybe Text
-> Destinations
Destinations'
            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
"Description")
            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
"Expression")
            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
"ExpressionType")
            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")
            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
"RoleArn")
      )

instance Prelude.Hashable Destinations where
  hashWithSalt :: Int -> Destinations -> Int
hashWithSalt Int
_salt Destinations' {Maybe Text
Maybe ExpressionType
roleArn :: Maybe Text
name :: Maybe Text
expressionType :: Maybe ExpressionType
expression :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:roleArn:Destinations' :: Destinations -> Maybe Text
$sel:name:Destinations' :: Destinations -> Maybe Text
$sel:expressionType:Destinations' :: Destinations -> Maybe ExpressionType
$sel:expression:Destinations' :: Destinations -> Maybe Text
$sel:description:Destinations' :: Destinations -> Maybe Text
$sel:arn:Destinations' :: Destinations -> 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
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ExpressionType
expressionType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
roleArn

instance Prelude.NFData Destinations where
  rnf :: Destinations -> ()
rnf Destinations' {Maybe Text
Maybe ExpressionType
roleArn :: Maybe Text
name :: Maybe Text
expressionType :: Maybe ExpressionType
expression :: Maybe Text
description :: Maybe Text
arn :: Maybe Text
$sel:roleArn:Destinations' :: Destinations -> Maybe Text
$sel:name:Destinations' :: Destinations -> Maybe Text
$sel:expressionType:Destinations' :: Destinations -> Maybe ExpressionType
$sel:expression:Destinations' :: Destinations -> Maybe Text
$sel:description:Destinations' :: Destinations -> Maybe Text
$sel:arn:Destinations' :: Destinations -> 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
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expression
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ExpressionType
expressionType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
roleArn