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

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

-- | Lists the properties for one or more specified associated accesses.
--
-- /See:/ 'newListedAccess' smart constructor.
data ListedAccess = ListedAccess'
  { -- | 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.
    ListedAccess -> Maybe HomeDirectoryType
homeDirectoryType :: Prelude.Maybe HomeDirectoryType,
    -- | 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.
    ListedAccess -> Maybe Text
role' :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier that is required to identify specific groups within
    -- your directory. The users of the group that you associate have access to
    -- your Amazon S3 or Amazon EFS resources over the enabled protocols using
    -- Amazon Web Services Transfer Family. If you know the group name, you can
    -- view the SID values by running the following command using Windows
    -- PowerShell.
    --
    -- @Get-ADGroup -Filter {samAccountName -like \"YourGroupName*\"} -Properties * | Select SamAccountName,ObjectSid@
    --
    -- In that command, replace /YourGroupName/ with the name of your Active
    -- Directory group.
    --
    -- The regex used to validate this parameter is a string of characters
    -- consisting of uppercase and lowercase alphanumeric characters with no
    -- spaces. You can also include underscores or any of the following
    -- characters: =,.\@:\/-
    ListedAccess -> Maybe Text
externalId :: 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@.
    ListedAccess -> Maybe Text
homeDirectory :: Prelude.Maybe Prelude.Text
  }
  deriving (ListedAccess -> ListedAccess -> Bool
(ListedAccess -> ListedAccess -> Bool)
-> (ListedAccess -> ListedAccess -> Bool) -> Eq ListedAccess
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedAccess -> ListedAccess -> Bool
$c/= :: ListedAccess -> ListedAccess -> Bool
== :: ListedAccess -> ListedAccess -> Bool
$c== :: ListedAccess -> ListedAccess -> Bool
Prelude.Eq, ReadPrec [ListedAccess]
ReadPrec ListedAccess
Int -> ReadS ListedAccess
ReadS [ListedAccess]
(Int -> ReadS ListedAccess)
-> ReadS [ListedAccess]
-> ReadPrec ListedAccess
-> ReadPrec [ListedAccess]
-> Read ListedAccess
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedAccess]
$creadListPrec :: ReadPrec [ListedAccess]
readPrec :: ReadPrec ListedAccess
$creadPrec :: ReadPrec ListedAccess
readList :: ReadS [ListedAccess]
$creadList :: ReadS [ListedAccess]
readsPrec :: Int -> ReadS ListedAccess
$creadsPrec :: Int -> ReadS ListedAccess
Prelude.Read, Int -> ListedAccess -> ShowS
[ListedAccess] -> ShowS
ListedAccess -> String
(Int -> ListedAccess -> ShowS)
-> (ListedAccess -> String)
-> ([ListedAccess] -> ShowS)
-> Show ListedAccess
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedAccess] -> ShowS
$cshowList :: [ListedAccess] -> ShowS
show :: ListedAccess -> String
$cshow :: ListedAccess -> String
showsPrec :: Int -> ListedAccess -> ShowS
$cshowsPrec :: Int -> ListedAccess -> ShowS
Prelude.Show, (forall x. ListedAccess -> Rep ListedAccess x)
-> (forall x. Rep ListedAccess x -> ListedAccess)
-> Generic ListedAccess
forall x. Rep ListedAccess x -> ListedAccess
forall x. ListedAccess -> Rep ListedAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedAccess x -> ListedAccess
$cfrom :: forall x. ListedAccess -> Rep ListedAccess x
Prelude.Generic)

-- |
-- Create a value of 'ListedAccess' 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', 'listedAccess_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.
--
-- 'role'', 'listedAccess_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.
--
-- 'externalId', 'listedAccess_externalId' - A unique identifier that is required to identify specific groups within
-- your directory. The users of the group that you associate have access to
-- your Amazon S3 or Amazon EFS resources over the enabled protocols using
-- Amazon Web Services Transfer Family. If you know the group name, you can
-- view the SID values by running the following command using Windows
-- PowerShell.
--
-- @Get-ADGroup -Filter {samAccountName -like \"YourGroupName*\"} -Properties * | Select SamAccountName,ObjectSid@
--
-- In that command, replace /YourGroupName/ with the name of your Active
-- Directory group.
--
-- The regex used to validate this parameter is a string of characters
-- consisting of uppercase and lowercase alphanumeric characters with no
-- spaces. You can also include underscores or any of the following
-- characters: =,.\@:\/-
--
-- 'homeDirectory', 'listedAccess_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@.
newListedAccess ::
  ListedAccess
newListedAccess :: ListedAccess
newListedAccess =
  ListedAccess' :: Maybe HomeDirectoryType
-> Maybe Text -> Maybe Text -> Maybe Text -> ListedAccess
ListedAccess'
    { $sel:homeDirectoryType:ListedAccess' :: Maybe HomeDirectoryType
homeDirectoryType = Maybe HomeDirectoryType
forall a. Maybe a
Prelude.Nothing,
      $sel:role':ListedAccess' :: Maybe Text
role' = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:externalId:ListedAccess' :: Maybe Text
externalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectory:ListedAccess' :: Maybe Text
homeDirectory = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | A unique identifier that is required to identify specific groups within
-- your directory. The users of the group that you associate have access to
-- your Amazon S3 or Amazon EFS resources over the enabled protocols using
-- Amazon Web Services Transfer Family. If you know the group name, you can
-- view the SID values by running the following command using Windows
-- PowerShell.
--
-- @Get-ADGroup -Filter {samAccountName -like \"YourGroupName*\"} -Properties * | Select SamAccountName,ObjectSid@
--
-- In that command, replace /YourGroupName/ with the name of your Active
-- Directory group.
--
-- The regex used to validate this parameter is a string of characters
-- consisting of uppercase and lowercase alphanumeric characters with no
-- spaces. You can also include underscores or any of the following
-- characters: =,.\@:\/-
listedAccess_externalId :: Lens.Lens' ListedAccess (Prelude.Maybe Prelude.Text)
listedAccess_externalId :: (Maybe Text -> f (Maybe Text)) -> ListedAccess -> f ListedAccess
listedAccess_externalId = (ListedAccess -> Maybe Text)
-> (ListedAccess -> Maybe Text -> ListedAccess)
-> Lens ListedAccess ListedAccess (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedAccess' {Maybe Text
externalId :: Maybe Text
$sel:externalId:ListedAccess' :: ListedAccess -> Maybe Text
externalId} -> Maybe Text
externalId) (\s :: ListedAccess
s@ListedAccess' {} Maybe Text
a -> ListedAccess
s {$sel:externalId:ListedAccess' :: Maybe Text
externalId = Maybe Text
a} :: ListedAccess)

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

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

instance Prelude.Hashable ListedAccess

instance Prelude.NFData ListedAccess