{-# 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.SageMakerEdge.Types.Checksum
-- 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.SageMakerEdge.Types.Checksum 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
import Amazonka.SageMakerEdge.Types.ChecksumType

-- | Information about the checksum of a model deployed on a device.
--
-- /See:/ 'newChecksum' smart constructor.
data Checksum = Checksum'
  { -- | The checksum of the model.
    Checksum -> Maybe Text
sum :: Prelude.Maybe Prelude.Text,
    -- | The type of the checksum.
    Checksum -> Maybe ChecksumType
type' :: Prelude.Maybe ChecksumType
  }
  deriving (Checksum -> Checksum -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Checksum -> Checksum -> Bool
$c/= :: Checksum -> Checksum -> Bool
== :: Checksum -> Checksum -> Bool
$c== :: Checksum -> Checksum -> Bool
Prelude.Eq, ReadPrec [Checksum]
ReadPrec Checksum
Int -> ReadS Checksum
ReadS [Checksum]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Checksum]
$creadListPrec :: ReadPrec [Checksum]
readPrec :: ReadPrec Checksum
$creadPrec :: ReadPrec Checksum
readList :: ReadS [Checksum]
$creadList :: ReadS [Checksum]
readsPrec :: Int -> ReadS Checksum
$creadsPrec :: Int -> ReadS Checksum
Prelude.Read, Int -> Checksum -> ShowS
[Checksum] -> ShowS
Checksum -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Checksum] -> ShowS
$cshowList :: [Checksum] -> ShowS
show :: Checksum -> String
$cshow :: Checksum -> String
showsPrec :: Int -> Checksum -> ShowS
$cshowsPrec :: Int -> Checksum -> ShowS
Prelude.Show, forall x. Rep Checksum x -> Checksum
forall x. Checksum -> Rep Checksum x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Checksum x -> Checksum
$cfrom :: forall x. Checksum -> Rep Checksum x
Prelude.Generic)

-- |
-- Create a value of 'Checksum' 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:
--
-- 'sum', 'checksum_sum' - The checksum of the model.
--
-- 'type'', 'checksum_type' - The type of the checksum.
newChecksum ::
  Checksum
newChecksum :: Checksum
newChecksum =
  Checksum'
    { $sel:sum:Checksum' :: Maybe Text
sum = forall a. Maybe a
Prelude.Nothing,
      $sel:type':Checksum' :: Maybe ChecksumType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | The checksum of the model.
checksum_sum :: Lens.Lens' Checksum (Prelude.Maybe Prelude.Text)
checksum_sum :: Lens' Checksum (Maybe Text)
checksum_sum = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Checksum' {Maybe Text
sum :: Maybe Text
$sel:sum:Checksum' :: Checksum -> Maybe Text
sum} -> Maybe Text
sum) (\s :: Checksum
s@Checksum' {} Maybe Text
a -> Checksum
s {$sel:sum:Checksum' :: Maybe Text
sum = Maybe Text
a} :: Checksum)

-- | The type of the checksum.
checksum_type :: Lens.Lens' Checksum (Prelude.Maybe ChecksumType)
checksum_type :: Lens' Checksum (Maybe ChecksumType)
checksum_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Checksum' {Maybe ChecksumType
type' :: Maybe ChecksumType
$sel:type':Checksum' :: Checksum -> Maybe ChecksumType
type'} -> Maybe ChecksumType
type') (\s :: Checksum
s@Checksum' {} Maybe ChecksumType
a -> Checksum
s {$sel:type':Checksum' :: Maybe ChecksumType
type' = Maybe ChecksumType
a} :: Checksum)

instance Data.FromJSON Checksum where
  parseJSON :: Value -> Parser Checksum
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Checksum"
      ( \Object
x ->
          Maybe Text -> Maybe ChecksumType -> Checksum
Checksum'
            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
"Sum")
            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
"Type")
      )

instance Prelude.Hashable Checksum where
  hashWithSalt :: Int -> Checksum -> Int
hashWithSalt Int
_salt Checksum' {Maybe Text
Maybe ChecksumType
type' :: Maybe ChecksumType
sum :: Maybe Text
$sel:type':Checksum' :: Checksum -> Maybe ChecksumType
$sel:sum:Checksum' :: Checksum -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ChecksumType
type'

instance Prelude.NFData Checksum where
  rnf :: Checksum -> ()
rnf Checksum' {Maybe Text
Maybe ChecksumType
type' :: Maybe ChecksumType
sum :: Maybe Text
$sel:type':Checksum' :: Checksum -> Maybe ChecksumType
$sel:sum:Checksum' :: Checksum -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sum seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ChecksumType
type'