{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.UpdateConstraint
-- 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)
--
-- Updates the specified constraint.
module Amazonka.ServiceCatalog.UpdateConstraint
  ( -- * Creating a Request
    UpdateConstraint (..),
    newUpdateConstraint,

    -- * Request Lenses
    updateConstraint_acceptLanguage,
    updateConstraint_parameters,
    updateConstraint_description,
    updateConstraint_id,

    -- * Destructuring the Response
    UpdateConstraintResponse (..),
    newUpdateConstraintResponse,

    -- * Response Lenses
    updateConstraintResponse_status,
    updateConstraintResponse_constraintDetail,
    updateConstraintResponse_constraintParameters,
    updateConstraintResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.ServiceCatalog.Types

-- | /See:/ 'newUpdateConstraint' smart constructor.
data UpdateConstraint = UpdateConstraint'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    UpdateConstraint -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The constraint parameters, in JSON format. The syntax depends on the
    -- constraint type as follows:
    --
    -- [LAUNCH]
    --     You are required to specify either the @RoleArn@ or the
    --     @LocalRoleName@ but can\'t use both.
    --
    --     Specify the @RoleArn@ property as follows:
    --
    --     @{\"RoleArn\" : \"arn:aws:iam::123456789012:role\/LaunchRole\"}@
    --
    --     Specify the @LocalRoleName@ property as follows:
    --
    --     @{\"LocalRoleName\": \"SCBasicLaunchRole\"}@
    --
    --     If you specify the @LocalRoleName@ property, when an account uses
    --     the launch constraint, the IAM role with that name in the account
    --     will be used. This allows launch-role constraints to be
    --     account-agnostic so the administrator can create fewer resources per
    --     shared account.
    --
    --     The given role name must exist in the account used to create the
    --     launch constraint and the account of the user who launches a product
    --     with this launch constraint.
    --
    --     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
    --
    --     You also cannot have more than one @LAUNCH@ constraint on a product
    --     and portfolio.
    --
    -- [NOTIFICATION]
    --     Specify the @NotificationArns@ property as follows:
    --
    --     @{\"NotificationArns\" : [\"arn:aws:sns:us-east-1:123456789012:Topic\"]}@
    --
    -- [RESOURCE_UPDATE]
    --     Specify the @TagUpdatesOnProvisionedProduct@ property as follows:
    --
    --     @{\"Version\":\"2.0\",\"Properties\":{\"TagUpdateOnProvisionedProduct\":\"String\"}}@
    --
    --     The @TagUpdatesOnProvisionedProduct@ property accepts a string value
    --     of @ALLOWED@ or @NOT_ALLOWED@.
    --
    -- [STACKSET]
    --     Specify the @Parameters@ property as follows:
    --
    --     @{\"Version\": \"String\", \"Properties\": {\"AccountList\": [ \"String\" ], \"RegionList\": [ \"String\" ], \"AdminRole\": \"String\", \"ExecutionRole\": \"String\"}}@
    --
    --     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
    --
    --     You also cannot have more than one @STACKSET@ constraint on a
    --     product and portfolio.
    --
    --     Products with a @STACKSET@ constraint will launch an AWS
    --     CloudFormation stack set.
    --
    -- [TEMPLATE]
    --     Specify the @Rules@ property. For more information, see
    --     <http://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html Template Constraint Rules>.
    UpdateConstraint -> Maybe Text
parameters :: Prelude.Maybe Prelude.Text,
    -- | The updated description of the constraint.
    UpdateConstraint -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the constraint.
    UpdateConstraint -> Text
id :: Prelude.Text
  }
  deriving (UpdateConstraint -> UpdateConstraint -> Bool
(UpdateConstraint -> UpdateConstraint -> Bool)
-> (UpdateConstraint -> UpdateConstraint -> Bool)
-> Eq UpdateConstraint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConstraint -> UpdateConstraint -> Bool
$c/= :: UpdateConstraint -> UpdateConstraint -> Bool
== :: UpdateConstraint -> UpdateConstraint -> Bool
$c== :: UpdateConstraint -> UpdateConstraint -> Bool
Prelude.Eq, ReadPrec [UpdateConstraint]
ReadPrec UpdateConstraint
Int -> ReadS UpdateConstraint
ReadS [UpdateConstraint]
(Int -> ReadS UpdateConstraint)
-> ReadS [UpdateConstraint]
-> ReadPrec UpdateConstraint
-> ReadPrec [UpdateConstraint]
-> Read UpdateConstraint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConstraint]
$creadListPrec :: ReadPrec [UpdateConstraint]
readPrec :: ReadPrec UpdateConstraint
$creadPrec :: ReadPrec UpdateConstraint
readList :: ReadS [UpdateConstraint]
$creadList :: ReadS [UpdateConstraint]
readsPrec :: Int -> ReadS UpdateConstraint
$creadsPrec :: Int -> ReadS UpdateConstraint
Prelude.Read, Int -> UpdateConstraint -> ShowS
[UpdateConstraint] -> ShowS
UpdateConstraint -> String
(Int -> UpdateConstraint -> ShowS)
-> (UpdateConstraint -> String)
-> ([UpdateConstraint] -> ShowS)
-> Show UpdateConstraint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConstraint] -> ShowS
$cshowList :: [UpdateConstraint] -> ShowS
show :: UpdateConstraint -> String
$cshow :: UpdateConstraint -> String
showsPrec :: Int -> UpdateConstraint -> ShowS
$cshowsPrec :: Int -> UpdateConstraint -> ShowS
Prelude.Show, (forall x. UpdateConstraint -> Rep UpdateConstraint x)
-> (forall x. Rep UpdateConstraint x -> UpdateConstraint)
-> Generic UpdateConstraint
forall x. Rep UpdateConstraint x -> UpdateConstraint
forall x. UpdateConstraint -> Rep UpdateConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateConstraint x -> UpdateConstraint
$cfrom :: forall x. UpdateConstraint -> Rep UpdateConstraint x
Prelude.Generic)

-- |
-- Create a value of 'UpdateConstraint' 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:
--
-- 'acceptLanguage', 'updateConstraint_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'parameters', 'updateConstraint_parameters' - The constraint parameters, in JSON format. The syntax depends on the
-- constraint type as follows:
--
-- [LAUNCH]
--     You are required to specify either the @RoleArn@ or the
--     @LocalRoleName@ but can\'t use both.
--
--     Specify the @RoleArn@ property as follows:
--
--     @{\"RoleArn\" : \"arn:aws:iam::123456789012:role\/LaunchRole\"}@
--
--     Specify the @LocalRoleName@ property as follows:
--
--     @{\"LocalRoleName\": \"SCBasicLaunchRole\"}@
--
--     If you specify the @LocalRoleName@ property, when an account uses
--     the launch constraint, the IAM role with that name in the account
--     will be used. This allows launch-role constraints to be
--     account-agnostic so the administrator can create fewer resources per
--     shared account.
--
--     The given role name must exist in the account used to create the
--     launch constraint and the account of the user who launches a product
--     with this launch constraint.
--
--     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
--
--     You also cannot have more than one @LAUNCH@ constraint on a product
--     and portfolio.
--
-- [NOTIFICATION]
--     Specify the @NotificationArns@ property as follows:
--
--     @{\"NotificationArns\" : [\"arn:aws:sns:us-east-1:123456789012:Topic\"]}@
--
-- [RESOURCE_UPDATE]
--     Specify the @TagUpdatesOnProvisionedProduct@ property as follows:
--
--     @{\"Version\":\"2.0\",\"Properties\":{\"TagUpdateOnProvisionedProduct\":\"String\"}}@
--
--     The @TagUpdatesOnProvisionedProduct@ property accepts a string value
--     of @ALLOWED@ or @NOT_ALLOWED@.
--
-- [STACKSET]
--     Specify the @Parameters@ property as follows:
--
--     @{\"Version\": \"String\", \"Properties\": {\"AccountList\": [ \"String\" ], \"RegionList\": [ \"String\" ], \"AdminRole\": \"String\", \"ExecutionRole\": \"String\"}}@
--
--     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
--
--     You also cannot have more than one @STACKSET@ constraint on a
--     product and portfolio.
--
--     Products with a @STACKSET@ constraint will launch an AWS
--     CloudFormation stack set.
--
-- [TEMPLATE]
--     Specify the @Rules@ property. For more information, see
--     <http://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html Template Constraint Rules>.
--
-- 'description', 'updateConstraint_description' - The updated description of the constraint.
--
-- 'id', 'updateConstraint_id' - The identifier of the constraint.
newUpdateConstraint ::
  -- | 'id'
  Prelude.Text ->
  UpdateConstraint
newUpdateConstraint :: Text -> UpdateConstraint
newUpdateConstraint Text
pId_ =
  UpdateConstraint' :: Maybe Text -> Maybe Text -> Maybe Text -> Text -> UpdateConstraint
UpdateConstraint'
    { $sel:acceptLanguage:UpdateConstraint' :: Maybe Text
acceptLanguage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:parameters:UpdateConstraint' :: Maybe Text
parameters = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateConstraint' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateConstraint' :: Text
id = Text
pId_
    }

-- | The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
updateConstraint_acceptLanguage :: Lens.Lens' UpdateConstraint (Prelude.Maybe Prelude.Text)
updateConstraint_acceptLanguage :: (Maybe Text -> f (Maybe Text))
-> UpdateConstraint -> f UpdateConstraint
updateConstraint_acceptLanguage = (UpdateConstraint -> Maybe Text)
-> (UpdateConstraint -> Maybe Text -> UpdateConstraint)
-> Lens UpdateConstraint UpdateConstraint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraint' {Maybe Text
acceptLanguage :: Maybe Text
$sel:acceptLanguage:UpdateConstraint' :: UpdateConstraint -> Maybe Text
acceptLanguage} -> Maybe Text
acceptLanguage) (\s :: UpdateConstraint
s@UpdateConstraint' {} Maybe Text
a -> UpdateConstraint
s {$sel:acceptLanguage:UpdateConstraint' :: Maybe Text
acceptLanguage = Maybe Text
a} :: UpdateConstraint)

-- | The constraint parameters, in JSON format. The syntax depends on the
-- constraint type as follows:
--
-- [LAUNCH]
--     You are required to specify either the @RoleArn@ or the
--     @LocalRoleName@ but can\'t use both.
--
--     Specify the @RoleArn@ property as follows:
--
--     @{\"RoleArn\" : \"arn:aws:iam::123456789012:role\/LaunchRole\"}@
--
--     Specify the @LocalRoleName@ property as follows:
--
--     @{\"LocalRoleName\": \"SCBasicLaunchRole\"}@
--
--     If you specify the @LocalRoleName@ property, when an account uses
--     the launch constraint, the IAM role with that name in the account
--     will be used. This allows launch-role constraints to be
--     account-agnostic so the administrator can create fewer resources per
--     shared account.
--
--     The given role name must exist in the account used to create the
--     launch constraint and the account of the user who launches a product
--     with this launch constraint.
--
--     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
--
--     You also cannot have more than one @LAUNCH@ constraint on a product
--     and portfolio.
--
-- [NOTIFICATION]
--     Specify the @NotificationArns@ property as follows:
--
--     @{\"NotificationArns\" : [\"arn:aws:sns:us-east-1:123456789012:Topic\"]}@
--
-- [RESOURCE_UPDATE]
--     Specify the @TagUpdatesOnProvisionedProduct@ property as follows:
--
--     @{\"Version\":\"2.0\",\"Properties\":{\"TagUpdateOnProvisionedProduct\":\"String\"}}@
--
--     The @TagUpdatesOnProvisionedProduct@ property accepts a string value
--     of @ALLOWED@ or @NOT_ALLOWED@.
--
-- [STACKSET]
--     Specify the @Parameters@ property as follows:
--
--     @{\"Version\": \"String\", \"Properties\": {\"AccountList\": [ \"String\" ], \"RegionList\": [ \"String\" ], \"AdminRole\": \"String\", \"ExecutionRole\": \"String\"}}@
--
--     You cannot have both a @LAUNCH@ and a @STACKSET@ constraint.
--
--     You also cannot have more than one @STACKSET@ constraint on a
--     product and portfolio.
--
--     Products with a @STACKSET@ constraint will launch an AWS
--     CloudFormation stack set.
--
-- [TEMPLATE]
--     Specify the @Rules@ property. For more information, see
--     <http://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html Template Constraint Rules>.
updateConstraint_parameters :: Lens.Lens' UpdateConstraint (Prelude.Maybe Prelude.Text)
updateConstraint_parameters :: (Maybe Text -> f (Maybe Text))
-> UpdateConstraint -> f UpdateConstraint
updateConstraint_parameters = (UpdateConstraint -> Maybe Text)
-> (UpdateConstraint -> Maybe Text -> UpdateConstraint)
-> Lens UpdateConstraint UpdateConstraint (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraint' {Maybe Text
parameters :: Maybe Text
$sel:parameters:UpdateConstraint' :: UpdateConstraint -> Maybe Text
parameters} -> Maybe Text
parameters) (\s :: UpdateConstraint
s@UpdateConstraint' {} Maybe Text
a -> UpdateConstraint
s {$sel:parameters:UpdateConstraint' :: Maybe Text
parameters = Maybe Text
a} :: UpdateConstraint)

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

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

instance Core.AWSRequest UpdateConstraint where
  type
    AWSResponse UpdateConstraint =
      UpdateConstraintResponse
  request :: UpdateConstraint -> Request UpdateConstraint
request = Service -> UpdateConstraint -> Request UpdateConstraint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateConstraint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConstraint)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateConstraint))
-> Logger
-> Service
-> Proxy UpdateConstraint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateConstraint)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe RequestStatus
-> Maybe ConstraintDetail
-> Maybe Text
-> Int
-> UpdateConstraintResponse
UpdateConstraintResponse'
            (Maybe RequestStatus
 -> Maybe ConstraintDetail
 -> Maybe Text
 -> Int
 -> UpdateConstraintResponse)
-> Either String (Maybe RequestStatus)
-> Either
     String
     (Maybe ConstraintDetail
      -> Maybe Text -> Int -> UpdateConstraintResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe RequestStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Status")
            Either
  String
  (Maybe ConstraintDetail
   -> Maybe Text -> Int -> UpdateConstraintResponse)
-> Either String (Maybe ConstraintDetail)
-> Either String (Maybe Text -> Int -> UpdateConstraintResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ConstraintDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConstraintDetail")
            Either String (Maybe Text -> Int -> UpdateConstraintResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateConstraintResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConstraintParameters")
            Either String (Int -> UpdateConstraintResponse)
-> Either String Int -> Either String UpdateConstraintResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateConstraint

instance Prelude.NFData UpdateConstraint

instance Core.ToHeaders UpdateConstraint where
  toHeaders :: UpdateConstraint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateConstraint -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWS242ServiceCatalogService.UpdateConstraint" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateConstraint where
  toJSON :: UpdateConstraint -> Value
toJSON UpdateConstraint' {Maybe Text
Text
id :: Text
description :: Maybe Text
parameters :: Maybe Text
acceptLanguage :: Maybe Text
$sel:id:UpdateConstraint' :: UpdateConstraint -> Text
$sel:description:UpdateConstraint' :: UpdateConstraint -> Maybe Text
$sel:parameters:UpdateConstraint' :: UpdateConstraint -> Maybe Text
$sel:acceptLanguage:UpdateConstraint' :: UpdateConstraint -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AcceptLanguage" 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
acceptLanguage,
            (Text
"Parameters" 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
parameters,
            (Text
"Description" 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
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)
          ]
      )

instance Core.ToPath UpdateConstraint where
  toPath :: UpdateConstraint -> ByteString
toPath = ByteString -> UpdateConstraint -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery UpdateConstraint where
  toQuery :: UpdateConstraint -> QueryString
toQuery = QueryString -> UpdateConstraint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateConstraintResponse' smart constructor.
data UpdateConstraintResponse = UpdateConstraintResponse'
  { -- | The status of the current request.
    UpdateConstraintResponse -> Maybe RequestStatus
status :: Prelude.Maybe RequestStatus,
    -- | Information about the constraint.
    UpdateConstraintResponse -> Maybe ConstraintDetail
constraintDetail :: Prelude.Maybe ConstraintDetail,
    -- | The constraint parameters.
    UpdateConstraintResponse -> Maybe Text
constraintParameters :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateConstraintResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateConstraintResponse -> UpdateConstraintResponse -> Bool
(UpdateConstraintResponse -> UpdateConstraintResponse -> Bool)
-> (UpdateConstraintResponse -> UpdateConstraintResponse -> Bool)
-> Eq UpdateConstraintResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateConstraintResponse -> UpdateConstraintResponse -> Bool
$c/= :: UpdateConstraintResponse -> UpdateConstraintResponse -> Bool
== :: UpdateConstraintResponse -> UpdateConstraintResponse -> Bool
$c== :: UpdateConstraintResponse -> UpdateConstraintResponse -> Bool
Prelude.Eq, ReadPrec [UpdateConstraintResponse]
ReadPrec UpdateConstraintResponse
Int -> ReadS UpdateConstraintResponse
ReadS [UpdateConstraintResponse]
(Int -> ReadS UpdateConstraintResponse)
-> ReadS [UpdateConstraintResponse]
-> ReadPrec UpdateConstraintResponse
-> ReadPrec [UpdateConstraintResponse]
-> Read UpdateConstraintResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateConstraintResponse]
$creadListPrec :: ReadPrec [UpdateConstraintResponse]
readPrec :: ReadPrec UpdateConstraintResponse
$creadPrec :: ReadPrec UpdateConstraintResponse
readList :: ReadS [UpdateConstraintResponse]
$creadList :: ReadS [UpdateConstraintResponse]
readsPrec :: Int -> ReadS UpdateConstraintResponse
$creadsPrec :: Int -> ReadS UpdateConstraintResponse
Prelude.Read, Int -> UpdateConstraintResponse -> ShowS
[UpdateConstraintResponse] -> ShowS
UpdateConstraintResponse -> String
(Int -> UpdateConstraintResponse -> ShowS)
-> (UpdateConstraintResponse -> String)
-> ([UpdateConstraintResponse] -> ShowS)
-> Show UpdateConstraintResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateConstraintResponse] -> ShowS
$cshowList :: [UpdateConstraintResponse] -> ShowS
show :: UpdateConstraintResponse -> String
$cshow :: UpdateConstraintResponse -> String
showsPrec :: Int -> UpdateConstraintResponse -> ShowS
$cshowsPrec :: Int -> UpdateConstraintResponse -> ShowS
Prelude.Show, (forall x.
 UpdateConstraintResponse -> Rep UpdateConstraintResponse x)
-> (forall x.
    Rep UpdateConstraintResponse x -> UpdateConstraintResponse)
-> Generic UpdateConstraintResponse
forall x.
Rep UpdateConstraintResponse x -> UpdateConstraintResponse
forall x.
UpdateConstraintResponse -> Rep UpdateConstraintResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateConstraintResponse x -> UpdateConstraintResponse
$cfrom :: forall x.
UpdateConstraintResponse -> Rep UpdateConstraintResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateConstraintResponse' 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:
--
-- 'status', 'updateConstraintResponse_status' - The status of the current request.
--
-- 'constraintDetail', 'updateConstraintResponse_constraintDetail' - Information about the constraint.
--
-- 'constraintParameters', 'updateConstraintResponse_constraintParameters' - The constraint parameters.
--
-- 'httpStatus', 'updateConstraintResponse_httpStatus' - The response's http status code.
newUpdateConstraintResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateConstraintResponse
newUpdateConstraintResponse :: Int -> UpdateConstraintResponse
newUpdateConstraintResponse Int
pHttpStatus_ =
  UpdateConstraintResponse' :: Maybe RequestStatus
-> Maybe ConstraintDetail
-> Maybe Text
-> Int
-> UpdateConstraintResponse
UpdateConstraintResponse'
    { $sel:status:UpdateConstraintResponse' :: Maybe RequestStatus
status = Maybe RequestStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:constraintDetail:UpdateConstraintResponse' :: Maybe ConstraintDetail
constraintDetail = Maybe ConstraintDetail
forall a. Maybe a
Prelude.Nothing,
      $sel:constraintParameters:UpdateConstraintResponse' :: Maybe Text
constraintParameters = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateConstraintResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The status of the current request.
updateConstraintResponse_status :: Lens.Lens' UpdateConstraintResponse (Prelude.Maybe RequestStatus)
updateConstraintResponse_status :: (Maybe RequestStatus -> f (Maybe RequestStatus))
-> UpdateConstraintResponse -> f UpdateConstraintResponse
updateConstraintResponse_status = (UpdateConstraintResponse -> Maybe RequestStatus)
-> (UpdateConstraintResponse
    -> Maybe RequestStatus -> UpdateConstraintResponse)
-> Lens
     UpdateConstraintResponse
     UpdateConstraintResponse
     (Maybe RequestStatus)
     (Maybe RequestStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraintResponse' {Maybe RequestStatus
status :: Maybe RequestStatus
$sel:status:UpdateConstraintResponse' :: UpdateConstraintResponse -> Maybe RequestStatus
status} -> Maybe RequestStatus
status) (\s :: UpdateConstraintResponse
s@UpdateConstraintResponse' {} Maybe RequestStatus
a -> UpdateConstraintResponse
s {$sel:status:UpdateConstraintResponse' :: Maybe RequestStatus
status = Maybe RequestStatus
a} :: UpdateConstraintResponse)

-- | Information about the constraint.
updateConstraintResponse_constraintDetail :: Lens.Lens' UpdateConstraintResponse (Prelude.Maybe ConstraintDetail)
updateConstraintResponse_constraintDetail :: (Maybe ConstraintDetail -> f (Maybe ConstraintDetail))
-> UpdateConstraintResponse -> f UpdateConstraintResponse
updateConstraintResponse_constraintDetail = (UpdateConstraintResponse -> Maybe ConstraintDetail)
-> (UpdateConstraintResponse
    -> Maybe ConstraintDetail -> UpdateConstraintResponse)
-> Lens
     UpdateConstraintResponse
     UpdateConstraintResponse
     (Maybe ConstraintDetail)
     (Maybe ConstraintDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraintResponse' {Maybe ConstraintDetail
constraintDetail :: Maybe ConstraintDetail
$sel:constraintDetail:UpdateConstraintResponse' :: UpdateConstraintResponse -> Maybe ConstraintDetail
constraintDetail} -> Maybe ConstraintDetail
constraintDetail) (\s :: UpdateConstraintResponse
s@UpdateConstraintResponse' {} Maybe ConstraintDetail
a -> UpdateConstraintResponse
s {$sel:constraintDetail:UpdateConstraintResponse' :: Maybe ConstraintDetail
constraintDetail = Maybe ConstraintDetail
a} :: UpdateConstraintResponse)

-- | The constraint parameters.
updateConstraintResponse_constraintParameters :: Lens.Lens' UpdateConstraintResponse (Prelude.Maybe Prelude.Text)
updateConstraintResponse_constraintParameters :: (Maybe Text -> f (Maybe Text))
-> UpdateConstraintResponse -> f UpdateConstraintResponse
updateConstraintResponse_constraintParameters = (UpdateConstraintResponse -> Maybe Text)
-> (UpdateConstraintResponse
    -> Maybe Text -> UpdateConstraintResponse)
-> Lens
     UpdateConstraintResponse
     UpdateConstraintResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraintResponse' {Maybe Text
constraintParameters :: Maybe Text
$sel:constraintParameters:UpdateConstraintResponse' :: UpdateConstraintResponse -> Maybe Text
constraintParameters} -> Maybe Text
constraintParameters) (\s :: UpdateConstraintResponse
s@UpdateConstraintResponse' {} Maybe Text
a -> UpdateConstraintResponse
s {$sel:constraintParameters:UpdateConstraintResponse' :: Maybe Text
constraintParameters = Maybe Text
a} :: UpdateConstraintResponse)

-- | The response's http status code.
updateConstraintResponse_httpStatus :: Lens.Lens' UpdateConstraintResponse Prelude.Int
updateConstraintResponse_httpStatus :: (Int -> f Int)
-> UpdateConstraintResponse -> f UpdateConstraintResponse
updateConstraintResponse_httpStatus = (UpdateConstraintResponse -> Int)
-> (UpdateConstraintResponse -> Int -> UpdateConstraintResponse)
-> Lens UpdateConstraintResponse UpdateConstraintResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateConstraintResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateConstraintResponse' :: UpdateConstraintResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateConstraintResponse
s@UpdateConstraintResponse' {} Int
a -> UpdateConstraintResponse
s {$sel:httpStatus:UpdateConstraintResponse' :: Int
httpStatus = Int
a} :: UpdateConstraintResponse)

instance Prelude.NFData UpdateConstraintResponse