{-# 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.SolutionStackDescription
-- 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.SolutionStackDescription where

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

-- | Describes the solution stack.
--
-- /See:/ 'newSolutionStackDescription' smart constructor.
data SolutionStackDescription = SolutionStackDescription'
  { -- | The permitted file types allowed for a solution stack.
    SolutionStackDescription -> Maybe [Text]
permittedFileTypes :: Prelude.Maybe [Prelude.Text],
    -- | The name of the solution stack.
    SolutionStackDescription -> Maybe Text
solutionStackName :: Prelude.Maybe Prelude.Text
  }
  deriving (SolutionStackDescription -> SolutionStackDescription -> Bool
(SolutionStackDescription -> SolutionStackDescription -> Bool)
-> (SolutionStackDescription -> SolutionStackDescription -> Bool)
-> Eq SolutionStackDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SolutionStackDescription -> SolutionStackDescription -> Bool
$c/= :: SolutionStackDescription -> SolutionStackDescription -> Bool
== :: SolutionStackDescription -> SolutionStackDescription -> Bool
$c== :: SolutionStackDescription -> SolutionStackDescription -> Bool
Prelude.Eq, ReadPrec [SolutionStackDescription]
ReadPrec SolutionStackDescription
Int -> ReadS SolutionStackDescription
ReadS [SolutionStackDescription]
(Int -> ReadS SolutionStackDescription)
-> ReadS [SolutionStackDescription]
-> ReadPrec SolutionStackDescription
-> ReadPrec [SolutionStackDescription]
-> Read SolutionStackDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SolutionStackDescription]
$creadListPrec :: ReadPrec [SolutionStackDescription]
readPrec :: ReadPrec SolutionStackDescription
$creadPrec :: ReadPrec SolutionStackDescription
readList :: ReadS [SolutionStackDescription]
$creadList :: ReadS [SolutionStackDescription]
readsPrec :: Int -> ReadS SolutionStackDescription
$creadsPrec :: Int -> ReadS SolutionStackDescription
Prelude.Read, Int -> SolutionStackDescription -> ShowS
[SolutionStackDescription] -> ShowS
SolutionStackDescription -> String
(Int -> SolutionStackDescription -> ShowS)
-> (SolutionStackDescription -> String)
-> ([SolutionStackDescription] -> ShowS)
-> Show SolutionStackDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SolutionStackDescription] -> ShowS
$cshowList :: [SolutionStackDescription] -> ShowS
show :: SolutionStackDescription -> String
$cshow :: SolutionStackDescription -> String
showsPrec :: Int -> SolutionStackDescription -> ShowS
$cshowsPrec :: Int -> SolutionStackDescription -> ShowS
Prelude.Show, (forall x.
 SolutionStackDescription -> Rep SolutionStackDescription x)
-> (forall x.
    Rep SolutionStackDescription x -> SolutionStackDescription)
-> Generic SolutionStackDescription
forall x.
Rep SolutionStackDescription x -> SolutionStackDescription
forall x.
SolutionStackDescription -> Rep SolutionStackDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SolutionStackDescription x -> SolutionStackDescription
$cfrom :: forall x.
SolutionStackDescription -> Rep SolutionStackDescription x
Prelude.Generic)

-- |
-- Create a value of 'SolutionStackDescription' 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:
--
-- 'permittedFileTypes', 'solutionStackDescription_permittedFileTypes' - The permitted file types allowed for a solution stack.
--
-- 'solutionStackName', 'solutionStackDescription_solutionStackName' - The name of the solution stack.
newSolutionStackDescription ::
  SolutionStackDescription
newSolutionStackDescription :: SolutionStackDescription
newSolutionStackDescription =
  SolutionStackDescription' :: Maybe [Text] -> Maybe Text -> SolutionStackDescription
SolutionStackDescription'
    { $sel:permittedFileTypes:SolutionStackDescription' :: Maybe [Text]
permittedFileTypes =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:solutionStackName:SolutionStackDescription' :: Maybe Text
solutionStackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The permitted file types allowed for a solution stack.
solutionStackDescription_permittedFileTypes :: Lens.Lens' SolutionStackDescription (Prelude.Maybe [Prelude.Text])
solutionStackDescription_permittedFileTypes :: (Maybe [Text] -> f (Maybe [Text]))
-> SolutionStackDescription -> f SolutionStackDescription
solutionStackDescription_permittedFileTypes = (SolutionStackDescription -> Maybe [Text])
-> (SolutionStackDescription
    -> Maybe [Text] -> SolutionStackDescription)
-> Lens
     SolutionStackDescription
     SolutionStackDescription
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionStackDescription' {Maybe [Text]
permittedFileTypes :: Maybe [Text]
$sel:permittedFileTypes:SolutionStackDescription' :: SolutionStackDescription -> Maybe [Text]
permittedFileTypes} -> Maybe [Text]
permittedFileTypes) (\s :: SolutionStackDescription
s@SolutionStackDescription' {} Maybe [Text]
a -> SolutionStackDescription
s {$sel:permittedFileTypes:SolutionStackDescription' :: Maybe [Text]
permittedFileTypes = Maybe [Text]
a} :: SolutionStackDescription) ((Maybe [Text] -> f (Maybe [Text]))
 -> SolutionStackDescription -> f SolutionStackDescription)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> SolutionStackDescription
-> f SolutionStackDescription
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 solution stack.
solutionStackDescription_solutionStackName :: Lens.Lens' SolutionStackDescription (Prelude.Maybe Prelude.Text)
solutionStackDescription_solutionStackName :: (Maybe Text -> f (Maybe Text))
-> SolutionStackDescription -> f SolutionStackDescription
solutionStackDescription_solutionStackName = (SolutionStackDescription -> Maybe Text)
-> (SolutionStackDescription
    -> Maybe Text -> SolutionStackDescription)
-> Lens
     SolutionStackDescription
     SolutionStackDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SolutionStackDescription' {Maybe Text
solutionStackName :: Maybe Text
$sel:solutionStackName:SolutionStackDescription' :: SolutionStackDescription -> Maybe Text
solutionStackName} -> Maybe Text
solutionStackName) (\s :: SolutionStackDescription
s@SolutionStackDescription' {} Maybe Text
a -> SolutionStackDescription
s {$sel:solutionStackName:SolutionStackDescription' :: Maybe Text
solutionStackName = Maybe Text
a} :: SolutionStackDescription)

instance Core.FromXML SolutionStackDescription where
  parseXML :: [Node] -> Either String SolutionStackDescription
parseXML [Node]
x =
    Maybe [Text] -> Maybe Text -> SolutionStackDescription
SolutionStackDescription'
      (Maybe [Text] -> Maybe Text -> SolutionStackDescription)
-> Either String (Maybe [Text])
-> Either String (Maybe Text -> SolutionStackDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PermittedFileTypes"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [Text]))
-> Either String (Maybe [Text])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Text])
-> [Node] -> Either String (Maybe [Text])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Text]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either String (Maybe Text -> SolutionStackDescription)
-> Either String (Maybe Text)
-> Either String SolutionStackDescription
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
"SolutionStackName")

instance Prelude.Hashable SolutionStackDescription

instance Prelude.NFData SolutionStackDescription