{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.StudioMembership
-- 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)
module Amazonka.Nimble.Types.StudioMembership where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types.StudioPersona
import qualified Amazonka.Prelude as Prelude

-- |
--
-- /See:/ 'newStudioMembership' smart constructor.
data StudioMembership = StudioMembership'
  { -- | The ID of the identity store.
    StudioMembership -> Maybe Text
identityStoreId :: Prelude.Maybe Prelude.Text,
    -- | The principal ID.
    StudioMembership -> Maybe Text
principalId :: Prelude.Maybe Prelude.Text,
    -- | The persona.
    StudioMembership -> Maybe StudioPersona
persona :: Prelude.Maybe StudioPersona
  }
  deriving (StudioMembership -> StudioMembership -> Bool
(StudioMembership -> StudioMembership -> Bool)
-> (StudioMembership -> StudioMembership -> Bool)
-> Eq StudioMembership
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StudioMembership -> StudioMembership -> Bool
$c/= :: StudioMembership -> StudioMembership -> Bool
== :: StudioMembership -> StudioMembership -> Bool
$c== :: StudioMembership -> StudioMembership -> Bool
Prelude.Eq, ReadPrec [StudioMembership]
ReadPrec StudioMembership
Int -> ReadS StudioMembership
ReadS [StudioMembership]
(Int -> ReadS StudioMembership)
-> ReadS [StudioMembership]
-> ReadPrec StudioMembership
-> ReadPrec [StudioMembership]
-> Read StudioMembership
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StudioMembership]
$creadListPrec :: ReadPrec [StudioMembership]
readPrec :: ReadPrec StudioMembership
$creadPrec :: ReadPrec StudioMembership
readList :: ReadS [StudioMembership]
$creadList :: ReadS [StudioMembership]
readsPrec :: Int -> ReadS StudioMembership
$creadsPrec :: Int -> ReadS StudioMembership
Prelude.Read, Int -> StudioMembership -> ShowS
[StudioMembership] -> ShowS
StudioMembership -> String
(Int -> StudioMembership -> ShowS)
-> (StudioMembership -> String)
-> ([StudioMembership] -> ShowS)
-> Show StudioMembership
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StudioMembership] -> ShowS
$cshowList :: [StudioMembership] -> ShowS
show :: StudioMembership -> String
$cshow :: StudioMembership -> String
showsPrec :: Int -> StudioMembership -> ShowS
$cshowsPrec :: Int -> StudioMembership -> ShowS
Prelude.Show, (forall x. StudioMembership -> Rep StudioMembership x)
-> (forall x. Rep StudioMembership x -> StudioMembership)
-> Generic StudioMembership
forall x. Rep StudioMembership x -> StudioMembership
forall x. StudioMembership -> Rep StudioMembership x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StudioMembership x -> StudioMembership
$cfrom :: forall x. StudioMembership -> Rep StudioMembership x
Prelude.Generic)

-- |
-- Create a value of 'StudioMembership' 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:
--
-- 'identityStoreId', 'studioMembership_identityStoreId' - The ID of the identity store.
--
-- 'principalId', 'studioMembership_principalId' - The principal ID.
--
-- 'persona', 'studioMembership_persona' - The persona.
newStudioMembership ::
  StudioMembership
newStudioMembership :: StudioMembership
newStudioMembership =
  StudioMembership' :: Maybe Text -> Maybe Text -> Maybe StudioPersona -> StudioMembership
StudioMembership'
    { $sel:identityStoreId:StudioMembership' :: Maybe Text
identityStoreId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:principalId:StudioMembership' :: Maybe Text
principalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:persona:StudioMembership' :: Maybe StudioPersona
persona = Maybe StudioPersona
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the identity store.
studioMembership_identityStoreId :: Lens.Lens' StudioMembership (Prelude.Maybe Prelude.Text)
studioMembership_identityStoreId :: (Maybe Text -> f (Maybe Text))
-> StudioMembership -> f StudioMembership
studioMembership_identityStoreId = (StudioMembership -> Maybe Text)
-> (StudioMembership -> Maybe Text -> StudioMembership)
-> Lens StudioMembership StudioMembership (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StudioMembership' {Maybe Text
identityStoreId :: Maybe Text
$sel:identityStoreId:StudioMembership' :: StudioMembership -> Maybe Text
identityStoreId} -> Maybe Text
identityStoreId) (\s :: StudioMembership
s@StudioMembership' {} Maybe Text
a -> StudioMembership
s {$sel:identityStoreId:StudioMembership' :: Maybe Text
identityStoreId = Maybe Text
a} :: StudioMembership)

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

-- | The persona.
studioMembership_persona :: Lens.Lens' StudioMembership (Prelude.Maybe StudioPersona)
studioMembership_persona :: (Maybe StudioPersona -> f (Maybe StudioPersona))
-> StudioMembership -> f StudioMembership
studioMembership_persona = (StudioMembership -> Maybe StudioPersona)
-> (StudioMembership -> Maybe StudioPersona -> StudioMembership)
-> Lens
     StudioMembership
     StudioMembership
     (Maybe StudioPersona)
     (Maybe StudioPersona)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StudioMembership' {Maybe StudioPersona
persona :: Maybe StudioPersona
$sel:persona:StudioMembership' :: StudioMembership -> Maybe StudioPersona
persona} -> Maybe StudioPersona
persona) (\s :: StudioMembership
s@StudioMembership' {} Maybe StudioPersona
a -> StudioMembership
s {$sel:persona:StudioMembership' :: Maybe StudioPersona
persona = Maybe StudioPersona
a} :: StudioMembership)

instance Core.FromJSON StudioMembership where
  parseJSON :: Value -> Parser StudioMembership
parseJSON =
    String
-> (Object -> Parser StudioMembership)
-> Value
-> Parser StudioMembership
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"StudioMembership"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe StudioPersona -> StudioMembership
StudioMembership'
            (Maybe Text
 -> Maybe Text -> Maybe StudioPersona -> StudioMembership)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe StudioPersona -> StudioMembership)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"identityStoreId")
            Parser (Maybe Text -> Maybe StudioPersona -> StudioMembership)
-> Parser (Maybe Text)
-> Parser (Maybe StudioPersona -> StudioMembership)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"principalId")
            Parser (Maybe StudioPersona -> StudioMembership)
-> Parser (Maybe StudioPersona) -> Parser StudioMembership
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe StudioPersona)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"persona")
      )

instance Prelude.Hashable StudioMembership

instance Prelude.NFData StudioMembership