{-# 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.DeleteConstraint
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes the specified constraint.
--
-- A delegated admin is authorized to invoke this command.
module Amazonka.ServiceCatalog.DeleteConstraint
  ( -- * Creating a Request
    DeleteConstraint (..),
    newDeleteConstraint,

    -- * Request Lenses
    deleteConstraint_acceptLanguage,
    deleteConstraint_id,

    -- * Destructuring the Response
    DeleteConstraintResponse (..),
    newDeleteConstraintResponse,

    -- * Response Lenses
    deleteConstraintResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteConstraint' smart constructor.
data DeleteConstraint = DeleteConstraint'
  { -- | The language code.
    --
    -- -   @en@ - English (default)
    --
    -- -   @jp@ - Japanese
    --
    -- -   @zh@ - Chinese
    DeleteConstraint -> Maybe Text
acceptLanguage :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the constraint.
    DeleteConstraint -> Text
id :: Prelude.Text
  }
  deriving (DeleteConstraint -> DeleteConstraint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConstraint -> DeleteConstraint -> Bool
$c/= :: DeleteConstraint -> DeleteConstraint -> Bool
== :: DeleteConstraint -> DeleteConstraint -> Bool
$c== :: DeleteConstraint -> DeleteConstraint -> Bool
Prelude.Eq, ReadPrec [DeleteConstraint]
ReadPrec DeleteConstraint
Int -> ReadS DeleteConstraint
ReadS [DeleteConstraint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConstraint]
$creadListPrec :: ReadPrec [DeleteConstraint]
readPrec :: ReadPrec DeleteConstraint
$creadPrec :: ReadPrec DeleteConstraint
readList :: ReadS [DeleteConstraint]
$creadList :: ReadS [DeleteConstraint]
readsPrec :: Int -> ReadS DeleteConstraint
$creadsPrec :: Int -> ReadS DeleteConstraint
Prelude.Read, Int -> DeleteConstraint -> ShowS
[DeleteConstraint] -> ShowS
DeleteConstraint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConstraint] -> ShowS
$cshowList :: [DeleteConstraint] -> ShowS
show :: DeleteConstraint -> String
$cshow :: DeleteConstraint -> String
showsPrec :: Int -> DeleteConstraint -> ShowS
$cshowsPrec :: Int -> DeleteConstraint -> ShowS
Prelude.Show, forall x. Rep DeleteConstraint x -> DeleteConstraint
forall x. DeleteConstraint -> Rep DeleteConstraint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConstraint x -> DeleteConstraint
$cfrom :: forall x. DeleteConstraint -> Rep DeleteConstraint x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConstraint' 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', 'deleteConstraint_acceptLanguage' - The language code.
--
-- -   @en@ - English (default)
--
-- -   @jp@ - Japanese
--
-- -   @zh@ - Chinese
--
-- 'id', 'deleteConstraint_id' - The identifier of the constraint.
newDeleteConstraint ::
  -- | 'id'
  Prelude.Text ->
  DeleteConstraint
newDeleteConstraint :: Text -> DeleteConstraint
newDeleteConstraint Text
pId_ =
  DeleteConstraint'
    { $sel:acceptLanguage:DeleteConstraint' :: Maybe Text
acceptLanguage = forall a. Maybe a
Prelude.Nothing,
      $sel:id:DeleteConstraint' :: Text
id = Text
pId_
    }

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

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

instance Core.AWSRequest DeleteConstraint where
  type
    AWSResponse DeleteConstraint =
      DeleteConstraintResponse
  request :: (Service -> Service)
-> DeleteConstraint -> Request DeleteConstraint
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteConstraint
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteConstraint)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteConstraintResponse
DeleteConstraintResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteConstraint where
  hashWithSalt :: Int -> DeleteConstraint -> Int
hashWithSalt Int
_salt DeleteConstraint' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteConstraint' :: DeleteConstraint -> Text
$sel:acceptLanguage:DeleteConstraint' :: DeleteConstraint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
acceptLanguage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance Prelude.NFData DeleteConstraint where
  rnf :: DeleteConstraint -> ()
rnf DeleteConstraint' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteConstraint' :: DeleteConstraint -> Text
$sel:acceptLanguage:DeleteConstraint' :: DeleteConstraint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
acceptLanguage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id

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

instance Data.ToJSON DeleteConstraint where
  toJSON :: DeleteConstraint -> Value
toJSON DeleteConstraint' {Maybe Text
Text
id :: Text
acceptLanguage :: Maybe Text
$sel:id:DeleteConstraint' :: DeleteConstraint -> Text
$sel:acceptLanguage:DeleteConstraint' :: DeleteConstraint -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AcceptLanguage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
acceptLanguage,
            forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)
          ]
      )

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

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

-- | /See:/ 'newDeleteConstraintResponse' smart constructor.
data DeleteConstraintResponse = DeleteConstraintResponse'
  { -- | The response's http status code.
    DeleteConstraintResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteConstraintResponse -> DeleteConstraintResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConstraintResponse -> DeleteConstraintResponse -> Bool
$c/= :: DeleteConstraintResponse -> DeleteConstraintResponse -> Bool
== :: DeleteConstraintResponse -> DeleteConstraintResponse -> Bool
$c== :: DeleteConstraintResponse -> DeleteConstraintResponse -> Bool
Prelude.Eq, ReadPrec [DeleteConstraintResponse]
ReadPrec DeleteConstraintResponse
Int -> ReadS DeleteConstraintResponse
ReadS [DeleteConstraintResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConstraintResponse]
$creadListPrec :: ReadPrec [DeleteConstraintResponse]
readPrec :: ReadPrec DeleteConstraintResponse
$creadPrec :: ReadPrec DeleteConstraintResponse
readList :: ReadS [DeleteConstraintResponse]
$creadList :: ReadS [DeleteConstraintResponse]
readsPrec :: Int -> ReadS DeleteConstraintResponse
$creadsPrec :: Int -> ReadS DeleteConstraintResponse
Prelude.Read, Int -> DeleteConstraintResponse -> ShowS
[DeleteConstraintResponse] -> ShowS
DeleteConstraintResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConstraintResponse] -> ShowS
$cshowList :: [DeleteConstraintResponse] -> ShowS
show :: DeleteConstraintResponse -> String
$cshow :: DeleteConstraintResponse -> String
showsPrec :: Int -> DeleteConstraintResponse -> ShowS
$cshowsPrec :: Int -> DeleteConstraintResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteConstraintResponse x -> DeleteConstraintResponse
forall x.
DeleteConstraintResponse -> Rep DeleteConstraintResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteConstraintResponse x -> DeleteConstraintResponse
$cfrom :: forall x.
DeleteConstraintResponse -> Rep DeleteConstraintResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConstraintResponse' 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:
--
-- 'httpStatus', 'deleteConstraintResponse_httpStatus' - The response's http status code.
newDeleteConstraintResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteConstraintResponse
newDeleteConstraintResponse :: Int -> DeleteConstraintResponse
newDeleteConstraintResponse Int
pHttpStatus_ =
  DeleteConstraintResponse'
    { $sel:httpStatus:DeleteConstraintResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData DeleteConstraintResponse where
  rnf :: DeleteConstraintResponse -> ()
rnf DeleteConstraintResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteConstraintResponse' :: DeleteConstraintResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus