{-# 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.SecurityHub.Types.AwsEcsTaskDefinitionPlacementConstraintsDetails
-- 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.SecurityHub.Types.AwsEcsTaskDefinitionPlacementConstraintsDetails where

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

-- | A placement constraint object to use for tasks.
--
-- /See:/ 'newAwsEcsTaskDefinitionPlacementConstraintsDetails' smart constructor.
data AwsEcsTaskDefinitionPlacementConstraintsDetails = AwsEcsTaskDefinitionPlacementConstraintsDetails'
  { -- | A cluster query language expression to apply to the constraint.
    AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
expression :: Prelude.Maybe Prelude.Text,
    -- | The type of constraint.
    AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
type' :: Prelude.Maybe Prelude.Text
  }
  deriving (AwsEcsTaskDefinitionPlacementConstraintsDetails
-> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool
(AwsEcsTaskDefinitionPlacementConstraintsDetails
 -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool)
-> (AwsEcsTaskDefinitionPlacementConstraintsDetails
    -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool)
-> Eq AwsEcsTaskDefinitionPlacementConstraintsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsEcsTaskDefinitionPlacementConstraintsDetails
-> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool
$c/= :: AwsEcsTaskDefinitionPlacementConstraintsDetails
-> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool
== :: AwsEcsTaskDefinitionPlacementConstraintsDetails
-> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool
$c== :: AwsEcsTaskDefinitionPlacementConstraintsDetails
-> AwsEcsTaskDefinitionPlacementConstraintsDetails -> Bool
Prelude.Eq, ReadPrec [AwsEcsTaskDefinitionPlacementConstraintsDetails]
ReadPrec AwsEcsTaskDefinitionPlacementConstraintsDetails
Int -> ReadS AwsEcsTaskDefinitionPlacementConstraintsDetails
ReadS [AwsEcsTaskDefinitionPlacementConstraintsDetails]
(Int -> ReadS AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> ReadS [AwsEcsTaskDefinitionPlacementConstraintsDetails]
-> ReadPrec AwsEcsTaskDefinitionPlacementConstraintsDetails
-> ReadPrec [AwsEcsTaskDefinitionPlacementConstraintsDetails]
-> Read AwsEcsTaskDefinitionPlacementConstraintsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsEcsTaskDefinitionPlacementConstraintsDetails]
$creadListPrec :: ReadPrec [AwsEcsTaskDefinitionPlacementConstraintsDetails]
readPrec :: ReadPrec AwsEcsTaskDefinitionPlacementConstraintsDetails
$creadPrec :: ReadPrec AwsEcsTaskDefinitionPlacementConstraintsDetails
readList :: ReadS [AwsEcsTaskDefinitionPlacementConstraintsDetails]
$creadList :: ReadS [AwsEcsTaskDefinitionPlacementConstraintsDetails]
readsPrec :: Int -> ReadS AwsEcsTaskDefinitionPlacementConstraintsDetails
$creadsPrec :: Int -> ReadS AwsEcsTaskDefinitionPlacementConstraintsDetails
Prelude.Read, Int -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> ShowS
[AwsEcsTaskDefinitionPlacementConstraintsDetails] -> ShowS
AwsEcsTaskDefinitionPlacementConstraintsDetails -> String
(Int -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> ShowS)
-> (AwsEcsTaskDefinitionPlacementConstraintsDetails -> String)
-> ([AwsEcsTaskDefinitionPlacementConstraintsDetails] -> ShowS)
-> Show AwsEcsTaskDefinitionPlacementConstraintsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsEcsTaskDefinitionPlacementConstraintsDetails] -> ShowS
$cshowList :: [AwsEcsTaskDefinitionPlacementConstraintsDetails] -> ShowS
show :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> String
$cshow :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> String
showsPrec :: Int -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> ShowS
$cshowsPrec :: Int -> AwsEcsTaskDefinitionPlacementConstraintsDetails -> ShowS
Prelude.Show, (forall x.
 AwsEcsTaskDefinitionPlacementConstraintsDetails
 -> Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x)
-> (forall x.
    Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x
    -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Generic AwsEcsTaskDefinitionPlacementConstraintsDetails
forall x.
Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x
-> AwsEcsTaskDefinitionPlacementConstraintsDetails
forall x.
AwsEcsTaskDefinitionPlacementConstraintsDetails
-> Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x
-> AwsEcsTaskDefinitionPlacementConstraintsDetails
$cfrom :: forall x.
AwsEcsTaskDefinitionPlacementConstraintsDetails
-> Rep AwsEcsTaskDefinitionPlacementConstraintsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsEcsTaskDefinitionPlacementConstraintsDetails' 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:
--
-- 'expression', 'awsEcsTaskDefinitionPlacementConstraintsDetails_expression' - A cluster query language expression to apply to the constraint.
--
-- 'type'', 'awsEcsTaskDefinitionPlacementConstraintsDetails_type' - The type of constraint.
newAwsEcsTaskDefinitionPlacementConstraintsDetails ::
  AwsEcsTaskDefinitionPlacementConstraintsDetails
newAwsEcsTaskDefinitionPlacementConstraintsDetails :: AwsEcsTaskDefinitionPlacementConstraintsDetails
newAwsEcsTaskDefinitionPlacementConstraintsDetails =
  AwsEcsTaskDefinitionPlacementConstraintsDetails' :: Maybe Text
-> Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails
AwsEcsTaskDefinitionPlacementConstraintsDetails'
    { $sel:expression:AwsEcsTaskDefinitionPlacementConstraintsDetails' :: Maybe Text
expression =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':AwsEcsTaskDefinitionPlacementConstraintsDetails' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A cluster query language expression to apply to the constraint.
awsEcsTaskDefinitionPlacementConstraintsDetails_expression :: Lens.Lens' AwsEcsTaskDefinitionPlacementConstraintsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionPlacementConstraintsDetails_expression :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionPlacementConstraintsDetails
-> f AwsEcsTaskDefinitionPlacementConstraintsDetails
awsEcsTaskDefinitionPlacementConstraintsDetails_expression = (AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text)
-> (AwsEcsTaskDefinitionPlacementConstraintsDetails
    -> Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Lens
     AwsEcsTaskDefinitionPlacementConstraintsDetails
     AwsEcsTaskDefinitionPlacementConstraintsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionPlacementConstraintsDetails' {Maybe Text
expression :: Maybe Text
$sel:expression:AwsEcsTaskDefinitionPlacementConstraintsDetails' :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
expression} -> Maybe Text
expression) (\s :: AwsEcsTaskDefinitionPlacementConstraintsDetails
s@AwsEcsTaskDefinitionPlacementConstraintsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionPlacementConstraintsDetails
s {$sel:expression:AwsEcsTaskDefinitionPlacementConstraintsDetails' :: Maybe Text
expression = Maybe Text
a} :: AwsEcsTaskDefinitionPlacementConstraintsDetails)

-- | The type of constraint.
awsEcsTaskDefinitionPlacementConstraintsDetails_type :: Lens.Lens' AwsEcsTaskDefinitionPlacementConstraintsDetails (Prelude.Maybe Prelude.Text)
awsEcsTaskDefinitionPlacementConstraintsDetails_type :: (Maybe Text -> f (Maybe Text))
-> AwsEcsTaskDefinitionPlacementConstraintsDetails
-> f AwsEcsTaskDefinitionPlacementConstraintsDetails
awsEcsTaskDefinitionPlacementConstraintsDetails_type = (AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text)
-> (AwsEcsTaskDefinitionPlacementConstraintsDetails
    -> Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Lens
     AwsEcsTaskDefinitionPlacementConstraintsDetails
     AwsEcsTaskDefinitionPlacementConstraintsDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsEcsTaskDefinitionPlacementConstraintsDetails' {Maybe Text
type' :: Maybe Text
$sel:type':AwsEcsTaskDefinitionPlacementConstraintsDetails' :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
type'} -> Maybe Text
type') (\s :: AwsEcsTaskDefinitionPlacementConstraintsDetails
s@AwsEcsTaskDefinitionPlacementConstraintsDetails' {} Maybe Text
a -> AwsEcsTaskDefinitionPlacementConstraintsDetails
s {$sel:type':AwsEcsTaskDefinitionPlacementConstraintsDetails' :: Maybe Text
type' = Maybe Text
a} :: AwsEcsTaskDefinitionPlacementConstraintsDetails)

instance
  Core.FromJSON
    AwsEcsTaskDefinitionPlacementConstraintsDetails
  where
  parseJSON :: Value -> Parser AwsEcsTaskDefinitionPlacementConstraintsDetails
parseJSON =
    String
-> (Object
    -> Parser AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Value
-> Parser AwsEcsTaskDefinitionPlacementConstraintsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsEcsTaskDefinitionPlacementConstraintsDetails"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails
AwsEcsTaskDefinitionPlacementConstraintsDetails'
            (Maybe Text
 -> Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
forall (f :: * -> *) a b. Functor 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
"Expression")
              Parser
  (Maybe Text -> AwsEcsTaskDefinitionPlacementConstraintsDetails)
-> Parser (Maybe Text)
-> Parser AwsEcsTaskDefinitionPlacementConstraintsDetails
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
"Type")
      )

instance
  Prelude.Hashable
    AwsEcsTaskDefinitionPlacementConstraintsDetails

instance
  Prelude.NFData
    AwsEcsTaskDefinitionPlacementConstraintsDetails

instance
  Core.ToJSON
    AwsEcsTaskDefinitionPlacementConstraintsDetails
  where
  toJSON :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> Value
toJSON
    AwsEcsTaskDefinitionPlacementConstraintsDetails' {Maybe Text
type' :: Maybe Text
expression :: Maybe Text
$sel:type':AwsEcsTaskDefinitionPlacementConstraintsDetails' :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
$sel:expression:AwsEcsTaskDefinitionPlacementConstraintsDetails' :: AwsEcsTaskDefinitionPlacementConstraintsDetails -> Maybe Text
..} =
      [Pair] -> Value
Core.object
        ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
            [ (Text
"Expression" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
expression,
              (Text
"Type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
type'
            ]
        )