{-# 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.SecurityHub.Types.AwsEc2VolumeDetails
-- 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.SecurityHub.Types.AwsEc2VolumeDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SecurityHub.Types.AwsEc2VolumeAttachment

-- | Details about an EC2 volume.
--
-- /See:/ 'newAwsEc2VolumeDetails' smart constructor.
data AwsEc2VolumeDetails = AwsEc2VolumeDetails'
  { -- | The volume state.
    AwsEc2VolumeDetails -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
    -- | The volume attachments.
    AwsEc2VolumeDetails -> Maybe [AwsEc2VolumeAttachment]
attachments :: Prelude.Maybe [AwsEc2VolumeAttachment],
    -- | The size of the volume, in GiBs.
    AwsEc2VolumeDetails -> Maybe Int
size :: Prelude.Maybe Prelude.Int,
    -- | Whether the volume is encrypted.
    AwsEc2VolumeDetails -> Maybe Bool
encrypted :: Prelude.Maybe Prelude.Bool,
    -- | The ARN of the KMS key that was used to protect the volume encryption
    -- key for the volume.
    AwsEc2VolumeDetails -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Indicates when the volume was created.
    --
    -- Uses the @date-time@ format specified in
    -- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
    -- The value cannot contain spaces. For example,
    -- @2020-03-22T13:22:13.933Z@.
    AwsEc2VolumeDetails -> Maybe Text
createTime :: Prelude.Maybe Prelude.Text,
    -- | The snapshot from which the volume was created.
    AwsEc2VolumeDetails -> Maybe Text
snapshotId :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool
(AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool)
-> (AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool)
-> Eq AwsEc2VolumeDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool
$c/= :: AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool
== :: AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool
$c== :: AwsEc2VolumeDetails -> AwsEc2VolumeDetails -> Bool
Prelude.Eq, ReadPrec [AwsEc2VolumeDetails]
ReadPrec AwsEc2VolumeDetails
Int -> ReadS AwsEc2VolumeDetails
ReadS [AwsEc2VolumeDetails]
(Int -> ReadS AwsEc2VolumeDetails)
-> ReadS [AwsEc2VolumeDetails]
-> ReadPrec AwsEc2VolumeDetails
-> ReadPrec [AwsEc2VolumeDetails]
-> Read AwsEc2VolumeDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEc2VolumeDetails]
$creadListPrec :: ReadPrec [AwsEc2VolumeDetails]
readPrec :: ReadPrec AwsEc2VolumeDetails
$creadPrec :: ReadPrec AwsEc2VolumeDetails
readList :: ReadS [AwsEc2VolumeDetails]
$creadList :: ReadS [AwsEc2VolumeDetails]
readsPrec :: Int -> ReadS AwsEc2VolumeDetails
$creadsPrec :: Int -> ReadS AwsEc2VolumeDetails
Prelude.Read, Int -> AwsEc2VolumeDetails -> ShowS
[AwsEc2VolumeDetails] -> ShowS
AwsEc2VolumeDetails -> String
(Int -> AwsEc2VolumeDetails -> ShowS)
-> (AwsEc2VolumeDetails -> String)
-> ([AwsEc2VolumeDetails] -> ShowS)
-> Show AwsEc2VolumeDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEc2VolumeDetails] -> ShowS
$cshowList :: [AwsEc2VolumeDetails] -> ShowS
show :: AwsEc2VolumeDetails -> String
$cshow :: AwsEc2VolumeDetails -> String
showsPrec :: Int -> AwsEc2VolumeDetails -> ShowS
$cshowsPrec :: Int -> AwsEc2VolumeDetails -> ShowS
Prelude.Show, (forall x. AwsEc2VolumeDetails -> Rep AwsEc2VolumeDetails x)
-> (forall x. Rep AwsEc2VolumeDetails x -> AwsEc2VolumeDetails)
-> Generic AwsEc2VolumeDetails
forall x. Rep AwsEc2VolumeDetails x -> AwsEc2VolumeDetails
forall x. AwsEc2VolumeDetails -> Rep AwsEc2VolumeDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AwsEc2VolumeDetails x -> AwsEc2VolumeDetails
$cfrom :: forall x. AwsEc2VolumeDetails -> Rep AwsEc2VolumeDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEc2VolumeDetails' 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:
--
-- 'status', 'awsEc2VolumeDetails_status' - The volume state.
--
-- 'attachments', 'awsEc2VolumeDetails_attachments' - The volume attachments.
--
-- 'size', 'awsEc2VolumeDetails_size' - The size of the volume, in GiBs.
--
-- 'encrypted', 'awsEc2VolumeDetails_encrypted' - Whether the volume is encrypted.
--
-- 'kmsKeyId', 'awsEc2VolumeDetails_kmsKeyId' - The ARN of the KMS key that was used to protect the volume encryption
-- key for the volume.
--
-- 'createTime', 'awsEc2VolumeDetails_createTime' - Indicates when the volume was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
--
-- 'snapshotId', 'awsEc2VolumeDetails_snapshotId' - The snapshot from which the volume was created.
newAwsEc2VolumeDetails ::
  AwsEc2VolumeDetails
newAwsEc2VolumeDetails :: AwsEc2VolumeDetails
newAwsEc2VolumeDetails =
  AwsEc2VolumeDetails' :: Maybe Text
-> Maybe [AwsEc2VolumeAttachment]
-> Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsEc2VolumeDetails
AwsEc2VolumeDetails'
    { $sel:status:AwsEc2VolumeDetails' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attachments:AwsEc2VolumeDetails' :: Maybe [AwsEc2VolumeAttachment]
attachments = Maybe [AwsEc2VolumeAttachment]
forall a. Maybe a
Prelude.Nothing,
      $sel:size:AwsEc2VolumeDetails' :: Maybe Int
size = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:encrypted:AwsEc2VolumeDetails' :: Maybe Bool
encrypted = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:AwsEc2VolumeDetails' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createTime:AwsEc2VolumeDetails' :: Maybe Text
createTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:snapshotId:AwsEc2VolumeDetails' :: Maybe Text
snapshotId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The volume state.
awsEc2VolumeDetails_status :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Text)
awsEc2VolumeDetails_status :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_status = (AwsEc2VolumeDetails -> Maybe Text)
-> (AwsEc2VolumeDetails -> Maybe Text -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Text
status :: Maybe Text
$sel:status:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
status} -> Maybe Text
status) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Text
a -> AwsEc2VolumeDetails
s {$sel:status:AwsEc2VolumeDetails' :: Maybe Text
status = Maybe Text
a} :: AwsEc2VolumeDetails)

-- | The volume attachments.
awsEc2VolumeDetails_attachments :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe [AwsEc2VolumeAttachment])
awsEc2VolumeDetails_attachments :: (Maybe [AwsEc2VolumeAttachment]
 -> f (Maybe [AwsEc2VolumeAttachment]))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_attachments = (AwsEc2VolumeDetails -> Maybe [AwsEc2VolumeAttachment])
-> (AwsEc2VolumeDetails
    -> Maybe [AwsEc2VolumeAttachment] -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails
     AwsEc2VolumeDetails
     (Maybe [AwsEc2VolumeAttachment])
     (Maybe [AwsEc2VolumeAttachment])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe [AwsEc2VolumeAttachment]
attachments :: Maybe [AwsEc2VolumeAttachment]
$sel:attachments:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe [AwsEc2VolumeAttachment]
attachments} -> Maybe [AwsEc2VolumeAttachment]
attachments) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe [AwsEc2VolumeAttachment]
a -> AwsEc2VolumeDetails
s {$sel:attachments:AwsEc2VolumeDetails' :: Maybe [AwsEc2VolumeAttachment]
attachments = Maybe [AwsEc2VolumeAttachment]
a} :: AwsEc2VolumeDetails) ((Maybe [AwsEc2VolumeAttachment]
  -> f (Maybe [AwsEc2VolumeAttachment]))
 -> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails)
-> ((Maybe [AwsEc2VolumeAttachment]
     -> f (Maybe [AwsEc2VolumeAttachment]))
    -> Maybe [AwsEc2VolumeAttachment]
    -> f (Maybe [AwsEc2VolumeAttachment]))
-> (Maybe [AwsEc2VolumeAttachment]
    -> f (Maybe [AwsEc2VolumeAttachment]))
-> AwsEc2VolumeDetails
-> f AwsEc2VolumeDetails
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
-> Iso
     (Maybe [AwsEc2VolumeAttachment])
     (Maybe [AwsEc2VolumeAttachment])
     (Maybe [AwsEc2VolumeAttachment])
     (Maybe [AwsEc2VolumeAttachment])
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
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
  [AwsEc2VolumeAttachment]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The size of the volume, in GiBs.
awsEc2VolumeDetails_size :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Int)
awsEc2VolumeDetails_size :: (Maybe Int -> f (Maybe Int))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_size = (AwsEc2VolumeDetails -> Maybe Int)
-> (AwsEc2VolumeDetails -> Maybe Int -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Int
size :: Maybe Int
$sel:size:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Int
size} -> Maybe Int
size) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Int
a -> AwsEc2VolumeDetails
s {$sel:size:AwsEc2VolumeDetails' :: Maybe Int
size = Maybe Int
a} :: AwsEc2VolumeDetails)

-- | Whether the volume is encrypted.
awsEc2VolumeDetails_encrypted :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Bool)
awsEc2VolumeDetails_encrypted :: (Maybe Bool -> f (Maybe Bool))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_encrypted = (AwsEc2VolumeDetails -> Maybe Bool)
-> (AwsEc2VolumeDetails -> Maybe Bool -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Bool
encrypted :: Maybe Bool
$sel:encrypted:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Bool
encrypted} -> Maybe Bool
encrypted) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Bool
a -> AwsEc2VolumeDetails
s {$sel:encrypted:AwsEc2VolumeDetails' :: Maybe Bool
encrypted = Maybe Bool
a} :: AwsEc2VolumeDetails)

-- | The ARN of the KMS key that was used to protect the volume encryption
-- key for the volume.
awsEc2VolumeDetails_kmsKeyId :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Text)
awsEc2VolumeDetails_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_kmsKeyId = (AwsEc2VolumeDetails -> Maybe Text)
-> (AwsEc2VolumeDetails -> Maybe Text -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Text
a -> AwsEc2VolumeDetails
s {$sel:kmsKeyId:AwsEc2VolumeDetails' :: Maybe Text
kmsKeyId = Maybe Text
a} :: AwsEc2VolumeDetails)

-- | Indicates when the volume was created.
--
-- Uses the @date-time@ format specified in
-- <https://tools.ietf.org/html/rfc3339#section-5.6 RFC 3339 section 5.6, Internet Date\/Time Format>.
-- The value cannot contain spaces. For example,
-- @2020-03-22T13:22:13.933Z@.
awsEc2VolumeDetails_createTime :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Text)
awsEc2VolumeDetails_createTime :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_createTime = (AwsEc2VolumeDetails -> Maybe Text)
-> (AwsEc2VolumeDetails -> Maybe Text -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Text
createTime :: Maybe Text
$sel:createTime:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
createTime} -> Maybe Text
createTime) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Text
a -> AwsEc2VolumeDetails
s {$sel:createTime:AwsEc2VolumeDetails' :: Maybe Text
createTime = Maybe Text
a} :: AwsEc2VolumeDetails)

-- | The snapshot from which the volume was created.
awsEc2VolumeDetails_snapshotId :: Lens.Lens' AwsEc2VolumeDetails (Prelude.Maybe Prelude.Text)
awsEc2VolumeDetails_snapshotId :: (Maybe Text -> f (Maybe Text))
-> AwsEc2VolumeDetails -> f AwsEc2VolumeDetails
awsEc2VolumeDetails_snapshotId = (AwsEc2VolumeDetails -> Maybe Text)
-> (AwsEc2VolumeDetails -> Maybe Text -> AwsEc2VolumeDetails)
-> Lens
     AwsEc2VolumeDetails AwsEc2VolumeDetails (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEc2VolumeDetails' {Maybe Text
snapshotId :: Maybe Text
$sel:snapshotId:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
snapshotId} -> Maybe Text
snapshotId) (\s :: AwsEc2VolumeDetails
s@AwsEc2VolumeDetails' {} Maybe Text
a -> AwsEc2VolumeDetails
s {$sel:snapshotId:AwsEc2VolumeDetails' :: Maybe Text
snapshotId = Maybe Text
a} :: AwsEc2VolumeDetails)

instance Core.FromJSON AwsEc2VolumeDetails where
  parseJSON :: Value -> Parser AwsEc2VolumeDetails
parseJSON =
    String
-> (Object -> Parser AwsEc2VolumeDetails)
-> Value
-> Parser AwsEc2VolumeDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEc2VolumeDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe [AwsEc2VolumeAttachment]
-> Maybe Int
-> Maybe Bool
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> AwsEc2VolumeDetails
AwsEc2VolumeDetails'
            (Maybe Text
 -> Maybe [AwsEc2VolumeAttachment]
 -> Maybe Int
 -> Maybe Bool
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> AwsEc2VolumeDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe [AwsEc2VolumeAttachment]
      -> Maybe Int
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AwsEc2VolumeDetails)
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
"Status")
            Parser
  (Maybe [AwsEc2VolumeAttachment]
   -> Maybe Int
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AwsEc2VolumeDetails)
-> Parser (Maybe [AwsEc2VolumeAttachment])
-> Parser
     (Maybe Int
      -> Maybe Bool
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> AwsEc2VolumeDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [AwsEc2VolumeAttachment]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attachments" Parser (Maybe (Maybe [AwsEc2VolumeAttachment]))
-> Maybe [AwsEc2VolumeAttachment]
-> Parser (Maybe [AwsEc2VolumeAttachment])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [AwsEc2VolumeAttachment]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Int
   -> Maybe Bool
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> AwsEc2VolumeDetails)
-> Parser (Maybe Int)
-> Parser
     (Maybe Bool
      -> Maybe Text -> Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Size")
            Parser
  (Maybe Bool
   -> Maybe Text -> Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
-> Parser (Maybe Bool)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Encrypted")
            Parser
  (Maybe Text -> Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
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
"KmsKeyId")
            Parser (Maybe Text -> Maybe Text -> AwsEc2VolumeDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> AwsEc2VolumeDetails)
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
"CreateTime")
            Parser (Maybe Text -> AwsEc2VolumeDetails)
-> Parser (Maybe Text) -> Parser AwsEc2VolumeDetails
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
"SnapshotId")
      )

instance Prelude.Hashable AwsEc2VolumeDetails

instance Prelude.NFData AwsEc2VolumeDetails

instance Core.ToJSON AwsEc2VolumeDetails where
  toJSON :: AwsEc2VolumeDetails -> Value
toJSON AwsEc2VolumeDetails' {Maybe Bool
Maybe Int
Maybe [AwsEc2VolumeAttachment]
Maybe Text
snapshotId :: Maybe Text
createTime :: Maybe Text
kmsKeyId :: Maybe Text
encrypted :: Maybe Bool
size :: Maybe Int
attachments :: Maybe [AwsEc2VolumeAttachment]
status :: Maybe Text
$sel:snapshotId:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
$sel:createTime:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
$sel:kmsKeyId:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
$sel:encrypted:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Bool
$sel:size:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Int
$sel:attachments:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe [AwsEc2VolumeAttachment]
$sel:status:AwsEc2VolumeDetails' :: AwsEc2VolumeDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Status" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
status,
            (Text
"Attachments" Text -> [AwsEc2VolumeAttachment] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AwsEc2VolumeAttachment] -> Pair)
-> Maybe [AwsEc2VolumeAttachment] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AwsEc2VolumeAttachment]
attachments,
            (Text
"Size" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
size,
            (Text
"Encrypted" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
encrypted,
            (Text
"KmsKeyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Text
"CreateTime" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
createTime,
            (Text
"SnapshotId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
snapshotId
          ]
      )