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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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,
    -- | The Amazon Resource Name (ARN) of the task.
    TaskSummary -> Maybe Text
taskArn :: Prelude.Maybe Prelude.Text,
    -- | 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 task ID.
    TaskSummary -> Text
taskId :: Prelude.Text
  }
  deriving (TaskSummary -> TaskSummary -> Bool
(TaskSummary -> TaskSummary -> Bool)
-> (TaskSummary -> TaskSummary -> Bool) -> Eq TaskSummary
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]
(Int -> ReadS TaskSummary)
-> ReadS [TaskSummary]
-> ReadPrec TaskSummary
-> ReadPrec [TaskSummary]
-> Read 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
(Int -> TaskSummary -> ShowS)
-> (TaskSummary -> String)
-> ([TaskSummary] -> ShowS)
-> Show TaskSummary
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. TaskSummary -> Rep TaskSummary x)
-> (forall x. Rep TaskSummary x -> TaskSummary)
-> Generic TaskSummary
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.
--
-- 'taskArn', 'taskSummary_taskArn' - The Amazon Resource Name (ARN) of the task.
--
-- '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.
--
-- 'taskId', 'taskSummary_taskId' - The task ID.
newTaskSummary ::
  -- | 'taskId'
  Prelude.Text ->
  TaskSummary
newTaskSummary :: Text -> TaskSummary
newTaskSummary Text
pTaskId_ =
  TaskSummary' :: Maybe TaskState
-> Maybe Text -> Maybe (HashMap Text Text) -> Text -> TaskSummary
TaskSummary'
    { $sel:state:TaskSummary' :: Maybe TaskState
state = Maybe TaskState
forall a. Maybe a
Prelude.Nothing,
      $sel:taskArn:TaskSummary' :: Maybe Text
taskArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:TaskSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
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 :: (Maybe TaskState -> f (Maybe TaskState))
-> TaskSummary -> f TaskSummary
taskSummary_state = (TaskSummary -> Maybe TaskState)
-> (TaskSummary -> Maybe TaskState -> TaskSummary)
-> Lens TaskSummary TaskSummary (Maybe TaskState) (Maybe TaskState)
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)

-- | The Amazon Resource Name (ARN) of the task.
taskSummary_taskArn :: Lens.Lens' TaskSummary (Prelude.Maybe Prelude.Text)
taskSummary_taskArn :: (Maybe Text -> f (Maybe Text)) -> TaskSummary -> f TaskSummary
taskSummary_taskArn = (TaskSummary -> Maybe Text)
-> (TaskSummary -> Maybe Text -> TaskSummary)
-> Lens TaskSummary TaskSummary (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TaskSummary -> f TaskSummary
taskSummary_tags = (TaskSummary -> Maybe (HashMap Text Text))
-> (TaskSummary -> Maybe (HashMap Text Text) -> TaskSummary)
-> Lens
     TaskSummary
     TaskSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> TaskSummary -> f TaskSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> TaskSummary
-> f TaskSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The task ID.
taskSummary_taskId :: Lens.Lens' TaskSummary Prelude.Text
taskSummary_taskId :: (Text -> f Text) -> TaskSummary -> f TaskSummary
taskSummary_taskId = (TaskSummary -> Text)
-> (TaskSummary -> Text -> TaskSummary)
-> Lens TaskSummary TaskSummary Text Text
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 Core.FromJSON TaskSummary where
  parseJSON :: Value -> Parser TaskSummary
parseJSON =
    String
-> (Object -> Parser TaskSummary) -> Value -> Parser TaskSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TaskSummary"
      ( \Object
x ->
          Maybe TaskState
-> Maybe Text -> Maybe (HashMap Text Text) -> Text -> TaskSummary
TaskSummary'
            (Maybe TaskState
 -> Maybe Text -> Maybe (HashMap Text Text) -> Text -> TaskSummary)
-> Parser (Maybe TaskState)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> Text -> TaskSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe TaskState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser
  (Maybe Text -> Maybe (HashMap Text Text) -> Text -> TaskSummary)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> Text -> TaskSummary)
forall (f :: * -> *) a b. Applicative f => 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
"taskArn")
            Parser (Maybe (HashMap Text Text) -> Text -> TaskSummary)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> TaskSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
            Parser (Text -> TaskSummary) -> Parser Text -> Parser TaskSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"taskId")
      )

instance Prelude.Hashable TaskSummary

instance Prelude.NFData TaskSummary