{-# 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.ImageBuilder.Types.OutputResources
-- 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.ImageBuilder.Types.OutputResources where

import qualified Amazonka.Core as Core
import Amazonka.ImageBuilder.Types.Ami
import Amazonka.ImageBuilder.Types.Container
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The resources produced by this image.
--
-- /See:/ 'newOutputResources' smart constructor.
data OutputResources = OutputResources'
  { -- | Container images that the pipeline has generated and stored in the
    -- output repository.
    OutputResources -> Maybe [Container]
containers :: Prelude.Maybe [Container],
    -- | The Amazon EC2 AMIs created by this image.
    OutputResources -> Maybe [Ami]
amis :: Prelude.Maybe [Ami]
  }
  deriving (OutputResources -> OutputResources -> Bool
(OutputResources -> OutputResources -> Bool)
-> (OutputResources -> OutputResources -> Bool)
-> Eq OutputResources
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputResources -> OutputResources -> Bool
$c/= :: OutputResources -> OutputResources -> Bool
== :: OutputResources -> OutputResources -> Bool
$c== :: OutputResources -> OutputResources -> Bool
Prelude.Eq, ReadPrec [OutputResources]
ReadPrec OutputResources
Int -> ReadS OutputResources
ReadS [OutputResources]
(Int -> ReadS OutputResources)
-> ReadS [OutputResources]
-> ReadPrec OutputResources
-> ReadPrec [OutputResources]
-> Read OutputResources
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputResources]
$creadListPrec :: ReadPrec [OutputResources]
readPrec :: ReadPrec OutputResources
$creadPrec :: ReadPrec OutputResources
readList :: ReadS [OutputResources]
$creadList :: ReadS [OutputResources]
readsPrec :: Int -> ReadS OutputResources
$creadsPrec :: Int -> ReadS OutputResources
Prelude.Read, Int -> OutputResources -> ShowS
[OutputResources] -> ShowS
OutputResources -> String
(Int -> OutputResources -> ShowS)
-> (OutputResources -> String)
-> ([OutputResources] -> ShowS)
-> Show OutputResources
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputResources] -> ShowS
$cshowList :: [OutputResources] -> ShowS
show :: OutputResources -> String
$cshow :: OutputResources -> String
showsPrec :: Int -> OutputResources -> ShowS
$cshowsPrec :: Int -> OutputResources -> ShowS
Prelude.Show, (forall x. OutputResources -> Rep OutputResources x)
-> (forall x. Rep OutputResources x -> OutputResources)
-> Generic OutputResources
forall x. Rep OutputResources x -> OutputResources
forall x. OutputResources -> Rep OutputResources x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputResources x -> OutputResources
$cfrom :: forall x. OutputResources -> Rep OutputResources x
Prelude.Generic)

-- |
-- Create a value of 'OutputResources' 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:
--
-- 'containers', 'outputResources_containers' - Container images that the pipeline has generated and stored in the
-- output repository.
--
-- 'amis', 'outputResources_amis' - The Amazon EC2 AMIs created by this image.
newOutputResources ::
  OutputResources
newOutputResources :: OutputResources
newOutputResources =
  OutputResources' :: Maybe [Container] -> Maybe [Ami] -> OutputResources
OutputResources'
    { $sel:containers:OutputResources' :: Maybe [Container]
containers = Maybe [Container]
forall a. Maybe a
Prelude.Nothing,
      $sel:amis:OutputResources' :: Maybe [Ami]
amis = Maybe [Ami]
forall a. Maybe a
Prelude.Nothing
    }

-- | Container images that the pipeline has generated and stored in the
-- output repository.
outputResources_containers :: Lens.Lens' OutputResources (Prelude.Maybe [Container])
outputResources_containers :: (Maybe [Container] -> f (Maybe [Container]))
-> OutputResources -> f OutputResources
outputResources_containers = (OutputResources -> Maybe [Container])
-> (OutputResources -> Maybe [Container] -> OutputResources)
-> Lens
     OutputResources
     OutputResources
     (Maybe [Container])
     (Maybe [Container])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputResources' {Maybe [Container]
containers :: Maybe [Container]
$sel:containers:OutputResources' :: OutputResources -> Maybe [Container]
containers} -> Maybe [Container]
containers) (\s :: OutputResources
s@OutputResources' {} Maybe [Container]
a -> OutputResources
s {$sel:containers:OutputResources' :: Maybe [Container]
containers = Maybe [Container]
a} :: OutputResources) ((Maybe [Container] -> f (Maybe [Container]))
 -> OutputResources -> f OutputResources)
-> ((Maybe [Container] -> f (Maybe [Container]))
    -> Maybe [Container] -> f (Maybe [Container]))
-> (Maybe [Container] -> f (Maybe [Container]))
-> OutputResources
-> f OutputResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Container] [Container] [Container] [Container]
-> Iso
     (Maybe [Container])
     (Maybe [Container])
     (Maybe [Container])
     (Maybe [Container])
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 [Container] [Container] [Container] [Container]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon EC2 AMIs created by this image.
outputResources_amis :: Lens.Lens' OutputResources (Prelude.Maybe [Ami])
outputResources_amis :: (Maybe [Ami] -> f (Maybe [Ami]))
-> OutputResources -> f OutputResources
outputResources_amis = (OutputResources -> Maybe [Ami])
-> (OutputResources -> Maybe [Ami] -> OutputResources)
-> Lens OutputResources OutputResources (Maybe [Ami]) (Maybe [Ami])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputResources' {Maybe [Ami]
amis :: Maybe [Ami]
$sel:amis:OutputResources' :: OutputResources -> Maybe [Ami]
amis} -> Maybe [Ami]
amis) (\s :: OutputResources
s@OutputResources' {} Maybe [Ami]
a -> OutputResources
s {$sel:amis:OutputResources' :: Maybe [Ami]
amis = Maybe [Ami]
a} :: OutputResources) ((Maybe [Ami] -> f (Maybe [Ami]))
 -> OutputResources -> f OutputResources)
-> ((Maybe [Ami] -> f (Maybe [Ami]))
    -> Maybe [Ami] -> f (Maybe [Ami]))
-> (Maybe [Ami] -> f (Maybe [Ami]))
-> OutputResources
-> f OutputResources
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Ami] [Ami] [Ami] [Ami]
-> Iso (Maybe [Ami]) (Maybe [Ami]) (Maybe [Ami]) (Maybe [Ami])
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 [Ami] [Ami] [Ami] [Ami]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON OutputResources where
  parseJSON :: Value -> Parser OutputResources
parseJSON =
    String
-> (Object -> Parser OutputResources)
-> Value
-> Parser OutputResources
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputResources"
      ( \Object
x ->
          Maybe [Container] -> Maybe [Ami] -> OutputResources
OutputResources'
            (Maybe [Container] -> Maybe [Ami] -> OutputResources)
-> Parser (Maybe [Container])
-> Parser (Maybe [Ami] -> OutputResources)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Container]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"containers" Parser (Maybe (Maybe [Container]))
-> Maybe [Container] -> Parser (Maybe [Container])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Container]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe [Ami] -> OutputResources)
-> Parser (Maybe [Ami]) -> Parser OutputResources
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Ami]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"amis" Parser (Maybe (Maybe [Ami])) -> Maybe [Ami] -> Parser (Maybe [Ami])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Ami]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable OutputResources

instance Prelude.NFData OutputResources