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

-- |
--
-- /See:/ 'newDefinition' smart constructor.
data Definition = Definition'
  { -- | The checksum information of the model.
    Definition -> Maybe Checksum
checksum :: Prelude.Maybe Checksum,
    -- | The unique model handle.
    Definition -> Maybe Text
modelHandle :: Prelude.Maybe Prelude.Text,
    -- | The absolute S3 location of the model.
    Definition -> Maybe Text
s3Url :: Prelude.Maybe Prelude.Text,
    -- | The desired state of the model.
    Definition -> Maybe ModelState
state :: Prelude.Maybe ModelState
  }
  deriving (Definition -> Definition -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Definition -> Definition -> Bool
$c/= :: Definition -> Definition -> Bool
== :: Definition -> Definition -> Bool
$c== :: Definition -> Definition -> Bool
Prelude.Eq, ReadPrec [Definition]
ReadPrec Definition
Int -> ReadS Definition
ReadS [Definition]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Definition]
$creadListPrec :: ReadPrec [Definition]
readPrec :: ReadPrec Definition
$creadPrec :: ReadPrec Definition
readList :: ReadS [Definition]
$creadList :: ReadS [Definition]
readsPrec :: Int -> ReadS Definition
$creadsPrec :: Int -> ReadS Definition
Prelude.Read, Int -> Definition -> ShowS
[Definition] -> ShowS
Definition -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Definition] -> ShowS
$cshowList :: [Definition] -> ShowS
show :: Definition -> String
$cshow :: Definition -> String
showsPrec :: Int -> Definition -> ShowS
$cshowsPrec :: Int -> Definition -> ShowS
Prelude.Show, forall x. Rep Definition x -> Definition
forall x. Definition -> Rep Definition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Definition x -> Definition
$cfrom :: forall x. Definition -> Rep Definition x
Prelude.Generic)

-- |
-- Create a value of 'Definition' 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:
--
-- 'checksum', 'definition_checksum' - The checksum information of the model.
--
-- 'modelHandle', 'definition_modelHandle' - The unique model handle.
--
-- 's3Url', 'definition_s3Url' - The absolute S3 location of the model.
--
-- 'state', 'definition_state' - The desired state of the model.
newDefinition ::
  Definition
newDefinition :: Definition
newDefinition =
  Definition'
    { $sel:checksum:Definition' :: Maybe Checksum
checksum = forall a. Maybe a
Prelude.Nothing,
      $sel:modelHandle:Definition' :: Maybe Text
modelHandle = forall a. Maybe a
Prelude.Nothing,
      $sel:s3Url:Definition' :: Maybe Text
s3Url = forall a. Maybe a
Prelude.Nothing,
      $sel:state:Definition' :: Maybe ModelState
state = forall a. Maybe a
Prelude.Nothing
    }

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

-- | The unique model handle.
definition_modelHandle :: Lens.Lens' Definition (Prelude.Maybe Prelude.Text)
definition_modelHandle :: Lens' Definition (Maybe Text)
definition_modelHandle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe Text
modelHandle :: Maybe Text
$sel:modelHandle:Definition' :: Definition -> Maybe Text
modelHandle} -> Maybe Text
modelHandle) (\s :: Definition
s@Definition' {} Maybe Text
a -> Definition
s {$sel:modelHandle:Definition' :: Maybe Text
modelHandle = Maybe Text
a} :: Definition)

-- | The absolute S3 location of the model.
definition_s3Url :: Lens.Lens' Definition (Prelude.Maybe Prelude.Text)
definition_s3Url :: Lens' Definition (Maybe Text)
definition_s3Url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe Text
s3Url :: Maybe Text
$sel:s3Url:Definition' :: Definition -> Maybe Text
s3Url} -> Maybe Text
s3Url) (\s :: Definition
s@Definition' {} Maybe Text
a -> Definition
s {$sel:s3Url:Definition' :: Maybe Text
s3Url = Maybe Text
a} :: Definition)

-- | The desired state of the model.
definition_state :: Lens.Lens' Definition (Prelude.Maybe ModelState)
definition_state :: Lens' Definition (Maybe ModelState)
definition_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Definition' {Maybe ModelState
state :: Maybe ModelState
$sel:state:Definition' :: Definition -> Maybe ModelState
state} -> Maybe ModelState
state) (\s :: Definition
s@Definition' {} Maybe ModelState
a -> Definition
s {$sel:state:Definition' :: Maybe ModelState
state = Maybe ModelState
a} :: Definition)

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

instance Prelude.Hashable Definition where
  hashWithSalt :: Int -> Definition -> Int
hashWithSalt Int
_salt Definition' {Maybe Text
Maybe Checksum
Maybe ModelState
state :: Maybe ModelState
s3Url :: Maybe Text
modelHandle :: Maybe Text
checksum :: Maybe Checksum
$sel:state:Definition' :: Definition -> Maybe ModelState
$sel:s3Url:Definition' :: Definition -> Maybe Text
$sel:modelHandle:Definition' :: Definition -> Maybe Text
$sel:checksum:Definition' :: Definition -> Maybe Checksum
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Checksum
checksum
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
modelHandle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ModelState
state

instance Prelude.NFData Definition where
  rnf :: Definition -> ()
rnf Definition' {Maybe Text
Maybe Checksum
Maybe ModelState
state :: Maybe ModelState
s3Url :: Maybe Text
modelHandle :: Maybe Text
checksum :: Maybe Checksum
$sel:state:Definition' :: Definition -> Maybe ModelState
$sel:s3Url:Definition' :: Definition -> Maybe Text
$sel:modelHandle:Definition' :: Definition -> Maybe Text
$sel:checksum:Definition' :: Definition -> Maybe Checksum
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Checksum
checksum
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
modelHandle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ModelState
state