{-# 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.DescribeMatchmakingRuleSets
-- 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)
--
-- Retrieves the details for FlexMatch matchmaking rule sets. You can
-- request all existing rule sets for the Region, or provide a list of one
-- or more rule set names. When requesting multiple items, use the
-- pagination parameters to retrieve results as a set of sequential pages.
-- If successful, a rule set is returned for each requested name.
--
-- __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>
--
-- This operation returns paginated results.
module Amazonka.GameLift.DescribeMatchmakingRuleSets
  ( -- * Creating a Request
    DescribeMatchmakingRuleSets (..),
    newDescribeMatchmakingRuleSets,

    -- * Request Lenses
    describeMatchmakingRuleSets_nextToken,
    describeMatchmakingRuleSets_names,
    describeMatchmakingRuleSets_limit,

    -- * Destructuring the Response
    DescribeMatchmakingRuleSetsResponse (..),
    newDescribeMatchmakingRuleSetsResponse,

    -- * Response Lenses
    describeMatchmakingRuleSetsResponse_nextToken,
    describeMatchmakingRuleSetsResponse_httpStatus,
    describeMatchmakingRuleSetsResponse_ruleSets,
  )
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:/ 'newDescribeMatchmakingRuleSets' smart constructor.
data DescribeMatchmakingRuleSets = DescribeMatchmakingRuleSets'
  { -- | A token that indicates the start of the next sequential page of results.
    -- Use the token that is returned with a previous call to this operation.
    -- To start at the beginning of the result set, do not specify a value.
    DescribeMatchmakingRuleSets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of one or more matchmaking rule set names to retrieve details
    -- for. (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.
    DescribeMatchmakingRuleSets -> Maybe (NonEmpty Text)
names :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The maximum number of results to return. Use this parameter with
    -- @NextToken@ to get results as a set of sequential pages.
    DescribeMatchmakingRuleSets -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets -> Bool
(DescribeMatchmakingRuleSets
 -> DescribeMatchmakingRuleSets -> Bool)
-> (DescribeMatchmakingRuleSets
    -> DescribeMatchmakingRuleSets -> Bool)
-> Eq DescribeMatchmakingRuleSets
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets -> Bool
$c/= :: DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets -> Bool
== :: DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets -> Bool
$c== :: DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets -> Bool
Prelude.Eq, ReadPrec [DescribeMatchmakingRuleSets]
ReadPrec DescribeMatchmakingRuleSets
Int -> ReadS DescribeMatchmakingRuleSets
ReadS [DescribeMatchmakingRuleSets]
(Int -> ReadS DescribeMatchmakingRuleSets)
-> ReadS [DescribeMatchmakingRuleSets]
-> ReadPrec DescribeMatchmakingRuleSets
-> ReadPrec [DescribeMatchmakingRuleSets]
-> Read DescribeMatchmakingRuleSets
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMatchmakingRuleSets]
$creadListPrec :: ReadPrec [DescribeMatchmakingRuleSets]
readPrec :: ReadPrec DescribeMatchmakingRuleSets
$creadPrec :: ReadPrec DescribeMatchmakingRuleSets
readList :: ReadS [DescribeMatchmakingRuleSets]
$creadList :: ReadS [DescribeMatchmakingRuleSets]
readsPrec :: Int -> ReadS DescribeMatchmakingRuleSets
$creadsPrec :: Int -> ReadS DescribeMatchmakingRuleSets
Prelude.Read, Int -> DescribeMatchmakingRuleSets -> ShowS
[DescribeMatchmakingRuleSets] -> ShowS
DescribeMatchmakingRuleSets -> String
(Int -> DescribeMatchmakingRuleSets -> ShowS)
-> (DescribeMatchmakingRuleSets -> String)
-> ([DescribeMatchmakingRuleSets] -> ShowS)
-> Show DescribeMatchmakingRuleSets
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMatchmakingRuleSets] -> ShowS
$cshowList :: [DescribeMatchmakingRuleSets] -> ShowS
show :: DescribeMatchmakingRuleSets -> String
$cshow :: DescribeMatchmakingRuleSets -> String
showsPrec :: Int -> DescribeMatchmakingRuleSets -> ShowS
$cshowsPrec :: Int -> DescribeMatchmakingRuleSets -> ShowS
Prelude.Show, (forall x.
 DescribeMatchmakingRuleSets -> Rep DescribeMatchmakingRuleSets x)
-> (forall x.
    Rep DescribeMatchmakingRuleSets x -> DescribeMatchmakingRuleSets)
-> Generic DescribeMatchmakingRuleSets
forall x.
Rep DescribeMatchmakingRuleSets x -> DescribeMatchmakingRuleSets
forall x.
DescribeMatchmakingRuleSets -> Rep DescribeMatchmakingRuleSets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMatchmakingRuleSets x -> DescribeMatchmakingRuleSets
$cfrom :: forall x.
DescribeMatchmakingRuleSets -> Rep DescribeMatchmakingRuleSets x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMatchmakingRuleSets' 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:
--
-- 'nextToken', 'describeMatchmakingRuleSets_nextToken' - A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
--
-- 'names', 'describeMatchmakingRuleSets_names' - A list of one or more matchmaking rule set names to retrieve details
-- for. (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.
--
-- 'limit', 'describeMatchmakingRuleSets_limit' - The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
newDescribeMatchmakingRuleSets ::
  DescribeMatchmakingRuleSets
newDescribeMatchmakingRuleSets :: DescribeMatchmakingRuleSets
newDescribeMatchmakingRuleSets =
  DescribeMatchmakingRuleSets' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Natural
-> DescribeMatchmakingRuleSets
DescribeMatchmakingRuleSets'
    { $sel:nextToken:DescribeMatchmakingRuleSets' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:names:DescribeMatchmakingRuleSets' :: Maybe (NonEmpty Text)
names = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeMatchmakingRuleSets' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | A token that indicates the start of the next sequential page of results.
-- Use the token that is returned with a previous call to this operation.
-- To start at the beginning of the result set, do not specify a value.
describeMatchmakingRuleSets_nextToken :: Lens.Lens' DescribeMatchmakingRuleSets (Prelude.Maybe Prelude.Text)
describeMatchmakingRuleSets_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMatchmakingRuleSets -> f DescribeMatchmakingRuleSets
describeMatchmakingRuleSets_nextToken = (DescribeMatchmakingRuleSets -> Maybe Text)
-> (DescribeMatchmakingRuleSets
    -> Maybe Text -> DescribeMatchmakingRuleSets)
-> Lens
     DescribeMatchmakingRuleSets
     DescribeMatchmakingRuleSets
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMatchmakingRuleSets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMatchmakingRuleSets
s@DescribeMatchmakingRuleSets' {} Maybe Text
a -> DescribeMatchmakingRuleSets
s {$sel:nextToken:DescribeMatchmakingRuleSets' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMatchmakingRuleSets)

-- | A list of one or more matchmaking rule set names to retrieve details
-- for. (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.
describeMatchmakingRuleSets_names :: Lens.Lens' DescribeMatchmakingRuleSets (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeMatchmakingRuleSets_names :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeMatchmakingRuleSets -> f DescribeMatchmakingRuleSets
describeMatchmakingRuleSets_names = (DescribeMatchmakingRuleSets -> Maybe (NonEmpty Text))
-> (DescribeMatchmakingRuleSets
    -> Maybe (NonEmpty Text) -> DescribeMatchmakingRuleSets)
-> Lens
     DescribeMatchmakingRuleSets
     DescribeMatchmakingRuleSets
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMatchmakingRuleSets' {Maybe (NonEmpty Text)
names :: Maybe (NonEmpty Text)
$sel:names:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe (NonEmpty Text)
names} -> Maybe (NonEmpty Text)
names) (\s :: DescribeMatchmakingRuleSets
s@DescribeMatchmakingRuleSets' {} Maybe (NonEmpty Text)
a -> DescribeMatchmakingRuleSets
s {$sel:names:DescribeMatchmakingRuleSets' :: Maybe (NonEmpty Text)
names = Maybe (NonEmpty Text)
a} :: DescribeMatchmakingRuleSets) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeMatchmakingRuleSets -> f DescribeMatchmakingRuleSets)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeMatchmakingRuleSets
-> f DescribeMatchmakingRuleSets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of results to return. Use this parameter with
-- @NextToken@ to get results as a set of sequential pages.
describeMatchmakingRuleSets_limit :: Lens.Lens' DescribeMatchmakingRuleSets (Prelude.Maybe Prelude.Natural)
describeMatchmakingRuleSets_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeMatchmakingRuleSets -> f DescribeMatchmakingRuleSets
describeMatchmakingRuleSets_limit = (DescribeMatchmakingRuleSets -> Maybe Natural)
-> (DescribeMatchmakingRuleSets
    -> Maybe Natural -> DescribeMatchmakingRuleSets)
-> Lens
     DescribeMatchmakingRuleSets
     DescribeMatchmakingRuleSets
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMatchmakingRuleSets' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeMatchmakingRuleSets
s@DescribeMatchmakingRuleSets' {} Maybe Natural
a -> DescribeMatchmakingRuleSets
s {$sel:limit:DescribeMatchmakingRuleSets' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeMatchmakingRuleSets)

instance Core.AWSPager DescribeMatchmakingRuleSets where
  page :: DescribeMatchmakingRuleSets
-> AWSResponse DescribeMatchmakingRuleSets
-> Maybe DescribeMatchmakingRuleSets
page DescribeMatchmakingRuleSets
rq AWSResponse DescribeMatchmakingRuleSets
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMatchmakingRuleSets
DescribeMatchmakingRuleSetsResponse
rs
            DescribeMatchmakingRuleSetsResponse
-> Getting (First Text) DescribeMatchmakingRuleSetsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeMatchmakingRuleSetsResponse
-> Const (First Text) DescribeMatchmakingRuleSetsResponse
Lens' DescribeMatchmakingRuleSetsResponse (Maybe Text)
describeMatchmakingRuleSetsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeMatchmakingRuleSetsResponse
 -> Const (First Text) DescribeMatchmakingRuleSetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeMatchmakingRuleSetsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeMatchmakingRuleSets
forall a. Maybe a
Prelude.Nothing
    | [MatchmakingRuleSet] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeMatchmakingRuleSets
DescribeMatchmakingRuleSetsResponse
rs
            DescribeMatchmakingRuleSetsResponse
-> Getting
     [MatchmakingRuleSet]
     DescribeMatchmakingRuleSetsResponse
     [MatchmakingRuleSet]
-> [MatchmakingRuleSet]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [MatchmakingRuleSet]
  DescribeMatchmakingRuleSetsResponse
  [MatchmakingRuleSet]
Lens' DescribeMatchmakingRuleSetsResponse [MatchmakingRuleSet]
describeMatchmakingRuleSetsResponse_ruleSets
        ) =
      Maybe DescribeMatchmakingRuleSets
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeMatchmakingRuleSets -> Maybe DescribeMatchmakingRuleSets
forall a. a -> Maybe a
Prelude.Just (DescribeMatchmakingRuleSets -> Maybe DescribeMatchmakingRuleSets)
-> DescribeMatchmakingRuleSets -> Maybe DescribeMatchmakingRuleSets
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeMatchmakingRuleSets
rq
          DescribeMatchmakingRuleSets
-> (DescribeMatchmakingRuleSets -> DescribeMatchmakingRuleSets)
-> DescribeMatchmakingRuleSets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeMatchmakingRuleSets
-> Identity DescribeMatchmakingRuleSets
Lens
  DescribeMatchmakingRuleSets
  DescribeMatchmakingRuleSets
  (Maybe Text)
  (Maybe Text)
describeMatchmakingRuleSets_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeMatchmakingRuleSets
 -> Identity DescribeMatchmakingRuleSets)
-> Maybe Text
-> DescribeMatchmakingRuleSets
-> DescribeMatchmakingRuleSets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeMatchmakingRuleSets
DescribeMatchmakingRuleSetsResponse
rs
          DescribeMatchmakingRuleSetsResponse
-> Getting (First Text) DescribeMatchmakingRuleSetsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeMatchmakingRuleSetsResponse
-> Const (First Text) DescribeMatchmakingRuleSetsResponse
Lens' DescribeMatchmakingRuleSetsResponse (Maybe Text)
describeMatchmakingRuleSetsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeMatchmakingRuleSetsResponse
 -> Const (First Text) DescribeMatchmakingRuleSetsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeMatchmakingRuleSetsResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeMatchmakingRuleSets where
  type
    AWSResponse DescribeMatchmakingRuleSets =
      DescribeMatchmakingRuleSetsResponse
  request :: DescribeMatchmakingRuleSets -> Request DescribeMatchmakingRuleSets
request = Service
-> DescribeMatchmakingRuleSets
-> Request DescribeMatchmakingRuleSets
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeMatchmakingRuleSets
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeMatchmakingRuleSets)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeMatchmakingRuleSets))
-> Logger
-> Service
-> Proxy DescribeMatchmakingRuleSets
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeMatchmakingRuleSets)))
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 Text
-> Int
-> [MatchmakingRuleSet]
-> DescribeMatchmakingRuleSetsResponse
DescribeMatchmakingRuleSetsResponse'
            (Maybe Text
 -> Int
 -> [MatchmakingRuleSet]
 -> DescribeMatchmakingRuleSetsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> [MatchmakingRuleSet] -> DescribeMatchmakingRuleSetsResponse)
forall (f :: * -> *) a b. Functor 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
"NextToken")
            Either
  String
  (Int
   -> [MatchmakingRuleSet] -> DescribeMatchmakingRuleSetsResponse)
-> Either String Int
-> Either
     String
     ([MatchmakingRuleSet] -> DescribeMatchmakingRuleSetsResponse)
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))
            Either
  String
  ([MatchmakingRuleSet] -> DescribeMatchmakingRuleSetsResponse)
-> Either String [MatchmakingRuleSet]
-> Either String DescribeMatchmakingRuleSetsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [MatchmakingRuleSet])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"RuleSets" Either String (Maybe [MatchmakingRuleSet])
-> [MatchmakingRuleSet] -> Either String [MatchmakingRuleSet]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [MatchmakingRuleSet]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable DescribeMatchmakingRuleSets

instance Prelude.NFData DescribeMatchmakingRuleSets

instance Core.ToHeaders DescribeMatchmakingRuleSets where
  toHeaders :: DescribeMatchmakingRuleSets -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeMatchmakingRuleSets -> 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.DescribeMatchmakingRuleSets" ::
                          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 DescribeMatchmakingRuleSets where
  toJSON :: DescribeMatchmakingRuleSets -> Value
toJSON DescribeMatchmakingRuleSets' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
limit :: Maybe Natural
names :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
$sel:limit:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe Natural
$sel:names:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe (NonEmpty Text)
$sel:nextToken:DescribeMatchmakingRuleSets' :: DescribeMatchmakingRuleSets -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" 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
nextToken,
            (Text
"Names" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
names,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
          ]
      )

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

instance Core.ToQuery DescribeMatchmakingRuleSets where
  toQuery :: DescribeMatchmakingRuleSets -> QueryString
toQuery = QueryString -> DescribeMatchmakingRuleSets -> 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:/ 'newDescribeMatchmakingRuleSetsResponse' smart constructor.
data DescribeMatchmakingRuleSetsResponse = DescribeMatchmakingRuleSetsResponse'
  { -- | A token that indicates where to resume retrieving results on the next
    -- call to this operation. If no token is returned, these results represent
    -- the end of the list.
    DescribeMatchmakingRuleSetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeMatchmakingRuleSetsResponse -> Int
httpStatus :: Prelude.Int,
    -- | A collection of requested matchmaking rule set objects.
    DescribeMatchmakingRuleSetsResponse -> [MatchmakingRuleSet]
ruleSets :: [MatchmakingRuleSet]
  }
  deriving (DescribeMatchmakingRuleSetsResponse
-> DescribeMatchmakingRuleSetsResponse -> Bool
(DescribeMatchmakingRuleSetsResponse
 -> DescribeMatchmakingRuleSetsResponse -> Bool)
-> (DescribeMatchmakingRuleSetsResponse
    -> DescribeMatchmakingRuleSetsResponse -> Bool)
-> Eq DescribeMatchmakingRuleSetsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeMatchmakingRuleSetsResponse
-> DescribeMatchmakingRuleSetsResponse -> Bool
$c/= :: DescribeMatchmakingRuleSetsResponse
-> DescribeMatchmakingRuleSetsResponse -> Bool
== :: DescribeMatchmakingRuleSetsResponse
-> DescribeMatchmakingRuleSetsResponse -> Bool
$c== :: DescribeMatchmakingRuleSetsResponse
-> DescribeMatchmakingRuleSetsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeMatchmakingRuleSetsResponse]
ReadPrec DescribeMatchmakingRuleSetsResponse
Int -> ReadS DescribeMatchmakingRuleSetsResponse
ReadS [DescribeMatchmakingRuleSetsResponse]
(Int -> ReadS DescribeMatchmakingRuleSetsResponse)
-> ReadS [DescribeMatchmakingRuleSetsResponse]
-> ReadPrec DescribeMatchmakingRuleSetsResponse
-> ReadPrec [DescribeMatchmakingRuleSetsResponse]
-> Read DescribeMatchmakingRuleSetsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeMatchmakingRuleSetsResponse]
$creadListPrec :: ReadPrec [DescribeMatchmakingRuleSetsResponse]
readPrec :: ReadPrec DescribeMatchmakingRuleSetsResponse
$creadPrec :: ReadPrec DescribeMatchmakingRuleSetsResponse
readList :: ReadS [DescribeMatchmakingRuleSetsResponse]
$creadList :: ReadS [DescribeMatchmakingRuleSetsResponse]
readsPrec :: Int -> ReadS DescribeMatchmakingRuleSetsResponse
$creadsPrec :: Int -> ReadS DescribeMatchmakingRuleSetsResponse
Prelude.Read, Int -> DescribeMatchmakingRuleSetsResponse -> ShowS
[DescribeMatchmakingRuleSetsResponse] -> ShowS
DescribeMatchmakingRuleSetsResponse -> String
(Int -> DescribeMatchmakingRuleSetsResponse -> ShowS)
-> (DescribeMatchmakingRuleSetsResponse -> String)
-> ([DescribeMatchmakingRuleSetsResponse] -> ShowS)
-> Show DescribeMatchmakingRuleSetsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeMatchmakingRuleSetsResponse] -> ShowS
$cshowList :: [DescribeMatchmakingRuleSetsResponse] -> ShowS
show :: DescribeMatchmakingRuleSetsResponse -> String
$cshow :: DescribeMatchmakingRuleSetsResponse -> String
showsPrec :: Int -> DescribeMatchmakingRuleSetsResponse -> ShowS
$cshowsPrec :: Int -> DescribeMatchmakingRuleSetsResponse -> ShowS
Prelude.Show, (forall x.
 DescribeMatchmakingRuleSetsResponse
 -> Rep DescribeMatchmakingRuleSetsResponse x)
-> (forall x.
    Rep DescribeMatchmakingRuleSetsResponse x
    -> DescribeMatchmakingRuleSetsResponse)
-> Generic DescribeMatchmakingRuleSetsResponse
forall x.
Rep DescribeMatchmakingRuleSetsResponse x
-> DescribeMatchmakingRuleSetsResponse
forall x.
DescribeMatchmakingRuleSetsResponse
-> Rep DescribeMatchmakingRuleSetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeMatchmakingRuleSetsResponse x
-> DescribeMatchmakingRuleSetsResponse
$cfrom :: forall x.
DescribeMatchmakingRuleSetsResponse
-> Rep DescribeMatchmakingRuleSetsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeMatchmakingRuleSetsResponse' 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:
--
-- 'nextToken', 'describeMatchmakingRuleSetsResponse_nextToken' - A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
--
-- 'httpStatus', 'describeMatchmakingRuleSetsResponse_httpStatus' - The response's http status code.
--
-- 'ruleSets', 'describeMatchmakingRuleSetsResponse_ruleSets' - A collection of requested matchmaking rule set objects.
newDescribeMatchmakingRuleSetsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeMatchmakingRuleSetsResponse
newDescribeMatchmakingRuleSetsResponse :: Int -> DescribeMatchmakingRuleSetsResponse
newDescribeMatchmakingRuleSetsResponse Int
pHttpStatus_ =
  DescribeMatchmakingRuleSetsResponse' :: Maybe Text
-> Int
-> [MatchmakingRuleSet]
-> DescribeMatchmakingRuleSetsResponse
DescribeMatchmakingRuleSetsResponse'
    { $sel:nextToken:DescribeMatchmakingRuleSetsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeMatchmakingRuleSetsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:ruleSets:DescribeMatchmakingRuleSetsResponse' :: [MatchmakingRuleSet]
ruleSets = [MatchmakingRuleSet]
forall a. Monoid a => a
Prelude.mempty
    }

-- | A token that indicates where to resume retrieving results on the next
-- call to this operation. If no token is returned, these results represent
-- the end of the list.
describeMatchmakingRuleSetsResponse_nextToken :: Lens.Lens' DescribeMatchmakingRuleSetsResponse (Prelude.Maybe Prelude.Text)
describeMatchmakingRuleSetsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeMatchmakingRuleSetsResponse
-> f DescribeMatchmakingRuleSetsResponse
describeMatchmakingRuleSetsResponse_nextToken = (DescribeMatchmakingRuleSetsResponse -> Maybe Text)
-> (DescribeMatchmakingRuleSetsResponse
    -> Maybe Text -> DescribeMatchmakingRuleSetsResponse)
-> Lens' DescribeMatchmakingRuleSetsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMatchmakingRuleSetsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeMatchmakingRuleSetsResponse' :: DescribeMatchmakingRuleSetsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeMatchmakingRuleSetsResponse
s@DescribeMatchmakingRuleSetsResponse' {} Maybe Text
a -> DescribeMatchmakingRuleSetsResponse
s {$sel:nextToken:DescribeMatchmakingRuleSetsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeMatchmakingRuleSetsResponse)

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

-- | A collection of requested matchmaking rule set objects.
describeMatchmakingRuleSetsResponse_ruleSets :: Lens.Lens' DescribeMatchmakingRuleSetsResponse [MatchmakingRuleSet]
describeMatchmakingRuleSetsResponse_ruleSets :: ([MatchmakingRuleSet] -> f [MatchmakingRuleSet])
-> DescribeMatchmakingRuleSetsResponse
-> f DescribeMatchmakingRuleSetsResponse
describeMatchmakingRuleSetsResponse_ruleSets = (DescribeMatchmakingRuleSetsResponse -> [MatchmakingRuleSet])
-> (DescribeMatchmakingRuleSetsResponse
    -> [MatchmakingRuleSet] -> DescribeMatchmakingRuleSetsResponse)
-> Lens' DescribeMatchmakingRuleSetsResponse [MatchmakingRuleSet]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeMatchmakingRuleSetsResponse' {[MatchmakingRuleSet]
ruleSets :: [MatchmakingRuleSet]
$sel:ruleSets:DescribeMatchmakingRuleSetsResponse' :: DescribeMatchmakingRuleSetsResponse -> [MatchmakingRuleSet]
ruleSets} -> [MatchmakingRuleSet]
ruleSets) (\s :: DescribeMatchmakingRuleSetsResponse
s@DescribeMatchmakingRuleSetsResponse' {} [MatchmakingRuleSet]
a -> DescribeMatchmakingRuleSetsResponse
s {$sel:ruleSets:DescribeMatchmakingRuleSetsResponse' :: [MatchmakingRuleSet]
ruleSets = [MatchmakingRuleSet]
a} :: DescribeMatchmakingRuleSetsResponse) (([MatchmakingRuleSet] -> f [MatchmakingRuleSet])
 -> DescribeMatchmakingRuleSetsResponse
 -> f DescribeMatchmakingRuleSetsResponse)
-> (([MatchmakingRuleSet] -> f [MatchmakingRuleSet])
    -> [MatchmakingRuleSet] -> f [MatchmakingRuleSet])
-> ([MatchmakingRuleSet] -> f [MatchmakingRuleSet])
-> DescribeMatchmakingRuleSetsResponse
-> f DescribeMatchmakingRuleSetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([MatchmakingRuleSet] -> f [MatchmakingRuleSet])
-> [MatchmakingRuleSet] -> f [MatchmakingRuleSet]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    DescribeMatchmakingRuleSetsResponse