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

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

-- | Information about a constraint.
--
-- /See:/ 'newConstraintDetail' smart constructor.
data ConstraintDetail = ConstraintDetail'
  { -- | The identifier of the portfolio the product resides in. The constraint
    -- applies only to the instance of the product that lives within this
    -- portfolio.
    ConstraintDetail -> Maybe Text
portfolioId :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the constraint.
    ConstraintDetail -> Maybe Text
constraintId :: Prelude.Maybe Prelude.Text,
    -- | The owner of the constraint.
    ConstraintDetail -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The type of constraint.
    --
    -- -   @LAUNCH@
    --
    -- -   @NOTIFICATION@
    --
    -- -   STACKSET
    --
    -- -   @TEMPLATE@
    ConstraintDetail -> Maybe Text
type' :: Prelude.Maybe Prelude.Text,
    -- | The description of the constraint.
    ConstraintDetail -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the product the constraint applies to. Note that a
    -- constraint applies to a specific instance of a product within a certain
    -- portfolio.
    ConstraintDetail -> Maybe Text
productId :: Prelude.Maybe Prelude.Text
  }
  deriving (ConstraintDetail -> ConstraintDetail -> Bool
(ConstraintDetail -> ConstraintDetail -> Bool)
-> (ConstraintDetail -> ConstraintDetail -> Bool)
-> Eq ConstraintDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstraintDetail -> ConstraintDetail -> Bool
$c/= :: ConstraintDetail -> ConstraintDetail -> Bool
== :: ConstraintDetail -> ConstraintDetail -> Bool
$c== :: ConstraintDetail -> ConstraintDetail -> Bool
Prelude.Eq, ReadPrec [ConstraintDetail]
ReadPrec ConstraintDetail
Int -> ReadS ConstraintDetail
ReadS [ConstraintDetail]
(Int -> ReadS ConstraintDetail)
-> ReadS [ConstraintDetail]
-> ReadPrec ConstraintDetail
-> ReadPrec [ConstraintDetail]
-> Read ConstraintDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConstraintDetail]
$creadListPrec :: ReadPrec [ConstraintDetail]
readPrec :: ReadPrec ConstraintDetail
$creadPrec :: ReadPrec ConstraintDetail
readList :: ReadS [ConstraintDetail]
$creadList :: ReadS [ConstraintDetail]
readsPrec :: Int -> ReadS ConstraintDetail
$creadsPrec :: Int -> ReadS ConstraintDetail
Prelude.Read, Int -> ConstraintDetail -> ShowS
[ConstraintDetail] -> ShowS
ConstraintDetail -> String
(Int -> ConstraintDetail -> ShowS)
-> (ConstraintDetail -> String)
-> ([ConstraintDetail] -> ShowS)
-> Show ConstraintDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstraintDetail] -> ShowS
$cshowList :: [ConstraintDetail] -> ShowS
show :: ConstraintDetail -> String
$cshow :: ConstraintDetail -> String
showsPrec :: Int -> ConstraintDetail -> ShowS
$cshowsPrec :: Int -> ConstraintDetail -> ShowS
Prelude.Show, (forall x. ConstraintDetail -> Rep ConstraintDetail x)
-> (forall x. Rep ConstraintDetail x -> ConstraintDetail)
-> Generic ConstraintDetail
forall x. Rep ConstraintDetail x -> ConstraintDetail
forall x. ConstraintDetail -> Rep ConstraintDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConstraintDetail x -> ConstraintDetail
$cfrom :: forall x. ConstraintDetail -> Rep ConstraintDetail x
Prelude.Generic)

-- |
-- Create a value of 'ConstraintDetail' 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:
--
-- 'portfolioId', 'constraintDetail_portfolioId' - The identifier of the portfolio the product resides in. The constraint
-- applies only to the instance of the product that lives within this
-- portfolio.
--
-- 'constraintId', 'constraintDetail_constraintId' - The identifier of the constraint.
--
-- 'owner', 'constraintDetail_owner' - The owner of the constraint.
--
-- 'type'', 'constraintDetail_type' - The type of constraint.
--
-- -   @LAUNCH@
--
-- -   @NOTIFICATION@
--
-- -   STACKSET
--
-- -   @TEMPLATE@
--
-- 'description', 'constraintDetail_description' - The description of the constraint.
--
-- 'productId', 'constraintDetail_productId' - The identifier of the product the constraint applies to. Note that a
-- constraint applies to a specific instance of a product within a certain
-- portfolio.
newConstraintDetail ::
  ConstraintDetail
newConstraintDetail :: ConstraintDetail
newConstraintDetail =
  ConstraintDetail' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ConstraintDetail
ConstraintDetail'
    { $sel:portfolioId:ConstraintDetail' :: Maybe Text
portfolioId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:constraintId:ConstraintDetail' :: Maybe Text
constraintId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:ConstraintDetail' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ConstraintDetail' :: Maybe Text
type' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ConstraintDetail' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:productId:ConstraintDetail' :: Maybe Text
productId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the portfolio the product resides in. The constraint
-- applies only to the instance of the product that lives within this
-- portfolio.
constraintDetail_portfolioId :: Lens.Lens' ConstraintDetail (Prelude.Maybe Prelude.Text)
constraintDetail_portfolioId :: (Maybe Text -> f (Maybe Text))
-> ConstraintDetail -> f ConstraintDetail
constraintDetail_portfolioId = (ConstraintDetail -> Maybe Text)
-> (ConstraintDetail -> Maybe Text -> ConstraintDetail)
-> Lens ConstraintDetail ConstraintDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConstraintDetail' {Maybe Text
portfolioId :: Maybe Text
$sel:portfolioId:ConstraintDetail' :: ConstraintDetail -> Maybe Text
portfolioId} -> Maybe Text
portfolioId) (\s :: ConstraintDetail
s@ConstraintDetail' {} Maybe Text
a -> ConstraintDetail
s {$sel:portfolioId:ConstraintDetail' :: Maybe Text
portfolioId = Maybe Text
a} :: ConstraintDetail)

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

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

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

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

-- | The identifier of the product the constraint applies to. Note that a
-- constraint applies to a specific instance of a product within a certain
-- portfolio.
constraintDetail_productId :: Lens.Lens' ConstraintDetail (Prelude.Maybe Prelude.Text)
constraintDetail_productId :: (Maybe Text -> f (Maybe Text))
-> ConstraintDetail -> f ConstraintDetail
constraintDetail_productId = (ConstraintDetail -> Maybe Text)
-> (ConstraintDetail -> Maybe Text -> ConstraintDetail)
-> Lens ConstraintDetail ConstraintDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConstraintDetail' {Maybe Text
productId :: Maybe Text
$sel:productId:ConstraintDetail' :: ConstraintDetail -> Maybe Text
productId} -> Maybe Text
productId) (\s :: ConstraintDetail
s@ConstraintDetail' {} Maybe Text
a -> ConstraintDetail
s {$sel:productId:ConstraintDetail' :: Maybe Text
productId = Maybe Text
a} :: ConstraintDetail)

instance Core.FromJSON ConstraintDetail where
  parseJSON :: Value -> Parser ConstraintDetail
parseJSON =
    String
-> (Object -> Parser ConstraintDetail)
-> Value
-> Parser ConstraintDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConstraintDetail"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> ConstraintDetail
ConstraintDetail'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> ConstraintDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> ConstraintDetail)
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
"PortfolioId")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> ConstraintDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Maybe Text -> ConstraintDetail)
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
"ConstraintId")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Text -> Maybe Text -> ConstraintDetail)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe Text -> ConstraintDetail)
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
"Owner")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> ConstraintDetail)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ConstraintDetail)
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")
            Parser (Maybe Text -> Maybe Text -> ConstraintDetail)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ConstraintDetail)
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")
            Parser (Maybe Text -> ConstraintDetail)
-> Parser (Maybe Text) -> Parser ConstraintDetail
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
"ProductId")
      )

instance Prelude.Hashable ConstraintDetail

instance Prelude.NFData ConstraintDetail