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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Transfer.Types.Domain
import Amazonka.Transfer.Types.EndpointType
import Amazonka.Transfer.Types.IdentityProviderType
import Amazonka.Transfer.Types.State

-- | Returns properties of a file transfer protocol-enabled server that was
-- specified.
--
-- /See:/ 'newListedServer' smart constructor.
data ListedServer = ListedServer'
  { -- | Specifies the domain of the storage system that is used for file
    -- transfers.
    ListedServer -> Maybe Domain
domain :: Prelude.Maybe Domain,
    -- | Specifies the type of VPC endpoint that your server is connected to. If
    -- your server is connected to a VPC endpoint, your server isn\'t
    -- accessible over the public internet.
    ListedServer -> Maybe EndpointType
endpointType :: Prelude.Maybe EndpointType,
    -- | The mode of authentication for a server. The default value is
    -- @SERVICE_MANAGED@, which allows you to store and access user credentials
    -- within the Transfer Family service.
    --
    -- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
    -- in Directory Service for Microsoft Active Directory or Microsoft Active
    -- Directory in your on-premises environment or in Amazon Web Services
    -- using AD Connector. This option also requires you to provide a Directory
    -- ID by using the @IdentityProviderDetails@ parameter.
    --
    -- Use the @API_GATEWAY@ value to integrate with an identity provider of
    -- your choosing. The @API_GATEWAY@ setting requires you to provide an
    -- Amazon API Gateway endpoint URL to call for authentication by using the
    -- @IdentityProviderDetails@ parameter.
    --
    -- Use the @AWS_LAMBDA@ value to directly use an Lambda function as your
    -- identity provider. If you choose this value, you must specify the ARN
    -- for the Lambda function in the @Function@ parameter or the
    -- @IdentityProviderDetails@ data type.
    ListedServer -> Maybe IdentityProviderType
identityProviderType :: Prelude.Maybe IdentityProviderType,
    -- | The Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) role that allows a server to turn on Amazon CloudWatch logging for
    -- Amazon S3 or Amazon EFSevents. When set, you can view user activity in
    -- your CloudWatch logs.
    ListedServer -> Maybe Text
loggingRole :: Prelude.Maybe Prelude.Text,
    -- | Specifies the unique system assigned identifier for the servers that
    -- were listed.
    ListedServer -> Maybe Text
serverId :: Prelude.Maybe Prelude.Text,
    -- | The condition of the server that was described. A value of @ONLINE@
    -- indicates that the server can accept jobs and transfer files. A @State@
    -- value of @OFFLINE@ means that the server cannot perform file transfer
    -- operations.
    --
    -- The states of @STARTING@ and @STOPPING@ indicate that the server is in
    -- an intermediate state, either not fully able to respond, or not fully
    -- offline. The values of @START_FAILED@ or @STOP_FAILED@ can indicate an
    -- error condition.
    ListedServer -> Maybe State
state :: Prelude.Maybe State,
    -- | Specifies the number of users that are assigned to a server you
    -- specified with the @ServerId@.
    ListedServer -> Maybe Int
userCount :: Prelude.Maybe Prelude.Int,
    -- | Specifies the unique Amazon Resource Name (ARN) for a server to be
    -- listed.
    ListedServer -> Text
arn :: Prelude.Text
  }
  deriving (ListedServer -> ListedServer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListedServer -> ListedServer -> Bool
$c/= :: ListedServer -> ListedServer -> Bool
== :: ListedServer -> ListedServer -> Bool
$c== :: ListedServer -> ListedServer -> Bool
Prelude.Eq, ReadPrec [ListedServer]
ReadPrec ListedServer
Int -> ReadS ListedServer
ReadS [ListedServer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListedServer]
$creadListPrec :: ReadPrec [ListedServer]
readPrec :: ReadPrec ListedServer
$creadPrec :: ReadPrec ListedServer
readList :: ReadS [ListedServer]
$creadList :: ReadS [ListedServer]
readsPrec :: Int -> ReadS ListedServer
$creadsPrec :: Int -> ReadS ListedServer
Prelude.Read, Int -> ListedServer -> ShowS
[ListedServer] -> ShowS
ListedServer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListedServer] -> ShowS
$cshowList :: [ListedServer] -> ShowS
show :: ListedServer -> String
$cshow :: ListedServer -> String
showsPrec :: Int -> ListedServer -> ShowS
$cshowsPrec :: Int -> ListedServer -> ShowS
Prelude.Show, forall x. Rep ListedServer x -> ListedServer
forall x. ListedServer -> Rep ListedServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListedServer x -> ListedServer
$cfrom :: forall x. ListedServer -> Rep ListedServer x
Prelude.Generic)

-- |
-- Create a value of 'ListedServer' 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:
--
-- 'domain', 'listedServer_domain' - Specifies the domain of the storage system that is used for file
-- transfers.
--
-- 'endpointType', 'listedServer_endpointType' - Specifies the type of VPC endpoint that your server is connected to. If
-- your server is connected to a VPC endpoint, your server isn\'t
-- accessible over the public internet.
--
-- 'identityProviderType', 'listedServer_identityProviderType' - The mode of authentication for a server. The default value is
-- @SERVICE_MANAGED@, which allows you to store and access user credentials
-- within the Transfer Family service.
--
-- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
-- in Directory Service for Microsoft Active Directory or Microsoft Active
-- Directory in your on-premises environment or in Amazon Web Services
-- using AD Connector. This option also requires you to provide a Directory
-- ID by using the @IdentityProviderDetails@ parameter.
--
-- Use the @API_GATEWAY@ value to integrate with an identity provider of
-- your choosing. The @API_GATEWAY@ setting requires you to provide an
-- Amazon API Gateway endpoint URL to call for authentication by using the
-- @IdentityProviderDetails@ parameter.
--
-- Use the @AWS_LAMBDA@ value to directly use an Lambda function as your
-- identity provider. If you choose this value, you must specify the ARN
-- for the Lambda function in the @Function@ parameter or the
-- @IdentityProviderDetails@ data type.
--
-- 'loggingRole', 'listedServer_loggingRole' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role that allows a server to turn on Amazon CloudWatch logging for
-- Amazon S3 or Amazon EFSevents. When set, you can view user activity in
-- your CloudWatch logs.
--
-- 'serverId', 'listedServer_serverId' - Specifies the unique system assigned identifier for the servers that
-- were listed.
--
-- 'state', 'listedServer_state' - The condition of the server that was described. A value of @ONLINE@
-- indicates that the server can accept jobs and transfer files. A @State@
-- value of @OFFLINE@ means that the server cannot perform file transfer
-- operations.
--
-- The states of @STARTING@ and @STOPPING@ indicate that the server is in
-- an intermediate state, either not fully able to respond, or not fully
-- offline. The values of @START_FAILED@ or @STOP_FAILED@ can indicate an
-- error condition.
--
-- 'userCount', 'listedServer_userCount' - Specifies the number of users that are assigned to a server you
-- specified with the @ServerId@.
--
-- 'arn', 'listedServer_arn' - Specifies the unique Amazon Resource Name (ARN) for a server to be
-- listed.
newListedServer ::
  -- | 'arn'
  Prelude.Text ->
  ListedServer
newListedServer :: Text -> ListedServer
newListedServer Text
pArn_ =
  ListedServer'
    { $sel:domain:ListedServer' :: Maybe Domain
domain = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointType:ListedServer' :: Maybe EndpointType
endpointType = forall a. Maybe a
Prelude.Nothing,
      $sel:identityProviderType:ListedServer' :: Maybe IdentityProviderType
identityProviderType = forall a. Maybe a
Prelude.Nothing,
      $sel:loggingRole:ListedServer' :: Maybe Text
loggingRole = forall a. Maybe a
Prelude.Nothing,
      $sel:serverId:ListedServer' :: Maybe Text
serverId = forall a. Maybe a
Prelude.Nothing,
      $sel:state:ListedServer' :: Maybe State
state = forall a. Maybe a
Prelude.Nothing,
      $sel:userCount:ListedServer' :: Maybe Int
userCount = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ListedServer' :: Text
arn = Text
pArn_
    }

-- | Specifies the domain of the storage system that is used for file
-- transfers.
listedServer_domain :: Lens.Lens' ListedServer (Prelude.Maybe Domain)
listedServer_domain :: Lens' ListedServer (Maybe Domain)
listedServer_domain = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe Domain
domain :: Maybe Domain
$sel:domain:ListedServer' :: ListedServer -> Maybe Domain
domain} -> Maybe Domain
domain) (\s :: ListedServer
s@ListedServer' {} Maybe Domain
a -> ListedServer
s {$sel:domain:ListedServer' :: Maybe Domain
domain = Maybe Domain
a} :: ListedServer)

-- | Specifies the type of VPC endpoint that your server is connected to. If
-- your server is connected to a VPC endpoint, your server isn\'t
-- accessible over the public internet.
listedServer_endpointType :: Lens.Lens' ListedServer (Prelude.Maybe EndpointType)
listedServer_endpointType :: Lens' ListedServer (Maybe EndpointType)
listedServer_endpointType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe EndpointType
endpointType :: Maybe EndpointType
$sel:endpointType:ListedServer' :: ListedServer -> Maybe EndpointType
endpointType} -> Maybe EndpointType
endpointType) (\s :: ListedServer
s@ListedServer' {} Maybe EndpointType
a -> ListedServer
s {$sel:endpointType:ListedServer' :: Maybe EndpointType
endpointType = Maybe EndpointType
a} :: ListedServer)

-- | The mode of authentication for a server. The default value is
-- @SERVICE_MANAGED@, which allows you to store and access user credentials
-- within the Transfer Family service.
--
-- Use @AWS_DIRECTORY_SERVICE@ to provide access to Active Directory groups
-- in Directory Service for Microsoft Active Directory or Microsoft Active
-- Directory in your on-premises environment or in Amazon Web Services
-- using AD Connector. This option also requires you to provide a Directory
-- ID by using the @IdentityProviderDetails@ parameter.
--
-- Use the @API_GATEWAY@ value to integrate with an identity provider of
-- your choosing. The @API_GATEWAY@ setting requires you to provide an
-- Amazon API Gateway endpoint URL to call for authentication by using the
-- @IdentityProviderDetails@ parameter.
--
-- Use the @AWS_LAMBDA@ value to directly use an Lambda function as your
-- identity provider. If you choose this value, you must specify the ARN
-- for the Lambda function in the @Function@ parameter or the
-- @IdentityProviderDetails@ data type.
listedServer_identityProviderType :: Lens.Lens' ListedServer (Prelude.Maybe IdentityProviderType)
listedServer_identityProviderType :: Lens' ListedServer (Maybe IdentityProviderType)
listedServer_identityProviderType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe IdentityProviderType
identityProviderType :: Maybe IdentityProviderType
$sel:identityProviderType:ListedServer' :: ListedServer -> Maybe IdentityProviderType
identityProviderType} -> Maybe IdentityProviderType
identityProviderType) (\s :: ListedServer
s@ListedServer' {} Maybe IdentityProviderType
a -> ListedServer
s {$sel:identityProviderType:ListedServer' :: Maybe IdentityProviderType
identityProviderType = Maybe IdentityProviderType
a} :: ListedServer)

-- | The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role that allows a server to turn on Amazon CloudWatch logging for
-- Amazon S3 or Amazon EFSevents. When set, you can view user activity in
-- your CloudWatch logs.
listedServer_loggingRole :: Lens.Lens' ListedServer (Prelude.Maybe Prelude.Text)
listedServer_loggingRole :: Lens' ListedServer (Maybe Text)
listedServer_loggingRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe Text
loggingRole :: Maybe Text
$sel:loggingRole:ListedServer' :: ListedServer -> Maybe Text
loggingRole} -> Maybe Text
loggingRole) (\s :: ListedServer
s@ListedServer' {} Maybe Text
a -> ListedServer
s {$sel:loggingRole:ListedServer' :: Maybe Text
loggingRole = Maybe Text
a} :: ListedServer)

-- | Specifies the unique system assigned identifier for the servers that
-- were listed.
listedServer_serverId :: Lens.Lens' ListedServer (Prelude.Maybe Prelude.Text)
listedServer_serverId :: Lens' ListedServer (Maybe Text)
listedServer_serverId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe Text
serverId :: Maybe Text
$sel:serverId:ListedServer' :: ListedServer -> Maybe Text
serverId} -> Maybe Text
serverId) (\s :: ListedServer
s@ListedServer' {} Maybe Text
a -> ListedServer
s {$sel:serverId:ListedServer' :: Maybe Text
serverId = Maybe Text
a} :: ListedServer)

-- | The condition of the server that was described. A value of @ONLINE@
-- indicates that the server can accept jobs and transfer files. A @State@
-- value of @OFFLINE@ means that the server cannot perform file transfer
-- operations.
--
-- The states of @STARTING@ and @STOPPING@ indicate that the server is in
-- an intermediate state, either not fully able to respond, or not fully
-- offline. The values of @START_FAILED@ or @STOP_FAILED@ can indicate an
-- error condition.
listedServer_state :: Lens.Lens' ListedServer (Prelude.Maybe State)
listedServer_state :: Lens' ListedServer (Maybe State)
listedServer_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe State
state :: Maybe State
$sel:state:ListedServer' :: ListedServer -> Maybe State
state} -> Maybe State
state) (\s :: ListedServer
s@ListedServer' {} Maybe State
a -> ListedServer
s {$sel:state:ListedServer' :: Maybe State
state = Maybe State
a} :: ListedServer)

-- | Specifies the number of users that are assigned to a server you
-- specified with the @ServerId@.
listedServer_userCount :: Lens.Lens' ListedServer (Prelude.Maybe Prelude.Int)
listedServer_userCount :: Lens' ListedServer (Maybe Int)
listedServer_userCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Maybe Int
userCount :: Maybe Int
$sel:userCount:ListedServer' :: ListedServer -> Maybe Int
userCount} -> Maybe Int
userCount) (\s :: ListedServer
s@ListedServer' {} Maybe Int
a -> ListedServer
s {$sel:userCount:ListedServer' :: Maybe Int
userCount = Maybe Int
a} :: ListedServer)

-- | Specifies the unique Amazon Resource Name (ARN) for a server to be
-- listed.
listedServer_arn :: Lens.Lens' ListedServer Prelude.Text
listedServer_arn :: Lens' ListedServer Text
listedServer_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListedServer' {Text
arn :: Text
$sel:arn:ListedServer' :: ListedServer -> Text
arn} -> Text
arn) (\s :: ListedServer
s@ListedServer' {} Text
a -> ListedServer
s {$sel:arn:ListedServer' :: Text
arn = Text
a} :: ListedServer)

instance Data.FromJSON ListedServer where
  parseJSON :: Value -> Parser ListedServer
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ListedServer"
      ( \Object
x ->
          Maybe Domain
-> Maybe EndpointType
-> Maybe IdentityProviderType
-> Maybe Text
-> Maybe Text
-> Maybe State
-> Maybe Int
-> Text
-> ListedServer
ListedServer'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Domain")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EndpointType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"IdentityProviderType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LoggingRole")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ServerId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"State")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"UserCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Arn")
      )

instance Prelude.Hashable ListedServer where
  hashWithSalt :: Int -> ListedServer -> Int
hashWithSalt Int
_salt ListedServer' {Maybe Int
Maybe Text
Maybe Domain
Maybe EndpointType
Maybe IdentityProviderType
Maybe State
Text
arn :: Text
userCount :: Maybe Int
state :: Maybe State
serverId :: Maybe Text
loggingRole :: Maybe Text
identityProviderType :: Maybe IdentityProviderType
endpointType :: Maybe EndpointType
domain :: Maybe Domain
$sel:arn:ListedServer' :: ListedServer -> Text
$sel:userCount:ListedServer' :: ListedServer -> Maybe Int
$sel:state:ListedServer' :: ListedServer -> Maybe State
$sel:serverId:ListedServer' :: ListedServer -> Maybe Text
$sel:loggingRole:ListedServer' :: ListedServer -> Maybe Text
$sel:identityProviderType:ListedServer' :: ListedServer -> Maybe IdentityProviderType
$sel:endpointType:ListedServer' :: ListedServer -> Maybe EndpointType
$sel:domain:ListedServer' :: ListedServer -> Maybe Domain
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Domain
domain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EndpointType
endpointType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IdentityProviderType
identityProviderType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
loggingRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
serverId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe State
state
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
userCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData ListedServer where
  rnf :: ListedServer -> ()
rnf ListedServer' {Maybe Int
Maybe Text
Maybe Domain
Maybe EndpointType
Maybe IdentityProviderType
Maybe State
Text
arn :: Text
userCount :: Maybe Int
state :: Maybe State
serverId :: Maybe Text
loggingRole :: Maybe Text
identityProviderType :: Maybe IdentityProviderType
endpointType :: Maybe EndpointType
domain :: Maybe Domain
$sel:arn:ListedServer' :: ListedServer -> Text
$sel:userCount:ListedServer' :: ListedServer -> Maybe Int
$sel:state:ListedServer' :: ListedServer -> Maybe State
$sel:serverId:ListedServer' :: ListedServer -> Maybe Text
$sel:loggingRole:ListedServer' :: ListedServer -> Maybe Text
$sel:identityProviderType:ListedServer' :: ListedServer -> Maybe IdentityProviderType
$sel:endpointType:ListedServer' :: ListedServer -> Maybe EndpointType
$sel:domain:ListedServer' :: ListedServer -> Maybe Domain
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Domain
domain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EndpointType
endpointType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IdentityProviderType
identityProviderType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
loggingRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
serverId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe State
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
userCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn