{-# 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.ServiceCatalog.Types.ConstraintSummary
-- 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.ServiceCatalog.Types.ConstraintSummary where

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

-- | Summary information about a constraint.
--
-- /See:/ 'newConstraintSummary' smart constructor.
data ConstraintSummary = ConstraintSummary'
  { -- | The type of constraint.
    --
    -- -   @LAUNCH@
    --
    -- -   @NOTIFICATION@
    --
    -- -   STACKSET
    --
    -- -   @TEMPLATE@
    ConstraintSummary -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The description of the constraint.
    ConstraintSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (ConstraintSummary -> ConstraintSummary -> Bool
(ConstraintSummary -> ConstraintSummary -> Bool)
-> (ConstraintSummary -> ConstraintSummary -> Bool)
-> Eq ConstraintSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstraintSummary -> ConstraintSummary -> Bool
$c/= :: ConstraintSummary -> ConstraintSummary -> Bool
== :: ConstraintSummary -> ConstraintSummary -> Bool
$c== :: ConstraintSummary -> ConstraintSummary -> Bool
Prelude.Eq, ReadPrec [ConstraintSummary]
ReadPrec ConstraintSummary
Int -> ReadS ConstraintSummary
ReadS [ConstraintSummary]
(Int -> ReadS ConstraintSummary)
-> ReadS [ConstraintSummary]
-> ReadPrec ConstraintSummary
-> ReadPrec [ConstraintSummary]
-> Read ConstraintSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConstraintSummary]
$creadListPrec :: ReadPrec [ConstraintSummary]
readPrec :: ReadPrec ConstraintSummary
$creadPrec :: ReadPrec ConstraintSummary
readList :: ReadS [ConstraintSummary]
$creadList :: ReadS [ConstraintSummary]
readsPrec :: Int -> ReadS ConstraintSummary
$creadsPrec :: Int -> ReadS ConstraintSummary
Prelude.Read, Int -> ConstraintSummary -> ShowS
[ConstraintSummary] -> ShowS
ConstraintSummary -> String
(Int -> ConstraintSummary -> ShowS)
-> (ConstraintSummary -> String)
-> ([ConstraintSummary] -> ShowS)
-> Show ConstraintSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstraintSummary] -> ShowS
$cshowList :: [ConstraintSummary] -> ShowS
show :: ConstraintSummary -> String
$cshow :: ConstraintSummary -> String
showsPrec :: Int -> ConstraintSummary -> ShowS
$cshowsPrec :: Int -> ConstraintSummary -> ShowS
Prelude.Show, (forall x. ConstraintSummary -> Rep ConstraintSummary x)
-> (forall x. Rep ConstraintSummary x -> ConstraintSummary)
-> Generic ConstraintSummary
forall x. Rep ConstraintSummary x -> ConstraintSummary
forall x. ConstraintSummary -> Rep ConstraintSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConstraintSummary x -> ConstraintSummary
$cfrom :: forall x. ConstraintSummary -> Rep ConstraintSummary x
Prelude.Generic)

-- |
-- Create a value of 'ConstraintSummary' 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:
--
-- 'type'', 'constraintSummary_type' - The type of constraint.
--
-- -   @LAUNCH@
--
-- -   @NOTIFICATION@
--
-- -   STACKSET
--
-- -   @TEMPLATE@
--
-- 'description', 'constraintSummary_description' - The description of the constraint.
newConstraintSummary ::
  ConstraintSummary
newConstraintSummary :: ConstraintSummary
newConstraintSummary =
  ConstraintSummary' :: Maybe Text -> Maybe Text -> ConstraintSummary
ConstraintSummary'
    { $sel:type':ConstraintSummary' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ConstraintSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of constraint.
--
-- -   @LAUNCH@
--
-- -   @NOTIFICATION@
--
-- -   STACKSET
--
-- -   @TEMPLATE@
constraintSummary_type :: Lens.Lens' ConstraintSummary (Prelude.Maybe Prelude.Text)
constraintSummary_type :: (Maybe Text -> f (Maybe Text))
-> ConstraintSummary -> f ConstraintSummary
constraintSummary_type = (ConstraintSummary -> Maybe Text)
-> (ConstraintSummary -> Maybe Text -> ConstraintSummary)
-> Lens
     ConstraintSummary ConstraintSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConstraintSummary' {Maybe Text
type' :: Maybe Text
$sel:type':ConstraintSummary' :: ConstraintSummary -> Maybe Text
type'} -> Maybe Text
type') (\s :: ConstraintSummary
s@ConstraintSummary' {} Maybe Text
a -> ConstraintSummary
s {$sel:type':ConstraintSummary' :: Maybe Text
type' = Maybe Text
a} :: ConstraintSummary)

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

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

instance Prelude.Hashable ConstraintSummary

instance Prelude.NFData ConstraintSummary