{-# 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.ListedUser
-- 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.ListedUser where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transfer.Types.HomeDirectoryType

-- | Returns properties of the user that you specify.
--
-- /See:/ 'newListedUser' smart constructor.
data ListedUser = ListedUser'
  { -- | The type of landing directory (folder) you want your users\' home
    -- directory to be when they log into the server. If you set it to @PATH@,
    -- the user will see the absolute Amazon S3 bucket or EFS paths as is in
    -- their file transfer protocol clients. If you set it @LOGICAL@, you need
    -- to provide mappings in the @HomeDirectoryMappings@ for how you want to
    -- make Amazon S3 or EFS paths visible to your users.
    ListedUser -> Maybe HomeDirectoryType
homeDirectoryType :: Prelude.Maybe HomeDirectoryType,
    -- | Specifies the name of the user whose ARN was specified. User names are
    -- used for authentication purposes.
    ListedUser -> Maybe Text
userName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the Amazon Resource Name (ARN) of the IAM role that controls
    -- your users\' access to your Amazon S3 bucket or EFS file system. The
    -- policies attached to this role determine the level of access that you
    -- want to provide your users when transferring files into and out of your
    -- Amazon S3 bucket or EFS file system. The IAM role should also contain a
    -- trust relationship that allows the server to access your resources when
    -- servicing your users\' transfer requests.
    --
    -- The IAM role that controls your users\' access to your Amazon S3 bucket
    -- for servers with @Domain=S3@, or your EFS file system for servers with
    -- @Domain=EFS@.
    --
    -- The policies attached to this role determine the level of access you
    -- want to provide your users when transferring files into and out of your
    -- S3 buckets or EFS file systems.
    ListedUser -> Maybe Text
role' :: Prelude.Maybe Prelude.Text,
    -- | Specifies the number of SSH public keys stored for the user you
    -- specified.
    ListedUser -> Maybe Int
sshPublicKeyCount :: Prelude.Maybe Prelude.Int,
    -- | The landing directory (folder) for a user when they log in to the server
    -- using the client.
    --
    -- A @HomeDirectory@ example is @\/bucket_name\/home\/mydirectory@.
    ListedUser -> Maybe Text
homeDirectory :: Prelude.Maybe Prelude.Text,
    -- | Provides the unique Amazon Resource Name (ARN) for the user that you
    -- want to learn about.
    ListedUser -> Text
arn :: Prelude.Text
  }
  deriving (ListedUser -> ListedUser -> Bool
(ListedUser -> ListedUser -> Bool)
-> (ListedUser -> ListedUser -> Bool) -> Eq ListedUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedUser -> ListedUser -> Bool
$c/= :: ListedUser -> ListedUser -> Bool
== :: ListedUser -> ListedUser -> Bool
$c== :: ListedUser -> ListedUser -> Bool
Prelude.Eq, ReadPrec [ListedUser]
ReadPrec ListedUser
Int -> ReadS ListedUser
ReadS [ListedUser]
(Int -> ReadS ListedUser)
-> ReadS [ListedUser]
-> ReadPrec ListedUser
-> ReadPrec [ListedUser]
-> Read ListedUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedUser]
$creadListPrec :: ReadPrec [ListedUser]
readPrec :: ReadPrec ListedUser
$creadPrec :: ReadPrec ListedUser
readList :: ReadS [ListedUser]
$creadList :: ReadS [ListedUser]
readsPrec :: Int -> ReadS ListedUser
$creadsPrec :: Int -> ReadS ListedUser
Prelude.Read, Int -> ListedUser -> ShowS
[ListedUser] -> ShowS
ListedUser -> String
(Int -> ListedUser -> ShowS)
-> (ListedUser -> String)
-> ([ListedUser] -> ShowS)
-> Show ListedUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedUser] -> ShowS
$cshowList :: [ListedUser] -> ShowS
show :: ListedUser -> String
$cshow :: ListedUser -> String
showsPrec :: Int -> ListedUser -> ShowS
$cshowsPrec :: Int -> ListedUser -> ShowS
Prelude.Show, (forall x. ListedUser -> Rep ListedUser x)
-> (forall x. Rep ListedUser x -> ListedUser) -> Generic ListedUser
forall x. Rep ListedUser x -> ListedUser
forall x. ListedUser -> Rep ListedUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedUser x -> ListedUser
$cfrom :: forall x. ListedUser -> Rep ListedUser x
Prelude.Generic)

-- |
-- Create a value of 'ListedUser' 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:
--
-- 'homeDirectoryType', 'listedUser_homeDirectoryType' - The type of landing directory (folder) you want your users\' home
-- directory to be when they log into the server. If you set it to @PATH@,
-- the user will see the absolute Amazon S3 bucket or EFS paths as is in
-- their file transfer protocol clients. If you set it @LOGICAL@, you need
-- to provide mappings in the @HomeDirectoryMappings@ for how you want to
-- make Amazon S3 or EFS paths visible to your users.
--
-- 'userName', 'listedUser_userName' - Specifies the name of the user whose ARN was specified. User names are
-- used for authentication purposes.
--
-- 'role'', 'listedUser_role' - Specifies the Amazon Resource Name (ARN) of the IAM role that controls
-- your users\' access to your Amazon S3 bucket or EFS file system. The
-- policies attached to this role determine the level of access that you
-- want to provide your users when transferring files into and out of your
-- Amazon S3 bucket or EFS file system. The IAM role should also contain a
-- trust relationship that allows the server to access your resources when
-- servicing your users\' transfer requests.
--
-- The IAM role that controls your users\' access to your Amazon S3 bucket
-- for servers with @Domain=S3@, or your EFS file system for servers with
-- @Domain=EFS@.
--
-- The policies attached to this role determine the level of access you
-- want to provide your users when transferring files into and out of your
-- S3 buckets or EFS file systems.
--
-- 'sshPublicKeyCount', 'listedUser_sshPublicKeyCount' - Specifies the number of SSH public keys stored for the user you
-- specified.
--
-- 'homeDirectory', 'listedUser_homeDirectory' - The landing directory (folder) for a user when they log in to the server
-- using the client.
--
-- A @HomeDirectory@ example is @\/bucket_name\/home\/mydirectory@.
--
-- 'arn', 'listedUser_arn' - Provides the unique Amazon Resource Name (ARN) for the user that you
-- want to learn about.
newListedUser ::
  -- | 'arn'
  Prelude.Text ->
  ListedUser
newListedUser :: Text -> ListedUser
newListedUser Text
pArn_ =
  ListedUser' :: Maybe HomeDirectoryType
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Text
-> ListedUser
ListedUser'
    { $sel:homeDirectoryType:ListedUser' :: Maybe HomeDirectoryType
homeDirectoryType = Maybe HomeDirectoryType
forall a. Maybe a
Prelude.Nothing,
      $sel:userName:ListedUser' :: Maybe Text
userName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:role':ListedUser' :: Maybe Text
role' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:sshPublicKeyCount:ListedUser' :: Maybe Int
sshPublicKeyCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectory:ListedUser' :: Maybe Text
homeDirectory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListedUser' :: Text
arn = Text
pArn_
    }

-- | The type of landing directory (folder) you want your users\' home
-- directory to be when they log into the server. If you set it to @PATH@,
-- the user will see the absolute Amazon S3 bucket or EFS paths as is in
-- their file transfer protocol clients. If you set it @LOGICAL@, you need
-- to provide mappings in the @HomeDirectoryMappings@ for how you want to
-- make Amazon S3 or EFS paths visible to your users.
listedUser_homeDirectoryType :: Lens.Lens' ListedUser (Prelude.Maybe HomeDirectoryType)
listedUser_homeDirectoryType :: (Maybe HomeDirectoryType -> f (Maybe HomeDirectoryType))
-> ListedUser -> f ListedUser
listedUser_homeDirectoryType = (ListedUser -> Maybe HomeDirectoryType)
-> (ListedUser -> Maybe HomeDirectoryType -> ListedUser)
-> Lens
     ListedUser
     ListedUser
     (Maybe HomeDirectoryType)
     (Maybe HomeDirectoryType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Maybe HomeDirectoryType
homeDirectoryType :: Maybe HomeDirectoryType
$sel:homeDirectoryType:ListedUser' :: ListedUser -> Maybe HomeDirectoryType
homeDirectoryType} -> Maybe HomeDirectoryType
homeDirectoryType) (\s :: ListedUser
s@ListedUser' {} Maybe HomeDirectoryType
a -> ListedUser
s {$sel:homeDirectoryType:ListedUser' :: Maybe HomeDirectoryType
homeDirectoryType = Maybe HomeDirectoryType
a} :: ListedUser)

-- | Specifies the name of the user whose ARN was specified. User names are
-- used for authentication purposes.
listedUser_userName :: Lens.Lens' ListedUser (Prelude.Maybe Prelude.Text)
listedUser_userName :: (Maybe Text -> f (Maybe Text)) -> ListedUser -> f ListedUser
listedUser_userName = (ListedUser -> Maybe Text)
-> (ListedUser -> Maybe Text -> ListedUser)
-> Lens ListedUser ListedUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Maybe Text
userName :: Maybe Text
$sel:userName:ListedUser' :: ListedUser -> Maybe Text
userName} -> Maybe Text
userName) (\s :: ListedUser
s@ListedUser' {} Maybe Text
a -> ListedUser
s {$sel:userName:ListedUser' :: Maybe Text
userName = Maybe Text
a} :: ListedUser)

-- | Specifies the Amazon Resource Name (ARN) of the IAM role that controls
-- your users\' access to your Amazon S3 bucket or EFS file system. The
-- policies attached to this role determine the level of access that you
-- want to provide your users when transferring files into and out of your
-- Amazon S3 bucket or EFS file system. The IAM role should also contain a
-- trust relationship that allows the server to access your resources when
-- servicing your users\' transfer requests.
--
-- The IAM role that controls your users\' access to your Amazon S3 bucket
-- for servers with @Domain=S3@, or your EFS file system for servers with
-- @Domain=EFS@.
--
-- The policies attached to this role determine the level of access you
-- want to provide your users when transferring files into and out of your
-- S3 buckets or EFS file systems.
listedUser_role :: Lens.Lens' ListedUser (Prelude.Maybe Prelude.Text)
listedUser_role :: (Maybe Text -> f (Maybe Text)) -> ListedUser -> f ListedUser
listedUser_role = (ListedUser -> Maybe Text)
-> (ListedUser -> Maybe Text -> ListedUser)
-> Lens ListedUser ListedUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Maybe Text
role' :: Maybe Text
$sel:role':ListedUser' :: ListedUser -> Maybe Text
role'} -> Maybe Text
role') (\s :: ListedUser
s@ListedUser' {} Maybe Text
a -> ListedUser
s {$sel:role':ListedUser' :: Maybe Text
role' = Maybe Text
a} :: ListedUser)

-- | Specifies the number of SSH public keys stored for the user you
-- specified.
listedUser_sshPublicKeyCount :: Lens.Lens' ListedUser (Prelude.Maybe Prelude.Int)
listedUser_sshPublicKeyCount :: (Maybe Int -> f (Maybe Int)) -> ListedUser -> f ListedUser
listedUser_sshPublicKeyCount = (ListedUser -> Maybe Int)
-> (ListedUser -> Maybe Int -> ListedUser)
-> Lens ListedUser ListedUser (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Maybe Int
sshPublicKeyCount :: Maybe Int
$sel:sshPublicKeyCount:ListedUser' :: ListedUser -> Maybe Int
sshPublicKeyCount} -> Maybe Int
sshPublicKeyCount) (\s :: ListedUser
s@ListedUser' {} Maybe Int
a -> ListedUser
s {$sel:sshPublicKeyCount:ListedUser' :: Maybe Int
sshPublicKeyCount = Maybe Int
a} :: ListedUser)

-- | The landing directory (folder) for a user when they log in to the server
-- using the client.
--
-- A @HomeDirectory@ example is @\/bucket_name\/home\/mydirectory@.
listedUser_homeDirectory :: Lens.Lens' ListedUser (Prelude.Maybe Prelude.Text)
listedUser_homeDirectory :: (Maybe Text -> f (Maybe Text)) -> ListedUser -> f ListedUser
listedUser_homeDirectory = (ListedUser -> Maybe Text)
-> (ListedUser -> Maybe Text -> ListedUser)
-> Lens ListedUser ListedUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Maybe Text
homeDirectory :: Maybe Text
$sel:homeDirectory:ListedUser' :: ListedUser -> Maybe Text
homeDirectory} -> Maybe Text
homeDirectory) (\s :: ListedUser
s@ListedUser' {} Maybe Text
a -> ListedUser
s {$sel:homeDirectory:ListedUser' :: Maybe Text
homeDirectory = Maybe Text
a} :: ListedUser)

-- | Provides the unique Amazon Resource Name (ARN) for the user that you
-- want to learn about.
listedUser_arn :: Lens.Lens' ListedUser Prelude.Text
listedUser_arn :: (Text -> f Text) -> ListedUser -> f ListedUser
listedUser_arn = (ListedUser -> Text)
-> (ListedUser -> Text -> ListedUser)
-> Lens ListedUser ListedUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedUser' {Text
arn :: Text
$sel:arn:ListedUser' :: ListedUser -> Text
arn} -> Text
arn) (\s :: ListedUser
s@ListedUser' {} Text
a -> ListedUser
s {$sel:arn:ListedUser' :: Text
arn = Text
a} :: ListedUser)

instance Core.FromJSON ListedUser where
  parseJSON :: Value -> Parser ListedUser
parseJSON =
    String
-> (Object -> Parser ListedUser) -> Value -> Parser ListedUser
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ListedUser"
      ( \Object
x ->
          Maybe HomeDirectoryType
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Text
-> ListedUser
ListedUser'
            (Maybe HomeDirectoryType
 -> Maybe Text
 -> Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Text
 -> ListedUser)
-> Parser (Maybe HomeDirectoryType)
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe Int -> Maybe Text -> Text -> ListedUser)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe HomeDirectoryType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"HomeDirectoryType")
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe Int -> Maybe Text -> Text -> ListedUser)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Int -> Maybe Text -> Text -> ListedUser)
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
"UserName")
            Parser
  (Maybe Text -> Maybe Int -> Maybe Text -> Text -> ListedUser)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> Maybe Text -> Text -> ListedUser)
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
"Role")
            Parser (Maybe Int -> Maybe Text -> Text -> ListedUser)
-> Parser (Maybe Int) -> Parser (Maybe Text -> Text -> ListedUser)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SshPublicKeyCount")
            Parser (Maybe Text -> Text -> ListedUser)
-> Parser (Maybe Text) -> Parser (Text -> ListedUser)
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
"HomeDirectory")
            Parser (Text -> ListedUser) -> Parser Text -> Parser ListedUser
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Arn")
      )

instance Prelude.Hashable ListedUser

instance Prelude.NFData ListedUser