{-# 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.LoRaWANUpdateGatewayTaskCreate
-- 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.LoRaWANUpdateGatewayTaskCreate where

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

-- | LoRaWANUpdateGatewayTaskCreate object.
--
-- /See:/ 'newLoRaWANUpdateGatewayTaskCreate' smart constructor.
data LoRaWANUpdateGatewayTaskCreate = LoRaWANUpdateGatewayTaskCreate'
  { -- | The signature used to verify the update firmware.
    LoRaWANUpdateGatewayTaskCreate -> Maybe Text
updateSignature :: Prelude.Maybe Prelude.Text,
    -- | The CRC of the signature private key to check.
    LoRaWANUpdateGatewayTaskCreate -> Maybe Natural
sigKeyCrc :: Prelude.Maybe Prelude.Natural,
    -- | The version of the gateways that should receive the update.
    LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
currentVersion :: Prelude.Maybe LoRaWANGatewayVersion,
    -- | The firmware version to update the gateway to.
    LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
updateVersion :: Prelude.Maybe LoRaWANGatewayVersion
  }
  deriving (LoRaWANUpdateGatewayTaskCreate
-> LoRaWANUpdateGatewayTaskCreate -> Bool
(LoRaWANUpdateGatewayTaskCreate
 -> LoRaWANUpdateGatewayTaskCreate -> Bool)
-> (LoRaWANUpdateGatewayTaskCreate
    -> LoRaWANUpdateGatewayTaskCreate -> Bool)
-> Eq LoRaWANUpdateGatewayTaskCreate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoRaWANUpdateGatewayTaskCreate
-> LoRaWANUpdateGatewayTaskCreate -> Bool
$c/= :: LoRaWANUpdateGatewayTaskCreate
-> LoRaWANUpdateGatewayTaskCreate -> Bool
== :: LoRaWANUpdateGatewayTaskCreate
-> LoRaWANUpdateGatewayTaskCreate -> Bool
$c== :: LoRaWANUpdateGatewayTaskCreate
-> LoRaWANUpdateGatewayTaskCreate -> Bool
Prelude.Eq, ReadPrec [LoRaWANUpdateGatewayTaskCreate]
ReadPrec LoRaWANUpdateGatewayTaskCreate
Int -> ReadS LoRaWANUpdateGatewayTaskCreate
ReadS [LoRaWANUpdateGatewayTaskCreate]
(Int -> ReadS LoRaWANUpdateGatewayTaskCreate)
-> ReadS [LoRaWANUpdateGatewayTaskCreate]
-> ReadPrec LoRaWANUpdateGatewayTaskCreate
-> ReadPrec [LoRaWANUpdateGatewayTaskCreate]
-> Read LoRaWANUpdateGatewayTaskCreate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoRaWANUpdateGatewayTaskCreate]
$creadListPrec :: ReadPrec [LoRaWANUpdateGatewayTaskCreate]
readPrec :: ReadPrec LoRaWANUpdateGatewayTaskCreate
$creadPrec :: ReadPrec LoRaWANUpdateGatewayTaskCreate
readList :: ReadS [LoRaWANUpdateGatewayTaskCreate]
$creadList :: ReadS [LoRaWANUpdateGatewayTaskCreate]
readsPrec :: Int -> ReadS LoRaWANUpdateGatewayTaskCreate
$creadsPrec :: Int -> ReadS LoRaWANUpdateGatewayTaskCreate
Prelude.Read, Int -> LoRaWANUpdateGatewayTaskCreate -> ShowS
[LoRaWANUpdateGatewayTaskCreate] -> ShowS
LoRaWANUpdateGatewayTaskCreate -> String
(Int -> LoRaWANUpdateGatewayTaskCreate -> ShowS)
-> (LoRaWANUpdateGatewayTaskCreate -> String)
-> ([LoRaWANUpdateGatewayTaskCreate] -> ShowS)
-> Show LoRaWANUpdateGatewayTaskCreate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoRaWANUpdateGatewayTaskCreate] -> ShowS
$cshowList :: [LoRaWANUpdateGatewayTaskCreate] -> ShowS
show :: LoRaWANUpdateGatewayTaskCreate -> String
$cshow :: LoRaWANUpdateGatewayTaskCreate -> String
showsPrec :: Int -> LoRaWANUpdateGatewayTaskCreate -> ShowS
$cshowsPrec :: Int -> LoRaWANUpdateGatewayTaskCreate -> ShowS
Prelude.Show, (forall x.
 LoRaWANUpdateGatewayTaskCreate
 -> Rep LoRaWANUpdateGatewayTaskCreate x)
-> (forall x.
    Rep LoRaWANUpdateGatewayTaskCreate x
    -> LoRaWANUpdateGatewayTaskCreate)
-> Generic LoRaWANUpdateGatewayTaskCreate
forall x.
Rep LoRaWANUpdateGatewayTaskCreate x
-> LoRaWANUpdateGatewayTaskCreate
forall x.
LoRaWANUpdateGatewayTaskCreate
-> Rep LoRaWANUpdateGatewayTaskCreate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep LoRaWANUpdateGatewayTaskCreate x
-> LoRaWANUpdateGatewayTaskCreate
$cfrom :: forall x.
LoRaWANUpdateGatewayTaskCreate
-> Rep LoRaWANUpdateGatewayTaskCreate x
Prelude.Generic)

-- |
-- Create a value of 'LoRaWANUpdateGatewayTaskCreate' 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:
--
-- 'updateSignature', 'loRaWANUpdateGatewayTaskCreate_updateSignature' - The signature used to verify the update firmware.
--
-- 'sigKeyCrc', 'loRaWANUpdateGatewayTaskCreate_sigKeyCrc' - The CRC of the signature private key to check.
--
-- 'currentVersion', 'loRaWANUpdateGatewayTaskCreate_currentVersion' - The version of the gateways that should receive the update.
--
-- 'updateVersion', 'loRaWANUpdateGatewayTaskCreate_updateVersion' - The firmware version to update the gateway to.
newLoRaWANUpdateGatewayTaskCreate ::
  LoRaWANUpdateGatewayTaskCreate
newLoRaWANUpdateGatewayTaskCreate :: LoRaWANUpdateGatewayTaskCreate
newLoRaWANUpdateGatewayTaskCreate =
  LoRaWANUpdateGatewayTaskCreate' :: Maybe Text
-> Maybe Natural
-> Maybe LoRaWANGatewayVersion
-> Maybe LoRaWANGatewayVersion
-> LoRaWANUpdateGatewayTaskCreate
LoRaWANUpdateGatewayTaskCreate'
    { $sel:updateSignature:LoRaWANUpdateGatewayTaskCreate' :: Maybe Text
updateSignature =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sigKeyCrc:LoRaWANUpdateGatewayTaskCreate' :: Maybe Natural
sigKeyCrc = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:currentVersion:LoRaWANUpdateGatewayTaskCreate' :: Maybe LoRaWANGatewayVersion
currentVersion = Maybe LoRaWANGatewayVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:updateVersion:LoRaWANUpdateGatewayTaskCreate' :: Maybe LoRaWANGatewayVersion
updateVersion = Maybe LoRaWANGatewayVersion
forall a. Maybe a
Prelude.Nothing
    }

-- | The signature used to verify the update firmware.
loRaWANUpdateGatewayTaskCreate_updateSignature :: Lens.Lens' LoRaWANUpdateGatewayTaskCreate (Prelude.Maybe Prelude.Text)
loRaWANUpdateGatewayTaskCreate_updateSignature :: (Maybe Text -> f (Maybe Text))
-> LoRaWANUpdateGatewayTaskCreate
-> f LoRaWANUpdateGatewayTaskCreate
loRaWANUpdateGatewayTaskCreate_updateSignature = (LoRaWANUpdateGatewayTaskCreate -> Maybe Text)
-> (LoRaWANUpdateGatewayTaskCreate
    -> Maybe Text -> LoRaWANUpdateGatewayTaskCreate)
-> Lens
     LoRaWANUpdateGatewayTaskCreate
     LoRaWANUpdateGatewayTaskCreate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskCreate' {Maybe Text
updateSignature :: Maybe Text
$sel:updateSignature:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe Text
updateSignature} -> Maybe Text
updateSignature) (\s :: LoRaWANUpdateGatewayTaskCreate
s@LoRaWANUpdateGatewayTaskCreate' {} Maybe Text
a -> LoRaWANUpdateGatewayTaskCreate
s {$sel:updateSignature:LoRaWANUpdateGatewayTaskCreate' :: Maybe Text
updateSignature = Maybe Text
a} :: LoRaWANUpdateGatewayTaskCreate)

-- | The CRC of the signature private key to check.
loRaWANUpdateGatewayTaskCreate_sigKeyCrc :: Lens.Lens' LoRaWANUpdateGatewayTaskCreate (Prelude.Maybe Prelude.Natural)
loRaWANUpdateGatewayTaskCreate_sigKeyCrc :: (Maybe Natural -> f (Maybe Natural))
-> LoRaWANUpdateGatewayTaskCreate
-> f LoRaWANUpdateGatewayTaskCreate
loRaWANUpdateGatewayTaskCreate_sigKeyCrc = (LoRaWANUpdateGatewayTaskCreate -> Maybe Natural)
-> (LoRaWANUpdateGatewayTaskCreate
    -> Maybe Natural -> LoRaWANUpdateGatewayTaskCreate)
-> Lens
     LoRaWANUpdateGatewayTaskCreate
     LoRaWANUpdateGatewayTaskCreate
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskCreate' {Maybe Natural
sigKeyCrc :: Maybe Natural
$sel:sigKeyCrc:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe Natural
sigKeyCrc} -> Maybe Natural
sigKeyCrc) (\s :: LoRaWANUpdateGatewayTaskCreate
s@LoRaWANUpdateGatewayTaskCreate' {} Maybe Natural
a -> LoRaWANUpdateGatewayTaskCreate
s {$sel:sigKeyCrc:LoRaWANUpdateGatewayTaskCreate' :: Maybe Natural
sigKeyCrc = Maybe Natural
a} :: LoRaWANUpdateGatewayTaskCreate)

-- | The version of the gateways that should receive the update.
loRaWANUpdateGatewayTaskCreate_currentVersion :: Lens.Lens' LoRaWANUpdateGatewayTaskCreate (Prelude.Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskCreate_currentVersion :: (Maybe LoRaWANGatewayVersion -> f (Maybe LoRaWANGatewayVersion))
-> LoRaWANUpdateGatewayTaskCreate
-> f LoRaWANUpdateGatewayTaskCreate
loRaWANUpdateGatewayTaskCreate_currentVersion = (LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion)
-> (LoRaWANUpdateGatewayTaskCreate
    -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
-> Lens
     LoRaWANUpdateGatewayTaskCreate
     LoRaWANUpdateGatewayTaskCreate
     (Maybe LoRaWANGatewayVersion)
     (Maybe LoRaWANGatewayVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskCreate' {Maybe LoRaWANGatewayVersion
currentVersion :: Maybe LoRaWANGatewayVersion
$sel:currentVersion:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
currentVersion} -> Maybe LoRaWANGatewayVersion
currentVersion) (\s :: LoRaWANUpdateGatewayTaskCreate
s@LoRaWANUpdateGatewayTaskCreate' {} Maybe LoRaWANGatewayVersion
a -> LoRaWANUpdateGatewayTaskCreate
s {$sel:currentVersion:LoRaWANUpdateGatewayTaskCreate' :: Maybe LoRaWANGatewayVersion
currentVersion = Maybe LoRaWANGatewayVersion
a} :: LoRaWANUpdateGatewayTaskCreate)

-- | The firmware version to update the gateway to.
loRaWANUpdateGatewayTaskCreate_updateVersion :: Lens.Lens' LoRaWANUpdateGatewayTaskCreate (Prelude.Maybe LoRaWANGatewayVersion)
loRaWANUpdateGatewayTaskCreate_updateVersion :: (Maybe LoRaWANGatewayVersion -> f (Maybe LoRaWANGatewayVersion))
-> LoRaWANUpdateGatewayTaskCreate
-> f LoRaWANUpdateGatewayTaskCreate
loRaWANUpdateGatewayTaskCreate_updateVersion = (LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion)
-> (LoRaWANUpdateGatewayTaskCreate
    -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
-> Lens
     LoRaWANUpdateGatewayTaskCreate
     LoRaWANUpdateGatewayTaskCreate
     (Maybe LoRaWANGatewayVersion)
     (Maybe LoRaWANGatewayVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoRaWANUpdateGatewayTaskCreate' {Maybe LoRaWANGatewayVersion
updateVersion :: Maybe LoRaWANGatewayVersion
$sel:updateVersion:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
updateVersion} -> Maybe LoRaWANGatewayVersion
updateVersion) (\s :: LoRaWANUpdateGatewayTaskCreate
s@LoRaWANUpdateGatewayTaskCreate' {} Maybe LoRaWANGatewayVersion
a -> LoRaWANUpdateGatewayTaskCreate
s {$sel:updateVersion:LoRaWANUpdateGatewayTaskCreate' :: Maybe LoRaWANGatewayVersion
updateVersion = Maybe LoRaWANGatewayVersion
a} :: LoRaWANUpdateGatewayTaskCreate)

instance Core.FromJSON LoRaWANUpdateGatewayTaskCreate where
  parseJSON :: Value -> Parser LoRaWANUpdateGatewayTaskCreate
parseJSON =
    String
-> (Object -> Parser LoRaWANUpdateGatewayTaskCreate)
-> Value
-> Parser LoRaWANUpdateGatewayTaskCreate
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoRaWANUpdateGatewayTaskCreate"
      ( \Object
x ->
          Maybe Text
-> Maybe Natural
-> Maybe LoRaWANGatewayVersion
-> Maybe LoRaWANGatewayVersion
-> LoRaWANUpdateGatewayTaskCreate
LoRaWANUpdateGatewayTaskCreate'
            (Maybe Text
 -> Maybe Natural
 -> Maybe LoRaWANGatewayVersion
 -> Maybe LoRaWANGatewayVersion
 -> LoRaWANUpdateGatewayTaskCreate)
-> Parser (Maybe Text)
-> Parser
     (Maybe Natural
      -> Maybe LoRaWANGatewayVersion
      -> Maybe LoRaWANGatewayVersion
      -> LoRaWANUpdateGatewayTaskCreate)
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
"UpdateSignature")
            Parser
  (Maybe Natural
   -> Maybe LoRaWANGatewayVersion
   -> Maybe LoRaWANGatewayVersion
   -> LoRaWANUpdateGatewayTaskCreate)
-> Parser (Maybe Natural)
-> Parser
     (Maybe LoRaWANGatewayVersion
      -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SigKeyCrc")
            Parser
  (Maybe LoRaWANGatewayVersion
   -> Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
-> Parser (Maybe LoRaWANGatewayVersion)
-> Parser
     (Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LoRaWANGatewayVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CurrentVersion")
            Parser
  (Maybe LoRaWANGatewayVersion -> LoRaWANUpdateGatewayTaskCreate)
-> Parser (Maybe LoRaWANGatewayVersion)
-> Parser LoRaWANUpdateGatewayTaskCreate
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe LoRaWANGatewayVersion)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdateVersion")
      )

instance
  Prelude.Hashable
    LoRaWANUpdateGatewayTaskCreate

instance
  Prelude.NFData
    LoRaWANUpdateGatewayTaskCreate

instance Core.ToJSON LoRaWANUpdateGatewayTaskCreate where
  toJSON :: LoRaWANUpdateGatewayTaskCreate -> Value
toJSON LoRaWANUpdateGatewayTaskCreate' {Maybe Natural
Maybe Text
Maybe LoRaWANGatewayVersion
updateVersion :: Maybe LoRaWANGatewayVersion
currentVersion :: Maybe LoRaWANGatewayVersion
sigKeyCrc :: Maybe Natural
updateSignature :: Maybe Text
$sel:updateVersion:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
$sel:currentVersion:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe LoRaWANGatewayVersion
$sel:sigKeyCrc:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe Natural
$sel:updateSignature:LoRaWANUpdateGatewayTaskCreate' :: LoRaWANUpdateGatewayTaskCreate -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"UpdateSignature" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
updateSignature,
            (Text
"SigKeyCrc" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
sigKeyCrc,
            (Text
"CurrentVersion" Text -> LoRaWANGatewayVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LoRaWANGatewayVersion -> Pair)
-> Maybe LoRaWANGatewayVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoRaWANGatewayVersion
currentVersion,
            (Text
"UpdateVersion" Text -> LoRaWANGatewayVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (LoRaWANGatewayVersion -> Pair)
-> Maybe LoRaWANGatewayVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoRaWANGatewayVersion
updateVersion
          ]
      )