{-# 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.CreateAccess
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Used by administrators to choose which groups in the directory should
-- have access to upload and download files over the enabled protocols
-- using Transfer Family. For example, a Microsoft Active Directory might
-- contain 50,000 users, but only a small fraction might need the ability
-- to transfer files to the server. An administrator can use @CreateAccess@
-- to limit the access to the correct set of users who need this ability.
module Amazonka.Transfer.CreateAccess
  ( -- * Creating a Request
    CreateAccess (..),
    newCreateAccess,

    -- * Request Lenses
    createAccess_homeDirectory,
    createAccess_homeDirectoryMappings,
    createAccess_homeDirectoryType,
    createAccess_policy,
    createAccess_posixProfile,
    createAccess_role,
    createAccess_serverId,
    createAccess_externalId,

    -- * Destructuring the Response
    CreateAccessResponse (..),
    newCreateAccessResponse,

    -- * Response Lenses
    createAccessResponse_httpStatus,
    createAccessResponse_serverId,
    createAccessResponse_externalId,
  )
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 qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Transfer.Types

-- | /See:/ 'newCreateAccess' smart constructor.
data CreateAccess = CreateAccess'
  { -- | 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@.
    CreateAccess -> Maybe Text
homeDirectory :: Prelude.Maybe Prelude.Text,
    -- | 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 Identity and Access
    -- Management (IAM) role provides access to paths in @Target@. This value
    -- can be set only 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\" } ]@
    CreateAccess -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings :: Prelude.Maybe (Prelude.NonEmpty HomeDirectoryMapEntry),
    -- | 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.
    CreateAccess -> Maybe HomeDirectoryType
homeDirectoryType :: Prelude.Maybe HomeDirectoryType,
    -- | A session policy for your user so that you can use the same Identity and
    -- Access Management (IAM) role across multiple users. This policy scopes
    -- down a user\'s 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 policy applies only when the domain of @ServerId@ is Amazon S3.
    -- Amazon EFS does not use session policies.
    --
    -- For session policies, 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.html Example session policy>.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
    -- in the /Security Token Service API Reference/.
    CreateAccess -> Maybe Text
policy :: Prelude.Maybe Prelude.Text,
    CreateAccess -> Maybe PosixProfile
posixProfile :: Prelude.Maybe PosixProfile,
    -- | 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.
    CreateAccess -> Text
role' :: Prelude.Text,
    -- | A system-assigned unique identifier for a server instance. This is the
    -- specific server that you added your user to.
    CreateAccess -> Text
serverId :: 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
    -- 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 regular expression 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: =,.\@:\/-
    CreateAccess -> Text
externalId :: Prelude.Text
  }
  deriving (CreateAccess -> CreateAccess -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccess -> CreateAccess -> Bool
$c/= :: CreateAccess -> CreateAccess -> Bool
== :: CreateAccess -> CreateAccess -> Bool
$c== :: CreateAccess -> CreateAccess -> Bool
Prelude.Eq, ReadPrec [CreateAccess]
ReadPrec CreateAccess
Int -> ReadS CreateAccess
ReadS [CreateAccess]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccess]
$creadListPrec :: ReadPrec [CreateAccess]
readPrec :: ReadPrec CreateAccess
$creadPrec :: ReadPrec CreateAccess
readList :: ReadS [CreateAccess]
$creadList :: ReadS [CreateAccess]
readsPrec :: Int -> ReadS CreateAccess
$creadsPrec :: Int -> ReadS CreateAccess
Prelude.Read, Int -> CreateAccess -> ShowS
[CreateAccess] -> ShowS
CreateAccess -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccess] -> ShowS
$cshowList :: [CreateAccess] -> ShowS
show :: CreateAccess -> String
$cshow :: CreateAccess -> String
showsPrec :: Int -> CreateAccess -> ShowS
$cshowsPrec :: Int -> CreateAccess -> ShowS
Prelude.Show, forall x. Rep CreateAccess x -> CreateAccess
forall x. CreateAccess -> Rep CreateAccess x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccess x -> CreateAccess
$cfrom :: forall x. CreateAccess -> Rep CreateAccess x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccess' 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', 'createAccess_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@.
--
-- 'homeDirectoryMappings', 'createAccess_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 Identity and Access
-- Management (IAM) role provides access to paths in @Target@. This value
-- can be set only 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\" } ]@
--
-- 'homeDirectoryType', 'createAccess_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.
--
-- 'policy', 'createAccess_policy' - A session policy for your user so that you can use the same Identity and
-- Access Management (IAM) role across multiple users. This policy scopes
-- down a user\'s 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 policy applies only when the domain of @ServerId@ is Amazon S3.
-- Amazon EFS does not use session policies.
--
-- For session policies, 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.html Example session policy>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
-- in the /Security Token Service API Reference/.
--
-- 'posixProfile', 'createAccess_posixProfile' - Undocumented member.
--
-- 'role'', 'createAccess_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.
--
-- 'serverId', 'createAccess_serverId' - A system-assigned unique identifier for a server instance. This is the
-- specific server that you added your user to.
--
-- 'externalId', 'createAccess_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
-- 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 regular expression 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: =,.\@:\/-
newCreateAccess ::
  -- | 'role''
  Prelude.Text ->
  -- | 'serverId'
  Prelude.Text ->
  -- | 'externalId'
  Prelude.Text ->
  CreateAccess
newCreateAccess :: Text -> Text -> Text -> CreateAccess
newCreateAccess Text
pRole_ Text
pServerId_ Text
pExternalId_ =
  CreateAccess'
    { $sel:homeDirectory:CreateAccess' :: Maybe Text
homeDirectory = forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectoryMappings:CreateAccess' :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings = forall a. Maybe a
Prelude.Nothing,
      $sel:homeDirectoryType:CreateAccess' :: Maybe HomeDirectoryType
homeDirectoryType = forall a. Maybe a
Prelude.Nothing,
      $sel:policy:CreateAccess' :: Maybe Text
policy = forall a. Maybe a
Prelude.Nothing,
      $sel:posixProfile:CreateAccess' :: Maybe PosixProfile
posixProfile = forall a. Maybe a
Prelude.Nothing,
      $sel:role':CreateAccess' :: Text
role' = Text
pRole_,
      $sel:serverId:CreateAccess' :: Text
serverId = Text
pServerId_,
      $sel:externalId:CreateAccess' :: Text
externalId = Text
pExternalId_
    }

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

-- | 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 Identity and Access
-- Management (IAM) role provides access to paths in @Target@. This value
-- can be set only 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\" } ]@
createAccess_homeDirectoryMappings :: Lens.Lens' CreateAccess (Prelude.Maybe (Prelude.NonEmpty HomeDirectoryMapEntry))
createAccess_homeDirectoryMappings :: Lens' CreateAccess (Maybe (NonEmpty HomeDirectoryMapEntry))
createAccess_homeDirectoryMappings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccess' {Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:homeDirectoryMappings:CreateAccess' :: CreateAccess -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings} -> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings) (\s :: CreateAccess
s@CreateAccess' {} Maybe (NonEmpty HomeDirectoryMapEntry)
a -> CreateAccess
s {$sel:homeDirectoryMappings:CreateAccess' :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings = Maybe (NonEmpty HomeDirectoryMapEntry)
a} :: CreateAccess) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

-- | A session policy for your user so that you can use the same Identity and
-- Access Management (IAM) role across multiple users. This policy scopes
-- down a user\'s 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 policy applies only when the domain of @ServerId@ is Amazon S3.
-- Amazon EFS does not use session policies.
--
-- For session policies, 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.html Example session policy>.
--
-- For more information, see
-- <https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html AssumeRole>
-- in the /Security Token Service API Reference/.
createAccess_policy :: Lens.Lens' CreateAccess (Prelude.Maybe Prelude.Text)
createAccess_policy :: Lens' CreateAccess (Maybe Text)
createAccess_policy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccess' {Maybe Text
policy :: Maybe Text
$sel:policy:CreateAccess' :: CreateAccess -> Maybe Text
policy} -> Maybe Text
policy) (\s :: CreateAccess
s@CreateAccess' {} Maybe Text
a -> CreateAccess
s {$sel:policy:CreateAccess' :: Maybe Text
policy = Maybe Text
a} :: CreateAccess)

-- | Undocumented member.
createAccess_posixProfile :: Lens.Lens' CreateAccess (Prelude.Maybe PosixProfile)
createAccess_posixProfile :: Lens' CreateAccess (Maybe PosixProfile)
createAccess_posixProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccess' {Maybe PosixProfile
posixProfile :: Maybe PosixProfile
$sel:posixProfile:CreateAccess' :: CreateAccess -> Maybe PosixProfile
posixProfile} -> Maybe PosixProfile
posixProfile) (\s :: CreateAccess
s@CreateAccess' {} Maybe PosixProfile
a -> CreateAccess
s {$sel:posixProfile:CreateAccess' :: Maybe PosixProfile
posixProfile = Maybe PosixProfile
a} :: CreateAccess)

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

-- | A system-assigned unique identifier for a server instance. This is the
-- specific server that you added your user to.
createAccess_serverId :: Lens.Lens' CreateAccess Prelude.Text
createAccess_serverId :: Lens' CreateAccess Text
createAccess_serverId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccess' {Text
serverId :: Text
$sel:serverId:CreateAccess' :: CreateAccess -> Text
serverId} -> Text
serverId) (\s :: CreateAccess
s@CreateAccess' {} Text
a -> CreateAccess
s {$sel:serverId:CreateAccess' :: Text
serverId = Text
a} :: CreateAccess)

-- | 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
-- 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 regular expression 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: =,.\@:\/-
createAccess_externalId :: Lens.Lens' CreateAccess Prelude.Text
createAccess_externalId :: Lens' CreateAccess Text
createAccess_externalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccess' {Text
externalId :: Text
$sel:externalId:CreateAccess' :: CreateAccess -> Text
externalId} -> Text
externalId) (\s :: CreateAccess
s@CreateAccess' {} Text
a -> CreateAccess
s {$sel:externalId:CreateAccess' :: Text
externalId = Text
a} :: CreateAccess)

instance Core.AWSRequest CreateAccess where
  type AWSResponse CreateAccess = CreateAccessResponse
  request :: (Service -> Service) -> CreateAccess -> Request CreateAccess
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateAccess
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateAccess)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> Text -> CreateAccessResponse
CreateAccessResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ServerId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"ExternalId")
      )

instance Prelude.Hashable CreateAccess where
  hashWithSalt :: Int -> CreateAccess -> Int
hashWithSalt Int
_salt CreateAccess' {Maybe (NonEmpty HomeDirectoryMapEntry)
Maybe Text
Maybe HomeDirectoryType
Maybe PosixProfile
Text
externalId :: Text
serverId :: Text
role' :: Text
posixProfile :: Maybe PosixProfile
policy :: Maybe Text
homeDirectoryType :: Maybe HomeDirectoryType
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectory :: Maybe Text
$sel:externalId:CreateAccess' :: CreateAccess -> Text
$sel:serverId:CreateAccess' :: CreateAccess -> Text
$sel:role':CreateAccess' :: CreateAccess -> Text
$sel:posixProfile:CreateAccess' :: CreateAccess -> Maybe PosixProfile
$sel:policy:CreateAccess' :: CreateAccess -> Maybe Text
$sel:homeDirectoryType:CreateAccess' :: CreateAccess -> Maybe HomeDirectoryType
$sel:homeDirectoryMappings:CreateAccess' :: CreateAccess -> Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:homeDirectory:CreateAccess' :: CreateAccess -> 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 (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HomeDirectoryType
homeDirectoryType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
policy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PosixProfile
posixProfile
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
role'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
serverId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
externalId

instance Prelude.NFData CreateAccess where
  rnf :: CreateAccess -> ()
rnf CreateAccess' {Maybe (NonEmpty HomeDirectoryMapEntry)
Maybe Text
Maybe HomeDirectoryType
Maybe PosixProfile
Text
externalId :: Text
serverId :: Text
role' :: Text
posixProfile :: Maybe PosixProfile
policy :: Maybe Text
homeDirectoryType :: Maybe HomeDirectoryType
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectory :: Maybe Text
$sel:externalId:CreateAccess' :: CreateAccess -> Text
$sel:serverId:CreateAccess' :: CreateAccess -> Text
$sel:role':CreateAccess' :: CreateAccess -> Text
$sel:posixProfile:CreateAccess' :: CreateAccess -> Maybe PosixProfile
$sel:policy:CreateAccess' :: CreateAccess -> Maybe Text
$sel:homeDirectoryType:CreateAccess' :: CreateAccess -> Maybe HomeDirectoryType
$sel:homeDirectoryMappings:CreateAccess' :: CreateAccess -> Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:homeDirectory:CreateAccess' :: CreateAccess -> 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 (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings
      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
policy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PosixProfile
posixProfile
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
role'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
externalId

instance Data.ToHeaders CreateAccess where
  toHeaders :: CreateAccess -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"TransferService.CreateAccess" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateAccess where
  toJSON :: CreateAccess -> Value
toJSON CreateAccess' {Maybe (NonEmpty HomeDirectoryMapEntry)
Maybe Text
Maybe HomeDirectoryType
Maybe PosixProfile
Text
externalId :: Text
serverId :: Text
role' :: Text
posixProfile :: Maybe PosixProfile
policy :: Maybe Text
homeDirectoryType :: Maybe HomeDirectoryType
homeDirectoryMappings :: Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectory :: Maybe Text
$sel:externalId:CreateAccess' :: CreateAccess -> Text
$sel:serverId:CreateAccess' :: CreateAccess -> Text
$sel:role':CreateAccess' :: CreateAccess -> Text
$sel:posixProfile:CreateAccess' :: CreateAccess -> Maybe PosixProfile
$sel:policy:CreateAccess' :: CreateAccess -> Maybe Text
$sel:homeDirectoryType:CreateAccess' :: CreateAccess -> Maybe HomeDirectoryType
$sel:homeDirectoryMappings:CreateAccess' :: CreateAccess -> Maybe (NonEmpty HomeDirectoryMapEntry)
$sel:homeDirectory:CreateAccess' :: CreateAccess -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"HomeDirectory" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
homeDirectory,
            (Key
"HomeDirectoryMappings" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty HomeDirectoryMapEntry)
homeDirectoryMappings,
            (Key
"HomeDirectoryType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HomeDirectoryType
homeDirectoryType,
            (Key
"Policy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
policy,
            (Key
"PosixProfile" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PosixProfile
posixProfile,
            forall a. a -> Maybe a
Prelude.Just (Key
"Role" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
role'),
            forall a. a -> Maybe a
Prelude.Just (Key
"ServerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
serverId),
            forall a. a -> Maybe a
Prelude.Just (Key
"ExternalId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
externalId)
          ]
      )

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

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

-- | /See:/ 'newCreateAccessResponse' smart constructor.
data CreateAccessResponse = CreateAccessResponse'
  { -- | The response's http status code.
    CreateAccessResponse -> Int
httpStatus :: Prelude.Int,
    -- | The identifier of the server that the user is attached to.
    CreateAccessResponse -> Text
serverId :: Prelude.Text,
    -- | The external identifier of the group whose users have access to your
    -- Amazon S3 or Amazon EFS resources over the enabled protocols using
    -- Transfer Family.
    CreateAccessResponse -> Text
externalId :: Prelude.Text
  }
  deriving (CreateAccessResponse -> CreateAccessResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateAccessResponse -> CreateAccessResponse -> Bool
$c/= :: CreateAccessResponse -> CreateAccessResponse -> Bool
== :: CreateAccessResponse -> CreateAccessResponse -> Bool
$c== :: CreateAccessResponse -> CreateAccessResponse -> Bool
Prelude.Eq, ReadPrec [CreateAccessResponse]
ReadPrec CreateAccessResponse
Int -> ReadS CreateAccessResponse
ReadS [CreateAccessResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateAccessResponse]
$creadListPrec :: ReadPrec [CreateAccessResponse]
readPrec :: ReadPrec CreateAccessResponse
$creadPrec :: ReadPrec CreateAccessResponse
readList :: ReadS [CreateAccessResponse]
$creadList :: ReadS [CreateAccessResponse]
readsPrec :: Int -> ReadS CreateAccessResponse
$creadsPrec :: Int -> ReadS CreateAccessResponse
Prelude.Read, Int -> CreateAccessResponse -> ShowS
[CreateAccessResponse] -> ShowS
CreateAccessResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateAccessResponse] -> ShowS
$cshowList :: [CreateAccessResponse] -> ShowS
show :: CreateAccessResponse -> String
$cshow :: CreateAccessResponse -> String
showsPrec :: Int -> CreateAccessResponse -> ShowS
$cshowsPrec :: Int -> CreateAccessResponse -> ShowS
Prelude.Show, forall x. Rep CreateAccessResponse x -> CreateAccessResponse
forall x. CreateAccessResponse -> Rep CreateAccessResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateAccessResponse x -> CreateAccessResponse
$cfrom :: forall x. CreateAccessResponse -> Rep CreateAccessResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateAccessResponse' 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', 'createAccessResponse_httpStatus' - The response's http status code.
--
-- 'serverId', 'createAccessResponse_serverId' - The identifier of the server that the user is attached to.
--
-- 'externalId', 'createAccessResponse_externalId' - The external identifier of the group whose users have access to your
-- Amazon S3 or Amazon EFS resources over the enabled protocols using
-- Transfer Family.
newCreateAccessResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serverId'
  Prelude.Text ->
  -- | 'externalId'
  Prelude.Text ->
  CreateAccessResponse
newCreateAccessResponse :: Int -> Text -> Text -> CreateAccessResponse
newCreateAccessResponse
  Int
pHttpStatus_
  Text
pServerId_
  Text
pExternalId_ =
    CreateAccessResponse'
      { $sel:httpStatus:CreateAccessResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:serverId:CreateAccessResponse' :: Text
serverId = Text
pServerId_,
        $sel:externalId:CreateAccessResponse' :: Text
externalId = Text
pExternalId_
      }

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

-- | The identifier of the server that the user is attached to.
createAccessResponse_serverId :: Lens.Lens' CreateAccessResponse Prelude.Text
createAccessResponse_serverId :: Lens' CreateAccessResponse Text
createAccessResponse_serverId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessResponse' {Text
serverId :: Text
$sel:serverId:CreateAccessResponse' :: CreateAccessResponse -> Text
serverId} -> Text
serverId) (\s :: CreateAccessResponse
s@CreateAccessResponse' {} Text
a -> CreateAccessResponse
s {$sel:serverId:CreateAccessResponse' :: Text
serverId = Text
a} :: CreateAccessResponse)

-- | The external identifier of the group whose users have access to your
-- Amazon S3 or Amazon EFS resources over the enabled protocols using
-- Transfer Family.
createAccessResponse_externalId :: Lens.Lens' CreateAccessResponse Prelude.Text
createAccessResponse_externalId :: Lens' CreateAccessResponse Text
createAccessResponse_externalId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateAccessResponse' {Text
externalId :: Text
$sel:externalId:CreateAccessResponse' :: CreateAccessResponse -> Text
externalId} -> Text
externalId) (\s :: CreateAccessResponse
s@CreateAccessResponse' {} Text
a -> CreateAccessResponse
s {$sel:externalId:CreateAccessResponse' :: Text
externalId = Text
a} :: CreateAccessResponse)

instance Prelude.NFData CreateAccessResponse where
  rnf :: CreateAccessResponse -> ()
rnf CreateAccessResponse' {Int
Text
externalId :: Text
serverId :: Text
httpStatus :: Int
$sel:externalId:CreateAccessResponse' :: CreateAccessResponse -> Text
$sel:serverId:CreateAccessResponse' :: CreateAccessResponse -> Text
$sel:httpStatus:CreateAccessResponse' :: CreateAccessResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
serverId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
externalId