{-# 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.GameLift.DeleteMatchmakingRuleSet
-- 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 an existing matchmaking rule set. To delete the rule set,
-- provide the rule set name. Rule sets cannot be deleted if they are
-- currently being used by a matchmaking configuration.
--
-- __Learn more__
--
-- -   <https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-rulesets.html Build a rule set>
module Amazonka.GameLift.DeleteMatchmakingRuleSet
  ( -- * Creating a Request
    DeleteMatchmakingRuleSet (..),
    newDeleteMatchmakingRuleSet,

    -- * Request Lenses
    deleteMatchmakingRuleSet_name,

    -- * Destructuring the Response
    DeleteMatchmakingRuleSetResponse (..),
    newDeleteMatchmakingRuleSetResponse,

    -- * Response Lenses
    deleteMatchmakingRuleSetResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteMatchmakingRuleSet' smart constructor.
data DeleteMatchmakingRuleSet = DeleteMatchmakingRuleSet'
  { -- | A unique identifier for the matchmaking rule set to be deleted. (Note:
    -- The rule set name is different from the optional \"name\" field in the
    -- rule set body.) You can use either the rule set name or ARN value.
    DeleteMatchmakingRuleSet -> Text
name :: Prelude.Text
  }
  deriving (DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool
$c/= :: DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool
== :: DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool
$c== :: DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool
Prelude.Eq, ReadPrec [DeleteMatchmakingRuleSet]
ReadPrec DeleteMatchmakingRuleSet
Int -> ReadS DeleteMatchmakingRuleSet
ReadS [DeleteMatchmakingRuleSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMatchmakingRuleSet]
$creadListPrec :: ReadPrec [DeleteMatchmakingRuleSet]
readPrec :: ReadPrec DeleteMatchmakingRuleSet
$creadPrec :: ReadPrec DeleteMatchmakingRuleSet
readList :: ReadS [DeleteMatchmakingRuleSet]
$creadList :: ReadS [DeleteMatchmakingRuleSet]
readsPrec :: Int -> ReadS DeleteMatchmakingRuleSet
$creadsPrec :: Int -> ReadS DeleteMatchmakingRuleSet
Prelude.Read, Int -> DeleteMatchmakingRuleSet -> ShowS
[DeleteMatchmakingRuleSet] -> ShowS
DeleteMatchmakingRuleSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMatchmakingRuleSet] -> ShowS
$cshowList :: [DeleteMatchmakingRuleSet] -> ShowS
show :: DeleteMatchmakingRuleSet -> String
$cshow :: DeleteMatchmakingRuleSet -> String
showsPrec :: Int -> DeleteMatchmakingRuleSet -> ShowS
$cshowsPrec :: Int -> DeleteMatchmakingRuleSet -> ShowS
Prelude.Show, forall x.
Rep DeleteMatchmakingRuleSet x -> DeleteMatchmakingRuleSet
forall x.
DeleteMatchmakingRuleSet -> Rep DeleteMatchmakingRuleSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteMatchmakingRuleSet x -> DeleteMatchmakingRuleSet
$cfrom :: forall x.
DeleteMatchmakingRuleSet -> Rep DeleteMatchmakingRuleSet x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMatchmakingRuleSet' 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:
--
-- 'name', 'deleteMatchmakingRuleSet_name' - A unique identifier for the matchmaking rule set to be deleted. (Note:
-- The rule set name is different from the optional \"name\" field in the
-- rule set body.) You can use either the rule set name or ARN value.
newDeleteMatchmakingRuleSet ::
  -- | 'name'
  Prelude.Text ->
  DeleteMatchmakingRuleSet
newDeleteMatchmakingRuleSet :: Text -> DeleteMatchmakingRuleSet
newDeleteMatchmakingRuleSet Text
pName_ =
  DeleteMatchmakingRuleSet' {$sel:name:DeleteMatchmakingRuleSet' :: Text
name = Text
pName_}

-- | A unique identifier for the matchmaking rule set to be deleted. (Note:
-- The rule set name is different from the optional \"name\" field in the
-- rule set body.) You can use either the rule set name or ARN value.
deleteMatchmakingRuleSet_name :: Lens.Lens' DeleteMatchmakingRuleSet Prelude.Text
deleteMatchmakingRuleSet_name :: Lens' DeleteMatchmakingRuleSet Text
deleteMatchmakingRuleSet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMatchmakingRuleSet' {Text
name :: Text
$sel:name:DeleteMatchmakingRuleSet' :: DeleteMatchmakingRuleSet -> Text
name} -> Text
name) (\s :: DeleteMatchmakingRuleSet
s@DeleteMatchmakingRuleSet' {} Text
a -> DeleteMatchmakingRuleSet
s {$sel:name:DeleteMatchmakingRuleSet' :: Text
name = Text
a} :: DeleteMatchmakingRuleSet)

instance Core.AWSRequest DeleteMatchmakingRuleSet where
  type
    AWSResponse DeleteMatchmakingRuleSet =
      DeleteMatchmakingRuleSetResponse
  request :: (Service -> Service)
-> DeleteMatchmakingRuleSet -> Request DeleteMatchmakingRuleSet
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 DeleteMatchmakingRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMatchmakingRuleSet)))
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 -> DeleteMatchmakingRuleSetResponse
DeleteMatchmakingRuleSetResponse'
            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 DeleteMatchmakingRuleSet where
  hashWithSalt :: Int -> DeleteMatchmakingRuleSet -> Int
hashWithSalt Int
_salt DeleteMatchmakingRuleSet' {Text
name :: Text
$sel:name:DeleteMatchmakingRuleSet' :: DeleteMatchmakingRuleSet -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData DeleteMatchmakingRuleSet where
  rnf :: DeleteMatchmakingRuleSet -> ()
rnf DeleteMatchmakingRuleSet' {Text
name :: Text
$sel:name:DeleteMatchmakingRuleSet' :: DeleteMatchmakingRuleSet -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders DeleteMatchmakingRuleSet where
  toHeaders :: DeleteMatchmakingRuleSet -> 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
"GameLift.DeleteMatchmakingRuleSet" ::
                          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 DeleteMatchmakingRuleSet where
  toJSON :: DeleteMatchmakingRuleSet -> Value
toJSON DeleteMatchmakingRuleSet' {Text
name :: Text
$sel:name:DeleteMatchmakingRuleSet' :: DeleteMatchmakingRuleSet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

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

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

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

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

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

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