{-# 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.SnowDeviceManagement.Types.TaskSummary
-- 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.SnowDeviceManagement.Types.TaskSummary 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.SnowDeviceManagement.Types.TaskState

-- | Information about the task assigned to one or many devices.
--
-- /See:/ 'newTaskSummary' smart constructor.
data TaskSummary = TaskSummary'
  { -- | The state of the task assigned to one or many devices.
    TaskSummary -> Maybe TaskState
state :: Prelude.Maybe TaskState,
    -- | Optional metadata that you assign to a resource. You can use tags to
    -- categorize a resource in different ways, such as by purpose, owner, or
    -- environment.
    TaskSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The Amazon Resource Name (ARN) of the task.
    TaskSummary -> Maybe Text
taskArn :: Prelude.Maybe Prelude.Text,
    -- | The task ID.
    TaskSummary -> Text
taskId :: Prelude.Text
  }
  deriving (TaskSummary -> TaskSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TaskSummary -> TaskSummary -> Bool
$c/= :: TaskSummary -> TaskSummary -> Bool
== :: TaskSummary -> TaskSummary -> Bool
$c== :: TaskSummary -> TaskSummary -> Bool
Prelude.Eq, ReadPrec [TaskSummary]
ReadPrec TaskSummary
Int -> ReadS TaskSummary
ReadS [TaskSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TaskSummary]
$creadListPrec :: ReadPrec [TaskSummary]
readPrec :: ReadPrec TaskSummary
$creadPrec :: ReadPrec TaskSummary
readList :: ReadS [TaskSummary]
$creadList :: ReadS [TaskSummary]
readsPrec :: Int -> ReadS TaskSummary
$creadsPrec :: Int -> ReadS TaskSummary
Prelude.Read, Int -> TaskSummary -> ShowS
[TaskSummary] -> ShowS
TaskSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TaskSummary] -> ShowS
$cshowList :: [TaskSummary] -> ShowS
show :: TaskSummary -> String
$cshow :: TaskSummary -> String
showsPrec :: Int -> TaskSummary -> ShowS
$cshowsPrec :: Int -> TaskSummary -> ShowS
Prelude.Show, forall x. Rep TaskSummary x -> TaskSummary
forall x. TaskSummary -> Rep TaskSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TaskSummary x -> TaskSummary
$cfrom :: forall x. TaskSummary -> Rep TaskSummary x
Prelude.Generic)

-- |
-- Create a value of 'TaskSummary' 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:
--
-- 'state', 'taskSummary_state' - The state of the task assigned to one or many devices.
--
-- 'tags', 'taskSummary_tags' - Optional metadata that you assign to a resource. You can use tags to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment.
--
-- 'taskArn', 'taskSummary_taskArn' - The Amazon Resource Name (ARN) of the task.
--
-- 'taskId', 'taskSummary_taskId' - The task ID.
newTaskSummary ::
  -- | 'taskId'
  Prelude.Text ->
  TaskSummary
newTaskSummary :: Text -> TaskSummary
newTaskSummary Text
pTaskId_ =
  TaskSummary'
    { $sel:state:TaskSummary' :: Maybe TaskState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:TaskSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:taskArn:TaskSummary' :: Maybe Text
taskArn = forall a. Maybe a
Prelude.Nothing,
      $sel:taskId:TaskSummary' :: Text
taskId = Text
pTaskId_
    }

-- | The state of the task assigned to one or many devices.
taskSummary_state :: Lens.Lens' TaskSummary (Prelude.Maybe TaskState)
taskSummary_state :: Lens' TaskSummary (Maybe TaskState)
taskSummary_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSummary' {Maybe TaskState
state :: Maybe TaskState
$sel:state:TaskSummary' :: TaskSummary -> Maybe TaskState
state} -> Maybe TaskState
state) (\s :: TaskSummary
s@TaskSummary' {} Maybe TaskState
a -> TaskSummary
s {$sel:state:TaskSummary' :: Maybe TaskState
state = Maybe TaskState
a} :: TaskSummary)

-- | Optional metadata that you assign to a resource. You can use tags to
-- categorize a resource in different ways, such as by purpose, owner, or
-- environment.
taskSummary_tags :: Lens.Lens' TaskSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
taskSummary_tags :: Lens' TaskSummary (Maybe (HashMap Text Text))
taskSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:TaskSummary' :: TaskSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: TaskSummary
s@TaskSummary' {} Maybe (HashMap Text Text)
a -> TaskSummary
s {$sel:tags:TaskSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: TaskSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the task.
taskSummary_taskArn :: Lens.Lens' TaskSummary (Prelude.Maybe Prelude.Text)
taskSummary_taskArn :: Lens' TaskSummary (Maybe Text)
taskSummary_taskArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSummary' {Maybe Text
taskArn :: Maybe Text
$sel:taskArn:TaskSummary' :: TaskSummary -> Maybe Text
taskArn} -> Maybe Text
taskArn) (\s :: TaskSummary
s@TaskSummary' {} Maybe Text
a -> TaskSummary
s {$sel:taskArn:TaskSummary' :: Maybe Text
taskArn = Maybe Text
a} :: TaskSummary)

-- | The task ID.
taskSummary_taskId :: Lens.Lens' TaskSummary Prelude.Text
taskSummary_taskId :: Lens' TaskSummary Text
taskSummary_taskId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TaskSummary' {Text
taskId :: Text
$sel:taskId:TaskSummary' :: TaskSummary -> Text
taskId} -> Text
taskId) (\s :: TaskSummary
s@TaskSummary' {} Text
a -> TaskSummary
s {$sel:taskId:TaskSummary' :: Text
taskId = Text
a} :: TaskSummary)

instance Data.FromJSON TaskSummary where
  parseJSON :: Value -> Parser TaskSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TaskSummary"
      ( \Object
x ->
          Maybe TaskState
-> Maybe (HashMap Text Text) -> Maybe Text -> Text -> TaskSummary
TaskSummary'
            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
"state")
            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
"tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"taskArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"taskId")
      )

instance Prelude.Hashable TaskSummary where
  hashWithSalt :: Int -> TaskSummary -> Int
hashWithSalt Int
_salt TaskSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe TaskState
Text
taskId :: Text
taskArn :: Maybe Text
tags :: Maybe (HashMap Text Text)
state :: Maybe TaskState
$sel:taskId:TaskSummary' :: TaskSummary -> Text
$sel:taskArn:TaskSummary' :: TaskSummary -> Maybe Text
$sel:tags:TaskSummary' :: TaskSummary -> Maybe (HashMap Text Text)
$sel:state:TaskSummary' :: TaskSummary -> Maybe TaskState
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TaskState
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
taskArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
taskId

instance Prelude.NFData TaskSummary where
  rnf :: TaskSummary -> ()
rnf TaskSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe TaskState
Text
taskId :: Text
taskArn :: Maybe Text
tags :: Maybe (HashMap Text Text)
state :: Maybe TaskState
$sel:taskId:TaskSummary' :: TaskSummary -> Text
$sel:taskArn:TaskSummary' :: TaskSummary -> Maybe Text
$sel:tags:TaskSummary' :: TaskSummary -> Maybe (HashMap Text Text)
$sel:state:TaskSummary' :: TaskSummary -> Maybe TaskState
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe TaskState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
taskArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
taskId