{-# 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.Nimble.GetLaunchProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Get a launch profile.
module Amazonka.Nimble.GetLaunchProfile
  ( -- * Creating a Request
    GetLaunchProfile (..),
    newGetLaunchProfile,

    -- * Request Lenses
    getLaunchProfile_launchProfileId,
    getLaunchProfile_studioId,

    -- * Destructuring the Response
    GetLaunchProfileResponse (..),
    newGetLaunchProfileResponse,

    -- * Response Lenses
    getLaunchProfileResponse_launchProfile,
    getLaunchProfileResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetLaunchProfile' smart constructor.
data GetLaunchProfile = GetLaunchProfile'
  { -- | The ID of the launch profile used to control access from the streaming
    -- session.
    GetLaunchProfile -> Text
launchProfileId :: Prelude.Text,
    -- | The studio ID.
    GetLaunchProfile -> Text
studioId :: Prelude.Text
  }
  deriving (GetLaunchProfile -> GetLaunchProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLaunchProfile -> GetLaunchProfile -> Bool
$c/= :: GetLaunchProfile -> GetLaunchProfile -> Bool
== :: GetLaunchProfile -> GetLaunchProfile -> Bool
$c== :: GetLaunchProfile -> GetLaunchProfile -> Bool
Prelude.Eq, ReadPrec [GetLaunchProfile]
ReadPrec GetLaunchProfile
Int -> ReadS GetLaunchProfile
ReadS [GetLaunchProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLaunchProfile]
$creadListPrec :: ReadPrec [GetLaunchProfile]
readPrec :: ReadPrec GetLaunchProfile
$creadPrec :: ReadPrec GetLaunchProfile
readList :: ReadS [GetLaunchProfile]
$creadList :: ReadS [GetLaunchProfile]
readsPrec :: Int -> ReadS GetLaunchProfile
$creadsPrec :: Int -> ReadS GetLaunchProfile
Prelude.Read, Int -> GetLaunchProfile -> ShowS
[GetLaunchProfile] -> ShowS
GetLaunchProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLaunchProfile] -> ShowS
$cshowList :: [GetLaunchProfile] -> ShowS
show :: GetLaunchProfile -> String
$cshow :: GetLaunchProfile -> String
showsPrec :: Int -> GetLaunchProfile -> ShowS
$cshowsPrec :: Int -> GetLaunchProfile -> ShowS
Prelude.Show, forall x. Rep GetLaunchProfile x -> GetLaunchProfile
forall x. GetLaunchProfile -> Rep GetLaunchProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLaunchProfile x -> GetLaunchProfile
$cfrom :: forall x. GetLaunchProfile -> Rep GetLaunchProfile x
Prelude.Generic)

-- |
-- Create a value of 'GetLaunchProfile' 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:
--
-- 'launchProfileId', 'getLaunchProfile_launchProfileId' - The ID of the launch profile used to control access from the streaming
-- session.
--
-- 'studioId', 'getLaunchProfile_studioId' - The studio ID.
newGetLaunchProfile ::
  -- | 'launchProfileId'
  Prelude.Text ->
  -- | 'studioId'
  Prelude.Text ->
  GetLaunchProfile
newGetLaunchProfile :: Text -> Text -> GetLaunchProfile
newGetLaunchProfile Text
pLaunchProfileId_ Text
pStudioId_ =
  GetLaunchProfile'
    { $sel:launchProfileId:GetLaunchProfile' :: Text
launchProfileId =
        Text
pLaunchProfileId_,
      $sel:studioId:GetLaunchProfile' :: Text
studioId = Text
pStudioId_
    }

-- | The ID of the launch profile used to control access from the streaming
-- session.
getLaunchProfile_launchProfileId :: Lens.Lens' GetLaunchProfile Prelude.Text
getLaunchProfile_launchProfileId :: Lens' GetLaunchProfile Text
getLaunchProfile_launchProfileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfile' {Text
launchProfileId :: Text
$sel:launchProfileId:GetLaunchProfile' :: GetLaunchProfile -> Text
launchProfileId} -> Text
launchProfileId) (\s :: GetLaunchProfile
s@GetLaunchProfile' {} Text
a -> GetLaunchProfile
s {$sel:launchProfileId:GetLaunchProfile' :: Text
launchProfileId = Text
a} :: GetLaunchProfile)

-- | The studio ID.
getLaunchProfile_studioId :: Lens.Lens' GetLaunchProfile Prelude.Text
getLaunchProfile_studioId :: Lens' GetLaunchProfile Text
getLaunchProfile_studioId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfile' {Text
studioId :: Text
$sel:studioId:GetLaunchProfile' :: GetLaunchProfile -> Text
studioId} -> Text
studioId) (\s :: GetLaunchProfile
s@GetLaunchProfile' {} Text
a -> GetLaunchProfile
s {$sel:studioId:GetLaunchProfile' :: Text
studioId = Text
a} :: GetLaunchProfile)

instance Core.AWSRequest GetLaunchProfile where
  type
    AWSResponse GetLaunchProfile =
      GetLaunchProfileResponse
  request :: (Service -> Service)
-> GetLaunchProfile -> Request GetLaunchProfile
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 GetLaunchProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetLaunchProfile)))
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 LaunchProfile -> Int -> GetLaunchProfileResponse
GetLaunchProfileResponse'
            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
"launchProfile")
            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 GetLaunchProfile where
  hashWithSalt :: Int -> GetLaunchProfile -> Int
hashWithSalt Int
_salt GetLaunchProfile' {Text
studioId :: Text
launchProfileId :: Text
$sel:studioId:GetLaunchProfile' :: GetLaunchProfile -> Text
$sel:launchProfileId:GetLaunchProfile' :: GetLaunchProfile -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
launchProfileId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioId

instance Prelude.NFData GetLaunchProfile where
  rnf :: GetLaunchProfile -> ()
rnf GetLaunchProfile' {Text
studioId :: Text
launchProfileId :: Text
$sel:studioId:GetLaunchProfile' :: GetLaunchProfile -> Text
$sel:launchProfileId:GetLaunchProfile' :: GetLaunchProfile -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
launchProfileId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
studioId

instance Data.ToHeaders GetLaunchProfile where
  toHeaders :: GetLaunchProfile -> 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 GetLaunchProfile where
  toPath :: GetLaunchProfile -> ByteString
toPath GetLaunchProfile' {Text
studioId :: Text
launchProfileId :: Text
$sel:studioId:GetLaunchProfile' :: GetLaunchProfile -> Text
$sel:launchProfileId:GetLaunchProfile' :: GetLaunchProfile -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
studioId,
        ByteString
"/launch-profiles/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
launchProfileId
      ]

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

-- | /See:/ 'newGetLaunchProfileResponse' smart constructor.
data GetLaunchProfileResponse = GetLaunchProfileResponse'
  { -- | The launch profile.
    GetLaunchProfileResponse -> Maybe LaunchProfile
launchProfile :: Prelude.Maybe LaunchProfile,
    -- | The response's http status code.
    GetLaunchProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool
$c/= :: GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool
== :: GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool
$c== :: GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool
Prelude.Eq, Int -> GetLaunchProfileResponse -> ShowS
[GetLaunchProfileResponse] -> ShowS
GetLaunchProfileResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLaunchProfileResponse] -> ShowS
$cshowList :: [GetLaunchProfileResponse] -> ShowS
show :: GetLaunchProfileResponse -> String
$cshow :: GetLaunchProfileResponse -> String
showsPrec :: Int -> GetLaunchProfileResponse -> ShowS
$cshowsPrec :: Int -> GetLaunchProfileResponse -> ShowS
Prelude.Show, forall x.
Rep GetLaunchProfileResponse x -> GetLaunchProfileResponse
forall x.
GetLaunchProfileResponse -> Rep GetLaunchProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetLaunchProfileResponse x -> GetLaunchProfileResponse
$cfrom :: forall x.
GetLaunchProfileResponse -> Rep GetLaunchProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetLaunchProfileResponse' 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:
--
-- 'launchProfile', 'getLaunchProfileResponse_launchProfile' - The launch profile.
--
-- 'httpStatus', 'getLaunchProfileResponse_httpStatus' - The response's http status code.
newGetLaunchProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLaunchProfileResponse
newGetLaunchProfileResponse :: Int -> GetLaunchProfileResponse
newGetLaunchProfileResponse Int
pHttpStatus_ =
  GetLaunchProfileResponse'
    { $sel:launchProfile:GetLaunchProfileResponse' :: Maybe LaunchProfile
launchProfile =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetLaunchProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The launch profile.
getLaunchProfileResponse_launchProfile :: Lens.Lens' GetLaunchProfileResponse (Prelude.Maybe LaunchProfile)
getLaunchProfileResponse_launchProfile :: Lens' GetLaunchProfileResponse (Maybe LaunchProfile)
getLaunchProfileResponse_launchProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfileResponse' {Maybe LaunchProfile
launchProfile :: Maybe LaunchProfile
$sel:launchProfile:GetLaunchProfileResponse' :: GetLaunchProfileResponse -> Maybe LaunchProfile
launchProfile} -> Maybe LaunchProfile
launchProfile) (\s :: GetLaunchProfileResponse
s@GetLaunchProfileResponse' {} Maybe LaunchProfile
a -> GetLaunchProfileResponse
s {$sel:launchProfile:GetLaunchProfileResponse' :: Maybe LaunchProfile
launchProfile = Maybe LaunchProfile
a} :: GetLaunchProfileResponse)

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

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