{-# 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.DescribeGameServerGroup
-- 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)
--
-- __This operation is used with the GameLift FleetIQ solution and game
-- server groups.__
--
-- Retrieves information on a game server group. This operation returns
-- only properties related to GameLift FleetIQ. To view or update
-- properties for the corresponding Auto Scaling group, such as launch
-- template, auto scaling policies, and maximum\/minimum group size, access
-- the Auto Scaling group directly.
--
-- To get attributes for a game server group, provide a group name or ARN
-- value. If successful, a GameServerGroup object is returned.
--
-- __Learn more__
--
-- <https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/gsg-intro.html GameLift FleetIQ Guide>
--
-- __Related actions__
--
-- CreateGameServerGroup | ListGameServerGroups | DescribeGameServerGroup |
-- UpdateGameServerGroup | DeleteGameServerGroup | ResumeGameServerGroup |
-- SuspendGameServerGroup | DescribeGameServerInstances |
-- <https://docs.aws.amazon.com/gamelift/latest/fleetiqguide/reference-awssdk-fleetiq.html All APIs by task>
module Amazonka.GameLift.DescribeGameServerGroup
  ( -- * Creating a Request
    DescribeGameServerGroup (..),
    newDescribeGameServerGroup,

    -- * Request Lenses
    describeGameServerGroup_gameServerGroupName,

    -- * Destructuring the Response
    DescribeGameServerGroupResponse (..),
    newDescribeGameServerGroupResponse,

    -- * Response Lenses
    describeGameServerGroupResponse_gameServerGroup,
    describeGameServerGroupResponse_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

-- | /See:/ 'newDescribeGameServerGroup' smart constructor.
data DescribeGameServerGroup = DescribeGameServerGroup'
  { -- | A unique identifier for the game server group. Use either the
    -- GameServerGroup name or ARN value.
    DescribeGameServerGroup -> Text
gameServerGroupName :: Prelude.Text
  }
  deriving (DescribeGameServerGroup -> DescribeGameServerGroup -> Bool
(DescribeGameServerGroup -> DescribeGameServerGroup -> Bool)
-> (DescribeGameServerGroup -> DescribeGameServerGroup -> Bool)
-> Eq DescribeGameServerGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameServerGroup -> DescribeGameServerGroup -> Bool
$c/= :: DescribeGameServerGroup -> DescribeGameServerGroup -> Bool
== :: DescribeGameServerGroup -> DescribeGameServerGroup -> Bool
$c== :: DescribeGameServerGroup -> DescribeGameServerGroup -> Bool
Prelude.Eq, ReadPrec [DescribeGameServerGroup]
ReadPrec DescribeGameServerGroup
Int -> ReadS DescribeGameServerGroup
ReadS [DescribeGameServerGroup]
(Int -> ReadS DescribeGameServerGroup)
-> ReadS [DescribeGameServerGroup]
-> ReadPrec DescribeGameServerGroup
-> ReadPrec [DescribeGameServerGroup]
-> Read DescribeGameServerGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameServerGroup]
$creadListPrec :: ReadPrec [DescribeGameServerGroup]
readPrec :: ReadPrec DescribeGameServerGroup
$creadPrec :: ReadPrec DescribeGameServerGroup
readList :: ReadS [DescribeGameServerGroup]
$creadList :: ReadS [DescribeGameServerGroup]
readsPrec :: Int -> ReadS DescribeGameServerGroup
$creadsPrec :: Int -> ReadS DescribeGameServerGroup
Prelude.Read, Int -> DescribeGameServerGroup -> ShowS
[DescribeGameServerGroup] -> ShowS
DescribeGameServerGroup -> String
(Int -> DescribeGameServerGroup -> ShowS)
-> (DescribeGameServerGroup -> String)
-> ([DescribeGameServerGroup] -> ShowS)
-> Show DescribeGameServerGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameServerGroup] -> ShowS
$cshowList :: [DescribeGameServerGroup] -> ShowS
show :: DescribeGameServerGroup -> String
$cshow :: DescribeGameServerGroup -> String
showsPrec :: Int -> DescribeGameServerGroup -> ShowS
$cshowsPrec :: Int -> DescribeGameServerGroup -> ShowS
Prelude.Show, (forall x.
 DescribeGameServerGroup -> Rep DescribeGameServerGroup x)
-> (forall x.
    Rep DescribeGameServerGroup x -> DescribeGameServerGroup)
-> Generic DescribeGameServerGroup
forall x. Rep DescribeGameServerGroup x -> DescribeGameServerGroup
forall x. DescribeGameServerGroup -> Rep DescribeGameServerGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGameServerGroup x -> DescribeGameServerGroup
$cfrom :: forall x. DescribeGameServerGroup -> Rep DescribeGameServerGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGameServerGroup' 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:
--
-- 'gameServerGroupName', 'describeGameServerGroup_gameServerGroupName' - A unique identifier for the game server group. Use either the
-- GameServerGroup name or ARN value.
newDescribeGameServerGroup ::
  -- | 'gameServerGroupName'
  Prelude.Text ->
  DescribeGameServerGroup
newDescribeGameServerGroup :: Text -> DescribeGameServerGroup
newDescribeGameServerGroup Text
pGameServerGroupName_ =
  DescribeGameServerGroup' :: Text -> DescribeGameServerGroup
DescribeGameServerGroup'
    { $sel:gameServerGroupName:DescribeGameServerGroup' :: Text
gameServerGroupName =
        Text
pGameServerGroupName_
    }

-- | A unique identifier for the game server group. Use either the
-- GameServerGroup name or ARN value.
describeGameServerGroup_gameServerGroupName :: Lens.Lens' DescribeGameServerGroup Prelude.Text
describeGameServerGroup_gameServerGroupName :: (Text -> f Text)
-> DescribeGameServerGroup -> f DescribeGameServerGroup
describeGameServerGroup_gameServerGroupName = (DescribeGameServerGroup -> Text)
-> (DescribeGameServerGroup -> Text -> DescribeGameServerGroup)
-> Lens DescribeGameServerGroup DescribeGameServerGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServerGroup' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:DescribeGameServerGroup' :: DescribeGameServerGroup -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: DescribeGameServerGroup
s@DescribeGameServerGroup' {} Text
a -> DescribeGameServerGroup
s {$sel:gameServerGroupName:DescribeGameServerGroup' :: Text
gameServerGroupName = Text
a} :: DescribeGameServerGroup)

instance Core.AWSRequest DescribeGameServerGroup where
  type
    AWSResponse DescribeGameServerGroup =
      DescribeGameServerGroupResponse
  request :: DescribeGameServerGroup -> Request DescribeGameServerGroup
request = Service
-> DescribeGameServerGroup -> Request DescribeGameServerGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeGameServerGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeGameServerGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeGameServerGroup))
-> Logger
-> Service
-> Proxy DescribeGameServerGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeGameServerGroup)))
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 GameServerGroup -> Int -> DescribeGameServerGroupResponse
DescribeGameServerGroupResponse'
            (Maybe GameServerGroup -> Int -> DescribeGameServerGroupResponse)
-> Either String (Maybe GameServerGroup)
-> Either String (Int -> DescribeGameServerGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GameServerGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GameServerGroup")
            Either String (Int -> DescribeGameServerGroupResponse)
-> Either String Int
-> Either String DescribeGameServerGroupResponse
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))
      )

instance Prelude.Hashable DescribeGameServerGroup

instance Prelude.NFData DescribeGameServerGroup

instance Core.ToHeaders DescribeGameServerGroup where
  toHeaders :: DescribeGameServerGroup -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeGameServerGroup -> 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.DescribeGameServerGroup" ::
                          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 DescribeGameServerGroup where
  toJSON :: DescribeGameServerGroup -> Value
toJSON DescribeGameServerGroup' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:DescribeGameServerGroup' :: DescribeGameServerGroup -> 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
"GameServerGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameServerGroupName)
          ]
      )

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

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

-- | /See:/ 'newDescribeGameServerGroupResponse' smart constructor.
data DescribeGameServerGroupResponse = DescribeGameServerGroupResponse'
  { -- | An object with the property settings for the requested game server group
    -- resource.
    DescribeGameServerGroupResponse -> Maybe GameServerGroup
gameServerGroup :: Prelude.Maybe GameServerGroup,
    -- | The response's http status code.
    DescribeGameServerGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeGameServerGroupResponse
-> DescribeGameServerGroupResponse -> Bool
(DescribeGameServerGroupResponse
 -> DescribeGameServerGroupResponse -> Bool)
-> (DescribeGameServerGroupResponse
    -> DescribeGameServerGroupResponse -> Bool)
-> Eq DescribeGameServerGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameServerGroupResponse
-> DescribeGameServerGroupResponse -> Bool
$c/= :: DescribeGameServerGroupResponse
-> DescribeGameServerGroupResponse -> Bool
== :: DescribeGameServerGroupResponse
-> DescribeGameServerGroupResponse -> Bool
$c== :: DescribeGameServerGroupResponse
-> DescribeGameServerGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGameServerGroupResponse]
ReadPrec DescribeGameServerGroupResponse
Int -> ReadS DescribeGameServerGroupResponse
ReadS [DescribeGameServerGroupResponse]
(Int -> ReadS DescribeGameServerGroupResponse)
-> ReadS [DescribeGameServerGroupResponse]
-> ReadPrec DescribeGameServerGroupResponse
-> ReadPrec [DescribeGameServerGroupResponse]
-> Read DescribeGameServerGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameServerGroupResponse]
$creadListPrec :: ReadPrec [DescribeGameServerGroupResponse]
readPrec :: ReadPrec DescribeGameServerGroupResponse
$creadPrec :: ReadPrec DescribeGameServerGroupResponse
readList :: ReadS [DescribeGameServerGroupResponse]
$creadList :: ReadS [DescribeGameServerGroupResponse]
readsPrec :: Int -> ReadS DescribeGameServerGroupResponse
$creadsPrec :: Int -> ReadS DescribeGameServerGroupResponse
Prelude.Read, Int -> DescribeGameServerGroupResponse -> ShowS
[DescribeGameServerGroupResponse] -> ShowS
DescribeGameServerGroupResponse -> String
(Int -> DescribeGameServerGroupResponse -> ShowS)
-> (DescribeGameServerGroupResponse -> String)
-> ([DescribeGameServerGroupResponse] -> ShowS)
-> Show DescribeGameServerGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameServerGroupResponse] -> ShowS
$cshowList :: [DescribeGameServerGroupResponse] -> ShowS
show :: DescribeGameServerGroupResponse -> String
$cshow :: DescribeGameServerGroupResponse -> String
showsPrec :: Int -> DescribeGameServerGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeGameServerGroupResponse -> ShowS
Prelude.Show, (forall x.
 DescribeGameServerGroupResponse
 -> Rep DescribeGameServerGroupResponse x)
-> (forall x.
    Rep DescribeGameServerGroupResponse x
    -> DescribeGameServerGroupResponse)
-> Generic DescribeGameServerGroupResponse
forall x.
Rep DescribeGameServerGroupResponse x
-> DescribeGameServerGroupResponse
forall x.
DescribeGameServerGroupResponse
-> Rep DescribeGameServerGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGameServerGroupResponse x
-> DescribeGameServerGroupResponse
$cfrom :: forall x.
DescribeGameServerGroupResponse
-> Rep DescribeGameServerGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeGameServerGroupResponse' 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:
--
-- 'gameServerGroup', 'describeGameServerGroupResponse_gameServerGroup' - An object with the property settings for the requested game server group
-- resource.
--
-- 'httpStatus', 'describeGameServerGroupResponse_httpStatus' - The response's http status code.
newDescribeGameServerGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeGameServerGroupResponse
newDescribeGameServerGroupResponse :: Int -> DescribeGameServerGroupResponse
newDescribeGameServerGroupResponse Int
pHttpStatus_ =
  DescribeGameServerGroupResponse' :: Maybe GameServerGroup -> Int -> DescribeGameServerGroupResponse
DescribeGameServerGroupResponse'
    { $sel:gameServerGroup:DescribeGameServerGroupResponse' :: Maybe GameServerGroup
gameServerGroup =
        Maybe GameServerGroup
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeGameServerGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object with the property settings for the requested game server group
-- resource.
describeGameServerGroupResponse_gameServerGroup :: Lens.Lens' DescribeGameServerGroupResponse (Prelude.Maybe GameServerGroup)
describeGameServerGroupResponse_gameServerGroup :: (Maybe GameServerGroup -> f (Maybe GameServerGroup))
-> DescribeGameServerGroupResponse
-> f DescribeGameServerGroupResponse
describeGameServerGroupResponse_gameServerGroup = (DescribeGameServerGroupResponse -> Maybe GameServerGroup)
-> (DescribeGameServerGroupResponse
    -> Maybe GameServerGroup -> DescribeGameServerGroupResponse)
-> Lens
     DescribeGameServerGroupResponse
     DescribeGameServerGroupResponse
     (Maybe GameServerGroup)
     (Maybe GameServerGroup)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServerGroupResponse' {Maybe GameServerGroup
gameServerGroup :: Maybe GameServerGroup
$sel:gameServerGroup:DescribeGameServerGroupResponse' :: DescribeGameServerGroupResponse -> Maybe GameServerGroup
gameServerGroup} -> Maybe GameServerGroup
gameServerGroup) (\s :: DescribeGameServerGroupResponse
s@DescribeGameServerGroupResponse' {} Maybe GameServerGroup
a -> DescribeGameServerGroupResponse
s {$sel:gameServerGroup:DescribeGameServerGroupResponse' :: Maybe GameServerGroup
gameServerGroup = Maybe GameServerGroup
a} :: DescribeGameServerGroupResponse)

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

instance
  Prelude.NFData
    DescribeGameServerGroupResponse