{-# 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.CostExplorer.Types.ResourceDetails
-- 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.CostExplorer.Types.ResourceDetails where

import qualified Amazonka.Core as Core
import Amazonka.CostExplorer.Types.EC2ResourceDetails
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Details on the resource.
--
-- /See:/ 'newResourceDetails' smart constructor.
data ResourceDetails = ResourceDetails'
  { -- | Details on the Amazon EC2 resource.
    ResourceDetails -> Maybe EC2ResourceDetails
eC2ResourceDetails :: Prelude.Maybe EC2ResourceDetails
  }
  deriving (ResourceDetails -> ResourceDetails -> Bool
(ResourceDetails -> ResourceDetails -> Bool)
-> (ResourceDetails -> ResourceDetails -> Bool)
-> Eq ResourceDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceDetails -> ResourceDetails -> Bool
$c/= :: ResourceDetails -> ResourceDetails -> Bool
== :: ResourceDetails -> ResourceDetails -> Bool
$c== :: ResourceDetails -> ResourceDetails -> Bool
Prelude.Eq, ReadPrec [ResourceDetails]
ReadPrec ResourceDetails
Int -> ReadS ResourceDetails
ReadS [ResourceDetails]
(Int -> ReadS ResourceDetails)
-> ReadS [ResourceDetails]
-> ReadPrec ResourceDetails
-> ReadPrec [ResourceDetails]
-> Read ResourceDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceDetails]
$creadListPrec :: ReadPrec [ResourceDetails]
readPrec :: ReadPrec ResourceDetails
$creadPrec :: ReadPrec ResourceDetails
readList :: ReadS [ResourceDetails]
$creadList :: ReadS [ResourceDetails]
readsPrec :: Int -> ReadS ResourceDetails
$creadsPrec :: Int -> ReadS ResourceDetails
Prelude.Read, Int -> ResourceDetails -> ShowS
[ResourceDetails] -> ShowS
ResourceDetails -> String
(Int -> ResourceDetails -> ShowS)
-> (ResourceDetails -> String)
-> ([ResourceDetails] -> ShowS)
-> Show ResourceDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceDetails] -> ShowS
$cshowList :: [ResourceDetails] -> ShowS
show :: ResourceDetails -> String
$cshow :: ResourceDetails -> String
showsPrec :: Int -> ResourceDetails -> ShowS
$cshowsPrec :: Int -> ResourceDetails -> ShowS
Prelude.Show, (forall x. ResourceDetails -> Rep ResourceDetails x)
-> (forall x. Rep ResourceDetails x -> ResourceDetails)
-> Generic ResourceDetails
forall x. Rep ResourceDetails x -> ResourceDetails
forall x. ResourceDetails -> Rep ResourceDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceDetails x -> ResourceDetails
$cfrom :: forall x. ResourceDetails -> Rep ResourceDetails x
Prelude.Generic)

-- |
-- Create a value of 'ResourceDetails' 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:
--
-- 'eC2ResourceDetails', 'resourceDetails_eC2ResourceDetails' - Details on the Amazon EC2 resource.
newResourceDetails ::
  ResourceDetails
newResourceDetails :: ResourceDetails
newResourceDetails =
  ResourceDetails' :: Maybe EC2ResourceDetails -> ResourceDetails
ResourceDetails'
    { $sel:eC2ResourceDetails:ResourceDetails' :: Maybe EC2ResourceDetails
eC2ResourceDetails =
        Maybe EC2ResourceDetails
forall a. Maybe a
Prelude.Nothing
    }

-- | Details on the Amazon EC2 resource.
resourceDetails_eC2ResourceDetails :: Lens.Lens' ResourceDetails (Prelude.Maybe EC2ResourceDetails)
resourceDetails_eC2ResourceDetails :: (Maybe EC2ResourceDetails -> f (Maybe EC2ResourceDetails))
-> ResourceDetails -> f ResourceDetails
resourceDetails_eC2ResourceDetails = (ResourceDetails -> Maybe EC2ResourceDetails)
-> (ResourceDetails -> Maybe EC2ResourceDetails -> ResourceDetails)
-> Lens
     ResourceDetails
     ResourceDetails
     (Maybe EC2ResourceDetails)
     (Maybe EC2ResourceDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceDetails' {Maybe EC2ResourceDetails
eC2ResourceDetails :: Maybe EC2ResourceDetails
$sel:eC2ResourceDetails:ResourceDetails' :: ResourceDetails -> Maybe EC2ResourceDetails
eC2ResourceDetails} -> Maybe EC2ResourceDetails
eC2ResourceDetails) (\s :: ResourceDetails
s@ResourceDetails' {} Maybe EC2ResourceDetails
a -> ResourceDetails
s {$sel:eC2ResourceDetails:ResourceDetails' :: Maybe EC2ResourceDetails
eC2ResourceDetails = Maybe EC2ResourceDetails
a} :: ResourceDetails)

instance Core.FromJSON ResourceDetails where
  parseJSON :: Value -> Parser ResourceDetails
parseJSON =
    String
-> (Object -> Parser ResourceDetails)
-> Value
-> Parser ResourceDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceDetails"
      ( \Object
x ->
          Maybe EC2ResourceDetails -> ResourceDetails
ResourceDetails'
            (Maybe EC2ResourceDetails -> ResourceDetails)
-> Parser (Maybe EC2ResourceDetails) -> Parser ResourceDetails
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe EC2ResourceDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EC2ResourceDetails")
      )

instance Prelude.Hashable ResourceDetails

instance Prelude.NFData ResourceDetails