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

-- | The details for a local or partner AS2 profile.
--
-- /See:/ 'newDescribedProfile' smart constructor.
data DescribedProfile = DescribedProfile'
  { -- | The @As2Id@ is the /AS2-name/, as defined in the
    -- <https://datatracker.ietf.org/doc/html/rfc4130 RFC 4130>. For inbound
    -- transfers, this is the @AS2-From@ header for the AS2 messages sent from
    -- the partner. For outbound connectors, this is the @AS2-To@ header for
    -- the AS2 messages sent to the partner using the @StartFileTransfer@ API
    -- operation. This ID cannot include spaces.
    DescribedProfile -> Maybe Text
as2Id :: Prelude.Maybe Prelude.Text,
    -- | An array of identifiers for the imported certificates. You use this
    -- identifier for working with profiles and partner profiles.
    DescribedProfile -> Maybe [Text]
certificateIds :: Prelude.Maybe [Prelude.Text],
    -- | A unique identifier for the local or partner AS2 profile.
    DescribedProfile -> Maybe Text
profileId :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether to list only @LOCAL@ type profiles or only @PARTNER@
    -- type profiles. If not supplied in the request, the command lists all
    -- types of profiles.
    DescribedProfile -> Maybe ProfileType
profileType :: Prelude.Maybe ProfileType,
    -- | Key-value pairs that can be used to group and search for profiles.
    DescribedProfile -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The unique Amazon Resource Name (ARN) for the profile.
    DescribedProfile -> Text
arn :: Prelude.Text
  }
  deriving (DescribedProfile -> DescribedProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribedProfile -> DescribedProfile -> Bool
$c/= :: DescribedProfile -> DescribedProfile -> Bool
== :: DescribedProfile -> DescribedProfile -> Bool
$c== :: DescribedProfile -> DescribedProfile -> Bool
Prelude.Eq, ReadPrec [DescribedProfile]
ReadPrec DescribedProfile
Int -> ReadS DescribedProfile
ReadS [DescribedProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribedProfile]
$creadListPrec :: ReadPrec [DescribedProfile]
readPrec :: ReadPrec DescribedProfile
$creadPrec :: ReadPrec DescribedProfile
readList :: ReadS [DescribedProfile]
$creadList :: ReadS [DescribedProfile]
readsPrec :: Int -> ReadS DescribedProfile
$creadsPrec :: Int -> ReadS DescribedProfile
Prelude.Read, Int -> DescribedProfile -> ShowS
[DescribedProfile] -> ShowS
DescribedProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribedProfile] -> ShowS
$cshowList :: [DescribedProfile] -> ShowS
show :: DescribedProfile -> String
$cshow :: DescribedProfile -> String
showsPrec :: Int -> DescribedProfile -> ShowS
$cshowsPrec :: Int -> DescribedProfile -> ShowS
Prelude.Show, forall x. Rep DescribedProfile x -> DescribedProfile
forall x. DescribedProfile -> Rep DescribedProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribedProfile x -> DescribedProfile
$cfrom :: forall x. DescribedProfile -> Rep DescribedProfile x
Prelude.Generic)

-- |
-- Create a value of 'DescribedProfile' 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:
--
-- 'as2Id', 'describedProfile_as2Id' - The @As2Id@ is the /AS2-name/, as defined in the
-- <https://datatracker.ietf.org/doc/html/rfc4130 RFC 4130>. For inbound
-- transfers, this is the @AS2-From@ header for the AS2 messages sent from
-- the partner. For outbound connectors, this is the @AS2-To@ header for
-- the AS2 messages sent to the partner using the @StartFileTransfer@ API
-- operation. This ID cannot include spaces.
--
-- 'certificateIds', 'describedProfile_certificateIds' - An array of identifiers for the imported certificates. You use this
-- identifier for working with profiles and partner profiles.
--
-- 'profileId', 'describedProfile_profileId' - A unique identifier for the local or partner AS2 profile.
--
-- 'profileType', 'describedProfile_profileType' - Indicates whether to list only @LOCAL@ type profiles or only @PARTNER@
-- type profiles. If not supplied in the request, the command lists all
-- types of profiles.
--
-- 'tags', 'describedProfile_tags' - Key-value pairs that can be used to group and search for profiles.
--
-- 'arn', 'describedProfile_arn' - The unique Amazon Resource Name (ARN) for the profile.
newDescribedProfile ::
  -- | 'arn'
  Prelude.Text ->
  DescribedProfile
newDescribedProfile :: Text -> DescribedProfile
newDescribedProfile Text
pArn_ =
  DescribedProfile'
    { $sel:as2Id:DescribedProfile' :: Maybe Text
as2Id = forall a. Maybe a
Prelude.Nothing,
      $sel:certificateIds:DescribedProfile' :: Maybe [Text]
certificateIds = forall a. Maybe a
Prelude.Nothing,
      $sel:profileId:DescribedProfile' :: Maybe Text
profileId = forall a. Maybe a
Prelude.Nothing,
      $sel:profileType:DescribedProfile' :: Maybe ProfileType
profileType = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:DescribedProfile' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DescribedProfile' :: Text
arn = Text
pArn_
    }

-- | The @As2Id@ is the /AS2-name/, as defined in the
-- <https://datatracker.ietf.org/doc/html/rfc4130 RFC 4130>. For inbound
-- transfers, this is the @AS2-From@ header for the AS2 messages sent from
-- the partner. For outbound connectors, this is the @AS2-To@ header for
-- the AS2 messages sent to the partner using the @StartFileTransfer@ API
-- operation. This ID cannot include spaces.
describedProfile_as2Id :: Lens.Lens' DescribedProfile (Prelude.Maybe Prelude.Text)
describedProfile_as2Id :: Lens' DescribedProfile (Maybe Text)
describedProfile_as2Id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Maybe Text
as2Id :: Maybe Text
$sel:as2Id:DescribedProfile' :: DescribedProfile -> Maybe Text
as2Id} -> Maybe Text
as2Id) (\s :: DescribedProfile
s@DescribedProfile' {} Maybe Text
a -> DescribedProfile
s {$sel:as2Id:DescribedProfile' :: Maybe Text
as2Id = Maybe Text
a} :: DescribedProfile)

-- | An array of identifiers for the imported certificates. You use this
-- identifier for working with profiles and partner profiles.
describedProfile_certificateIds :: Lens.Lens' DescribedProfile (Prelude.Maybe [Prelude.Text])
describedProfile_certificateIds :: Lens' DescribedProfile (Maybe [Text])
describedProfile_certificateIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Maybe [Text]
certificateIds :: Maybe [Text]
$sel:certificateIds:DescribedProfile' :: DescribedProfile -> Maybe [Text]
certificateIds} -> Maybe [Text]
certificateIds) (\s :: DescribedProfile
s@DescribedProfile' {} Maybe [Text]
a -> DescribedProfile
s {$sel:certificateIds:DescribedProfile' :: Maybe [Text]
certificateIds = Maybe [Text]
a} :: DescribedProfile) 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

-- | A unique identifier for the local or partner AS2 profile.
describedProfile_profileId :: Lens.Lens' DescribedProfile (Prelude.Maybe Prelude.Text)
describedProfile_profileId :: Lens' DescribedProfile (Maybe Text)
describedProfile_profileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Maybe Text
profileId :: Maybe Text
$sel:profileId:DescribedProfile' :: DescribedProfile -> Maybe Text
profileId} -> Maybe Text
profileId) (\s :: DescribedProfile
s@DescribedProfile' {} Maybe Text
a -> DescribedProfile
s {$sel:profileId:DescribedProfile' :: Maybe Text
profileId = Maybe Text
a} :: DescribedProfile)

-- | Indicates whether to list only @LOCAL@ type profiles or only @PARTNER@
-- type profiles. If not supplied in the request, the command lists all
-- types of profiles.
describedProfile_profileType :: Lens.Lens' DescribedProfile (Prelude.Maybe ProfileType)
describedProfile_profileType :: Lens' DescribedProfile (Maybe ProfileType)
describedProfile_profileType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Maybe ProfileType
profileType :: Maybe ProfileType
$sel:profileType:DescribedProfile' :: DescribedProfile -> Maybe ProfileType
profileType} -> Maybe ProfileType
profileType) (\s :: DescribedProfile
s@DescribedProfile' {} Maybe ProfileType
a -> DescribedProfile
s {$sel:profileType:DescribedProfile' :: Maybe ProfileType
profileType = Maybe ProfileType
a} :: DescribedProfile)

-- | Key-value pairs that can be used to group and search for profiles.
describedProfile_tags :: Lens.Lens' DescribedProfile (Prelude.Maybe (Prelude.NonEmpty Tag))
describedProfile_tags :: Lens' DescribedProfile (Maybe (NonEmpty Tag))
describedProfile_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:DescribedProfile' :: DescribedProfile -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: DescribedProfile
s@DescribedProfile' {} Maybe (NonEmpty Tag)
a -> DescribedProfile
s {$sel:tags:DescribedProfile' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: DescribedProfile) 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 unique Amazon Resource Name (ARN) for the profile.
describedProfile_arn :: Lens.Lens' DescribedProfile Prelude.Text
describedProfile_arn :: Lens' DescribedProfile Text
describedProfile_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribedProfile' {Text
arn :: Text
$sel:arn:DescribedProfile' :: DescribedProfile -> Text
arn} -> Text
arn) (\s :: DescribedProfile
s@DescribedProfile' {} Text
a -> DescribedProfile
s {$sel:arn:DescribedProfile' :: Text
arn = Text
a} :: DescribedProfile)

instance Data.FromJSON DescribedProfile where
  parseJSON :: Value -> Parser DescribedProfile
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DescribedProfile"
      ( \Object
x ->
          Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Maybe ProfileType
-> Maybe (NonEmpty Tag)
-> Text
-> DescribedProfile
DescribedProfile'
            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
"As2Id")
            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
"CertificateIds" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
            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
"ProfileId")
            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
"ProfileType")
            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 a
Data..: Key
"Arn")
      )

instance Prelude.Hashable DescribedProfile where
  hashWithSalt :: Int -> DescribedProfile -> Int
hashWithSalt Int
_salt DescribedProfile' {Maybe [Text]
Maybe (NonEmpty Tag)
Maybe Text
Maybe ProfileType
Text
arn :: Text
tags :: Maybe (NonEmpty Tag)
profileType :: Maybe ProfileType
profileId :: Maybe Text
certificateIds :: Maybe [Text]
as2Id :: Maybe Text
$sel:arn:DescribedProfile' :: DescribedProfile -> Text
$sel:tags:DescribedProfile' :: DescribedProfile -> Maybe (NonEmpty Tag)
$sel:profileType:DescribedProfile' :: DescribedProfile -> Maybe ProfileType
$sel:profileId:DescribedProfile' :: DescribedProfile -> Maybe Text
$sel:certificateIds:DescribedProfile' :: DescribedProfile -> Maybe [Text]
$sel:as2Id:DescribedProfile' :: DescribedProfile -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
as2Id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
certificateIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
profileId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProfileType
profileType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

instance Prelude.NFData DescribedProfile where
  rnf :: DescribedProfile -> ()
rnf DescribedProfile' {Maybe [Text]
Maybe (NonEmpty Tag)
Maybe Text
Maybe ProfileType
Text
arn :: Text
tags :: Maybe (NonEmpty Tag)
profileType :: Maybe ProfileType
profileId :: Maybe Text
certificateIds :: Maybe [Text]
as2Id :: Maybe Text
$sel:arn:DescribedProfile' :: DescribedProfile -> Text
$sel:tags:DescribedProfile' :: DescribedProfile -> Maybe (NonEmpty Tag)
$sel:profileType:DescribedProfile' :: DescribedProfile -> Maybe ProfileType
$sel:profileId:DescribedProfile' :: DescribedProfile -> Maybe Text
$sel:certificateIds:DescribedProfile' :: DescribedProfile -> Maybe [Text]
$sel:as2Id:DescribedProfile' :: DescribedProfile -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
as2Id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
certificateIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
profileId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProfileType
profileType
      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 Text
arn