{-# 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.AttachmentContent
-- 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.SSM.Types.AttachmentContent 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.SSM.Types.AttachmentHashType

-- | A structure that includes attributes that describe a document
-- attachment.
--
-- /See:/ 'newAttachmentContent' smart constructor.
data AttachmentContent = AttachmentContent'
  { -- | The cryptographic hash value of the document content.
    AttachmentContent -> Maybe Text
hash :: Prelude.Maybe Prelude.Text,
    -- | The hash algorithm used to calculate the hash value.
    AttachmentContent -> Maybe AttachmentHashType
hashType :: Prelude.Maybe AttachmentHashType,
    -- | The name of an attachment.
    AttachmentContent -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The size of an attachment in bytes.
    AttachmentContent -> Maybe Integer
size :: Prelude.Maybe Prelude.Integer,
    -- | The URL location of the attachment content.
    AttachmentContent -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (AttachmentContent -> AttachmentContent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachmentContent -> AttachmentContent -> Bool
$c/= :: AttachmentContent -> AttachmentContent -> Bool
== :: AttachmentContent -> AttachmentContent -> Bool
$c== :: AttachmentContent -> AttachmentContent -> Bool
Prelude.Eq, ReadPrec [AttachmentContent]
ReadPrec AttachmentContent
Int -> ReadS AttachmentContent
ReadS [AttachmentContent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachmentContent]
$creadListPrec :: ReadPrec [AttachmentContent]
readPrec :: ReadPrec AttachmentContent
$creadPrec :: ReadPrec AttachmentContent
readList :: ReadS [AttachmentContent]
$creadList :: ReadS [AttachmentContent]
readsPrec :: Int -> ReadS AttachmentContent
$creadsPrec :: Int -> ReadS AttachmentContent
Prelude.Read, Int -> AttachmentContent -> ShowS
[AttachmentContent] -> ShowS
AttachmentContent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachmentContent] -> ShowS
$cshowList :: [AttachmentContent] -> ShowS
show :: AttachmentContent -> String
$cshow :: AttachmentContent -> String
showsPrec :: Int -> AttachmentContent -> ShowS
$cshowsPrec :: Int -> AttachmentContent -> ShowS
Prelude.Show, forall x. Rep AttachmentContent x -> AttachmentContent
forall x. AttachmentContent -> Rep AttachmentContent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AttachmentContent x -> AttachmentContent
$cfrom :: forall x. AttachmentContent -> Rep AttachmentContent x
Prelude.Generic)

-- |
-- Create a value of 'AttachmentContent' 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:
--
-- 'hash', 'attachmentContent_hash' - The cryptographic hash value of the document content.
--
-- 'hashType', 'attachmentContent_hashType' - The hash algorithm used to calculate the hash value.
--
-- 'name', 'attachmentContent_name' - The name of an attachment.
--
-- 'size', 'attachmentContent_size' - The size of an attachment in bytes.
--
-- 'url', 'attachmentContent_url' - The URL location of the attachment content.
newAttachmentContent ::
  AttachmentContent
newAttachmentContent :: AttachmentContent
newAttachmentContent =
  AttachmentContent'
    { $sel:hash:AttachmentContent' :: Maybe Text
hash = forall a. Maybe a
Prelude.Nothing,
      $sel:hashType:AttachmentContent' :: Maybe AttachmentHashType
hashType = forall a. Maybe a
Prelude.Nothing,
      $sel:name:AttachmentContent' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:size:AttachmentContent' :: Maybe Integer
size = forall a. Maybe a
Prelude.Nothing,
      $sel:url:AttachmentContent' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing
    }

-- | The cryptographic hash value of the document content.
attachmentContent_hash :: Lens.Lens' AttachmentContent (Prelude.Maybe Prelude.Text)
attachmentContent_hash :: Lens' AttachmentContent (Maybe Text)
attachmentContent_hash = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentContent' {Maybe Text
hash :: Maybe Text
$sel:hash:AttachmentContent' :: AttachmentContent -> Maybe Text
hash} -> Maybe Text
hash) (\s :: AttachmentContent
s@AttachmentContent' {} Maybe Text
a -> AttachmentContent
s {$sel:hash:AttachmentContent' :: Maybe Text
hash = Maybe Text
a} :: AttachmentContent)

-- | The hash algorithm used to calculate the hash value.
attachmentContent_hashType :: Lens.Lens' AttachmentContent (Prelude.Maybe AttachmentHashType)
attachmentContent_hashType :: Lens' AttachmentContent (Maybe AttachmentHashType)
attachmentContent_hashType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentContent' {Maybe AttachmentHashType
hashType :: Maybe AttachmentHashType
$sel:hashType:AttachmentContent' :: AttachmentContent -> Maybe AttachmentHashType
hashType} -> Maybe AttachmentHashType
hashType) (\s :: AttachmentContent
s@AttachmentContent' {} Maybe AttachmentHashType
a -> AttachmentContent
s {$sel:hashType:AttachmentContent' :: Maybe AttachmentHashType
hashType = Maybe AttachmentHashType
a} :: AttachmentContent)

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

-- | The size of an attachment in bytes.
attachmentContent_size :: Lens.Lens' AttachmentContent (Prelude.Maybe Prelude.Integer)
attachmentContent_size :: Lens' AttachmentContent (Maybe Integer)
attachmentContent_size = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentContent' {Maybe Integer
size :: Maybe Integer
$sel:size:AttachmentContent' :: AttachmentContent -> Maybe Integer
size} -> Maybe Integer
size) (\s :: AttachmentContent
s@AttachmentContent' {} Maybe Integer
a -> AttachmentContent
s {$sel:size:AttachmentContent' :: Maybe Integer
size = Maybe Integer
a} :: AttachmentContent)

-- | The URL location of the attachment content.
attachmentContent_url :: Lens.Lens' AttachmentContent (Prelude.Maybe Prelude.Text)
attachmentContent_url :: Lens' AttachmentContent (Maybe Text)
attachmentContent_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachmentContent' {Maybe Text
url :: Maybe Text
$sel:url:AttachmentContent' :: AttachmentContent -> Maybe Text
url} -> Maybe Text
url) (\s :: AttachmentContent
s@AttachmentContent' {} Maybe Text
a -> AttachmentContent
s {$sel:url:AttachmentContent' :: Maybe Text
url = Maybe Text
a} :: AttachmentContent)

instance Data.FromJSON AttachmentContent where
  parseJSON :: Value -> Parser AttachmentContent
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AttachmentContent"
      ( \Object
x ->
          Maybe Text
-> Maybe AttachmentHashType
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> AttachmentContent
AttachmentContent'
            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
"Hash")
            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
"HashType")
            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
"Name")
            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
"Size")
            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
"Url")
      )

instance Prelude.Hashable AttachmentContent where
  hashWithSalt :: Int -> AttachmentContent -> Int
hashWithSalt Int
_salt AttachmentContent' {Maybe Integer
Maybe Text
Maybe AttachmentHashType
url :: Maybe Text
size :: Maybe Integer
name :: Maybe Text
hashType :: Maybe AttachmentHashType
hash :: Maybe Text
$sel:url:AttachmentContent' :: AttachmentContent -> Maybe Text
$sel:size:AttachmentContent' :: AttachmentContent -> Maybe Integer
$sel:name:AttachmentContent' :: AttachmentContent -> Maybe Text
$sel:hashType:AttachmentContent' :: AttachmentContent -> Maybe AttachmentHashType
$sel:hash:AttachmentContent' :: AttachmentContent -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hash
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AttachmentHashType
hashType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
size
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url

instance Prelude.NFData AttachmentContent where
  rnf :: AttachmentContent -> ()
rnf AttachmentContent' {Maybe Integer
Maybe Text
Maybe AttachmentHashType
url :: Maybe Text
size :: Maybe Integer
name :: Maybe Text
hashType :: Maybe AttachmentHashType
hash :: Maybe Text
$sel:url:AttachmentContent' :: AttachmentContent -> Maybe Text
$sel:size:AttachmentContent' :: AttachmentContent -> Maybe Integer
$sel:name:AttachmentContent' :: AttachmentContent -> Maybe Text
$sel:hashType:AttachmentContent' :: AttachmentContent -> Maybe AttachmentHashType
$sel:hash:AttachmentContent' :: AttachmentContent -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hash
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AttachmentHashType
hashType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
size
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url