{-# 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.GetStageDeployment
-- 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 deployment.
module Amazonka.GamesParks.GetStageDeployment
  ( -- * Creating a Request
    GetStageDeployment (..),
    newGetStageDeployment,

    -- * Request Lenses
    getStageDeployment_deploymentId,
    getStageDeployment_gameName,
    getStageDeployment_stageName,

    -- * Destructuring the Response
    GetStageDeploymentResponse (..),
    newGetStageDeploymentResponse,

    -- * Response Lenses
    getStageDeploymentResponse_stageDeployment,
    getStageDeploymentResponse_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:/ 'newGetStageDeployment' smart constructor.
data GetStageDeployment = GetStageDeployment'
  { -- | The identifier of the stage deployment. @StartStageDeployment@ returns
    -- the identifier that you use here.
    GetStageDeployment -> Maybe Text
deploymentId :: Prelude.Maybe Prelude.Text,
    -- | The name of the game.
    GetStageDeployment -> Text
gameName :: Prelude.Text,
    -- | The name of the stage.
    GetStageDeployment -> Text
stageName :: Prelude.Text
  }
  deriving (GetStageDeployment -> GetStageDeployment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetStageDeployment -> GetStageDeployment -> Bool
$c/= :: GetStageDeployment -> GetStageDeployment -> Bool
== :: GetStageDeployment -> GetStageDeployment -> Bool
$c== :: GetStageDeployment -> GetStageDeployment -> Bool
Prelude.Eq, ReadPrec [GetStageDeployment]
ReadPrec GetStageDeployment
Int -> ReadS GetStageDeployment
ReadS [GetStageDeployment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetStageDeployment]
$creadListPrec :: ReadPrec [GetStageDeployment]
readPrec :: ReadPrec GetStageDeployment
$creadPrec :: ReadPrec GetStageDeployment
readList :: ReadS [GetStageDeployment]
$creadList :: ReadS [GetStageDeployment]
readsPrec :: Int -> ReadS GetStageDeployment
$creadsPrec :: Int -> ReadS GetStageDeployment
Prelude.Read, Int -> GetStageDeployment -> ShowS
[GetStageDeployment] -> ShowS
GetStageDeployment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetStageDeployment] -> ShowS
$cshowList :: [GetStageDeployment] -> ShowS
show :: GetStageDeployment -> String
$cshow :: GetStageDeployment -> String
showsPrec :: Int -> GetStageDeployment -> ShowS
$cshowsPrec :: Int -> GetStageDeployment -> ShowS
Prelude.Show, forall x. Rep GetStageDeployment x -> GetStageDeployment
forall x. GetStageDeployment -> Rep GetStageDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetStageDeployment x -> GetStageDeployment
$cfrom :: forall x. GetStageDeployment -> Rep GetStageDeployment x
Prelude.Generic)

-- |
-- Create a value of 'GetStageDeployment' 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:
--
-- 'deploymentId', 'getStageDeployment_deploymentId' - The identifier of the stage deployment. @StartStageDeployment@ returns
-- the identifier that you use here.
--
-- 'gameName', 'getStageDeployment_gameName' - The name of the game.
--
-- 'stageName', 'getStageDeployment_stageName' - The name of the stage.
newGetStageDeployment ::
  -- | 'gameName'
  Prelude.Text ->
  -- | 'stageName'
  Prelude.Text ->
  GetStageDeployment
newGetStageDeployment :: Text -> Text -> GetStageDeployment
newGetStageDeployment Text
pGameName_ Text
pStageName_ =
  GetStageDeployment'
    { $sel:deploymentId:GetStageDeployment' :: Maybe Text
deploymentId = forall a. Maybe a
Prelude.Nothing,
      $sel:gameName:GetStageDeployment' :: Text
gameName = Text
pGameName_,
      $sel:stageName:GetStageDeployment' :: Text
stageName = Text
pStageName_
    }

-- | The identifier of the stage deployment. @StartStageDeployment@ returns
-- the identifier that you use here.
getStageDeployment_deploymentId :: Lens.Lens' GetStageDeployment (Prelude.Maybe Prelude.Text)
getStageDeployment_deploymentId :: Lens' GetStageDeployment (Maybe Text)
getStageDeployment_deploymentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStageDeployment' {Maybe Text
deploymentId :: Maybe Text
$sel:deploymentId:GetStageDeployment' :: GetStageDeployment -> Maybe Text
deploymentId} -> Maybe Text
deploymentId) (\s :: GetStageDeployment
s@GetStageDeployment' {} Maybe Text
a -> GetStageDeployment
s {$sel:deploymentId:GetStageDeployment' :: Maybe Text
deploymentId = Maybe Text
a} :: GetStageDeployment)

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

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

instance Core.AWSRequest GetStageDeployment where
  type
    AWSResponse GetStageDeployment =
      GetStageDeploymentResponse
  request :: (Service -> Service)
-> GetStageDeployment -> Request GetStageDeployment
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 GetStageDeployment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetStageDeployment)))
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 StageDeploymentDetails -> Int -> GetStageDeploymentResponse
GetStageDeploymentResponse'
            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
"StageDeployment")
            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 GetStageDeployment where
  hashWithSalt :: Int -> GetStageDeployment -> Int
hashWithSalt Int
_salt GetStageDeployment' {Maybe Text
Text
stageName :: Text
gameName :: Text
deploymentId :: Maybe Text
$sel:stageName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:gameName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:deploymentId:GetStageDeployment' :: GetStageDeployment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentId
      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 GetStageDeployment where
  rnf :: GetStageDeployment -> ()
rnf GetStageDeployment' {Maybe Text
Text
stageName :: Text
gameName :: Text
deploymentId :: Maybe Text
$sel:stageName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:gameName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:deploymentId:GetStageDeployment' :: GetStageDeployment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 GetStageDeployment where
  toHeaders :: GetStageDeployment -> 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 GetStageDeployment where
  toPath :: GetStageDeployment -> ByteString
toPath GetStageDeployment' {Maybe Text
Text
stageName :: Text
gameName :: Text
deploymentId :: Maybe Text
$sel:stageName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:gameName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:deploymentId:GetStageDeployment' :: GetStageDeployment -> Maybe 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,
        ByteString
"/deployment"
      ]

instance Data.ToQuery GetStageDeployment where
  toQuery :: GetStageDeployment -> QueryString
toQuery GetStageDeployment' {Maybe Text
Text
stageName :: Text
gameName :: Text
deploymentId :: Maybe Text
$sel:stageName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:gameName:GetStageDeployment' :: GetStageDeployment -> Text
$sel:deploymentId:GetStageDeployment' :: GetStageDeployment -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"DeploymentId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
deploymentId]

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

-- |
-- Create a value of 'GetStageDeploymentResponse' 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:
--
-- 'stageDeployment', 'getStageDeploymentResponse_stageDeployment' - Properties that provide details of the stage deployment.
--
-- 'httpStatus', 'getStageDeploymentResponse_httpStatus' - The response's http status code.
newGetStageDeploymentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetStageDeploymentResponse
newGetStageDeploymentResponse :: Int -> GetStageDeploymentResponse
newGetStageDeploymentResponse Int
pHttpStatus_ =
  GetStageDeploymentResponse'
    { $sel:stageDeployment:GetStageDeploymentResponse' :: Maybe StageDeploymentDetails
stageDeployment =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetStageDeploymentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Properties that provide details of the stage deployment.
getStageDeploymentResponse_stageDeployment :: Lens.Lens' GetStageDeploymentResponse (Prelude.Maybe StageDeploymentDetails)
getStageDeploymentResponse_stageDeployment :: Lens' GetStageDeploymentResponse (Maybe StageDeploymentDetails)
getStageDeploymentResponse_stageDeployment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetStageDeploymentResponse' {Maybe StageDeploymentDetails
stageDeployment :: Maybe StageDeploymentDetails
$sel:stageDeployment:GetStageDeploymentResponse' :: GetStageDeploymentResponse -> Maybe StageDeploymentDetails
stageDeployment} -> Maybe StageDeploymentDetails
stageDeployment) (\s :: GetStageDeploymentResponse
s@GetStageDeploymentResponse' {} Maybe StageDeploymentDetails
a -> GetStageDeploymentResponse
s {$sel:stageDeployment:GetStageDeploymentResponse' :: Maybe StageDeploymentDetails
stageDeployment = Maybe StageDeploymentDetails
a} :: GetStageDeploymentResponse)

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

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