{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Transfer.Types.ListedUser where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 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,
    -- | The type of landing directory (folder) that you want your users\' home
    -- directory to be when they log in to 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 Amazon EFS paths visible to your users.
    ListedUser -> Maybe HomeDirectoryType
homeDirectoryType :: Prelude.Maybe HomeDirectoryType,
    -- | The Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) role that controls your users\' access to your Amazon S3 bucket or
    -- Amazon 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 Amazon 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,
    -- | 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,
    -- | 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
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]
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
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. 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:
--
-- '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@.
--
-- 'homeDirectoryType', 'listedUser_homeDirectoryType' - The type of landing directory (folder) that you want your users\' home
-- directory to be when they log in to 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 Amazon EFS paths visible to your users.
--
-- 'role'', 'listedUser_role' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role that controls your users\' access to your Amazon S3 bucket or
-- Amazon 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 Amazon 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.
--
-- 'userName', 'listedUser_userName' - Specifies the name of the user whose ARN was specified. User names are
-- used for authentication purposes.
--
-- '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'
    { $sel:homeDirectory:ListedUser' :: Maybe Text
homeDirectory = forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectoryType:ListedUser' :: Maybe HomeDirectoryType
homeDirectoryType = forall a. Maybe a
Prelude.Nothing,
      $sel:role':ListedUser' :: Maybe Text
role' = forall a. Maybe a
Prelude.Nothing,
      $sel:sshPublicKeyCount:ListedUser' :: Maybe Int
sshPublicKeyCount = forall a. Maybe a
Prelude.Nothing,
      $sel:userName:ListedUser' :: Maybe Text
userName = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListedUser' :: Text
arn = Text
pArn_
    }

-- | 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 :: Lens' ListedUser (Maybe Text)
listedUser_homeDirectory = 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)

-- | The type of landing directory (folder) that you want your users\' home
-- directory to be when they log in to 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 Amazon EFS paths visible to your users.
listedUser_homeDirectoryType :: Lens.Lens' ListedUser (Prelude.Maybe HomeDirectoryType)
listedUser_homeDirectoryType :: Lens' ListedUser (Maybe HomeDirectoryType)
listedUser_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)

-- | The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role that controls your users\' access to your Amazon S3 bucket or
-- Amazon 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 Amazon 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 :: Lens' ListedUser (Maybe Text)
listedUser_role = 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 :: Lens' ListedUser (Maybe Int)
listedUser_sshPublicKeyCount = 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)

-- | 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 :: Lens' ListedUser (Maybe Text)
listedUser_userName = 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)

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

instance Prelude.Hashable ListedUser where
  hashWithSalt :: Int -> ListedUser -> Int
hashWithSalt Int
_salt ListedUser' {Maybe Int
Maybe Text
Maybe HomeDirectoryType
Text
arn :: Text
userName :: Maybe Text
sshPublicKeyCount :: Maybe Int
role' :: Maybe Text
homeDirectoryType :: Maybe HomeDirectoryType
homeDirectory :: Maybe Text
$sel:arn:ListedUser' :: ListedUser -> Text
$sel:userName:ListedUser' :: ListedUser -> Maybe Text
$sel:sshPublicKeyCount:ListedUser' :: ListedUser -> Maybe Int
$sel:role':ListedUser' :: ListedUser -> Maybe Text
$sel:homeDirectoryType:ListedUser' :: ListedUser -> Maybe HomeDirectoryType
$sel:homeDirectory:ListedUser' :: ListedUser -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
homeDirectory
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HomeDirectoryType
homeDirectoryType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
role'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
sshPublicKeyCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData ListedUser where
  rnf :: ListedUser -> ()
rnf ListedUser' {Maybe Int
Maybe Text
Maybe HomeDirectoryType
Text
arn :: Text
userName :: Maybe Text
sshPublicKeyCount :: Maybe Int
role' :: Maybe Text
homeDirectoryType :: Maybe HomeDirectoryType
homeDirectory :: Maybe Text
$sel:arn:ListedUser' :: ListedUser -> Text
$sel:userName:ListedUser' :: ListedUser -> Maybe Text
$sel:sshPublicKeyCount:ListedUser' :: ListedUser -> Maybe Int
$sel:role':ListedUser' :: ListedUser -> Maybe Text
$sel:homeDirectoryType:ListedUser' :: ListedUser -> Maybe HomeDirectoryType
$sel:homeDirectory:ListedUser' :: ListedUser -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
homeDirectory
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HomeDirectoryType
homeDirectoryType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
role'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
sshPublicKeyCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn