{-# 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-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)
--
-- Get a launch profile.
module Amazonka.Nimble.GetLaunchProfile
  ( -- * Creating a Request
    GetLaunchProfile (..),
    newGetLaunchProfile,

    -- * Request Lenses
    getLaunchProfile_studioId,
    getLaunchProfile_launchProfileId,

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

    -- * Response Lenses
    getLaunchProfileResponse_launchProfile,
    getLaunchProfileResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 studio ID.
    GetLaunchProfile -> Text
studioId :: Prelude.Text,
    -- | The launch profile ID.
    GetLaunchProfile -> Text
launchProfileId :: Prelude.Text
  }
  deriving (GetLaunchProfile -> GetLaunchProfile -> Bool
(GetLaunchProfile -> GetLaunchProfile -> Bool)
-> (GetLaunchProfile -> GetLaunchProfile -> Bool)
-> Eq GetLaunchProfile
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]
(Int -> ReadS GetLaunchProfile)
-> ReadS [GetLaunchProfile]
-> ReadPrec GetLaunchProfile
-> ReadPrec [GetLaunchProfile]
-> Read 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
(Int -> GetLaunchProfile -> ShowS)
-> (GetLaunchProfile -> String)
-> ([GetLaunchProfile] -> ShowS)
-> Show GetLaunchProfile
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. GetLaunchProfile -> Rep GetLaunchProfile x)
-> (forall x. Rep GetLaunchProfile x -> GetLaunchProfile)
-> Generic GetLaunchProfile
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:
--
-- 'studioId', 'getLaunchProfile_studioId' - The studio ID.
--
-- 'launchProfileId', 'getLaunchProfile_launchProfileId' - The launch profile ID.
newGetLaunchProfile ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'launchProfileId'
  Prelude.Text ->
  GetLaunchProfile
newGetLaunchProfile :: Text -> Text -> GetLaunchProfile
newGetLaunchProfile Text
pStudioId_ Text
pLaunchProfileId_ =
  GetLaunchProfile' :: Text -> Text -> GetLaunchProfile
GetLaunchProfile'
    { $sel:studioId:GetLaunchProfile' :: Text
studioId = Text
pStudioId_,
      $sel:launchProfileId:GetLaunchProfile' :: Text
launchProfileId = Text
pLaunchProfileId_
    }

-- | The studio ID.
getLaunchProfile_studioId :: Lens.Lens' GetLaunchProfile Prelude.Text
getLaunchProfile_studioId :: (Text -> f Text) -> GetLaunchProfile -> f GetLaunchProfile
getLaunchProfile_studioId = (GetLaunchProfile -> Text)
-> (GetLaunchProfile -> Text -> GetLaunchProfile)
-> Lens GetLaunchProfile GetLaunchProfile Text Text
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)

-- | The launch profile ID.
getLaunchProfile_launchProfileId :: Lens.Lens' GetLaunchProfile Prelude.Text
getLaunchProfile_launchProfileId :: (Text -> f Text) -> GetLaunchProfile -> f GetLaunchProfile
getLaunchProfile_launchProfileId = (GetLaunchProfile -> Text)
-> (GetLaunchProfile -> Text -> GetLaunchProfile)
-> Lens GetLaunchProfile GetLaunchProfile Text Text
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)

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

instance Prelude.NFData GetLaunchProfile

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

instance Core.ToQuery GetLaunchProfile where
  toQuery :: GetLaunchProfile -> QueryString
toQuery = QueryString -> GetLaunchProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool)
-> (GetLaunchProfileResponse -> GetLaunchProfileResponse -> Bool)
-> Eq GetLaunchProfileResponse
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, ReadPrec [GetLaunchProfileResponse]
ReadPrec GetLaunchProfileResponse
Int -> ReadS GetLaunchProfileResponse
ReadS [GetLaunchProfileResponse]
(Int -> ReadS GetLaunchProfileResponse)
-> ReadS [GetLaunchProfileResponse]
-> ReadPrec GetLaunchProfileResponse
-> ReadPrec [GetLaunchProfileResponse]
-> Read GetLaunchProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLaunchProfileResponse]
$creadListPrec :: ReadPrec [GetLaunchProfileResponse]
readPrec :: ReadPrec GetLaunchProfileResponse
$creadPrec :: ReadPrec GetLaunchProfileResponse
readList :: ReadS [GetLaunchProfileResponse]
$creadList :: ReadS [GetLaunchProfileResponse]
readsPrec :: Int -> ReadS GetLaunchProfileResponse
$creadsPrec :: Int -> ReadS GetLaunchProfileResponse
Prelude.Read, Int -> GetLaunchProfileResponse -> ShowS
[GetLaunchProfileResponse] -> ShowS
GetLaunchProfileResponse -> String
(Int -> GetLaunchProfileResponse -> ShowS)
-> (GetLaunchProfileResponse -> String)
-> ([GetLaunchProfileResponse] -> ShowS)
-> Show GetLaunchProfileResponse
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.
 GetLaunchProfileResponse -> Rep GetLaunchProfileResponse x)
-> (forall x.
    Rep GetLaunchProfileResponse x -> GetLaunchProfileResponse)
-> Generic GetLaunchProfileResponse
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' :: Maybe LaunchProfile -> Int -> GetLaunchProfileResponse
GetLaunchProfileResponse'
    { $sel:launchProfile:GetLaunchProfileResponse' :: Maybe LaunchProfile
launchProfile =
        Maybe 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 :: (Maybe LaunchProfile -> f (Maybe LaunchProfile))
-> GetLaunchProfileResponse -> f GetLaunchProfileResponse
getLaunchProfileResponse_launchProfile = (GetLaunchProfileResponse -> Maybe LaunchProfile)
-> (GetLaunchProfileResponse
    -> Maybe LaunchProfile -> GetLaunchProfileResponse)
-> Lens
     GetLaunchProfileResponse
     GetLaunchProfileResponse
     (Maybe LaunchProfile)
     (Maybe 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 :: (Int -> f Int)
-> GetLaunchProfileResponse -> f GetLaunchProfileResponse
getLaunchProfileResponse_httpStatus = (GetLaunchProfileResponse -> Int)
-> (GetLaunchProfileResponse -> Int -> GetLaunchProfileResponse)
-> Lens GetLaunchProfileResponse GetLaunchProfileResponse Int Int
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