{-# 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.ElasticBeanstalk.Types.CustomAmi
-- 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.ElasticBeanstalk.Types.CustomAmi where

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

-- | A custom AMI available to platforms.
--
-- /See:/ 'newCustomAmi' smart constructor.
data CustomAmi = CustomAmi'
  { -- | The type of virtualization used to create the custom AMI.
    CustomAmi -> Maybe Text
virtualizationType :: Prelude.Maybe Prelude.Text,
    -- | THe ID of the image used to create the custom AMI.
    CustomAmi -> Maybe Text
imageId :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomAmi -> CustomAmi -> Bool
(CustomAmi -> CustomAmi -> Bool)
-> (CustomAmi -> CustomAmi -> Bool) -> Eq CustomAmi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomAmi -> CustomAmi -> Bool
$c/= :: CustomAmi -> CustomAmi -> Bool
== :: CustomAmi -> CustomAmi -> Bool
$c== :: CustomAmi -> CustomAmi -> Bool
Prelude.Eq, ReadPrec [CustomAmi]
ReadPrec CustomAmi
Int -> ReadS CustomAmi
ReadS [CustomAmi]
(Int -> ReadS CustomAmi)
-> ReadS [CustomAmi]
-> ReadPrec CustomAmi
-> ReadPrec [CustomAmi]
-> Read CustomAmi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomAmi]
$creadListPrec :: ReadPrec [CustomAmi]
readPrec :: ReadPrec CustomAmi
$creadPrec :: ReadPrec CustomAmi
readList :: ReadS [CustomAmi]
$creadList :: ReadS [CustomAmi]
readsPrec :: Int -> ReadS CustomAmi
$creadsPrec :: Int -> ReadS CustomAmi
Prelude.Read, Int -> CustomAmi -> ShowS
[CustomAmi] -> ShowS
CustomAmi -> String
(Int -> CustomAmi -> ShowS)
-> (CustomAmi -> String)
-> ([CustomAmi] -> ShowS)
-> Show CustomAmi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomAmi] -> ShowS
$cshowList :: [CustomAmi] -> ShowS
show :: CustomAmi -> String
$cshow :: CustomAmi -> String
showsPrec :: Int -> CustomAmi -> ShowS
$cshowsPrec :: Int -> CustomAmi -> ShowS
Prelude.Show, (forall x. CustomAmi -> Rep CustomAmi x)
-> (forall x. Rep CustomAmi x -> CustomAmi) -> Generic CustomAmi
forall x. Rep CustomAmi x -> CustomAmi
forall x. CustomAmi -> Rep CustomAmi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CustomAmi x -> CustomAmi
$cfrom :: forall x. CustomAmi -> Rep CustomAmi x
Prelude.Generic)

-- |
-- Create a value of 'CustomAmi' 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:
--
-- 'virtualizationType', 'customAmi_virtualizationType' - The type of virtualization used to create the custom AMI.
--
-- 'imageId', 'customAmi_imageId' - THe ID of the image used to create the custom AMI.
newCustomAmi ::
  CustomAmi
newCustomAmi :: CustomAmi
newCustomAmi =
  CustomAmi' :: Maybe Text -> Maybe Text -> CustomAmi
CustomAmi'
    { $sel:virtualizationType:CustomAmi' :: Maybe Text
virtualizationType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:imageId:CustomAmi' :: Maybe Text
imageId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of virtualization used to create the custom AMI.
customAmi_virtualizationType :: Lens.Lens' CustomAmi (Prelude.Maybe Prelude.Text)
customAmi_virtualizationType :: (Maybe Text -> f (Maybe Text)) -> CustomAmi -> f CustomAmi
customAmi_virtualizationType = (CustomAmi -> Maybe Text)
-> (CustomAmi -> Maybe Text -> CustomAmi)
-> Lens CustomAmi CustomAmi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomAmi' {Maybe Text
virtualizationType :: Maybe Text
$sel:virtualizationType:CustomAmi' :: CustomAmi -> Maybe Text
virtualizationType} -> Maybe Text
virtualizationType) (\s :: CustomAmi
s@CustomAmi' {} Maybe Text
a -> CustomAmi
s {$sel:virtualizationType:CustomAmi' :: Maybe Text
virtualizationType = Maybe Text
a} :: CustomAmi)

-- | THe ID of the image used to create the custom AMI.
customAmi_imageId :: Lens.Lens' CustomAmi (Prelude.Maybe Prelude.Text)
customAmi_imageId :: (Maybe Text -> f (Maybe Text)) -> CustomAmi -> f CustomAmi
customAmi_imageId = (CustomAmi -> Maybe Text)
-> (CustomAmi -> Maybe Text -> CustomAmi)
-> Lens CustomAmi CustomAmi (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomAmi' {Maybe Text
imageId :: Maybe Text
$sel:imageId:CustomAmi' :: CustomAmi -> Maybe Text
imageId} -> Maybe Text
imageId) (\s :: CustomAmi
s@CustomAmi' {} Maybe Text
a -> CustomAmi
s {$sel:imageId:CustomAmi' :: Maybe Text
imageId = Maybe Text
a} :: CustomAmi)

instance Core.FromXML CustomAmi where
  parseXML :: [Node] -> Either String CustomAmi
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> CustomAmi
CustomAmi'
      (Maybe Text -> Maybe Text -> CustomAmi)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> CustomAmi)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"VirtualizationType")
      Either String (Maybe Text -> CustomAmi)
-> Either String (Maybe Text) -> Either String CustomAmi
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ImageId")

instance Prelude.Hashable CustomAmi

instance Prelude.NFData CustomAmi