{-# 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.DescribedConnector
-- 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.DescribedConnector 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.As2ConnectorConfig
import Amazonka.Transfer.Types.Tag

-- | Describes the parameters for the connector, as identified by the
-- @ConnectorId@.
--
-- /See:/ 'newDescribedConnector' smart constructor.
data DescribedConnector = DescribedConnector'
  { -- | With AS2, you can send files by calling @StartFileTransfer@ and
    -- specifying the file paths in the request parameter, @SendFilePaths@. We
    -- use the file’s parent directory (for example, for
    -- @--send-file-paths \/bucket\/dir\/file.txt@, parent directory is
    -- @\/bucket\/dir\/@) to temporarily store a processed AS2 message file,
    -- store the MDN when we receive them from the partner, and write a final
    -- JSON file containing relevant metadata of the transmission. So, the
    -- @AccessRole@ needs to provide read and write access to the parent
    -- directory of the file location used in the @StartFileTransfer@ request.
    -- Additionally, you need to provide read and write access to the parent
    -- directory of the files that you intend to send with @StartFileTransfer@.
    DescribedConnector -> Maybe Text
accessRole :: Prelude.Maybe Prelude.Text,
    -- | A structure that contains the parameters for a connector object.
    DescribedConnector -> Maybe As2ConnectorConfig
as2Config :: Prelude.Maybe As2ConnectorConfig,
    -- | The unique identifier for the connector.
    DescribedConnector -> Maybe Text
connectorId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Identity and Access Management
    -- (IAM) role that allows a connector to turn on CloudWatch logging for
    -- Amazon S3 events. When set, you can view connector activity in your
    -- CloudWatch logs.
    DescribedConnector -> Maybe Text
loggingRole :: Prelude.Maybe Prelude.Text,
    -- | Key-value pairs that can be used to group and search for connectors.
    DescribedConnector -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The URL of the partner\'s AS2 endpoint.
    DescribedConnector -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The unique Amazon Resource Name (ARN) for the connector.
    DescribedConnector -> Text
arn :: Prelude.Text
  }
  deriving (DescribedConnector -> DescribedConnector -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribedConnector -> DescribedConnector -> Bool
$c/= :: DescribedConnector -> DescribedConnector -> Bool
== :: DescribedConnector -> DescribedConnector -> Bool
$c== :: DescribedConnector -> DescribedConnector -> Bool
Prelude.Eq, ReadPrec [DescribedConnector]
ReadPrec DescribedConnector
Int -> ReadS DescribedConnector
ReadS [DescribedConnector]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribedConnector]
$creadListPrec :: ReadPrec [DescribedConnector]
readPrec :: ReadPrec DescribedConnector
$creadPrec :: ReadPrec DescribedConnector
readList :: ReadS [DescribedConnector]
$creadList :: ReadS [DescribedConnector]
readsPrec :: Int -> ReadS DescribedConnector
$creadsPrec :: Int -> ReadS DescribedConnector
Prelude.Read, Int -> DescribedConnector -> ShowS
[DescribedConnector] -> ShowS
DescribedConnector -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribedConnector] -> ShowS
$cshowList :: [DescribedConnector] -> ShowS
show :: DescribedConnector -> String
$cshow :: DescribedConnector -> String
showsPrec :: Int -> DescribedConnector -> ShowS
$cshowsPrec :: Int -> DescribedConnector -> ShowS
Prelude.Show, forall x. Rep DescribedConnector x -> DescribedConnector
forall x. DescribedConnector -> Rep DescribedConnector x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribedConnector x -> DescribedConnector
$cfrom :: forall x. DescribedConnector -> Rep DescribedConnector x
Prelude.Generic)

-- |
-- Create a value of 'DescribedConnector' 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:
--
-- 'accessRole', 'describedConnector_accessRole' - With AS2, you can send files by calling @StartFileTransfer@ and
-- specifying the file paths in the request parameter, @SendFilePaths@. We
-- use the file’s parent directory (for example, for
-- @--send-file-paths \/bucket\/dir\/file.txt@, parent directory is
-- @\/bucket\/dir\/@) to temporarily store a processed AS2 message file,
-- store the MDN when we receive them from the partner, and write a final
-- JSON file containing relevant metadata of the transmission. So, the
-- @AccessRole@ needs to provide read and write access to the parent
-- directory of the file location used in the @StartFileTransfer@ request.
-- Additionally, you need to provide read and write access to the parent
-- directory of the files that you intend to send with @StartFileTransfer@.
--
-- 'as2Config', 'describedConnector_as2Config' - A structure that contains the parameters for a connector object.
--
-- 'connectorId', 'describedConnector_connectorId' - The unique identifier for the connector.
--
-- 'loggingRole', 'describedConnector_loggingRole' - The Amazon Resource Name (ARN) of the Identity and Access Management
-- (IAM) role that allows a connector to turn on CloudWatch logging for
-- Amazon S3 events. When set, you can view connector activity in your
-- CloudWatch logs.
--
-- 'tags', 'describedConnector_tags' - Key-value pairs that can be used to group and search for connectors.
--
-- 'url', 'describedConnector_url' - The URL of the partner\'s AS2 endpoint.
--
-- 'arn', 'describedConnector_arn' - The unique Amazon Resource Name (ARN) for the connector.
newDescribedConnector ::
  -- | 'arn'
  Prelude.Text ->
  DescribedConnector
newDescribedConnector :: Text -> DescribedConnector
newDescribedConnector Text
pArn_ =
  DescribedConnector'
    { $sel:accessRole:DescribedConnector' :: Maybe Text
accessRole = forall a. Maybe a
Prelude.Nothing,
      $sel:as2Config:DescribedConnector' :: Maybe As2ConnectorConfig
as2Config = forall a. Maybe a
Prelude.Nothing,
      $sel:connectorId:DescribedConnector' :: Maybe Text
connectorId = forall a. Maybe a
Prelude.Nothing,
      $sel:loggingRole:DescribedConnector' :: Maybe Text
loggingRole = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DescribedConnector' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:url:DescribedConnector' :: Maybe Text
url = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DescribedConnector' :: Text
arn = Text
pArn_
    }

-- | With AS2, you can send files by calling @StartFileTransfer@ and
-- specifying the file paths in the request parameter, @SendFilePaths@. We
-- use the file’s parent directory (for example, for
-- @--send-file-paths \/bucket\/dir\/file.txt@, parent directory is
-- @\/bucket\/dir\/@) to temporarily store a processed AS2 message file,
-- store the MDN when we receive them from the partner, and write a final
-- JSON file containing relevant metadata of the transmission. So, the
-- @AccessRole@ needs to provide read and write access to the parent
-- directory of the file location used in the @StartFileTransfer@ request.
-- Additionally, you need to provide read and write access to the parent
-- directory of the files that you intend to send with @StartFileTransfer@.
describedConnector_accessRole :: Lens.Lens' DescribedConnector (Prelude.Maybe Prelude.Text)
describedConnector_accessRole :: Lens' DescribedConnector (Maybe Text)
describedConnector_accessRole = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Maybe Text
accessRole :: Maybe Text
$sel:accessRole:DescribedConnector' :: DescribedConnector -> Maybe Text
accessRole} -> Maybe Text
accessRole) (\s :: DescribedConnector
s@DescribedConnector' {} Maybe Text
a -> DescribedConnector
s {$sel:accessRole:DescribedConnector' :: Maybe Text
accessRole = Maybe Text
a} :: DescribedConnector)

-- | A structure that contains the parameters for a connector object.
describedConnector_as2Config :: Lens.Lens' DescribedConnector (Prelude.Maybe As2ConnectorConfig)
describedConnector_as2Config :: Lens' DescribedConnector (Maybe As2ConnectorConfig)
describedConnector_as2Config = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Maybe As2ConnectorConfig
as2Config :: Maybe As2ConnectorConfig
$sel:as2Config:DescribedConnector' :: DescribedConnector -> Maybe As2ConnectorConfig
as2Config} -> Maybe As2ConnectorConfig
as2Config) (\s :: DescribedConnector
s@DescribedConnector' {} Maybe As2ConnectorConfig
a -> DescribedConnector
s {$sel:as2Config:DescribedConnector' :: Maybe As2ConnectorConfig
as2Config = Maybe As2ConnectorConfig
a} :: DescribedConnector)

-- | The unique identifier for the connector.
describedConnector_connectorId :: Lens.Lens' DescribedConnector (Prelude.Maybe Prelude.Text)
describedConnector_connectorId :: Lens' DescribedConnector (Maybe Text)
describedConnector_connectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Maybe Text
connectorId :: Maybe Text
$sel:connectorId:DescribedConnector' :: DescribedConnector -> Maybe Text
connectorId} -> Maybe Text
connectorId) (\s :: DescribedConnector
s@DescribedConnector' {} Maybe Text
a -> DescribedConnector
s {$sel:connectorId:DescribedConnector' :: Maybe Text
connectorId = Maybe Text
a} :: DescribedConnector)

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

-- | Key-value pairs that can be used to group and search for connectors.
describedConnector_tags :: Lens.Lens' DescribedConnector (Prelude.Maybe (Prelude.NonEmpty Tag))
describedConnector_tags :: Lens' DescribedConnector (Maybe (NonEmpty Tag))
describedConnector_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:DescribedConnector' :: DescribedConnector -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: DescribedConnector
s@DescribedConnector' {} Maybe (NonEmpty Tag)
a -> DescribedConnector
s {$sel:tags:DescribedConnector' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: DescribedConnector) 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 URL of the partner\'s AS2 endpoint.
describedConnector_url :: Lens.Lens' DescribedConnector (Prelude.Maybe Prelude.Text)
describedConnector_url :: Lens' DescribedConnector (Maybe Text)
describedConnector_url = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Maybe Text
url :: Maybe Text
$sel:url:DescribedConnector' :: DescribedConnector -> Maybe Text
url} -> Maybe Text
url) (\s :: DescribedConnector
s@DescribedConnector' {} Maybe Text
a -> DescribedConnector
s {$sel:url:DescribedConnector' :: Maybe Text
url = Maybe Text
a} :: DescribedConnector)

-- | The unique Amazon Resource Name (ARN) for the connector.
describedConnector_arn :: Lens.Lens' DescribedConnector Prelude.Text
describedConnector_arn :: Lens' DescribedConnector Text
describedConnector_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedConnector' {Text
arn :: Text
$sel:arn:DescribedConnector' :: DescribedConnector -> Text
arn} -> Text
arn) (\s :: DescribedConnector
s@DescribedConnector' {} Text
a -> DescribedConnector
s {$sel:arn:DescribedConnector' :: Text
arn = Text
a} :: DescribedConnector)

instance Data.FromJSON DescribedConnector where
  parseJSON :: Value -> Parser DescribedConnector
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DescribedConnector"
      ( \Object
x ->
          Maybe Text
-> Maybe As2ConnectorConfig
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Maybe Text
-> Text
-> DescribedConnector
DescribedConnector'
            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
"AccessRole")
            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
"As2Config")
            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
"ConnectorId")
            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
"Tags")
            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
"Url")
            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 DescribedConnector where
  hashWithSalt :: Int -> DescribedConnector -> Int
hashWithSalt Int
_salt DescribedConnector' {Maybe (NonEmpty Tag)
Maybe Text
Maybe As2ConnectorConfig
Text
arn :: Text
url :: Maybe Text
tags :: Maybe (NonEmpty Tag)
loggingRole :: Maybe Text
connectorId :: Maybe Text
as2Config :: Maybe As2ConnectorConfig
accessRole :: Maybe Text
$sel:arn:DescribedConnector' :: DescribedConnector -> Text
$sel:url:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:tags:DescribedConnector' :: DescribedConnector -> Maybe (NonEmpty Tag)
$sel:loggingRole:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:connectorId:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:as2Config:DescribedConnector' :: DescribedConnector -> Maybe As2ConnectorConfig
$sel:accessRole:DescribedConnector' :: DescribedConnector -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accessRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe As2ConnectorConfig
as2Config
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
connectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
loggingRole
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
url
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData DescribedConnector where
  rnf :: DescribedConnector -> ()
rnf DescribedConnector' {Maybe (NonEmpty Tag)
Maybe Text
Maybe As2ConnectorConfig
Text
arn :: Text
url :: Maybe Text
tags :: Maybe (NonEmpty Tag)
loggingRole :: Maybe Text
connectorId :: Maybe Text
as2Config :: Maybe As2ConnectorConfig
accessRole :: Maybe Text
$sel:arn:DescribedConnector' :: DescribedConnector -> Text
$sel:url:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:tags:DescribedConnector' :: DescribedConnector -> Maybe (NonEmpty Tag)
$sel:loggingRole:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:connectorId:DescribedConnector' :: DescribedConnector -> Maybe Text
$sel:as2Config:DescribedConnector' :: DescribedConnector -> Maybe As2ConnectorConfig
$sel:accessRole:DescribedConnector' :: DescribedConnector -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accessRole
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe As2ConnectorConfig
as2Config
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
connectorId
      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 (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
url
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn