{-# 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.EC2.Types.DiskImageDetail
-- 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.EC2.Types.DiskImageDetail where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.DiskImageFormat
import qualified Amazonka.Prelude as Prelude

-- | Describes a disk image.
--
-- /See:/ 'newDiskImageDetail' smart constructor.
data DiskImageDetail = DiskImageDetail'
  { -- | The size of the disk image, in GiB.
    DiskImageDetail -> Integer
bytes :: Prelude.Integer,
    -- | The disk image format.
    DiskImageDetail -> DiskImageFormat
format :: DiskImageFormat,
    -- | A presigned URL for the import manifest stored in Amazon S3 and
    -- presented here as an Amazon S3 presigned URL. For information about
    -- creating a presigned URL for an Amazon S3 object, read the \"Query
    -- String Request Authentication Alternative\" section of the
    -- <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html Authenticating REST Requests>
    -- topic in the /Amazon Simple Storage Service Developer Guide/.
    --
    -- For information about the import manifest referenced by this API action,
    -- see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html VM Import Manifest>.
    DiskImageDetail -> Text
importManifestUrl :: Prelude.Text
  }
  deriving (DiskImageDetail -> DiskImageDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DiskImageDetail -> DiskImageDetail -> Bool
$c/= :: DiskImageDetail -> DiskImageDetail -> Bool
== :: DiskImageDetail -> DiskImageDetail -> Bool
$c== :: DiskImageDetail -> DiskImageDetail -> Bool
Prelude.Eq, ReadPrec [DiskImageDetail]
ReadPrec DiskImageDetail
Int -> ReadS DiskImageDetail
ReadS [DiskImageDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DiskImageDetail]
$creadListPrec :: ReadPrec [DiskImageDetail]
readPrec :: ReadPrec DiskImageDetail
$creadPrec :: ReadPrec DiskImageDetail
readList :: ReadS [DiskImageDetail]
$creadList :: ReadS [DiskImageDetail]
readsPrec :: Int -> ReadS DiskImageDetail
$creadsPrec :: Int -> ReadS DiskImageDetail
Prelude.Read, Int -> DiskImageDetail -> ShowS
[DiskImageDetail] -> ShowS
DiskImageDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DiskImageDetail] -> ShowS
$cshowList :: [DiskImageDetail] -> ShowS
show :: DiskImageDetail -> String
$cshow :: DiskImageDetail -> String
showsPrec :: Int -> DiskImageDetail -> ShowS
$cshowsPrec :: Int -> DiskImageDetail -> ShowS
Prelude.Show, forall x. Rep DiskImageDetail x -> DiskImageDetail
forall x. DiskImageDetail -> Rep DiskImageDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DiskImageDetail x -> DiskImageDetail
$cfrom :: forall x. DiskImageDetail -> Rep DiskImageDetail x
Prelude.Generic)

-- |
-- Create a value of 'DiskImageDetail' 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:
--
-- 'bytes', 'diskImageDetail_bytes' - The size of the disk image, in GiB.
--
-- 'format', 'diskImageDetail_format' - The disk image format.
--
-- 'importManifestUrl', 'diskImageDetail_importManifestUrl' - A presigned URL for the import manifest stored in Amazon S3 and
-- presented here as an Amazon S3 presigned URL. For information about
-- creating a presigned URL for an Amazon S3 object, read the \"Query
-- String Request Authentication Alternative\" section of the
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html Authenticating REST Requests>
-- topic in the /Amazon Simple Storage Service Developer Guide/.
--
-- For information about the import manifest referenced by this API action,
-- see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html VM Import Manifest>.
newDiskImageDetail ::
  -- | 'bytes'
  Prelude.Integer ->
  -- | 'format'
  DiskImageFormat ->
  -- | 'importManifestUrl'
  Prelude.Text ->
  DiskImageDetail
newDiskImageDetail :: Integer -> DiskImageFormat -> Text -> DiskImageDetail
newDiskImageDetail
  Integer
pBytes_
  DiskImageFormat
pFormat_
  Text
pImportManifestUrl_ =
    DiskImageDetail'
      { $sel:bytes:DiskImageDetail' :: Integer
bytes = Integer
pBytes_,
        $sel:format:DiskImageDetail' :: DiskImageFormat
format = DiskImageFormat
pFormat_,
        $sel:importManifestUrl:DiskImageDetail' :: Text
importManifestUrl = Text
pImportManifestUrl_
      }

-- | The size of the disk image, in GiB.
diskImageDetail_bytes :: Lens.Lens' DiskImageDetail Prelude.Integer
diskImageDetail_bytes :: Lens' DiskImageDetail Integer
diskImageDetail_bytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskImageDetail' {Integer
bytes :: Integer
$sel:bytes:DiskImageDetail' :: DiskImageDetail -> Integer
bytes} -> Integer
bytes) (\s :: DiskImageDetail
s@DiskImageDetail' {} Integer
a -> DiskImageDetail
s {$sel:bytes:DiskImageDetail' :: Integer
bytes = Integer
a} :: DiskImageDetail)

-- | The disk image format.
diskImageDetail_format :: Lens.Lens' DiskImageDetail DiskImageFormat
diskImageDetail_format :: Lens' DiskImageDetail DiskImageFormat
diskImageDetail_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskImageDetail' {DiskImageFormat
format :: DiskImageFormat
$sel:format:DiskImageDetail' :: DiskImageDetail -> DiskImageFormat
format} -> DiskImageFormat
format) (\s :: DiskImageDetail
s@DiskImageDetail' {} DiskImageFormat
a -> DiskImageDetail
s {$sel:format:DiskImageDetail' :: DiskImageFormat
format = DiskImageFormat
a} :: DiskImageDetail)

-- | A presigned URL for the import manifest stored in Amazon S3 and
-- presented here as an Amazon S3 presigned URL. For information about
-- creating a presigned URL for an Amazon S3 object, read the \"Query
-- String Request Authentication Alternative\" section of the
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html Authenticating REST Requests>
-- topic in the /Amazon Simple Storage Service Developer Guide/.
--
-- For information about the import manifest referenced by this API action,
-- see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/manifest.html VM Import Manifest>.
diskImageDetail_importManifestUrl :: Lens.Lens' DiskImageDetail Prelude.Text
diskImageDetail_importManifestUrl :: Lens' DiskImageDetail Text
diskImageDetail_importManifestUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DiskImageDetail' {Text
importManifestUrl :: Text
$sel:importManifestUrl:DiskImageDetail' :: DiskImageDetail -> Text
importManifestUrl} -> Text
importManifestUrl) (\s :: DiskImageDetail
s@DiskImageDetail' {} Text
a -> DiskImageDetail
s {$sel:importManifestUrl:DiskImageDetail' :: Text
importManifestUrl = Text
a} :: DiskImageDetail)

instance Prelude.Hashable DiskImageDetail where
  hashWithSalt :: Int -> DiskImageDetail -> Int
hashWithSalt Int
_salt DiskImageDetail' {Integer
Text
DiskImageFormat
importManifestUrl :: Text
format :: DiskImageFormat
bytes :: Integer
$sel:importManifestUrl:DiskImageDetail' :: DiskImageDetail -> Text
$sel:format:DiskImageDetail' :: DiskImageDetail -> DiskImageFormat
$sel:bytes:DiskImageDetail' :: DiskImageDetail -> Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Integer
bytes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DiskImageFormat
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
importManifestUrl

instance Prelude.NFData DiskImageDetail where
  rnf :: DiskImageDetail -> ()
rnf DiskImageDetail' {Integer
Text
DiskImageFormat
importManifestUrl :: Text
format :: DiskImageFormat
bytes :: Integer
$sel:importManifestUrl:DiskImageDetail' :: DiskImageDetail -> Text
$sel:format:DiskImageDetail' :: DiskImageDetail -> DiskImageFormat
$sel:bytes:DiskImageDetail' :: DiskImageDetail -> Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Integer
bytes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DiskImageFormat
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
importManifestUrl

instance Data.ToQuery DiskImageDetail where
  toQuery :: DiskImageDetail -> QueryString
toQuery DiskImageDetail' {Integer
Text
DiskImageFormat
importManifestUrl :: Text
format :: DiskImageFormat
bytes :: Integer
$sel:importManifestUrl:DiskImageDetail' :: DiskImageDetail -> Text
$sel:format:DiskImageDetail' :: DiskImageDetail -> DiskImageFormat
$sel:bytes:DiskImageDetail' :: DiskImageDetail -> Integer
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Bytes" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Integer
bytes,
        ByteString
"Format" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: DiskImageFormat
format,
        ByteString
"ImportManifestUrl" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
importManifestUrl
      ]