{-# 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.SSM.Types.AttachmentInformation
-- 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.SSM.Types.AttachmentInformation where

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

-- | An attribute of an attachment, such as the attachment name.
--
-- /See:/ 'newAttachmentInformation' smart constructor.
data AttachmentInformation = AttachmentInformation'
  { -- | The name of the attachment.
    AttachmentInformation -> Maybe Text
name :: Prelude.Maybe Prelude.Text
  }
  deriving (AttachmentInformation -> AttachmentInformation -> Bool
(AttachmentInformation -> AttachmentInformation -> Bool)
-> (AttachmentInformation -> AttachmentInformation -> Bool)
-> Eq AttachmentInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentInformation -> AttachmentInformation -> Bool
$c/= :: AttachmentInformation -> AttachmentInformation -> Bool
== :: AttachmentInformation -> AttachmentInformation -> Bool
$c== :: AttachmentInformation -> AttachmentInformation -> Bool
Prelude.Eq, ReadPrec [AttachmentInformation]
ReadPrec AttachmentInformation
Int -> ReadS AttachmentInformation
ReadS [AttachmentInformation]
(Int -> ReadS AttachmentInformation)
-> ReadS [AttachmentInformation]
-> ReadPrec AttachmentInformation
-> ReadPrec [AttachmentInformation]
-> Read AttachmentInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentInformation]
$creadListPrec :: ReadPrec [AttachmentInformation]
readPrec :: ReadPrec AttachmentInformation
$creadPrec :: ReadPrec AttachmentInformation
readList :: ReadS [AttachmentInformation]
$creadList :: ReadS [AttachmentInformation]
readsPrec :: Int -> ReadS AttachmentInformation
$creadsPrec :: Int -> ReadS AttachmentInformation
Prelude.Read, Int -> AttachmentInformation -> ShowS
[AttachmentInformation] -> ShowS
AttachmentInformation -> String
(Int -> AttachmentInformation -> ShowS)
-> (AttachmentInformation -> String)
-> ([AttachmentInformation] -> ShowS)
-> Show AttachmentInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentInformation] -> ShowS
$cshowList :: [AttachmentInformation] -> ShowS
show :: AttachmentInformation -> String
$cshow :: AttachmentInformation -> String
showsPrec :: Int -> AttachmentInformation -> ShowS
$cshowsPrec :: Int -> AttachmentInformation -> ShowS
Prelude.Show, (forall x. AttachmentInformation -> Rep AttachmentInformation x)
-> (forall x. Rep AttachmentInformation x -> AttachmentInformation)
-> Generic AttachmentInformation
forall x. Rep AttachmentInformation x -> AttachmentInformation
forall x. AttachmentInformation -> Rep AttachmentInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachmentInformation x -> AttachmentInformation
$cfrom :: forall x. AttachmentInformation -> Rep AttachmentInformation x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentInformation' 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:
--
-- 'name', 'attachmentInformation_name' - The name of the attachment.
newAttachmentInformation ::
  AttachmentInformation
newAttachmentInformation :: AttachmentInformation
newAttachmentInformation =
  AttachmentInformation' :: Maybe Text -> AttachmentInformation
AttachmentInformation' {$sel:name:AttachmentInformation' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing}

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

instance Core.FromJSON AttachmentInformation where
  parseJSON :: Value -> Parser AttachmentInformation
parseJSON =
    String
-> (Object -> Parser AttachmentInformation)
-> Value
-> Parser AttachmentInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AttachmentInformation"
      ( \Object
x ->
          Maybe Text -> AttachmentInformation
AttachmentInformation'
            (Maybe Text -> AttachmentInformation)
-> Parser (Maybe Text) -> Parser AttachmentInformation
forall (f :: * -> *) a b. Functor 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
"Name")
      )

instance Prelude.Hashable AttachmentInformation

instance Prelude.NFData AttachmentInformation