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

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

-- | Describes the properties of an environment tier
--
-- /See:/ 'newEnvironmentTier' smart constructor.
data EnvironmentTier = EnvironmentTier'
  { -- | The name of this environment tier.
    --
    -- Valid values:
    --
    -- -   For /Web server tier/ – @WebServer@
    --
    -- -   For /Worker tier/ – @Worker@
    EnvironmentTier -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The version of this environment tier. When you don\'t set a value to it,
    -- Elastic Beanstalk uses the latest compatible worker tier version.
    --
    -- This member is deprecated. Any specific version that you set may become
    -- out of date. We recommend leaving it unspecified.
    EnvironmentTier -> Maybe Text
version :: Prelude.Maybe Prelude.Text,
    -- | The type of this environment tier.
    --
    -- Valid values:
    --
    -- -   For /Web server tier/ – @Standard@
    --
    -- -   For /Worker tier/ – @SQS\/HTTP@
    EnvironmentTier -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (EnvironmentTier -> EnvironmentTier -> Bool
(EnvironmentTier -> EnvironmentTier -> Bool)
-> (EnvironmentTier -> EnvironmentTier -> Bool)
-> Eq EnvironmentTier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentTier -> EnvironmentTier -> Bool
$c/= :: EnvironmentTier -> EnvironmentTier -> Bool
== :: EnvironmentTier -> EnvironmentTier -> Bool
$c== :: EnvironmentTier -> EnvironmentTier -> Bool
Prelude.Eq, ReadPrec [EnvironmentTier]
ReadPrec EnvironmentTier
Int -> ReadS EnvironmentTier
ReadS [EnvironmentTier]
(Int -> ReadS EnvironmentTier)
-> ReadS [EnvironmentTier]
-> ReadPrec EnvironmentTier
-> ReadPrec [EnvironmentTier]
-> Read EnvironmentTier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentTier]
$creadListPrec :: ReadPrec [EnvironmentTier]
readPrec :: ReadPrec EnvironmentTier
$creadPrec :: ReadPrec EnvironmentTier
readList :: ReadS [EnvironmentTier]
$creadList :: ReadS [EnvironmentTier]
readsPrec :: Int -> ReadS EnvironmentTier
$creadsPrec :: Int -> ReadS EnvironmentTier
Prelude.Read, Int -> EnvironmentTier -> ShowS
[EnvironmentTier] -> ShowS
EnvironmentTier -> String
(Int -> EnvironmentTier -> ShowS)
-> (EnvironmentTier -> String)
-> ([EnvironmentTier] -> ShowS)
-> Show EnvironmentTier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentTier] -> ShowS
$cshowList :: [EnvironmentTier] -> ShowS
show :: EnvironmentTier -> String
$cshow :: EnvironmentTier -> String
showsPrec :: Int -> EnvironmentTier -> ShowS
$cshowsPrec :: Int -> EnvironmentTier -> ShowS
Prelude.Show, (forall x. EnvironmentTier -> Rep EnvironmentTier x)
-> (forall x. Rep EnvironmentTier x -> EnvironmentTier)
-> Generic EnvironmentTier
forall x. Rep EnvironmentTier x -> EnvironmentTier
forall x. EnvironmentTier -> Rep EnvironmentTier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EnvironmentTier x -> EnvironmentTier
$cfrom :: forall x. EnvironmentTier -> Rep EnvironmentTier x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentTier' 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:
--
-- 'name', 'environmentTier_name' - The name of this environment tier.
--
-- Valid values:
--
-- -   For /Web server tier/ – @WebServer@
--
-- -   For /Worker tier/ – @Worker@
--
-- 'version', 'environmentTier_version' - The version of this environment tier. When you don\'t set a value to it,
-- Elastic Beanstalk uses the latest compatible worker tier version.
--
-- This member is deprecated. Any specific version that you set may become
-- out of date. We recommend leaving it unspecified.
--
-- 'type'', 'environmentTier_type' - The type of this environment tier.
--
-- Valid values:
--
-- -   For /Web server tier/ – @Standard@
--
-- -   For /Worker tier/ – @SQS\/HTTP@
newEnvironmentTier ::
  EnvironmentTier
newEnvironmentTier :: EnvironmentTier
newEnvironmentTier =
  EnvironmentTier' :: Maybe Text -> Maybe Text -> Maybe Text -> EnvironmentTier
EnvironmentTier'
    { $sel:name:EnvironmentTier' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:version:EnvironmentTier' :: Maybe Text
version = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':EnvironmentTier' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of this environment tier.
--
-- Valid values:
--
-- -   For /Web server tier/ – @WebServer@
--
-- -   For /Worker tier/ – @Worker@
environmentTier_name :: Lens.Lens' EnvironmentTier (Prelude.Maybe Prelude.Text)
environmentTier_name :: (Maybe Text -> f (Maybe Text))
-> EnvironmentTier -> f EnvironmentTier
environmentTier_name = (EnvironmentTier -> Maybe Text)
-> (EnvironmentTier -> Maybe Text -> EnvironmentTier)
-> Lens EnvironmentTier EnvironmentTier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentTier' {Maybe Text
name :: Maybe Text
$sel:name:EnvironmentTier' :: EnvironmentTier -> Maybe Text
name} -> Maybe Text
name) (\s :: EnvironmentTier
s@EnvironmentTier' {} Maybe Text
a -> EnvironmentTier
s {$sel:name:EnvironmentTier' :: Maybe Text
name = Maybe Text
a} :: EnvironmentTier)

-- | The version of this environment tier. When you don\'t set a value to it,
-- Elastic Beanstalk uses the latest compatible worker tier version.
--
-- This member is deprecated. Any specific version that you set may become
-- out of date. We recommend leaving it unspecified.
environmentTier_version :: Lens.Lens' EnvironmentTier (Prelude.Maybe Prelude.Text)
environmentTier_version :: (Maybe Text -> f (Maybe Text))
-> EnvironmentTier -> f EnvironmentTier
environmentTier_version = (EnvironmentTier -> Maybe Text)
-> (EnvironmentTier -> Maybe Text -> EnvironmentTier)
-> Lens EnvironmentTier EnvironmentTier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentTier' {Maybe Text
version :: Maybe Text
$sel:version:EnvironmentTier' :: EnvironmentTier -> Maybe Text
version} -> Maybe Text
version) (\s :: EnvironmentTier
s@EnvironmentTier' {} Maybe Text
a -> EnvironmentTier
s {$sel:version:EnvironmentTier' :: Maybe Text
version = Maybe Text
a} :: EnvironmentTier)

-- | The type of this environment tier.
--
-- Valid values:
--
-- -   For /Web server tier/ – @Standard@
--
-- -   For /Worker tier/ – @SQS\/HTTP@
environmentTier_type :: Lens.Lens' EnvironmentTier (Prelude.Maybe Prelude.Text)
environmentTier_type :: (Maybe Text -> f (Maybe Text))
-> EnvironmentTier -> f EnvironmentTier
environmentTier_type = (EnvironmentTier -> Maybe Text)
-> (EnvironmentTier -> Maybe Text -> EnvironmentTier)
-> Lens EnvironmentTier EnvironmentTier (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentTier' {Maybe Text
type' :: Maybe Text
$sel:type':EnvironmentTier' :: EnvironmentTier -> Maybe Text
type'} -> Maybe Text
type') (\s :: EnvironmentTier
s@EnvironmentTier' {} Maybe Text
a -> EnvironmentTier
s {$sel:type':EnvironmentTier' :: Maybe Text
type' = Maybe Text
a} :: EnvironmentTier)

instance Core.FromXML EnvironmentTier where
  parseXML :: [Node] -> Either String EnvironmentTier
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> Maybe Text -> EnvironmentTier
EnvironmentTier'
      (Maybe Text -> Maybe Text -> Maybe Text -> EnvironmentTier)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Maybe Text -> EnvironmentTier)
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
"Name")
      Either String (Maybe Text -> Maybe Text -> EnvironmentTier)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> EnvironmentTier)
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
"Version")
      Either String (Maybe Text -> EnvironmentTier)
-> Either String (Maybe Text) -> Either String EnvironmentTier
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
"Type")

instance Prelude.Hashable EnvironmentTier

instance Prelude.NFData EnvironmentTier

instance Core.ToQuery EnvironmentTier where
  toQuery :: EnvironmentTier -> QueryString
toQuery EnvironmentTier' {Maybe Text
type' :: Maybe Text
version :: Maybe Text
name :: Maybe Text
$sel:type':EnvironmentTier' :: EnvironmentTier -> Maybe Text
$sel:version:EnvironmentTier' :: EnvironmentTier -> Maybe Text
$sel:name:EnvironmentTier' :: EnvironmentTier -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
name,
        ByteString
"Version" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
version,
        ByteString
"Type" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
type'
      ]