{-# 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.ECS.Types.AttachmentStateChange
-- 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.ECS.Types.AttachmentStateChange where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An object representing a change in state for a task attachment.
--
-- /See:/ 'newAttachmentStateChange' smart constructor.
data AttachmentStateChange = AttachmentStateChange'
  { -- | The Amazon Resource Name (ARN) of the attachment.
    AttachmentStateChange -> Text
attachmentArn :: Prelude.Text,
    -- | The status of the attachment.
    AttachmentStateChange -> Text
status :: Prelude.Text
  }
  deriving (AttachmentStateChange -> AttachmentStateChange -> Bool
(AttachmentStateChange -> AttachmentStateChange -> Bool)
-> (AttachmentStateChange -> AttachmentStateChange -> Bool)
-> Eq AttachmentStateChange
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentStateChange -> AttachmentStateChange -> Bool
$c/= :: AttachmentStateChange -> AttachmentStateChange -> Bool
== :: AttachmentStateChange -> AttachmentStateChange -> Bool
$c== :: AttachmentStateChange -> AttachmentStateChange -> Bool
Prelude.Eq, ReadPrec [AttachmentStateChange]
ReadPrec AttachmentStateChange
Int -> ReadS AttachmentStateChange
ReadS [AttachmentStateChange]
(Int -> ReadS AttachmentStateChange)
-> ReadS [AttachmentStateChange]
-> ReadPrec AttachmentStateChange
-> ReadPrec [AttachmentStateChange]
-> Read AttachmentStateChange
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentStateChange]
$creadListPrec :: ReadPrec [AttachmentStateChange]
readPrec :: ReadPrec AttachmentStateChange
$creadPrec :: ReadPrec AttachmentStateChange
readList :: ReadS [AttachmentStateChange]
$creadList :: ReadS [AttachmentStateChange]
readsPrec :: Int -> ReadS AttachmentStateChange
$creadsPrec :: Int -> ReadS AttachmentStateChange
Prelude.Read, Int -> AttachmentStateChange -> ShowS
[AttachmentStateChange] -> ShowS
AttachmentStateChange -> String
(Int -> AttachmentStateChange -> ShowS)
-> (AttachmentStateChange -> String)
-> ([AttachmentStateChange] -> ShowS)
-> Show AttachmentStateChange
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentStateChange] -> ShowS
$cshowList :: [AttachmentStateChange] -> ShowS
show :: AttachmentStateChange -> String
$cshow :: AttachmentStateChange -> String
showsPrec :: Int -> AttachmentStateChange -> ShowS
$cshowsPrec :: Int -> AttachmentStateChange -> ShowS
Prelude.Show, (forall x. AttachmentStateChange -> Rep AttachmentStateChange x)
-> (forall x. Rep AttachmentStateChange x -> AttachmentStateChange)
-> Generic AttachmentStateChange
forall x. Rep AttachmentStateChange x -> AttachmentStateChange
forall x. AttachmentStateChange -> Rep AttachmentStateChange x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachmentStateChange x -> AttachmentStateChange
$cfrom :: forall x. AttachmentStateChange -> Rep AttachmentStateChange x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentStateChange' 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:
--
-- 'attachmentArn', 'attachmentStateChange_attachmentArn' - The Amazon Resource Name (ARN) of the attachment.
--
-- 'status', 'attachmentStateChange_status' - The status of the attachment.
newAttachmentStateChange ::
  -- | 'attachmentArn'
  Prelude.Text ->
  -- | 'status'
  Prelude.Text ->
  AttachmentStateChange
newAttachmentStateChange :: Text -> Text -> AttachmentStateChange
newAttachmentStateChange Text
pAttachmentArn_ Text
pStatus_ =
  AttachmentStateChange' :: Text -> Text -> AttachmentStateChange
AttachmentStateChange'
    { $sel:attachmentArn:AttachmentStateChange' :: Text
attachmentArn =
        Text
pAttachmentArn_,
      $sel:status:AttachmentStateChange' :: Text
status = Text
pStatus_
    }

-- | The Amazon Resource Name (ARN) of the attachment.
attachmentStateChange_attachmentArn :: Lens.Lens' AttachmentStateChange Prelude.Text
attachmentStateChange_attachmentArn :: (Text -> f Text)
-> AttachmentStateChange -> f AttachmentStateChange
attachmentStateChange_attachmentArn = (AttachmentStateChange -> Text)
-> (AttachmentStateChange -> Text -> AttachmentStateChange)
-> Lens AttachmentStateChange AttachmentStateChange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentStateChange' {Text
attachmentArn :: Text
$sel:attachmentArn:AttachmentStateChange' :: AttachmentStateChange -> Text
attachmentArn} -> Text
attachmentArn) (\s :: AttachmentStateChange
s@AttachmentStateChange' {} Text
a -> AttachmentStateChange
s {$sel:attachmentArn:AttachmentStateChange' :: Text
attachmentArn = Text
a} :: AttachmentStateChange)

-- | The status of the attachment.
attachmentStateChange_status :: Lens.Lens' AttachmentStateChange Prelude.Text
attachmentStateChange_status :: (Text -> f Text)
-> AttachmentStateChange -> f AttachmentStateChange
attachmentStateChange_status = (AttachmentStateChange -> Text)
-> (AttachmentStateChange -> Text -> AttachmentStateChange)
-> Lens AttachmentStateChange AttachmentStateChange Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentStateChange' {Text
status :: Text
$sel:status:AttachmentStateChange' :: AttachmentStateChange -> Text
status} -> Text
status) (\s :: AttachmentStateChange
s@AttachmentStateChange' {} Text
a -> AttachmentStateChange
s {$sel:status:AttachmentStateChange' :: Text
status = Text
a} :: AttachmentStateChange)

instance Prelude.Hashable AttachmentStateChange

instance Prelude.NFData AttachmentStateChange

instance Core.ToJSON AttachmentStateChange where
  toJSON :: AttachmentStateChange -> Value
toJSON AttachmentStateChange' {Text
status :: Text
attachmentArn :: Text
$sel:status:AttachmentStateChange' :: AttachmentStateChange -> Text
$sel:attachmentArn:AttachmentStateChange' :: AttachmentStateChange -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"attachmentArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
attachmentArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
status)
          ]
      )