{-# 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.GetLaunchProfileMember
-- 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 user persona in launch profile membership.
module Amazonka.Nimble.GetLaunchProfileMember
  ( -- * Creating a Request
    GetLaunchProfileMember (..),
    newGetLaunchProfileMember,

    -- * Request Lenses
    getLaunchProfileMember_studioId,
    getLaunchProfileMember_principalId,
    getLaunchProfileMember_launchProfileId,

    -- * Destructuring the Response
    GetLaunchProfileMemberResponse (..),
    newGetLaunchProfileMemberResponse,

    -- * Response Lenses
    getLaunchProfileMemberResponse_member,
    getLaunchProfileMemberResponse_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:/ 'newGetLaunchProfileMember' smart constructor.
data GetLaunchProfileMember = GetLaunchProfileMember'
  { -- | The studio ID.
    GetLaunchProfileMember -> Text
studioId :: Prelude.Text,
    -- | The principal ID.
    GetLaunchProfileMember -> Text
principalId :: Prelude.Text,
    -- | The launch profile ID.
    GetLaunchProfileMember -> Text
launchProfileId :: Prelude.Text
  }
  deriving (GetLaunchProfileMember -> GetLaunchProfileMember -> Bool
(GetLaunchProfileMember -> GetLaunchProfileMember -> Bool)
-> (GetLaunchProfileMember -> GetLaunchProfileMember -> Bool)
-> Eq GetLaunchProfileMember
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetLaunchProfileMember -> GetLaunchProfileMember -> Bool
$c/= :: GetLaunchProfileMember -> GetLaunchProfileMember -> Bool
== :: GetLaunchProfileMember -> GetLaunchProfileMember -> Bool
$c== :: GetLaunchProfileMember -> GetLaunchProfileMember -> Bool
Prelude.Eq, ReadPrec [GetLaunchProfileMember]
ReadPrec GetLaunchProfileMember
Int -> ReadS GetLaunchProfileMember
ReadS [GetLaunchProfileMember]
(Int -> ReadS GetLaunchProfileMember)
-> ReadS [GetLaunchProfileMember]
-> ReadPrec GetLaunchProfileMember
-> ReadPrec [GetLaunchProfileMember]
-> Read GetLaunchProfileMember
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetLaunchProfileMember]
$creadListPrec :: ReadPrec [GetLaunchProfileMember]
readPrec :: ReadPrec GetLaunchProfileMember
$creadPrec :: ReadPrec GetLaunchProfileMember
readList :: ReadS [GetLaunchProfileMember]
$creadList :: ReadS [GetLaunchProfileMember]
readsPrec :: Int -> ReadS GetLaunchProfileMember
$creadsPrec :: Int -> ReadS GetLaunchProfileMember
Prelude.Read, Int -> GetLaunchProfileMember -> ShowS
[GetLaunchProfileMember] -> ShowS
GetLaunchProfileMember -> String
(Int -> GetLaunchProfileMember -> ShowS)
-> (GetLaunchProfileMember -> String)
-> ([GetLaunchProfileMember] -> ShowS)
-> Show GetLaunchProfileMember
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetLaunchProfileMember] -> ShowS
$cshowList :: [GetLaunchProfileMember] -> ShowS
show :: GetLaunchProfileMember -> String
$cshow :: GetLaunchProfileMember -> String
showsPrec :: Int -> GetLaunchProfileMember -> ShowS
$cshowsPrec :: Int -> GetLaunchProfileMember -> ShowS
Prelude.Show, (forall x. GetLaunchProfileMember -> Rep GetLaunchProfileMember x)
-> (forall x.
    Rep GetLaunchProfileMember x -> GetLaunchProfileMember)
-> Generic GetLaunchProfileMember
forall x. Rep GetLaunchProfileMember x -> GetLaunchProfileMember
forall x. GetLaunchProfileMember -> Rep GetLaunchProfileMember x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetLaunchProfileMember x -> GetLaunchProfileMember
$cfrom :: forall x. GetLaunchProfileMember -> Rep GetLaunchProfileMember x
Prelude.Generic)

-- |
-- Create a value of 'GetLaunchProfileMember' 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', 'getLaunchProfileMember_studioId' - The studio ID.
--
-- 'principalId', 'getLaunchProfileMember_principalId' - The principal ID.
--
-- 'launchProfileId', 'getLaunchProfileMember_launchProfileId' - The launch profile ID.
newGetLaunchProfileMember ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'principalId'
  Prelude.Text ->
  -- | 'launchProfileId'
  Prelude.Text ->
  GetLaunchProfileMember
newGetLaunchProfileMember :: Text -> Text -> Text -> GetLaunchProfileMember
newGetLaunchProfileMember
  Text
pStudioId_
  Text
pPrincipalId_
  Text
pLaunchProfileId_ =
    GetLaunchProfileMember' :: Text -> Text -> Text -> GetLaunchProfileMember
GetLaunchProfileMember'
      { $sel:studioId:GetLaunchProfileMember' :: Text
studioId = Text
pStudioId_,
        $sel:principalId:GetLaunchProfileMember' :: Text
principalId = Text
pPrincipalId_,
        $sel:launchProfileId:GetLaunchProfileMember' :: Text
launchProfileId = Text
pLaunchProfileId_
      }

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

-- | The principal ID.
getLaunchProfileMember_principalId :: Lens.Lens' GetLaunchProfileMember Prelude.Text
getLaunchProfileMember_principalId :: (Text -> f Text)
-> GetLaunchProfileMember -> f GetLaunchProfileMember
getLaunchProfileMember_principalId = (GetLaunchProfileMember -> Text)
-> (GetLaunchProfileMember -> Text -> GetLaunchProfileMember)
-> Lens GetLaunchProfileMember GetLaunchProfileMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfileMember' {Text
principalId :: Text
$sel:principalId:GetLaunchProfileMember' :: GetLaunchProfileMember -> Text
principalId} -> Text
principalId) (\s :: GetLaunchProfileMember
s@GetLaunchProfileMember' {} Text
a -> GetLaunchProfileMember
s {$sel:principalId:GetLaunchProfileMember' :: Text
principalId = Text
a} :: GetLaunchProfileMember)

-- | The launch profile ID.
getLaunchProfileMember_launchProfileId :: Lens.Lens' GetLaunchProfileMember Prelude.Text
getLaunchProfileMember_launchProfileId :: (Text -> f Text)
-> GetLaunchProfileMember -> f GetLaunchProfileMember
getLaunchProfileMember_launchProfileId = (GetLaunchProfileMember -> Text)
-> (GetLaunchProfileMember -> Text -> GetLaunchProfileMember)
-> Lens GetLaunchProfileMember GetLaunchProfileMember Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfileMember' {Text
launchProfileId :: Text
$sel:launchProfileId:GetLaunchProfileMember' :: GetLaunchProfileMember -> Text
launchProfileId} -> Text
launchProfileId) (\s :: GetLaunchProfileMember
s@GetLaunchProfileMember' {} Text
a -> GetLaunchProfileMember
s {$sel:launchProfileId:GetLaunchProfileMember' :: Text
launchProfileId = Text
a} :: GetLaunchProfileMember)

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

instance Prelude.NFData GetLaunchProfileMember

instance Core.ToHeaders GetLaunchProfileMember where
  toHeaders :: GetLaunchProfileMember -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetLaunchProfileMember -> 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 GetLaunchProfileMember where
  toPath :: GetLaunchProfileMember -> ByteString
toPath GetLaunchProfileMember' {Text
launchProfileId :: Text
principalId :: Text
studioId :: Text
$sel:launchProfileId:GetLaunchProfileMember' :: GetLaunchProfileMember -> Text
$sel:principalId:GetLaunchProfileMember' :: GetLaunchProfileMember -> Text
$sel:studioId:GetLaunchProfileMember' :: GetLaunchProfileMember -> 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,
        ByteString
"/membership/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
principalId
      ]

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

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

-- |
-- Create a value of 'GetLaunchProfileMemberResponse' 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:
--
-- 'member', 'getLaunchProfileMemberResponse_member' - The member.
--
-- 'httpStatus', 'getLaunchProfileMemberResponse_httpStatus' - The response's http status code.
newGetLaunchProfileMemberResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetLaunchProfileMemberResponse
newGetLaunchProfileMemberResponse :: Int -> GetLaunchProfileMemberResponse
newGetLaunchProfileMemberResponse Int
pHttpStatus_ =
  GetLaunchProfileMemberResponse' :: Maybe LaunchProfileMembership
-> Int -> GetLaunchProfileMemberResponse
GetLaunchProfileMemberResponse'
    { $sel:member:GetLaunchProfileMemberResponse' :: Maybe LaunchProfileMembership
member =
        Maybe LaunchProfileMembership
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetLaunchProfileMemberResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The member.
getLaunchProfileMemberResponse_member :: Lens.Lens' GetLaunchProfileMemberResponse (Prelude.Maybe LaunchProfileMembership)
getLaunchProfileMemberResponse_member :: (Maybe LaunchProfileMembership
 -> f (Maybe LaunchProfileMembership))
-> GetLaunchProfileMemberResponse
-> f GetLaunchProfileMemberResponse
getLaunchProfileMemberResponse_member = (GetLaunchProfileMemberResponse -> Maybe LaunchProfileMembership)
-> (GetLaunchProfileMemberResponse
    -> Maybe LaunchProfileMembership -> GetLaunchProfileMemberResponse)
-> Lens
     GetLaunchProfileMemberResponse
     GetLaunchProfileMemberResponse
     (Maybe LaunchProfileMembership)
     (Maybe LaunchProfileMembership)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetLaunchProfileMemberResponse' {Maybe LaunchProfileMembership
member :: Maybe LaunchProfileMembership
$sel:member:GetLaunchProfileMemberResponse' :: GetLaunchProfileMemberResponse -> Maybe LaunchProfileMembership
member} -> Maybe LaunchProfileMembership
member) (\s :: GetLaunchProfileMemberResponse
s@GetLaunchProfileMemberResponse' {} Maybe LaunchProfileMembership
a -> GetLaunchProfileMemberResponse
s {$sel:member:GetLaunchProfileMemberResponse' :: Maybe LaunchProfileMembership
member = Maybe LaunchProfileMembership
a} :: GetLaunchProfileMemberResponse)

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

instance
  Prelude.NFData
    GetLaunchProfileMemberResponse