{-# 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.Transfer.UpdateUser
-- 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)
--
-- Assigns new properties to a user. Parameters you pass modify any or all
-- of the following: the home directory, role, and policy for the
-- @UserName@ and @ServerId@ you specify.
--
-- The response returns the @ServerId@ and the @UserName@ for the updated
-- user.
module Amazonka.Transfer.UpdateUser
  ( -- * Creating a Request
    UpdateUser (..),
    newUpdateUser,

    -- * Request Lenses
    updateUser_homeDirectoryType,
    updateUser_posixProfile,
    updateUser_homeDirectoryMappings,
    updateUser_role,
    updateUser_policy,
    updateUser_homeDirectory,
    updateUser_serverId,
    updateUser_userName,

    -- * Destructuring the Response
    UpdateUserResponse (..),
    newUpdateUserResponse,

    -- * Response Lenses
    updateUserResponse_httpStatus,
    updateUserResponse_serverId,
    updateUserResponse_userName,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types

-- | /See:/ 'newUpdateUser' smart constructor.
data UpdateUser = UpdateUser'
  { -- | 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.
    UpdateUser -> Maybe HomeDirectoryType
homeDirectoryType :: Prelude.Maybe HomeDirectoryType,
    -- | Specifies the full POSIX identity, including user ID (@Uid@), group ID
    -- (@Gid@), and any secondary groups IDs (@SecondaryGids@), that controls
    -- your users\' access to your Amazon Elastic File Systems (Amazon EFS).
    -- The POSIX permissions that are set on files and directories in your file
    -- system determines the level of access your users get when transferring
    -- files into and out of your Amazon EFS file systems.
    UpdateUser -> Maybe PosixProfile
posixProfile :: Prelude.Maybe PosixProfile,
    -- | Logical directory mappings that specify what Amazon S3 or Amazon EFS
    -- paths and keys should be visible to your user and how you want to make
    -- them visible. You must specify the @Entry@ and @Target@ pair, where
    -- @Entry@ shows how the path is made visible and @Target@ is the actual
    -- Amazon S3 or Amazon EFS path. If you only specify a target, it is
    -- displayed as is. You also must ensure that your Amazon Web Services
    -- Identity and Access Management (IAM) role provides access to paths in
    -- @Target@. This value can only be set when @HomeDirectoryType@ is set to
    -- /LOGICAL/.
    --
    -- The following is an @Entry@ and @Target@ pair example.
    --
    -- @[ { \"Entry\": \"\/directory1\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
    --
    -- In most cases, you can use this value instead of the session policy to
    -- lock down your user to the designated home directory (\"@chroot@\"). To
    -- do this, you can set @Entry@ to \'\/\' and set @Target@ to the
    -- HomeDirectory parameter value.
    --
    -- The following is an @Entry@ and @Target@ pair example for @chroot@.
    --
    -- @[ { \"Entry:\": \"\/\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
    --
    -- If the target of a logical directory entry does not exist in Amazon S3
    -- or EFS, the entry is ignored. As a workaround, you can use the Amazon S3
    -- API or EFS API to create 0 byte objects as place holders for your
    -- directory. If using the CLI, use the @s3api@ or @efsapi@ call instead of
    -- @s3@ or @efs@ so you can use the put-object operation. For example, you
    -- use the following:
    -- @aws s3api put-object --bucket bucketname --key path\/to\/folder\/@.
    -- Make sure that the end of the key name ends in a @\/@ for it to be
    -- considered a folder.
    UpdateUser -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings :: Prelude.Maybe (Prelude.NonEmpty HomeDirectoryMapEntry),
    -- | 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.
    UpdateUser -> Maybe Text
role' :: Prelude.Maybe Prelude.Text,
    -- | A session policy for your user so that you can use the same IAM role
    -- across multiple users. This policy scopes down user access to portions
    -- of their Amazon S3 bucket. Variables that you can use inside this policy
    -- include @${Transfer:UserName}@, @${Transfer:HomeDirectory}@, and
    -- @${Transfer:HomeBucket}@.
    --
    -- This only applies when the domain of @ServerId@ is S3. EFS does not use
    -- session policies.
    --
    -- For session policies, Amazon Web Services Transfer Family stores the
    -- policy as a JSON blob, instead of the Amazon Resource Name (ARN) of the
    -- policy. You save the policy as a JSON blob and pass it in the @Policy@
    -- argument.
    --
    -- For an example of a session policy, see
    -- <https://docs.aws.amazon.com/transfer/latest/userguide/session-policy Creating a session policy>.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
    -- in the /Amazon Web Services Security Token Service API Reference/.
    UpdateUser -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
    -- | 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@.
    UpdateUser -> Maybe Text
homeDirectory :: Prelude.Maybe Prelude.Text,
    -- | A system-assigned unique identifier for a server instance that the user
    -- account is assigned to.
    UpdateUser -> Text
serverId :: Prelude.Text,
    -- | A unique string that identifies a user and is associated with a server
    -- as specified by the @ServerId@. This user name must be a minimum of 3
    -- and a maximum of 100 characters long. The following are valid
    -- characters: a-z, A-Z, 0-9, underscore \'_\', hyphen \'-\', period \'.\',
    -- and at sign \'\@\'. The user name can\'t start with a hyphen, period, or
    -- at sign.
    UpdateUser -> Text
userName :: Prelude.Text
  }
  deriving (UpdateUser -> UpdateUser -> Bool
(UpdateUser -> UpdateUser -> Bool)
-> (UpdateUser -> UpdateUser -> Bool) -> Eq UpdateUser
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUser -> UpdateUser -> Bool
$c/= :: UpdateUser -> UpdateUser -> Bool
== :: UpdateUser -> UpdateUser -> Bool
$c== :: UpdateUser -> UpdateUser -> Bool
Prelude.Eq, ReadPrec [UpdateUser]
ReadPrec UpdateUser
Int -> ReadS UpdateUser
ReadS [UpdateUser]
(Int -> ReadS UpdateUser)
-> ReadS [UpdateUser]
-> ReadPrec UpdateUser
-> ReadPrec [UpdateUser]
-> Read UpdateUser
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUser]
$creadListPrec :: ReadPrec [UpdateUser]
readPrec :: ReadPrec UpdateUser
$creadPrec :: ReadPrec UpdateUser
readList :: ReadS [UpdateUser]
$creadList :: ReadS [UpdateUser]
readsPrec :: Int -> ReadS UpdateUser
$creadsPrec :: Int -> ReadS UpdateUser
Prelude.Read, Int -> UpdateUser -> ShowS
[UpdateUser] -> ShowS
UpdateUser -> String
(Int -> UpdateUser -> ShowS)
-> (UpdateUser -> String)
-> ([UpdateUser] -> ShowS)
-> Show UpdateUser
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUser] -> ShowS
$cshowList :: [UpdateUser] -> ShowS
show :: UpdateUser -> String
$cshow :: UpdateUser -> String
showsPrec :: Int -> UpdateUser -> ShowS
$cshowsPrec :: Int -> UpdateUser -> ShowS
Prelude.Show, (forall x. UpdateUser -> Rep UpdateUser x)
-> (forall x. Rep UpdateUser x -> UpdateUser) -> Generic UpdateUser
forall x. Rep UpdateUser x -> UpdateUser
forall x. UpdateUser -> Rep UpdateUser x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUser x -> UpdateUser
$cfrom :: forall x. UpdateUser -> Rep UpdateUser x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUser' 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', 'updateUser_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.
--
-- 'posixProfile', 'updateUser_posixProfile' - Specifies the full POSIX identity, including user ID (@Uid@), group ID
-- (@Gid@), and any secondary groups IDs (@SecondaryGids@), that controls
-- your users\' access to your Amazon Elastic File Systems (Amazon EFS).
-- The POSIX permissions that are set on files and directories in your file
-- system determines the level of access your users get when transferring
-- files into and out of your Amazon EFS file systems.
--
-- 'homeDirectoryMappings', 'updateUser_homeDirectoryMappings' - Logical directory mappings that specify what Amazon S3 or Amazon EFS
-- paths and keys should be visible to your user and how you want to make
-- them visible. You must specify the @Entry@ and @Target@ pair, where
-- @Entry@ shows how the path is made visible and @Target@ is the actual
-- Amazon S3 or Amazon EFS path. If you only specify a target, it is
-- displayed as is. You also must ensure that your Amazon Web Services
-- Identity and Access Management (IAM) role provides access to paths in
-- @Target@. This value can only be set when @HomeDirectoryType@ is set to
-- /LOGICAL/.
--
-- The following is an @Entry@ and @Target@ pair example.
--
-- @[ { \"Entry\": \"\/directory1\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
--
-- In most cases, you can use this value instead of the session policy to
-- lock down your user to the designated home directory (\"@chroot@\"). To
-- do this, you can set @Entry@ to \'\/\' and set @Target@ to the
-- HomeDirectory parameter value.
--
-- The following is an @Entry@ and @Target@ pair example for @chroot@.
--
-- @[ { \"Entry:\": \"\/\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
--
-- If the target of a logical directory entry does not exist in Amazon S3
-- or EFS, the entry is ignored. As a workaround, you can use the Amazon S3
-- API or EFS API to create 0 byte objects as place holders for your
-- directory. If using the CLI, use the @s3api@ or @efsapi@ call instead of
-- @s3@ or @efs@ so you can use the put-object operation. For example, you
-- use the following:
-- @aws s3api put-object --bucket bucketname --key path\/to\/folder\/@.
-- Make sure that the end of the key name ends in a @\/@ for it to be
-- considered a folder.
--
-- 'role'', 'updateUser_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.
--
-- 'policy', 'updateUser_policy' - A session policy for your user so that you can use the same IAM role
-- across multiple users. This policy scopes down user access to portions
-- of their Amazon S3 bucket. Variables that you can use inside this policy
-- include @${Transfer:UserName}@, @${Transfer:HomeDirectory}@, and
-- @${Transfer:HomeBucket}@.
--
-- This only applies when the domain of @ServerId@ is S3. EFS does not use
-- session policies.
--
-- For session policies, Amazon Web Services Transfer Family stores the
-- policy as a JSON blob, instead of the Amazon Resource Name (ARN) of the
-- policy. You save the policy as a JSON blob and pass it in the @Policy@
-- argument.
--
-- For an example of a session policy, see
-- <https://docs.aws.amazon.com/transfer/latest/userguide/session-policy Creating a session policy>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
-- in the /Amazon Web Services Security Token Service API Reference/.
--
-- 'homeDirectory', 'updateUser_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@.
--
-- 'serverId', 'updateUser_serverId' - A system-assigned unique identifier for a server instance that the user
-- account is assigned to.
--
-- 'userName', 'updateUser_userName' - A unique string that identifies a user and is associated with a server
-- as specified by the @ServerId@. This user name must be a minimum of 3
-- and a maximum of 100 characters long. The following are valid
-- characters: a-z, A-Z, 0-9, underscore \'_\', hyphen \'-\', period \'.\',
-- and at sign \'\@\'. The user name can\'t start with a hyphen, period, or
-- at sign.
newUpdateUser ::
  -- | 'serverId'
  Prelude.Text ->
  -- | 'userName'
  Prelude.Text ->
  UpdateUser
newUpdateUser :: Text -> Text -> UpdateUser
newUpdateUser Text
pServerId_ Text
pUserName_ =
  UpdateUser' :: Maybe HomeDirectoryType
-> Maybe PosixProfile
-> Maybe (NonEmpty HomeDirectoryMapEntry)
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> UpdateUser
UpdateUser'
    { $sel:homeDirectoryType:UpdateUser' :: Maybe HomeDirectoryType
homeDirectoryType = Maybe HomeDirectoryType
forall a. Maybe a
Prelude.Nothing,
      $sel:posixProfile:UpdateUser' :: Maybe PosixProfile
posixProfile = Maybe PosixProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectoryMappings:UpdateUser' :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings = Maybe (NonEmpty HomeDirectoryMapEntry)
forall a. Maybe a
Prelude.Nothing,
      $sel:role':UpdateUser' :: Maybe Text
role' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:policy:UpdateUser' :: Maybe Text
policy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectory:UpdateUser' :: Maybe Text
homeDirectory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:serverId:UpdateUser' :: Text
serverId = Text
pServerId_,
      $sel:userName:UpdateUser' :: Text
userName = Text
pUserName_
    }

-- | 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.
updateUser_homeDirectoryType :: Lens.Lens' UpdateUser (Prelude.Maybe HomeDirectoryType)
updateUser_homeDirectoryType :: (Maybe HomeDirectoryType -> f (Maybe HomeDirectoryType))
-> UpdateUser -> f UpdateUser
updateUser_homeDirectoryType = (UpdateUser -> Maybe HomeDirectoryType)
-> (UpdateUser -> Maybe HomeDirectoryType -> UpdateUser)
-> Lens
     UpdateUser
     UpdateUser
     (Maybe HomeDirectoryType)
     (Maybe HomeDirectoryType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe HomeDirectoryType
homeDirectoryType :: Maybe HomeDirectoryType
$sel:homeDirectoryType:UpdateUser' :: UpdateUser -> Maybe HomeDirectoryType
homeDirectoryType} -> Maybe HomeDirectoryType
homeDirectoryType) (\s :: UpdateUser
s@UpdateUser' {} Maybe HomeDirectoryType
a -> UpdateUser
s {$sel:homeDirectoryType:UpdateUser' :: Maybe HomeDirectoryType
homeDirectoryType = Maybe HomeDirectoryType
a} :: UpdateUser)

-- | Specifies the full POSIX identity, including user ID (@Uid@), group ID
-- (@Gid@), and any secondary groups IDs (@SecondaryGids@), that controls
-- your users\' access to your Amazon Elastic File Systems (Amazon EFS).
-- The POSIX permissions that are set on files and directories in your file
-- system determines the level of access your users get when transferring
-- files into and out of your Amazon EFS file systems.
updateUser_posixProfile :: Lens.Lens' UpdateUser (Prelude.Maybe PosixProfile)
updateUser_posixProfile :: (Maybe PosixProfile -> f (Maybe PosixProfile))
-> UpdateUser -> f UpdateUser
updateUser_posixProfile = (UpdateUser -> Maybe PosixProfile)
-> (UpdateUser -> Maybe PosixProfile -> UpdateUser)
-> Lens
     UpdateUser UpdateUser (Maybe PosixProfile) (Maybe PosixProfile)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe PosixProfile
posixProfile :: Maybe PosixProfile
$sel:posixProfile:UpdateUser' :: UpdateUser -> Maybe PosixProfile
posixProfile} -> Maybe PosixProfile
posixProfile) (\s :: UpdateUser
s@UpdateUser' {} Maybe PosixProfile
a -> UpdateUser
s {$sel:posixProfile:UpdateUser' :: Maybe PosixProfile
posixProfile = Maybe PosixProfile
a} :: UpdateUser)

-- | Logical directory mappings that specify what Amazon S3 or Amazon EFS
-- paths and keys should be visible to your user and how you want to make
-- them visible. You must specify the @Entry@ and @Target@ pair, where
-- @Entry@ shows how the path is made visible and @Target@ is the actual
-- Amazon S3 or Amazon EFS path. If you only specify a target, it is
-- displayed as is. You also must ensure that your Amazon Web Services
-- Identity and Access Management (IAM) role provides access to paths in
-- @Target@. This value can only be set when @HomeDirectoryType@ is set to
-- /LOGICAL/.
--
-- The following is an @Entry@ and @Target@ pair example.
--
-- @[ { \"Entry\": \"\/directory1\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
--
-- In most cases, you can use this value instead of the session policy to
-- lock down your user to the designated home directory (\"@chroot@\"). To
-- do this, you can set @Entry@ to \'\/\' and set @Target@ to the
-- HomeDirectory parameter value.
--
-- The following is an @Entry@ and @Target@ pair example for @chroot@.
--
-- @[ { \"Entry:\": \"\/\", \"Target\": \"\/bucket_name\/home\/mydirectory\" } ]@
--
-- If the target of a logical directory entry does not exist in Amazon S3
-- or EFS, the entry is ignored. As a workaround, you can use the Amazon S3
-- API or EFS API to create 0 byte objects as place holders for your
-- directory. If using the CLI, use the @s3api@ or @efsapi@ call instead of
-- @s3@ or @efs@ so you can use the put-object operation. For example, you
-- use the following:
-- @aws s3api put-object --bucket bucketname --key path\/to\/folder\/@.
-- Make sure that the end of the key name ends in a @\/@ for it to be
-- considered a folder.
updateUser_homeDirectoryMappings :: Lens.Lens' UpdateUser (Prelude.Maybe (Prelude.NonEmpty HomeDirectoryMapEntry))
updateUser_homeDirectoryMappings :: (Maybe (NonEmpty HomeDirectoryMapEntry)
 -> f (Maybe (NonEmpty HomeDirectoryMapEntry)))
-> UpdateUser -> f UpdateUser
updateUser_homeDirectoryMappings = (UpdateUser -> Maybe (NonEmpty HomeDirectoryMapEntry))
-> (UpdateUser
    -> Maybe (NonEmpty HomeDirectoryMapEntry) -> UpdateUser)
-> Lens
     UpdateUser
     UpdateUser
     (Maybe (NonEmpty HomeDirectoryMapEntry))
     (Maybe (NonEmpty HomeDirectoryMapEntry))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:homeDirectoryMappings:UpdateUser' :: UpdateUser -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings} -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings) (\s :: UpdateUser
s@UpdateUser' {} Maybe (NonEmpty HomeDirectoryMapEntry)
a -> UpdateUser
s {$sel:homeDirectoryMappings:UpdateUser' :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings = Maybe (NonEmpty HomeDirectoryMapEntry)
a} :: UpdateUser) ((Maybe (NonEmpty HomeDirectoryMapEntry)
  -> f (Maybe (NonEmpty HomeDirectoryMapEntry)))
 -> UpdateUser -> f UpdateUser)
-> ((Maybe (NonEmpty HomeDirectoryMapEntry)
     -> f (Maybe (NonEmpty HomeDirectoryMapEntry)))
    -> Maybe (NonEmpty HomeDirectoryMapEntry)
    -> f (Maybe (NonEmpty HomeDirectoryMapEntry)))
-> (Maybe (NonEmpty HomeDirectoryMapEntry)
    -> f (Maybe (NonEmpty HomeDirectoryMapEntry)))
-> UpdateUser
-> f UpdateUser
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
-> Iso
     (Maybe (NonEmpty HomeDirectoryMapEntry))
     (Maybe (NonEmpty HomeDirectoryMapEntry))
     (Maybe (NonEmpty HomeDirectoryMapEntry))
     (Maybe (NonEmpty HomeDirectoryMapEntry))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
  (NonEmpty HomeDirectoryMapEntry)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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.
updateUser_role :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_role :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_role = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
role' :: Maybe Text
$sel:role':UpdateUser' :: UpdateUser -> Maybe Text
role'} -> Maybe Text
role') (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:role':UpdateUser' :: Maybe Text
role' = Maybe Text
a} :: UpdateUser)

-- | A session policy for your user so that you can use the same IAM role
-- across multiple users. This policy scopes down user access to portions
-- of their Amazon S3 bucket. Variables that you can use inside this policy
-- include @${Transfer:UserName}@, @${Transfer:HomeDirectory}@, and
-- @${Transfer:HomeBucket}@.
--
-- This only applies when the domain of @ServerId@ is S3. EFS does not use
-- session policies.
--
-- For session policies, Amazon Web Services Transfer Family stores the
-- policy as a JSON blob, instead of the Amazon Resource Name (ARN) of the
-- policy. You save the policy as a JSON blob and pass it in the @Policy@
-- argument.
--
-- For an example of a session policy, see
-- <https://docs.aws.amazon.com/transfer/latest/userguide/session-policy Creating a session policy>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
-- in the /Amazon Web Services Security Token Service API Reference/.
updateUser_policy :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_policy :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_policy = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
policy :: Maybe Text
$sel:policy:UpdateUser' :: UpdateUser -> Maybe Text
policy} -> Maybe Text
policy) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:policy:UpdateUser' :: Maybe Text
policy = Maybe Text
a} :: UpdateUser)

-- | 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@.
updateUser_homeDirectory :: Lens.Lens' UpdateUser (Prelude.Maybe Prelude.Text)
updateUser_homeDirectory :: (Maybe Text -> f (Maybe Text)) -> UpdateUser -> f UpdateUser
updateUser_homeDirectory = (UpdateUser -> Maybe Text)
-> (UpdateUser -> Maybe Text -> UpdateUser)
-> Lens UpdateUser UpdateUser (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Maybe Text
homeDirectory :: Maybe Text
$sel:homeDirectory:UpdateUser' :: UpdateUser -> Maybe Text
homeDirectory} -> Maybe Text
homeDirectory) (\s :: UpdateUser
s@UpdateUser' {} Maybe Text
a -> UpdateUser
s {$sel:homeDirectory:UpdateUser' :: Maybe Text
homeDirectory = Maybe Text
a} :: UpdateUser)

-- | A system-assigned unique identifier for a server instance that the user
-- account is assigned to.
updateUser_serverId :: Lens.Lens' UpdateUser Prelude.Text
updateUser_serverId :: (Text -> f Text) -> UpdateUser -> f UpdateUser
updateUser_serverId = (UpdateUser -> Text)
-> (UpdateUser -> Text -> UpdateUser)
-> Lens UpdateUser UpdateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Text
serverId :: Text
$sel:serverId:UpdateUser' :: UpdateUser -> Text
serverId} -> Text
serverId) (\s :: UpdateUser
s@UpdateUser' {} Text
a -> UpdateUser
s {$sel:serverId:UpdateUser' :: Text
serverId = Text
a} :: UpdateUser)

-- | A unique string that identifies a user and is associated with a server
-- as specified by the @ServerId@. This user name must be a minimum of 3
-- and a maximum of 100 characters long. The following are valid
-- characters: a-z, A-Z, 0-9, underscore \'_\', hyphen \'-\', period \'.\',
-- and at sign \'\@\'. The user name can\'t start with a hyphen, period, or
-- at sign.
updateUser_userName :: Lens.Lens' UpdateUser Prelude.Text
updateUser_userName :: (Text -> f Text) -> UpdateUser -> f UpdateUser
updateUser_userName = (UpdateUser -> Text)
-> (UpdateUser -> Text -> UpdateUser)
-> Lens UpdateUser UpdateUser Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUser' {Text
userName :: Text
$sel:userName:UpdateUser' :: UpdateUser -> Text
userName} -> Text
userName) (\s :: UpdateUser
s@UpdateUser' {} Text
a -> UpdateUser
s {$sel:userName:UpdateUser' :: Text
userName = Text
a} :: UpdateUser)

instance Core.AWSRequest UpdateUser where
  type AWSResponse UpdateUser = UpdateUserResponse
  request :: UpdateUser -> Request UpdateUser
request = Service -> UpdateUser -> Request UpdateUser
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateUser))
-> Logger
-> Service
-> Proxy UpdateUser
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateUser)))
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 ->
          Int -> Text -> Text -> UpdateUserResponse
UpdateUserResponse'
            (Int -> Text -> Text -> UpdateUserResponse)
-> Either String Int
-> Either String (Text -> Text -> UpdateUserResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (Text -> Text -> UpdateUserResponse)
-> Either String Text -> Either String (Text -> UpdateUserResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"ServerId")
            Either String (Text -> UpdateUserResponse)
-> Either String Text -> Either String UpdateUserResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"UserName")
      )

instance Prelude.Hashable UpdateUser

instance Prelude.NFData UpdateUser

instance Core.ToHeaders UpdateUser where
  toHeaders :: UpdateUser -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateUser -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"TransferService.UpdateUser" :: Prelude.ByteString),
            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.ToJSON UpdateUser where
  toJSON :: UpdateUser -> Value
toJSON UpdateUser' {Maybe (NonEmpty HomeDirectoryMapEntry)
Maybe Text
Maybe HomeDirectoryType
Maybe PosixProfile
Text
userName :: Text
serverId :: Text
homeDirectory :: Maybe Text
policy :: Maybe Text
role' :: Maybe Text
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
posixProfile :: Maybe PosixProfile
homeDirectoryType :: Maybe HomeDirectoryType
$sel:userName:UpdateUser' :: UpdateUser -> Text
$sel:serverId:UpdateUser' :: UpdateUser -> Text
$sel:homeDirectory:UpdateUser' :: UpdateUser -> Maybe Text
$sel:policy:UpdateUser' :: UpdateUser -> Maybe Text
$sel:role':UpdateUser' :: UpdateUser -> Maybe Text
$sel:homeDirectoryMappings:UpdateUser' :: UpdateUser -> Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:posixProfile:UpdateUser' :: UpdateUser -> Maybe PosixProfile
$sel:homeDirectoryType:UpdateUser' :: UpdateUser -> Maybe HomeDirectoryType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"HomeDirectoryType" Text -> HomeDirectoryType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HomeDirectoryType -> Pair)
-> Maybe HomeDirectoryType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HomeDirectoryType
homeDirectoryType,
            (Text
"PosixProfile" Text -> PosixProfile -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (PosixProfile -> Pair) -> Maybe PosixProfile -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PosixProfile
posixProfile,
            (Text
"HomeDirectoryMappings" Text -> NonEmpty HomeDirectoryMapEntry -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty HomeDirectoryMapEntry -> Pair)
-> Maybe (NonEmpty HomeDirectoryMapEntry) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings,
            (Text
"Role" 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
role',
            (Text
"Policy" 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
policy,
            (Text
"HomeDirectory" 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
homeDirectory,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userName)
          ]
      )

instance Core.ToPath UpdateUser where
  toPath :: UpdateUser -> ByteString
toPath = ByteString -> UpdateUser -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | @UpdateUserResponse@ returns the user name and identifier for the
-- request to update a user\'s properties.
--
-- /See:/ 'newUpdateUserResponse' smart constructor.
data UpdateUserResponse = UpdateUserResponse'
  { -- | The response's http status code.
    UpdateUserResponse -> Int
httpStatus :: Prelude.Int,
    -- | A system-assigned unique identifier for a server instance that the user
    -- account is assigned to.
    UpdateUserResponse -> Text
serverId :: Prelude.Text,
    -- | The unique identifier for a user that is assigned to a server instance
    -- that was specified in the request.
    UpdateUserResponse -> Text
userName :: Prelude.Text
  }
  deriving (UpdateUserResponse -> UpdateUserResponse -> Bool
(UpdateUserResponse -> UpdateUserResponse -> Bool)
-> (UpdateUserResponse -> UpdateUserResponse -> Bool)
-> Eq UpdateUserResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c/= :: UpdateUserResponse -> UpdateUserResponse -> Bool
== :: UpdateUserResponse -> UpdateUserResponse -> Bool
$c== :: UpdateUserResponse -> UpdateUserResponse -> Bool
Prelude.Eq, ReadPrec [UpdateUserResponse]
ReadPrec UpdateUserResponse
Int -> ReadS UpdateUserResponse
ReadS [UpdateUserResponse]
(Int -> ReadS UpdateUserResponse)
-> ReadS [UpdateUserResponse]
-> ReadPrec UpdateUserResponse
-> ReadPrec [UpdateUserResponse]
-> Read UpdateUserResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateUserResponse]
$creadListPrec :: ReadPrec [UpdateUserResponse]
readPrec :: ReadPrec UpdateUserResponse
$creadPrec :: ReadPrec UpdateUserResponse
readList :: ReadS [UpdateUserResponse]
$creadList :: ReadS [UpdateUserResponse]
readsPrec :: Int -> ReadS UpdateUserResponse
$creadsPrec :: Int -> ReadS UpdateUserResponse
Prelude.Read, Int -> UpdateUserResponse -> ShowS
[UpdateUserResponse] -> ShowS
UpdateUserResponse -> String
(Int -> UpdateUserResponse -> ShowS)
-> (UpdateUserResponse -> String)
-> ([UpdateUserResponse] -> ShowS)
-> Show UpdateUserResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateUserResponse] -> ShowS
$cshowList :: [UpdateUserResponse] -> ShowS
show :: UpdateUserResponse -> String
$cshow :: UpdateUserResponse -> String
showsPrec :: Int -> UpdateUserResponse -> ShowS
$cshowsPrec :: Int -> UpdateUserResponse -> ShowS
Prelude.Show, (forall x. UpdateUserResponse -> Rep UpdateUserResponse x)
-> (forall x. Rep UpdateUserResponse x -> UpdateUserResponse)
-> Generic UpdateUserResponse
forall x. Rep UpdateUserResponse x -> UpdateUserResponse
forall x. UpdateUserResponse -> Rep UpdateUserResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateUserResponse x -> UpdateUserResponse
$cfrom :: forall x. UpdateUserResponse -> Rep UpdateUserResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateUserResponse' 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:
--
-- 'httpStatus', 'updateUserResponse_httpStatus' - The response's http status code.
--
-- 'serverId', 'updateUserResponse_serverId' - A system-assigned unique identifier for a server instance that the user
-- account is assigned to.
--
-- 'userName', 'updateUserResponse_userName' - The unique identifier for a user that is assigned to a server instance
-- that was specified in the request.
newUpdateUserResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serverId'
  Prelude.Text ->
  -- | 'userName'
  Prelude.Text ->
  UpdateUserResponse
newUpdateUserResponse :: Int -> Text -> Text -> UpdateUserResponse
newUpdateUserResponse
  Int
pHttpStatus_
  Text
pServerId_
  Text
pUserName_ =
    UpdateUserResponse' :: Int -> Text -> Text -> UpdateUserResponse
UpdateUserResponse'
      { $sel:httpStatus:UpdateUserResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:serverId:UpdateUserResponse' :: Text
serverId = Text
pServerId_,
        $sel:userName:UpdateUserResponse' :: Text
userName = Text
pUserName_
      }

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

-- | A system-assigned unique identifier for a server instance that the user
-- account is assigned to.
updateUserResponse_serverId :: Lens.Lens' UpdateUserResponse Prelude.Text
updateUserResponse_serverId :: (Text -> f Text) -> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_serverId = (UpdateUserResponse -> Text)
-> (UpdateUserResponse -> Text -> UpdateUserResponse)
-> Lens UpdateUserResponse UpdateUserResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserResponse' {Text
serverId :: Text
$sel:serverId:UpdateUserResponse' :: UpdateUserResponse -> Text
serverId} -> Text
serverId) (\s :: UpdateUserResponse
s@UpdateUserResponse' {} Text
a -> UpdateUserResponse
s {$sel:serverId:UpdateUserResponse' :: Text
serverId = Text
a} :: UpdateUserResponse)

-- | The unique identifier for a user that is assigned to a server instance
-- that was specified in the request.
updateUserResponse_userName :: Lens.Lens' UpdateUserResponse Prelude.Text
updateUserResponse_userName :: (Text -> f Text) -> UpdateUserResponse -> f UpdateUserResponse
updateUserResponse_userName = (UpdateUserResponse -> Text)
-> (UpdateUserResponse -> Text -> UpdateUserResponse)
-> Lens UpdateUserResponse UpdateUserResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateUserResponse' {Text
userName :: Text
$sel:userName:UpdateUserResponse' :: UpdateUserResponse -> Text
userName} -> Text
userName) (\s :: UpdateUserResponse
s@UpdateUserResponse' {} Text
a -> UpdateUserResponse
s {$sel:userName:UpdateUserResponse' :: Text
userName = Text
a} :: UpdateUserResponse)

instance Prelude.NFData UpdateUserResponse