packages feed

amazonka-rum-2.0: gen/Amazonka/Rum/Types/UserDetails.hs

{-# 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.Rum.Types.UserDetails
-- 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.Rum.Types.UserDetails 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

-- | A structure that contains information about the user session that this
-- batch of events was collected from.
--
-- /See:/ 'newUserDetails' smart constructor.
data UserDetails = UserDetails'
  { -- | The session ID that the performance events are from.
    sessionId :: Prelude.Maybe Prelude.Text,
    -- | The ID of the user for this user session. This ID is generated by RUM
    -- and does not include any personally identifiable information about the
    -- user.
    userId :: Prelude.Maybe Prelude.Text
  }
  deriving (Prelude.Eq, Prelude.Read, Prelude.Show, Prelude.Generic)

-- |
-- Create a value of 'UserDetails' 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:
--
-- 'sessionId', 'userDetails_sessionId' - The session ID that the performance events are from.
--
-- 'userId', 'userDetails_userId' - The ID of the user for this user session. This ID is generated by RUM
-- and does not include any personally identifiable information about the
-- user.
newUserDetails ::
  UserDetails
newUserDetails =
  UserDetails'
    { sessionId = Prelude.Nothing,
      userId = Prelude.Nothing
    }

-- | The session ID that the performance events are from.
userDetails_sessionId :: Lens.Lens' UserDetails (Prelude.Maybe Prelude.Text)
userDetails_sessionId = Lens.lens (\UserDetails' {sessionId} -> sessionId) (\s@UserDetails' {} a -> s {sessionId = a} :: UserDetails)

-- | The ID of the user for this user session. This ID is generated by RUM
-- and does not include any personally identifiable information about the
-- user.
userDetails_userId :: Lens.Lens' UserDetails (Prelude.Maybe Prelude.Text)
userDetails_userId = Lens.lens (\UserDetails' {userId} -> userId) (\s@UserDetails' {} a -> s {userId = a} :: UserDetails)

instance Prelude.Hashable UserDetails where
  hashWithSalt _salt UserDetails' {..} =
    _salt
      `Prelude.hashWithSalt` sessionId
      `Prelude.hashWithSalt` userId

instance Prelude.NFData UserDetails where
  rnf UserDetails' {..} =
    Prelude.rnf sessionId
      `Prelude.seq` Prelude.rnf userId

instance Data.ToJSON UserDetails where
  toJSON UserDetails' {..} =
    Data.object
      ( Prelude.catMaybes
          [ ("sessionId" Data..=) Prelude.<$> sessionId,
            ("userId" Data..=) Prelude.<$> userId
          ]
      )