{-# 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.Transfer.Types.IdentityProviderDetails
-- 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.Transfer.Types.IdentityProviderDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Returns information related to the type of user authentication that is
-- in use for a file transfer protocol-enabled server\'s users. A server
-- can have only one method of authentication.
--
-- /See:/ 'newIdentityProviderDetails' smart constructor.
data IdentityProviderDetails = IdentityProviderDetails'
  { -- | Provides the type of @InvocationRole@ used to authenticate the user
    -- account.
    IdentityProviderDetails -> Maybe Text
invocationRole :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the Amazon Web ServicesDirectory Service directory
    -- that you want to stop sharing.
    IdentityProviderDetails -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | Provides the location of the service endpoint used to authenticate
    -- users.
    IdentityProviderDetails -> Maybe Text
url :: Prelude.Maybe Prelude.Text
  }
  deriving (IdentityProviderDetails -> IdentityProviderDetails -> Bool
(IdentityProviderDetails -> IdentityProviderDetails -> Bool)
-> (IdentityProviderDetails -> IdentityProviderDetails -> Bool)
-> Eq IdentityProviderDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IdentityProviderDetails -> IdentityProviderDetails -> Bool
$c/= :: IdentityProviderDetails -> IdentityProviderDetails -> Bool
== :: IdentityProviderDetails -> IdentityProviderDetails -> Bool
$c== :: IdentityProviderDetails -> IdentityProviderDetails -> Bool
Prelude.Eq, ReadPrec [IdentityProviderDetails]
ReadPrec IdentityProviderDetails
Int -> ReadS IdentityProviderDetails
ReadS [IdentityProviderDetails]
(Int -> ReadS IdentityProviderDetails)
-> ReadS [IdentityProviderDetails]
-> ReadPrec IdentityProviderDetails
-> ReadPrec [IdentityProviderDetails]
-> Read IdentityProviderDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IdentityProviderDetails]
$creadListPrec :: ReadPrec [IdentityProviderDetails]
readPrec :: ReadPrec IdentityProviderDetails
$creadPrec :: ReadPrec IdentityProviderDetails
readList :: ReadS [IdentityProviderDetails]
$creadList :: ReadS [IdentityProviderDetails]
readsPrec :: Int -> ReadS IdentityProviderDetails
$creadsPrec :: Int -> ReadS IdentityProviderDetails
Prelude.Read, Int -> IdentityProviderDetails -> ShowS
[IdentityProviderDetails] -> ShowS
IdentityProviderDetails -> String
(Int -> IdentityProviderDetails -> ShowS)
-> (IdentityProviderDetails -> String)
-> ([IdentityProviderDetails] -> ShowS)
-> Show IdentityProviderDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IdentityProviderDetails] -> ShowS
$cshowList :: [IdentityProviderDetails] -> ShowS
show :: IdentityProviderDetails -> String
$cshow :: IdentityProviderDetails -> String
showsPrec :: Int -> IdentityProviderDetails -> ShowS
$cshowsPrec :: Int -> IdentityProviderDetails -> ShowS
Prelude.Show, (forall x.
 IdentityProviderDetails -> Rep IdentityProviderDetails x)
-> (forall x.
    Rep IdentityProviderDetails x -> IdentityProviderDetails)
-> Generic IdentityProviderDetails
forall x. Rep IdentityProviderDetails x -> IdentityProviderDetails
forall x. IdentityProviderDetails -> Rep IdentityProviderDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IdentityProviderDetails x -> IdentityProviderDetails
$cfrom :: forall x. IdentityProviderDetails -> Rep IdentityProviderDetails x
Prelude.Generic)

-- |
-- Create a value of 'IdentityProviderDetails' 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:
--
-- 'invocationRole', 'identityProviderDetails_invocationRole' - Provides the type of @InvocationRole@ used to authenticate the user
-- account.
--
-- 'directoryId', 'identityProviderDetails_directoryId' - The identifier of the Amazon Web ServicesDirectory Service directory
-- that you want to stop sharing.
--
-- 'url', 'identityProviderDetails_url' - Provides the location of the service endpoint used to authenticate
-- users.
newIdentityProviderDetails ::
  IdentityProviderDetails
newIdentityProviderDetails :: IdentityProviderDetails
newIdentityProviderDetails =
  IdentityProviderDetails' :: Maybe Text -> Maybe Text -> Maybe Text -> IdentityProviderDetails
IdentityProviderDetails'
    { $sel:invocationRole:IdentityProviderDetails' :: Maybe Text
invocationRole =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryId:IdentityProviderDetails' :: Maybe Text
directoryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:IdentityProviderDetails' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Provides the type of @InvocationRole@ used to authenticate the user
-- account.
identityProviderDetails_invocationRole :: Lens.Lens' IdentityProviderDetails (Prelude.Maybe Prelude.Text)
identityProviderDetails_invocationRole :: (Maybe Text -> f (Maybe Text))
-> IdentityProviderDetails -> f IdentityProviderDetails
identityProviderDetails_invocationRole = (IdentityProviderDetails -> Maybe Text)
-> (IdentityProviderDetails
    -> Maybe Text -> IdentityProviderDetails)
-> Lens
     IdentityProviderDetails
     IdentityProviderDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityProviderDetails' {Maybe Text
invocationRole :: Maybe Text
$sel:invocationRole:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
invocationRole} -> Maybe Text
invocationRole) (\s :: IdentityProviderDetails
s@IdentityProviderDetails' {} Maybe Text
a -> IdentityProviderDetails
s {$sel:invocationRole:IdentityProviderDetails' :: Maybe Text
invocationRole = Maybe Text
a} :: IdentityProviderDetails)

-- | The identifier of the Amazon Web ServicesDirectory Service directory
-- that you want to stop sharing.
identityProviderDetails_directoryId :: Lens.Lens' IdentityProviderDetails (Prelude.Maybe Prelude.Text)
identityProviderDetails_directoryId :: (Maybe Text -> f (Maybe Text))
-> IdentityProviderDetails -> f IdentityProviderDetails
identityProviderDetails_directoryId = (IdentityProviderDetails -> Maybe Text)
-> (IdentityProviderDetails
    -> Maybe Text -> IdentityProviderDetails)
-> Lens
     IdentityProviderDetails
     IdentityProviderDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityProviderDetails' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: IdentityProviderDetails
s@IdentityProviderDetails' {} Maybe Text
a -> IdentityProviderDetails
s {$sel:directoryId:IdentityProviderDetails' :: Maybe Text
directoryId = Maybe Text
a} :: IdentityProviderDetails)

-- | Provides the location of the service endpoint used to authenticate
-- users.
identityProviderDetails_url :: Lens.Lens' IdentityProviderDetails (Prelude.Maybe Prelude.Text)
identityProviderDetails_url :: (Maybe Text -> f (Maybe Text))
-> IdentityProviderDetails -> f IdentityProviderDetails
identityProviderDetails_url = (IdentityProviderDetails -> Maybe Text)
-> (IdentityProviderDetails
    -> Maybe Text -> IdentityProviderDetails)
-> Lens
     IdentityProviderDetails
     IdentityProviderDetails
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IdentityProviderDetails' {Maybe Text
url :: Maybe Text
$sel:url:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
url} -> Maybe Text
url) (\s :: IdentityProviderDetails
s@IdentityProviderDetails' {} Maybe Text
a -> IdentityProviderDetails
s {$sel:url:IdentityProviderDetails' :: Maybe Text
url = Maybe Text
a} :: IdentityProviderDetails)

instance Core.FromJSON IdentityProviderDetails where
  parseJSON :: Value -> Parser IdentityProviderDetails
parseJSON =
    String
-> (Object -> Parser IdentityProviderDetails)
-> Value
-> Parser IdentityProviderDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"IdentityProviderDetails"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> IdentityProviderDetails
IdentityProviderDetails'
            (Maybe Text -> Maybe Text -> Maybe Text -> IdentityProviderDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> IdentityProviderDetails)
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
"InvocationRole")
            Parser (Maybe Text -> Maybe Text -> IdentityProviderDetails)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> IdentityProviderDetails)
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
"DirectoryId")
            Parser (Maybe Text -> IdentityProviderDetails)
-> Parser (Maybe Text) -> Parser IdentityProviderDetails
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
"Url")
      )

instance Prelude.Hashable IdentityProviderDetails

instance Prelude.NFData IdentityProviderDetails

instance Core.ToJSON IdentityProviderDetails where
  toJSON :: IdentityProviderDetails -> Value
toJSON IdentityProviderDetails' {Maybe Text
url :: Maybe Text
directoryId :: Maybe Text
invocationRole :: Maybe Text
$sel:url:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
$sel:directoryId:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
$sel:invocationRole:IdentityProviderDetails' :: IdentityProviderDetails -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InvocationRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
invocationRole,
            (Text
"DirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
directoryId,
            (Text
"Url" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
url
          ]
      )