{-# 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.CodeBuild.Types.EnvironmentImage
-- 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.CodeBuild.Types.EnvironmentImage where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a Docker image that is managed by CodeBuild.
--
-- /See:/ 'newEnvironmentImage' smart constructor.
data EnvironmentImage = EnvironmentImage'
  { -- | A list of environment image versions.
    EnvironmentImage -> Maybe [Text]
versions :: Prelude.Maybe [Prelude.Text],
    -- | The name of the Docker image.
    EnvironmentImage -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The description of the Docker image.
    EnvironmentImage -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (EnvironmentImage -> EnvironmentImage -> Bool
(EnvironmentImage -> EnvironmentImage -> Bool)
-> (EnvironmentImage -> EnvironmentImage -> Bool)
-> Eq EnvironmentImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentImage -> EnvironmentImage -> Bool
$c/= :: EnvironmentImage -> EnvironmentImage -> Bool
== :: EnvironmentImage -> EnvironmentImage -> Bool
$c== :: EnvironmentImage -> EnvironmentImage -> Bool
Prelude.Eq, ReadPrec [EnvironmentImage]
ReadPrec EnvironmentImage
Int -> ReadS EnvironmentImage
ReadS [EnvironmentImage]
(Int -> ReadS EnvironmentImage)
-> ReadS [EnvironmentImage]
-> ReadPrec EnvironmentImage
-> ReadPrec [EnvironmentImage]
-> Read EnvironmentImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentImage]
$creadListPrec :: ReadPrec [EnvironmentImage]
readPrec :: ReadPrec EnvironmentImage
$creadPrec :: ReadPrec EnvironmentImage
readList :: ReadS [EnvironmentImage]
$creadList :: ReadS [EnvironmentImage]
readsPrec :: Int -> ReadS EnvironmentImage
$creadsPrec :: Int -> ReadS EnvironmentImage
Prelude.Read, Int -> EnvironmentImage -> ShowS
[EnvironmentImage] -> ShowS
EnvironmentImage -> String
(Int -> EnvironmentImage -> ShowS)
-> (EnvironmentImage -> String)
-> ([EnvironmentImage] -> ShowS)
-> Show EnvironmentImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentImage] -> ShowS
$cshowList :: [EnvironmentImage] -> ShowS
show :: EnvironmentImage -> String
$cshow :: EnvironmentImage -> String
showsPrec :: Int -> EnvironmentImage -> ShowS
$cshowsPrec :: Int -> EnvironmentImage -> ShowS
Prelude.Show, (forall x. EnvironmentImage -> Rep EnvironmentImage x)
-> (forall x. Rep EnvironmentImage x -> EnvironmentImage)
-> Generic EnvironmentImage
forall x. Rep EnvironmentImage x -> EnvironmentImage
forall x. EnvironmentImage -> Rep EnvironmentImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentImage x -> EnvironmentImage
$cfrom :: forall x. EnvironmentImage -> Rep EnvironmentImage x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentImage' 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:
--
-- 'versions', 'environmentImage_versions' - A list of environment image versions.
--
-- 'name', 'environmentImage_name' - The name of the Docker image.
--
-- 'description', 'environmentImage_description' - The description of the Docker image.
newEnvironmentImage ::
  EnvironmentImage
newEnvironmentImage :: EnvironmentImage
newEnvironmentImage =
  EnvironmentImage' :: Maybe [Text] -> Maybe Text -> Maybe Text -> EnvironmentImage
EnvironmentImage'
    { $sel:versions:EnvironmentImage' :: Maybe [Text]
versions = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:EnvironmentImage' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:EnvironmentImage' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A list of environment image versions.
environmentImage_versions :: Lens.Lens' EnvironmentImage (Prelude.Maybe [Prelude.Text])
environmentImage_versions :: (Maybe [Text] -> f (Maybe [Text]))
-> EnvironmentImage -> f EnvironmentImage
environmentImage_versions = (EnvironmentImage -> Maybe [Text])
-> (EnvironmentImage -> Maybe [Text] -> EnvironmentImage)
-> Lens
     EnvironmentImage EnvironmentImage (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentImage' {Maybe [Text]
versions :: Maybe [Text]
$sel:versions:EnvironmentImage' :: EnvironmentImage -> Maybe [Text]
versions} -> Maybe [Text]
versions) (\s :: EnvironmentImage
s@EnvironmentImage' {} Maybe [Text]
a -> EnvironmentImage
s {$sel:versions:EnvironmentImage' :: Maybe [Text]
versions = Maybe [Text]
a} :: EnvironmentImage) ((Maybe [Text] -> f (Maybe [Text]))
 -> EnvironmentImage -> f EnvironmentImage)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> EnvironmentImage
-> f EnvironmentImage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the Docker image.
environmentImage_name :: Lens.Lens' EnvironmentImage (Prelude.Maybe Prelude.Text)
environmentImage_name :: (Maybe Text -> f (Maybe Text))
-> EnvironmentImage -> f EnvironmentImage
environmentImage_name = (EnvironmentImage -> Maybe Text)
-> (EnvironmentImage -> Maybe Text -> EnvironmentImage)
-> Lens EnvironmentImage EnvironmentImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentImage' {Maybe Text
name :: Maybe Text
$sel:name:EnvironmentImage' :: EnvironmentImage -> Maybe Text
name} -> Maybe Text
name) (\s :: EnvironmentImage
s@EnvironmentImage' {} Maybe Text
a -> EnvironmentImage
s {$sel:name:EnvironmentImage' :: Maybe Text
name = Maybe Text
a} :: EnvironmentImage)

-- | The description of the Docker image.
environmentImage_description :: Lens.Lens' EnvironmentImage (Prelude.Maybe Prelude.Text)
environmentImage_description :: (Maybe Text -> f (Maybe Text))
-> EnvironmentImage -> f EnvironmentImage
environmentImage_description = (EnvironmentImage -> Maybe Text)
-> (EnvironmentImage -> Maybe Text -> EnvironmentImage)
-> Lens EnvironmentImage EnvironmentImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentImage' {Maybe Text
description :: Maybe Text
$sel:description:EnvironmentImage' :: EnvironmentImage -> Maybe Text
description} -> Maybe Text
description) (\s :: EnvironmentImage
s@EnvironmentImage' {} Maybe Text
a -> EnvironmentImage
s {$sel:description:EnvironmentImage' :: Maybe Text
description = Maybe Text
a} :: EnvironmentImage)

instance Core.FromJSON EnvironmentImage where
  parseJSON :: Value -> Parser EnvironmentImage
parseJSON =
    String
-> (Object -> Parser EnvironmentImage)
-> Value
-> Parser EnvironmentImage
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EnvironmentImage"
      ( \Object
x ->
          Maybe [Text] -> Maybe Text -> Maybe Text -> EnvironmentImage
EnvironmentImage'
            (Maybe [Text] -> Maybe Text -> Maybe Text -> EnvironmentImage)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Text -> EnvironmentImage)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"versions" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser (Maybe Text -> Maybe Text -> EnvironmentImage)
-> Parser (Maybe Text) -> Parser (Maybe Text -> EnvironmentImage)
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
"name")
            Parser (Maybe Text -> EnvironmentImage)
-> Parser (Maybe Text) -> Parser EnvironmentImage
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
"description")
      )

instance Prelude.Hashable EnvironmentImage

instance Prelude.NFData EnvironmentImage