{-# 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.DeleteMatchmakingConfiguration
-- 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)
--
-- Permanently removes a FlexMatch matchmaking configuration. To delete,
-- specify the configuration name. A matchmaking configuration cannot be
-- deleted if it is being used in any active matchmaking tickets.
--
-- __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.DeleteMatchmakingConfiguration
  ( -- * Creating a Request
    DeleteMatchmakingConfiguration (..),
    newDeleteMatchmakingConfiguration,

    -- * Request Lenses
    deleteMatchmakingConfiguration_name,

    -- * Destructuring the Response
    DeleteMatchmakingConfigurationResponse (..),
    newDeleteMatchmakingConfigurationResponse,

    -- * Response Lenses
    deleteMatchmakingConfigurationResponse_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:/ 'newDeleteMatchmakingConfiguration' smart constructor.
data DeleteMatchmakingConfiguration = DeleteMatchmakingConfiguration'
  { -- | A unique identifier for the matchmaking configuration. You can use
    -- either the configuration name or ARN value.
    DeleteMatchmakingConfiguration -> Text
name :: Prelude.Text
  }
  deriving (DeleteMatchmakingConfiguration
-> DeleteMatchmakingConfiguration -> Bool
(DeleteMatchmakingConfiguration
 -> DeleteMatchmakingConfiguration -> Bool)
-> (DeleteMatchmakingConfiguration
    -> DeleteMatchmakingConfiguration -> Bool)
-> Eq DeleteMatchmakingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteMatchmakingConfiguration
-> DeleteMatchmakingConfiguration -> Bool
$c/= :: DeleteMatchmakingConfiguration
-> DeleteMatchmakingConfiguration -> Bool
== :: DeleteMatchmakingConfiguration
-> DeleteMatchmakingConfiguration -> Bool
$c== :: DeleteMatchmakingConfiguration
-> DeleteMatchmakingConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteMatchmakingConfiguration]
ReadPrec DeleteMatchmakingConfiguration
Int -> ReadS DeleteMatchmakingConfiguration
ReadS [DeleteMatchmakingConfiguration]
(Int -> ReadS DeleteMatchmakingConfiguration)
-> ReadS [DeleteMatchmakingConfiguration]
-> ReadPrec DeleteMatchmakingConfiguration
-> ReadPrec [DeleteMatchmakingConfiguration]
-> Read DeleteMatchmakingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteMatchmakingConfiguration]
$creadListPrec :: ReadPrec [DeleteMatchmakingConfiguration]
readPrec :: ReadPrec DeleteMatchmakingConfiguration
$creadPrec :: ReadPrec DeleteMatchmakingConfiguration
readList :: ReadS [DeleteMatchmakingConfiguration]
$creadList :: ReadS [DeleteMatchmakingConfiguration]
readsPrec :: Int -> ReadS DeleteMatchmakingConfiguration
$creadsPrec :: Int -> ReadS DeleteMatchmakingConfiguration
Prelude.Read, Int -> DeleteMatchmakingConfiguration -> ShowS
[DeleteMatchmakingConfiguration] -> ShowS
DeleteMatchmakingConfiguration -> String
(Int -> DeleteMatchmakingConfiguration -> ShowS)
-> (DeleteMatchmakingConfiguration -> String)
-> ([DeleteMatchmakingConfiguration] -> ShowS)
-> Show DeleteMatchmakingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteMatchmakingConfiguration] -> ShowS
$cshowList :: [DeleteMatchmakingConfiguration] -> ShowS
show :: DeleteMatchmakingConfiguration -> String
$cshow :: DeleteMatchmakingConfiguration -> String
showsPrec :: Int -> DeleteMatchmakingConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteMatchmakingConfiguration -> ShowS
Prelude.Show, (forall x.
 DeleteMatchmakingConfiguration
 -> Rep DeleteMatchmakingConfiguration x)
-> (forall x.
    Rep DeleteMatchmakingConfiguration x
    -> DeleteMatchmakingConfiguration)
-> Generic DeleteMatchmakingConfiguration
forall x.
Rep DeleteMatchmakingConfiguration x
-> DeleteMatchmakingConfiguration
forall x.
DeleteMatchmakingConfiguration
-> Rep DeleteMatchmakingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteMatchmakingConfiguration x
-> DeleteMatchmakingConfiguration
$cfrom :: forall x.
DeleteMatchmakingConfiguration
-> Rep DeleteMatchmakingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteMatchmakingConfiguration' 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', 'deleteMatchmakingConfiguration_name' - A unique identifier for the matchmaking configuration. You can use
-- either the configuration name or ARN value.
newDeleteMatchmakingConfiguration ::
  -- | 'name'
  Prelude.Text ->
  DeleteMatchmakingConfiguration
newDeleteMatchmakingConfiguration :: Text -> DeleteMatchmakingConfiguration
newDeleteMatchmakingConfiguration Text
pName_ =
  DeleteMatchmakingConfiguration' :: Text -> DeleteMatchmakingConfiguration
DeleteMatchmakingConfiguration' {$sel:name:DeleteMatchmakingConfiguration' :: Text
name = Text
pName_}

-- | A unique identifier for the matchmaking configuration. You can use
-- either the configuration name or ARN value.
deleteMatchmakingConfiguration_name :: Lens.Lens' DeleteMatchmakingConfiguration Prelude.Text
deleteMatchmakingConfiguration_name :: (Text -> f Text)
-> DeleteMatchmakingConfiguration
-> f DeleteMatchmakingConfiguration
deleteMatchmakingConfiguration_name = (DeleteMatchmakingConfiguration -> Text)
-> (DeleteMatchmakingConfiguration
    -> Text -> DeleteMatchmakingConfiguration)
-> Lens
     DeleteMatchmakingConfiguration
     DeleteMatchmakingConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteMatchmakingConfiguration' {Text
name :: Text
$sel:name:DeleteMatchmakingConfiguration' :: DeleteMatchmakingConfiguration -> Text
name} -> Text
name) (\s :: DeleteMatchmakingConfiguration
s@DeleteMatchmakingConfiguration' {} Text
a -> DeleteMatchmakingConfiguration
s {$sel:name:DeleteMatchmakingConfiguration' :: Text
name = Text
a} :: DeleteMatchmakingConfiguration)

instance
  Core.AWSRequest
    DeleteMatchmakingConfiguration
  where
  type
    AWSResponse DeleteMatchmakingConfiguration =
      DeleteMatchmakingConfigurationResponse
  request :: DeleteMatchmakingConfiguration
-> Request DeleteMatchmakingConfiguration
request = Service
-> DeleteMatchmakingConfiguration
-> Request DeleteMatchmakingConfiguration
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteMatchmakingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteMatchmakingConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteMatchmakingConfiguration))
-> Logger
-> Service
-> Proxy DeleteMatchmakingConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteMatchmakingConfiguration)))
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 -> DeleteMatchmakingConfigurationResponse
DeleteMatchmakingConfigurationResponse'
            (Int -> DeleteMatchmakingConfigurationResponse)
-> Either String Int
-> Either String DeleteMatchmakingConfigurationResponse
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
    DeleteMatchmakingConfiguration

instance
  Prelude.NFData
    DeleteMatchmakingConfiguration

instance
  Core.ToHeaders
    DeleteMatchmakingConfiguration
  where
  toHeaders :: DeleteMatchmakingConfiguration -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> DeleteMatchmakingConfiguration -> 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.DeleteMatchmakingConfiguration" ::
                          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 DeleteMatchmakingConfiguration where
  toJSON :: DeleteMatchmakingConfiguration -> Value
toJSON DeleteMatchmakingConfiguration' {Text
name :: Text
$sel:name:DeleteMatchmakingConfiguration' :: DeleteMatchmakingConfiguration -> 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 DeleteMatchmakingConfiguration where
  toPath :: DeleteMatchmakingConfiguration -> ByteString
toPath = ByteString -> DeleteMatchmakingConfiguration -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance
  Prelude.NFData
    DeleteMatchmakingConfigurationResponse