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

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

-- | Describes criteria to restrict the results when listing platform
-- versions.
--
-- The filter is evaluated as follows: @Type Operator Values[1]@
--
-- /See:/ 'newPlatformFilter' smart constructor.
data PlatformFilter = PlatformFilter'
  { -- | The list of values applied to the filtering platform version attribute.
    -- Only one value is supported for all current operators.
    --
    -- The following list shows valid filter values for some filter attributes.
    --
    -- -   @PlatformStatus@: @Creating@ | @Failed@ | @Ready@ | @Deleting@ |
    --     @Deleted@
    --
    -- -   @PlatformLifecycleState@: @recommended@
    --
    -- -   @SupportedTier@: @WebServer\/Standard@ | @Worker\/SQS\/HTTP@
    --
    -- -   @SupportedAddon@: @Log\/S3@ | @Monitoring\/Healthd@ |
    --     @WorkerDaemon\/SQSD@
    PlatformFilter -> Maybe [Text]
values :: Prelude.Maybe [Prelude.Text],
    -- | The operator to apply to the @Type@ with each of the @Values@.
    --
    -- Valid values: @=@ | @!=@ | @\<@ | @\<=@ | @>@ | @>=@ | @contains@ |
    -- @begins_with@ | @ends_with@
    PlatformFilter -> Maybe Text
operator :: Prelude.Maybe Prelude.Text,
    -- | The platform version attribute to which the filter values are applied.
    --
    -- Valid values: @PlatformName@ | @PlatformVersion@ | @PlatformStatus@ |
    -- @PlatformBranchName@ | @PlatformLifecycleState@ | @PlatformOwner@ |
    -- @SupportedTier@ | @SupportedAddon@ | @ProgrammingLanguageName@ |
    -- @OperatingSystemName@
    PlatformFilter -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (PlatformFilter -> PlatformFilter -> Bool
(PlatformFilter -> PlatformFilter -> Bool)
-> (PlatformFilter -> PlatformFilter -> Bool) -> Eq PlatformFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PlatformFilter -> PlatformFilter -> Bool
$c/= :: PlatformFilter -> PlatformFilter -> Bool
== :: PlatformFilter -> PlatformFilter -> Bool
$c== :: PlatformFilter -> PlatformFilter -> Bool
Prelude.Eq, ReadPrec [PlatformFilter]
ReadPrec PlatformFilter
Int -> ReadS PlatformFilter
ReadS [PlatformFilter]
(Int -> ReadS PlatformFilter)
-> ReadS [PlatformFilter]
-> ReadPrec PlatformFilter
-> ReadPrec [PlatformFilter]
-> Read PlatformFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PlatformFilter]
$creadListPrec :: ReadPrec [PlatformFilter]
readPrec :: ReadPrec PlatformFilter
$creadPrec :: ReadPrec PlatformFilter
readList :: ReadS [PlatformFilter]
$creadList :: ReadS [PlatformFilter]
readsPrec :: Int -> ReadS PlatformFilter
$creadsPrec :: Int -> ReadS PlatformFilter
Prelude.Read, Int -> PlatformFilter -> ShowS
[PlatformFilter] -> ShowS
PlatformFilter -> String
(Int -> PlatformFilter -> ShowS)
-> (PlatformFilter -> String)
-> ([PlatformFilter] -> ShowS)
-> Show PlatformFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PlatformFilter] -> ShowS
$cshowList :: [PlatformFilter] -> ShowS
show :: PlatformFilter -> String
$cshow :: PlatformFilter -> String
showsPrec :: Int -> PlatformFilter -> ShowS
$cshowsPrec :: Int -> PlatformFilter -> ShowS
Prelude.Show, (forall x. PlatformFilter -> Rep PlatformFilter x)
-> (forall x. Rep PlatformFilter x -> PlatformFilter)
-> Generic PlatformFilter
forall x. Rep PlatformFilter x -> PlatformFilter
forall x. PlatformFilter -> Rep PlatformFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PlatformFilter x -> PlatformFilter
$cfrom :: forall x. PlatformFilter -> Rep PlatformFilter x
Prelude.Generic)

-- |
-- Create a value of 'PlatformFilter' 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:
--
-- 'values', 'platformFilter_values' - The list of values applied to the filtering platform version attribute.
-- Only one value is supported for all current operators.
--
-- The following list shows valid filter values for some filter attributes.
--
-- -   @PlatformStatus@: @Creating@ | @Failed@ | @Ready@ | @Deleting@ |
--     @Deleted@
--
-- -   @PlatformLifecycleState@: @recommended@
--
-- -   @SupportedTier@: @WebServer\/Standard@ | @Worker\/SQS\/HTTP@
--
-- -   @SupportedAddon@: @Log\/S3@ | @Monitoring\/Healthd@ |
--     @WorkerDaemon\/SQSD@
--
-- 'operator', 'platformFilter_operator' - The operator to apply to the @Type@ with each of the @Values@.
--
-- Valid values: @=@ | @!=@ | @\<@ | @\<=@ | @>@ | @>=@ | @contains@ |
-- @begins_with@ | @ends_with@
--
-- 'type'', 'platformFilter_type' - The platform version attribute to which the filter values are applied.
--
-- Valid values: @PlatformName@ | @PlatformVersion@ | @PlatformStatus@ |
-- @PlatformBranchName@ | @PlatformLifecycleState@ | @PlatformOwner@ |
-- @SupportedTier@ | @SupportedAddon@ | @ProgrammingLanguageName@ |
-- @OperatingSystemName@
newPlatformFilter ::
  PlatformFilter
newPlatformFilter :: PlatformFilter
newPlatformFilter =
  PlatformFilter' :: Maybe [Text] -> Maybe Text -> Maybe Text -> PlatformFilter
PlatformFilter'
    { $sel:values:PlatformFilter' :: Maybe [Text]
values = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:operator:PlatformFilter' :: Maybe Text
operator = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':PlatformFilter' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of values applied to the filtering platform version attribute.
-- Only one value is supported for all current operators.
--
-- The following list shows valid filter values for some filter attributes.
--
-- -   @PlatformStatus@: @Creating@ | @Failed@ | @Ready@ | @Deleting@ |
--     @Deleted@
--
-- -   @PlatformLifecycleState@: @recommended@
--
-- -   @SupportedTier@: @WebServer\/Standard@ | @Worker\/SQS\/HTTP@
--
-- -   @SupportedAddon@: @Log\/S3@ | @Monitoring\/Healthd@ |
--     @WorkerDaemon\/SQSD@
platformFilter_values :: Lens.Lens' PlatformFilter (Prelude.Maybe [Prelude.Text])
platformFilter_values :: (Maybe [Text] -> f (Maybe [Text]))
-> PlatformFilter -> f PlatformFilter
platformFilter_values = (PlatformFilter -> Maybe [Text])
-> (PlatformFilter -> Maybe [Text] -> PlatformFilter)
-> Lens PlatformFilter PlatformFilter (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformFilter' {Maybe [Text]
values :: Maybe [Text]
$sel:values:PlatformFilter' :: PlatformFilter -> Maybe [Text]
values} -> Maybe [Text]
values) (\s :: PlatformFilter
s@PlatformFilter' {} Maybe [Text]
a -> PlatformFilter
s {$sel:values:PlatformFilter' :: Maybe [Text]
values = Maybe [Text]
a} :: PlatformFilter) ((Maybe [Text] -> f (Maybe [Text]))
 -> PlatformFilter -> f PlatformFilter)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> PlatformFilter
-> f PlatformFilter
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 operator to apply to the @Type@ with each of the @Values@.
--
-- Valid values: @=@ | @!=@ | @\<@ | @\<=@ | @>@ | @>=@ | @contains@ |
-- @begins_with@ | @ends_with@
platformFilter_operator :: Lens.Lens' PlatformFilter (Prelude.Maybe Prelude.Text)
platformFilter_operator :: (Maybe Text -> f (Maybe Text))
-> PlatformFilter -> f PlatformFilter
platformFilter_operator = (PlatformFilter -> Maybe Text)
-> (PlatformFilter -> Maybe Text -> PlatformFilter)
-> Lens PlatformFilter PlatformFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformFilter' {Maybe Text
operator :: Maybe Text
$sel:operator:PlatformFilter' :: PlatformFilter -> Maybe Text
operator} -> Maybe Text
operator) (\s :: PlatformFilter
s@PlatformFilter' {} Maybe Text
a -> PlatformFilter
s {$sel:operator:PlatformFilter' :: Maybe Text
operator = Maybe Text
a} :: PlatformFilter)

-- | The platform version attribute to which the filter values are applied.
--
-- Valid values: @PlatformName@ | @PlatformVersion@ | @PlatformStatus@ |
-- @PlatformBranchName@ | @PlatformLifecycleState@ | @PlatformOwner@ |
-- @SupportedTier@ | @SupportedAddon@ | @ProgrammingLanguageName@ |
-- @OperatingSystemName@
platformFilter_type :: Lens.Lens' PlatformFilter (Prelude.Maybe Prelude.Text)
platformFilter_type :: (Maybe Text -> f (Maybe Text))
-> PlatformFilter -> f PlatformFilter
platformFilter_type = (PlatformFilter -> Maybe Text)
-> (PlatformFilter -> Maybe Text -> PlatformFilter)
-> Lens PlatformFilter PlatformFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PlatformFilter' {Maybe Text
type' :: Maybe Text
$sel:type':PlatformFilter' :: PlatformFilter -> Maybe Text
type'} -> Maybe Text
type') (\s :: PlatformFilter
s@PlatformFilter' {} Maybe Text
a -> PlatformFilter
s {$sel:type':PlatformFilter' :: Maybe Text
type' = Maybe Text
a} :: PlatformFilter)

instance Prelude.Hashable PlatformFilter

instance Prelude.NFData PlatformFilter

instance Core.ToQuery PlatformFilter where
  toQuery :: PlatformFilter -> QueryString
toQuery PlatformFilter' {Maybe [Text]
Maybe Text
type' :: Maybe Text
operator :: Maybe Text
values :: Maybe [Text]
$sel:type':PlatformFilter' :: PlatformFilter -> Maybe Text
$sel:operator:PlatformFilter' :: PlatformFilter -> Maybe Text
$sel:values:PlatformFilter' :: PlatformFilter -> Maybe [Text]
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Values"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Text] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Text] -> QueryString) -> Maybe [Text] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
values),
        ByteString
"Operator" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
operator,
        ByteString
"Type" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
type'
      ]