{-# 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-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)
--
-- 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>
--
-- __Related actions__
--
-- CreateMatchmakingConfiguration | DescribeMatchmakingConfigurations |
-- UpdateMatchmakingConfiguration | DeleteMatchmakingConfiguration |
-- CreateMatchmakingRuleSet | DescribeMatchmakingRuleSets |
-- ValidateMatchmakingRuleSet | DeleteMatchmakingRuleSet |
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
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 Amazonka.GameLift.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | Represents the input for a request operation.
--
-- /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
(DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool)
-> (DeleteMatchmakingRuleSet -> DeleteMatchmakingRuleSet -> Bool)
-> Eq DeleteMatchmakingRuleSet
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]
(Int -> ReadS DeleteMatchmakingRuleSet)
-> ReadS [DeleteMatchmakingRuleSet]
-> ReadPrec DeleteMatchmakingRuleSet
-> ReadPrec [DeleteMatchmakingRuleSet]
-> Read 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
(Int -> DeleteMatchmakingRuleSet -> ShowS)
-> (DeleteMatchmakingRuleSet -> String)
-> ([DeleteMatchmakingRuleSet] -> ShowS)
-> Show DeleteMatchmakingRuleSet
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.
 DeleteMatchmakingRuleSet -> Rep DeleteMatchmakingRuleSet x)
-> (forall x.
    Rep DeleteMatchmakingRuleSet x -> DeleteMatchmakingRuleSet)
-> Generic DeleteMatchmakingRuleSet
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' :: Text -> DeleteMatchmakingRuleSet
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 :: (Text -> f Text)
-> DeleteMatchmakingRuleSet -> f DeleteMatchmakingRuleSet
deleteMatchmakingRuleSet_name = (DeleteMatchmakingRuleSet -> Text)
-> (DeleteMatchmakingRuleSet -> Text -> DeleteMatchmakingRuleSet)
-> Lens DeleteMatchmakingRuleSet DeleteMatchmakingRuleSet Text Text
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 :: DeleteMatchmakingRuleSet -> Request DeleteMatchmakingRuleSet
request = Service
-> DeleteMatchmakingRuleSet -> Request DeleteMatchmakingRuleSet
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMatchmakingRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMatchmakingRuleSet)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteMatchmakingRuleSet))
-> Logger
-> Service
-> Proxy DeleteMatchmakingRuleSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteMatchmakingRuleSet)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteMatchmakingRuleSetResponse
DeleteMatchmakingRuleSetResponse'
            (Int -> DeleteMatchmakingRuleSetResponse)
-> Either String Int
-> Either String DeleteMatchmakingRuleSetResponse
forall (f :: * -> *) a b. Functor 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 DeleteMatchmakingRuleSet

instance Prelude.NFData DeleteMatchmakingRuleSet

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

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

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

-- | Represents the returned data in response to a request operation.
--
-- /See:/ 'newDeleteMatchmakingRuleSetResponse' smart constructor.
data DeleteMatchmakingRuleSetResponse = DeleteMatchmakingRuleSetResponse'
  { -- | The response's http status code.
    DeleteMatchmakingRuleSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteMatchmakingRuleSetResponse
-> DeleteMatchmakingRuleSetResponse -> Bool
(DeleteMatchmakingRuleSetResponse
 -> DeleteMatchmakingRuleSetResponse -> Bool)
-> (DeleteMatchmakingRuleSetResponse
    -> DeleteMatchmakingRuleSetResponse -> Bool)
-> Eq DeleteMatchmakingRuleSetResponse
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]
(Int -> ReadS DeleteMatchmakingRuleSetResponse)
-> ReadS [DeleteMatchmakingRuleSetResponse]
-> ReadPrec DeleteMatchmakingRuleSetResponse
-> ReadPrec [DeleteMatchmakingRuleSetResponse]
-> Read 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
(Int -> DeleteMatchmakingRuleSetResponse -> ShowS)
-> (DeleteMatchmakingRuleSetResponse -> String)
-> ([DeleteMatchmakingRuleSetResponse] -> ShowS)
-> Show DeleteMatchmakingRuleSetResponse
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.
 DeleteMatchmakingRuleSetResponse
 -> Rep DeleteMatchmakingRuleSetResponse x)
-> (forall x.
    Rep DeleteMatchmakingRuleSetResponse x
    -> DeleteMatchmakingRuleSetResponse)
-> Generic DeleteMatchmakingRuleSetResponse
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' :: Int -> DeleteMatchmakingRuleSetResponse
DeleteMatchmakingRuleSetResponse'
    { $sel:httpStatus:DeleteMatchmakingRuleSetResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteMatchmakingRuleSetResponse_httpStatus :: Lens.Lens' DeleteMatchmakingRuleSetResponse Prelude.Int
deleteMatchmakingRuleSetResponse_httpStatus :: (Int -> f Int)
-> DeleteMatchmakingRuleSetResponse
-> f DeleteMatchmakingRuleSetResponse
deleteMatchmakingRuleSetResponse_httpStatus = (DeleteMatchmakingRuleSetResponse -> Int)
-> (DeleteMatchmakingRuleSetResponse
    -> Int -> DeleteMatchmakingRuleSetResponse)
-> Lens
     DeleteMatchmakingRuleSetResponse
     DeleteMatchmakingRuleSetResponse
     Int
     Int
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