{-# 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.ServiceMetadata
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Transfer.Types.ServiceMetadata where

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

-- | A container object for the session details associated with a workflow.
--
-- /See:/ 'newServiceMetadata' smart constructor.
data ServiceMetadata = ServiceMetadata'
  { -- | The Server ID (@ServerId@), Session ID (@SessionId@) and user
    -- (@UserName@) make up the @UserDetails@.
    ServiceMetadata -> UserDetails
userDetails :: UserDetails
  }
  deriving (ServiceMetadata -> ServiceMetadata -> Bool
(ServiceMetadata -> ServiceMetadata -> Bool)
-> (ServiceMetadata -> ServiceMetadata -> Bool)
-> Eq ServiceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ServiceMetadata -> ServiceMetadata -> Bool
$c/= :: ServiceMetadata -> ServiceMetadata -> Bool
== :: ServiceMetadata -> ServiceMetadata -> Bool
$c== :: ServiceMetadata -> ServiceMetadata -> Bool
Prelude.Eq, ReadPrec [ServiceMetadata]
ReadPrec ServiceMetadata
Int -> ReadS ServiceMetadata
ReadS [ServiceMetadata]
(Int -> ReadS ServiceMetadata)
-> ReadS [ServiceMetadata]
-> ReadPrec ServiceMetadata
-> ReadPrec [ServiceMetadata]
-> Read ServiceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ServiceMetadata]
$creadListPrec :: ReadPrec [ServiceMetadata]
readPrec :: ReadPrec ServiceMetadata
$creadPrec :: ReadPrec ServiceMetadata
readList :: ReadS [ServiceMetadata]
$creadList :: ReadS [ServiceMetadata]
readsPrec :: Int -> ReadS ServiceMetadata
$creadsPrec :: Int -> ReadS ServiceMetadata
Prelude.Read, Int -> ServiceMetadata -> ShowS
[ServiceMetadata] -> ShowS
ServiceMetadata -> String
(Int -> ServiceMetadata -> ShowS)
-> (ServiceMetadata -> String)
-> ([ServiceMetadata] -> ShowS)
-> Show ServiceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ServiceMetadata] -> ShowS
$cshowList :: [ServiceMetadata] -> ShowS
show :: ServiceMetadata -> String
$cshow :: ServiceMetadata -> String
showsPrec :: Int -> ServiceMetadata -> ShowS
$cshowsPrec :: Int -> ServiceMetadata -> ShowS
Prelude.Show, (forall x. ServiceMetadata -> Rep ServiceMetadata x)
-> (forall x. Rep ServiceMetadata x -> ServiceMetadata)
-> Generic ServiceMetadata
forall x. Rep ServiceMetadata x -> ServiceMetadata
forall x. ServiceMetadata -> Rep ServiceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ServiceMetadata x -> ServiceMetadata
$cfrom :: forall x. ServiceMetadata -> Rep ServiceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'ServiceMetadata' 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:
--
-- 'userDetails', 'serviceMetadata_userDetails' - The Server ID (@ServerId@), Session ID (@SessionId@) and user
-- (@UserName@) make up the @UserDetails@.
newServiceMetadata ::
  -- | 'userDetails'
  UserDetails ->
  ServiceMetadata
newServiceMetadata :: UserDetails -> ServiceMetadata
newServiceMetadata UserDetails
pUserDetails_ =
  ServiceMetadata' :: UserDetails -> ServiceMetadata
ServiceMetadata' {$sel:userDetails:ServiceMetadata' :: UserDetails
userDetails = UserDetails
pUserDetails_}

-- | The Server ID (@ServerId@), Session ID (@SessionId@) and user
-- (@UserName@) make up the @UserDetails@.
serviceMetadata_userDetails :: Lens.Lens' ServiceMetadata UserDetails
serviceMetadata_userDetails :: (UserDetails -> f UserDetails)
-> ServiceMetadata -> f ServiceMetadata
serviceMetadata_userDetails = (ServiceMetadata -> UserDetails)
-> (ServiceMetadata -> UserDetails -> ServiceMetadata)
-> Lens ServiceMetadata ServiceMetadata UserDetails UserDetails
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ServiceMetadata' {UserDetails
userDetails :: UserDetails
$sel:userDetails:ServiceMetadata' :: ServiceMetadata -> UserDetails
userDetails} -> UserDetails
userDetails) (\s :: ServiceMetadata
s@ServiceMetadata' {} UserDetails
a -> ServiceMetadata
s {$sel:userDetails:ServiceMetadata' :: UserDetails
userDetails = UserDetails
a} :: ServiceMetadata)

instance Core.FromJSON ServiceMetadata where
  parseJSON :: Value -> Parser ServiceMetadata
parseJSON =
    String
-> (Object -> Parser ServiceMetadata)
-> Value
-> Parser ServiceMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ServiceMetadata"
      ( \Object
x ->
          UserDetails -> ServiceMetadata
ServiceMetadata'
            (UserDetails -> ServiceMetadata)
-> Parser UserDetails -> Parser ServiceMetadata
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser UserDetails
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"UserDetails")
      )

instance Prelude.Hashable ServiceMetadata

instance Prelude.NFData ServiceMetadata