{-# 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.GamesParks.GetStage
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets information about a stage.
module Amazonka.GamesParks.GetStage
  ( -- * Creating a Request
    GetStage (..),
    newGetStage,

    -- * Request Lenses
    getStage_gameName,
    getStage_stageName,

    -- * Destructuring the Response
    GetStageResponse (..),
    newGetStageResponse,

    -- * Response Lenses
    getStageResponse_stage,
    getStageResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetStage' smart constructor.
data GetStage = GetStage'
  { -- | The name of the game.
    GetStage -> Text
gameName :: Prelude.Text,
    -- | The name of the stage.
    GetStage -> Text
stageName :: Prelude.Text
  }
  deriving (GetStage -> GetStage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStage -> GetStage -> Bool
$c/= :: GetStage -> GetStage -> Bool
== :: GetStage -> GetStage -> Bool
$c== :: GetStage -> GetStage -> Bool
Prelude.Eq, ReadPrec [GetStage]
ReadPrec GetStage
Int -> ReadS GetStage
ReadS [GetStage]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStage]
$creadListPrec :: ReadPrec [GetStage]
readPrec :: ReadPrec GetStage
$creadPrec :: ReadPrec GetStage
readList :: ReadS [GetStage]
$creadList :: ReadS [GetStage]
readsPrec :: Int -> ReadS GetStage
$creadsPrec :: Int -> ReadS GetStage
Prelude.Read, Int -> GetStage -> ShowS
[GetStage] -> ShowS
GetStage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStage] -> ShowS
$cshowList :: [GetStage] -> ShowS
show :: GetStage -> String
$cshow :: GetStage -> String
showsPrec :: Int -> GetStage -> ShowS
$cshowsPrec :: Int -> GetStage -> ShowS
Prelude.Show, forall x. Rep GetStage x -> GetStage
forall x. GetStage -> Rep GetStage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStage x -> GetStage
$cfrom :: forall x. GetStage -> Rep GetStage x
Prelude.Generic)

-- |
-- Create a value of 'GetStage' 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:
--
-- 'gameName', 'getStage_gameName' - The name of the game.
--
-- 'stageName', 'getStage_stageName' - The name of the stage.
newGetStage ::
  -- | 'gameName'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  GetStage
newGetStage :: Text -> Text -> GetStage
newGetStage Text
pGameName_ Text
pStageName_ =
  GetStage'
    { $sel:gameName:GetStage' :: Text
gameName = Text
pGameName_,
      $sel:stageName:GetStage' :: Text
stageName = Text
pStageName_
    }

-- | The name of the game.
getStage_gameName :: Lens.Lens' GetStage Prelude.Text
getStage_gameName :: Lens' GetStage Text
getStage_gameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStage' {Text
gameName :: Text
$sel:gameName:GetStage' :: GetStage -> Text
gameName} -> Text
gameName) (\s :: GetStage
s@GetStage' {} Text
a -> GetStage
s {$sel:gameName:GetStage' :: Text
gameName = Text
a} :: GetStage)

-- | The name of the stage.
getStage_stageName :: Lens.Lens' GetStage Prelude.Text
getStage_stageName :: Lens' GetStage Text
getStage_stageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStage' {Text
stageName :: Text
$sel:stageName:GetStage' :: GetStage -> Text
stageName} -> Text
stageName) (\s :: GetStage
s@GetStage' {} Text
a -> GetStage
s {$sel:stageName:GetStage' :: Text
stageName = Text
a} :: GetStage)

instance Core.AWSRequest GetStage where
  type AWSResponse GetStage = GetStageResponse
  request :: (Service -> Service) -> GetStage -> Request GetStage
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetStage
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetStage)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe StageDetails -> Int -> GetStageResponse
GetStageResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Stage")
            forall (f :: * -> *) a b. Applicative f => 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 GetStage where
  hashWithSalt :: Int -> GetStage -> Int
hashWithSalt Int
_salt GetStage' {Text
stageName :: Text
gameName :: Text
$sel:stageName:GetStage' :: GetStage -> Text
$sel:gameName:GetStage' :: GetStage -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stageName

instance Prelude.NFData GetStage where
  rnf :: GetStage -> ()
rnf GetStage' {Text
stageName :: Text
gameName :: Text
$sel:stageName:GetStage' :: GetStage -> Text
$sel:gameName:GetStage' :: GetStage -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
gameName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stageName

instance Data.ToHeaders GetStage where
  toHeaders :: GetStage -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath GetStage where
  toPath :: GetStage -> ByteString
toPath GetStage' {Text
stageName :: Text
gameName :: Text
$sel:stageName:GetStage' :: GetStage -> Text
$sel:gameName:GetStage' :: GetStage -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/game/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
gameName,
        ByteString
"/stage/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
stageName
      ]

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

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

-- |
-- Create a value of 'GetStageResponse' 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:
--
-- 'stage', 'getStageResponse_stage' - Properties that provide details of the stage.
--
-- 'httpStatus', 'getStageResponse_httpStatus' - The response's http status code.
newGetStageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetStageResponse
newGetStageResponse :: Int -> GetStageResponse
newGetStageResponse Int
pHttpStatus_ =
  GetStageResponse'
    { $sel:stage:GetStageResponse' :: Maybe StageDetails
stage = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetStageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Properties that provide details of the stage.
getStageResponse_stage :: Lens.Lens' GetStageResponse (Prelude.Maybe StageDetails)
getStageResponse_stage :: Lens' GetStageResponse (Maybe StageDetails)
getStageResponse_stage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStageResponse' {Maybe StageDetails
stage :: Maybe StageDetails
$sel:stage:GetStageResponse' :: GetStageResponse -> Maybe StageDetails
stage} -> Maybe StageDetails
stage) (\s :: GetStageResponse
s@GetStageResponse' {} Maybe StageDetails
a -> GetStageResponse
s {$sel:stage:GetStageResponse' :: Maybe StageDetails
stage = Maybe StageDetails
a} :: GetStageResponse)

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

instance Prelude.NFData GetStageResponse where
  rnf :: GetStageResponse -> ()
rnf GetStageResponse' {Int
Maybe StageDetails
httpStatus :: Int
stage :: Maybe StageDetails
$sel:httpStatus:GetStageResponse' :: GetStageResponse -> Int
$sel:stage:GetStageResponse' :: GetStageResponse -> Maybe StageDetails
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StageDetails
stage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus