{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WorkDocs.DescribeActivities
-- 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)
--
-- Describes the user activities in a specified time period.
--
-- This operation returns paginated results.
module Amazonka.WorkDocs.DescribeActivities
  ( -- * Creating a Request
    DescribeActivities (..),
    newDescribeActivities,

    -- * Request Lenses
    describeActivities_resourceId,
    describeActivities_includeIndirectActivities,
    describeActivities_startTime,
    describeActivities_authenticationToken,
    describeActivities_userId,
    describeActivities_marker,
    describeActivities_endTime,
    describeActivities_limit,
    describeActivities_activityTypes,
    describeActivities_organizationId,

    -- * Destructuring the Response
    DescribeActivitiesResponse (..),
    newDescribeActivitiesResponse,

    -- * Response Lenses
    describeActivitiesResponse_userActivities,
    describeActivitiesResponse_marker,
    describeActivitiesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WorkDocs.Types

-- | /See:/ 'newDescribeActivities' smart constructor.
data DescribeActivities = DescribeActivities'
  { -- | The document or folder ID for which to describe activity types.
    DescribeActivities -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | Includes indirect activities. An indirect activity results from a direct
    -- activity performed on a parent resource. For example, sharing a parent
    -- folder (the direct activity) shares all of the subfolders and documents
    -- within the parent folder (the indirect activity).
    DescribeActivities -> Maybe Bool
includeIndirectActivities :: Prelude.Maybe Prelude.Bool,
    -- | The timestamp that determines the starting time of the activities. The
    -- response includes the activities performed after the specified
    -- timestamp.
    DescribeActivities -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | Amazon WorkDocs authentication token. Not required when using AWS
    -- administrator credentials to access the API.
    DescribeActivities -> Maybe (Sensitive Text)
authenticationToken :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The ID of the user who performed the action. The response includes
    -- activities pertaining to this user. This is an optional parameter and is
    -- only applicable for administrative API (SigV4) requests.
    DescribeActivities -> Maybe Text
userId :: Prelude.Maybe Prelude.Text,
    -- | The marker for the next set of results.
    DescribeActivities -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The timestamp that determines the end time of the activities. The
    -- response includes the activities performed before the specified
    -- timestamp.
    DescribeActivities -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of items to return.
    DescribeActivities -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | Specifies which activity types to include in the response. If this field
    -- is left empty, all activity types are returned.
    DescribeActivities -> Maybe Text
activityTypes :: Prelude.Maybe Prelude.Text,
    -- | The ID of the organization. This is a mandatory parameter when using
    -- administrative API (SigV4) requests.
    DescribeActivities -> Maybe Text
organizationId :: Prelude.Maybe Prelude.Text
  }
  deriving (DescribeActivities -> DescribeActivities -> Bool
(DescribeActivities -> DescribeActivities -> Bool)
-> (DescribeActivities -> DescribeActivities -> Bool)
-> Eq DescribeActivities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeActivities -> DescribeActivities -> Bool
$c/= :: DescribeActivities -> DescribeActivities -> Bool
== :: DescribeActivities -> DescribeActivities -> Bool
$c== :: DescribeActivities -> DescribeActivities -> Bool
Prelude.Eq, Int -> DescribeActivities -> ShowS
[DescribeActivities] -> ShowS
DescribeActivities -> String
(Int -> DescribeActivities -> ShowS)
-> (DescribeActivities -> String)
-> ([DescribeActivities] -> ShowS)
-> Show DescribeActivities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeActivities] -> ShowS
$cshowList :: [DescribeActivities] -> ShowS
show :: DescribeActivities -> String
$cshow :: DescribeActivities -> String
showsPrec :: Int -> DescribeActivities -> ShowS
$cshowsPrec :: Int -> DescribeActivities -> ShowS
Prelude.Show, (forall x. DescribeActivities -> Rep DescribeActivities x)
-> (forall x. Rep DescribeActivities x -> DescribeActivities)
-> Generic DescribeActivities
forall x. Rep DescribeActivities x -> DescribeActivities
forall x. DescribeActivities -> Rep DescribeActivities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeActivities x -> DescribeActivities
$cfrom :: forall x. DescribeActivities -> Rep DescribeActivities x
Prelude.Generic)

-- |
-- Create a value of 'DescribeActivities' 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:
--
-- 'resourceId', 'describeActivities_resourceId' - The document or folder ID for which to describe activity types.
--
-- 'includeIndirectActivities', 'describeActivities_includeIndirectActivities' - Includes indirect activities. An indirect activity results from a direct
-- activity performed on a parent resource. For example, sharing a parent
-- folder (the direct activity) shares all of the subfolders and documents
-- within the parent folder (the indirect activity).
--
-- 'startTime', 'describeActivities_startTime' - The timestamp that determines the starting time of the activities. The
-- response includes the activities performed after the specified
-- timestamp.
--
-- 'authenticationToken', 'describeActivities_authenticationToken' - Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
--
-- 'userId', 'describeActivities_userId' - The ID of the user who performed the action. The response includes
-- activities pertaining to this user. This is an optional parameter and is
-- only applicable for administrative API (SigV4) requests.
--
-- 'marker', 'describeActivities_marker' - The marker for the next set of results.
--
-- 'endTime', 'describeActivities_endTime' - The timestamp that determines the end time of the activities. The
-- response includes the activities performed before the specified
-- timestamp.
--
-- 'limit', 'describeActivities_limit' - The maximum number of items to return.
--
-- 'activityTypes', 'describeActivities_activityTypes' - Specifies which activity types to include in the response. If this field
-- is left empty, all activity types are returned.
--
-- 'organizationId', 'describeActivities_organizationId' - The ID of the organization. This is a mandatory parameter when using
-- administrative API (SigV4) requests.
newDescribeActivities ::
  DescribeActivities
newDescribeActivities :: DescribeActivities
newDescribeActivities =
  DescribeActivities' :: Maybe Text
-> Maybe Bool
-> Maybe POSIX
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Text
-> Maybe POSIX
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> DescribeActivities
DescribeActivities'
    { $sel:resourceId:DescribeActivities' :: Maybe Text
resourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:includeIndirectActivities:DescribeActivities' :: Maybe Bool
includeIndirectActivities = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:DescribeActivities' :: Maybe POSIX
startTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:authenticationToken:DescribeActivities' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:userId:DescribeActivities' :: Maybe Text
userId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeActivities' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:endTime:DescribeActivities' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeActivities' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:activityTypes:DescribeActivities' :: Maybe Text
activityTypes = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:organizationId:DescribeActivities' :: Maybe Text
organizationId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The document or folder ID for which to describe activity types.
describeActivities_resourceId :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_resourceId :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_resourceId = (DescribeActivities -> Maybe Text)
-> (DescribeActivities -> Maybe Text -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:DescribeActivities' :: DescribeActivities -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Text
a -> DescribeActivities
s {$sel:resourceId:DescribeActivities' :: Maybe Text
resourceId = Maybe Text
a} :: DescribeActivities)

-- | Includes indirect activities. An indirect activity results from a direct
-- activity performed on a parent resource. For example, sharing a parent
-- folder (the direct activity) shares all of the subfolders and documents
-- within the parent folder (the indirect activity).
describeActivities_includeIndirectActivities :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Bool)
describeActivities_includeIndirectActivities :: (Maybe Bool -> f (Maybe Bool))
-> DescribeActivities -> f DescribeActivities
describeActivities_includeIndirectActivities = (DescribeActivities -> Maybe Bool)
-> (DescribeActivities -> Maybe Bool -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Bool
includeIndirectActivities :: Maybe Bool
$sel:includeIndirectActivities:DescribeActivities' :: DescribeActivities -> Maybe Bool
includeIndirectActivities} -> Maybe Bool
includeIndirectActivities) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Bool
a -> DescribeActivities
s {$sel:includeIndirectActivities:DescribeActivities' :: Maybe Bool
includeIndirectActivities = Maybe Bool
a} :: DescribeActivities)

-- | The timestamp that determines the starting time of the activities. The
-- response includes the activities performed after the specified
-- timestamp.
describeActivities_startTime :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.UTCTime)
describeActivities_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeActivities -> f DescribeActivities
describeActivities_startTime = (DescribeActivities -> Maybe POSIX)
-> (DescribeActivities -> Maybe POSIX -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe POSIX
a -> DescribeActivities
s {$sel:startTime:DescribeActivities' :: Maybe POSIX
startTime = Maybe POSIX
a} :: DescribeActivities) ((Maybe POSIX -> f (Maybe POSIX))
 -> DescribeActivities -> f DescribeActivities)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeActivities
-> f DescribeActivities
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Amazon WorkDocs authentication token. Not required when using AWS
-- administrator credentials to access the API.
describeActivities_authenticationToken :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_authenticationToken :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_authenticationToken = (DescribeActivities -> Maybe (Sensitive Text))
-> (DescribeActivities
    -> Maybe (Sensitive Text) -> DescribeActivities)
-> Lens
     DescribeActivities
     DescribeActivities
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe (Sensitive Text)
authenticationToken :: Maybe (Sensitive Text)
$sel:authenticationToken:DescribeActivities' :: DescribeActivities -> Maybe (Sensitive Text)
authenticationToken} -> Maybe (Sensitive Text)
authenticationToken) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe (Sensitive Text)
a -> DescribeActivities
s {$sel:authenticationToken:DescribeActivities' :: Maybe (Sensitive Text)
authenticationToken = Maybe (Sensitive Text)
a} :: DescribeActivities) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> DescribeActivities -> f DescribeActivities)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> DescribeActivities
-> f DescribeActivities
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The ID of the user who performed the action. The response includes
-- activities pertaining to this user. This is an optional parameter and is
-- only applicable for administrative API (SigV4) requests.
describeActivities_userId :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_userId :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_userId = (DescribeActivities -> Maybe Text)
-> (DescribeActivities -> Maybe Text -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Text
userId :: Maybe Text
$sel:userId:DescribeActivities' :: DescribeActivities -> Maybe Text
userId} -> Maybe Text
userId) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Text
a -> DescribeActivities
s {$sel:userId:DescribeActivities' :: Maybe Text
userId = Maybe Text
a} :: DescribeActivities)

-- | The marker for the next set of results.
describeActivities_marker :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_marker = (DescribeActivities -> Maybe Text)
-> (DescribeActivities -> Maybe Text -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeActivities' :: DescribeActivities -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Text
a -> DescribeActivities
s {$sel:marker:DescribeActivities' :: Maybe Text
marker = Maybe Text
a} :: DescribeActivities)

-- | The timestamp that determines the end time of the activities. The
-- response includes the activities performed before the specified
-- timestamp.
describeActivities_endTime :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.UTCTime)
describeActivities_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeActivities -> f DescribeActivities
describeActivities_endTime = (DescribeActivities -> Maybe POSIX)
-> (DescribeActivities -> Maybe POSIX -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe POSIX
a -> DescribeActivities
s {$sel:endTime:DescribeActivities' :: Maybe POSIX
endTime = Maybe POSIX
a} :: DescribeActivities) ((Maybe POSIX -> f (Maybe POSIX))
 -> DescribeActivities -> f DescribeActivities)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeActivities
-> f DescribeActivities
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The maximum number of items to return.
describeActivities_limit :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Natural)
describeActivities_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeActivities -> f DescribeActivities
describeActivities_limit = (DescribeActivities -> Maybe Natural)
-> (DescribeActivities -> Maybe Natural -> DescribeActivities)
-> Lens
     DescribeActivities
     DescribeActivities
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeActivities' :: DescribeActivities -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Natural
a -> DescribeActivities
s {$sel:limit:DescribeActivities' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeActivities)

-- | Specifies which activity types to include in the response. If this field
-- is left empty, all activity types are returned.
describeActivities_activityTypes :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_activityTypes :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_activityTypes = (DescribeActivities -> Maybe Text)
-> (DescribeActivities -> Maybe Text -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Text
activityTypes :: Maybe Text
$sel:activityTypes:DescribeActivities' :: DescribeActivities -> Maybe Text
activityTypes} -> Maybe Text
activityTypes) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Text
a -> DescribeActivities
s {$sel:activityTypes:DescribeActivities' :: Maybe Text
activityTypes = Maybe Text
a} :: DescribeActivities)

-- | The ID of the organization. This is a mandatory parameter when using
-- administrative API (SigV4) requests.
describeActivities_organizationId :: Lens.Lens' DescribeActivities (Prelude.Maybe Prelude.Text)
describeActivities_organizationId :: (Maybe Text -> f (Maybe Text))
-> DescribeActivities -> f DescribeActivities
describeActivities_organizationId = (DescribeActivities -> Maybe Text)
-> (DescribeActivities -> Maybe Text -> DescribeActivities)
-> Lens
     DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivities' {Maybe Text
organizationId :: Maybe Text
$sel:organizationId:DescribeActivities' :: DescribeActivities -> Maybe Text
organizationId} -> Maybe Text
organizationId) (\s :: DescribeActivities
s@DescribeActivities' {} Maybe Text
a -> DescribeActivities
s {$sel:organizationId:DescribeActivities' :: Maybe Text
organizationId = Maybe Text
a} :: DescribeActivities)

instance Core.AWSPager DescribeActivities where
  page :: DescribeActivities
-> AWSResponse DescribeActivities -> Maybe DescribeActivities
page DescribeActivities
rq AWSResponse DescribeActivities
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeActivities
DescribeActivitiesResponse
rs
            DescribeActivitiesResponse
-> Getting (First Text) DescribeActivitiesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeActivitiesResponse
-> Const (First Text) DescribeActivitiesResponse
Lens' DescribeActivitiesResponse (Maybe Text)
describeActivitiesResponse_marker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeActivitiesResponse
 -> Const (First Text) DescribeActivitiesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeActivitiesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeActivities
forall a. Maybe a
Prelude.Nothing
    | Maybe [Activity] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribeActivities
DescribeActivitiesResponse
rs
            DescribeActivitiesResponse
-> Getting (First [Activity]) DescribeActivitiesResponse [Activity]
-> Maybe [Activity]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Activity] -> Const (First [Activity]) (Maybe [Activity]))
-> DescribeActivitiesResponse
-> Const (First [Activity]) DescribeActivitiesResponse
Lens' DescribeActivitiesResponse (Maybe [Activity])
describeActivitiesResponse_userActivities
              ((Maybe [Activity] -> Const (First [Activity]) (Maybe [Activity]))
 -> DescribeActivitiesResponse
 -> Const (First [Activity]) DescribeActivitiesResponse)
-> (([Activity] -> Const (First [Activity]) [Activity])
    -> Maybe [Activity] -> Const (First [Activity]) (Maybe [Activity]))
-> Getting (First [Activity]) DescribeActivitiesResponse [Activity]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Activity] -> Const (First [Activity]) [Activity])
-> Maybe [Activity] -> Const (First [Activity]) (Maybe [Activity])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe DescribeActivities
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribeActivities -> Maybe DescribeActivities
forall a. a -> Maybe a
Prelude.Just (DescribeActivities -> Maybe DescribeActivities)
-> DescribeActivities -> Maybe DescribeActivities
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribeActivities
rq
          DescribeActivities
-> (DescribeActivities -> DescribeActivities) -> DescribeActivities
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribeActivities -> Identity DescribeActivities
Lens
  DescribeActivities DescribeActivities (Maybe Text) (Maybe Text)
describeActivities_marker
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribeActivities -> Identity DescribeActivities)
-> Maybe Text -> DescribeActivities -> DescribeActivities
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribeActivities
DescribeActivitiesResponse
rs
          DescribeActivitiesResponse
-> Getting (First Text) DescribeActivitiesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribeActivitiesResponse
-> Const (First Text) DescribeActivitiesResponse
Lens' DescribeActivitiesResponse (Maybe Text)
describeActivitiesResponse_marker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribeActivitiesResponse
 -> Const (First Text) DescribeActivitiesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribeActivitiesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest DescribeActivities where
  type
    AWSResponse DescribeActivities =
      DescribeActivitiesResponse
  request :: DescribeActivities -> Request DescribeActivities
request = Service -> DescribeActivities -> Request DescribeActivities
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeActivities
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeActivities)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeActivities))
-> Logger
-> Service
-> Proxy DescribeActivities
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeActivities)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Activity] -> Maybe Text -> Int -> DescribeActivitiesResponse
DescribeActivitiesResponse'
            (Maybe [Activity]
 -> Maybe Text -> Int -> DescribeActivitiesResponse)
-> Either String (Maybe [Activity])
-> Either String (Maybe Text -> Int -> DescribeActivitiesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Activity]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UserActivities" Either String (Maybe (Maybe [Activity]))
-> Maybe [Activity] -> Either String (Maybe [Activity])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Activity]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> DescribeActivitiesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeActivitiesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Marker")
            Either String (Int -> DescribeActivitiesResponse)
-> Either String Int -> Either String DescribeActivitiesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeActivities

instance Prelude.NFData DescribeActivities

instance Core.ToHeaders DescribeActivities where
  toHeaders :: DescribeActivities -> ResponseHeaders
toHeaders DescribeActivities' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
organizationId :: Maybe Text
activityTypes :: Maybe Text
limit :: Maybe Natural
endTime :: Maybe POSIX
marker :: Maybe Text
userId :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
startTime :: Maybe POSIX
includeIndirectActivities :: Maybe Bool
resourceId :: Maybe Text
$sel:organizationId:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:activityTypes:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:limit:DescribeActivities' :: DescribeActivities -> Maybe Natural
$sel:endTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
$sel:marker:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:userId:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:authenticationToken:DescribeActivities' :: DescribeActivities -> Maybe (Sensitive Text)
$sel:startTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
$sel:includeIndirectActivities:DescribeActivities' :: DescribeActivities -> Maybe Bool
$sel:resourceId:DescribeActivities' :: DescribeActivities -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"Authentication" HeaderName -> Maybe (Sensitive Text) -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe (Sensitive Text)
authenticationToken,
        HeaderName
"Content-Type"
          HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Core.ToPath DescribeActivities where
  toPath :: DescribeActivities -> ByteString
toPath = ByteString -> DescribeActivities -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/api/v1/activities"

instance Core.ToQuery DescribeActivities where
  toQuery :: DescribeActivities -> QueryString
toQuery DescribeActivities' {Maybe Bool
Maybe Natural
Maybe Text
Maybe (Sensitive Text)
Maybe POSIX
organizationId :: Maybe Text
activityTypes :: Maybe Text
limit :: Maybe Natural
endTime :: Maybe POSIX
marker :: Maybe Text
userId :: Maybe Text
authenticationToken :: Maybe (Sensitive Text)
startTime :: Maybe POSIX
includeIndirectActivities :: Maybe Bool
resourceId :: Maybe Text
$sel:organizationId:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:activityTypes:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:limit:DescribeActivities' :: DescribeActivities -> Maybe Natural
$sel:endTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
$sel:marker:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:userId:DescribeActivities' :: DescribeActivities -> Maybe Text
$sel:authenticationToken:DescribeActivities' :: DescribeActivities -> Maybe (Sensitive Text)
$sel:startTime:DescribeActivities' :: DescribeActivities -> Maybe POSIX
$sel:includeIndirectActivities:DescribeActivities' :: DescribeActivities -> Maybe Bool
$sel:resourceId:DescribeActivities' :: DescribeActivities -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"resourceId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
resourceId,
        ByteString
"includeIndirectActivities"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
includeIndirectActivities,
        ByteString
"startTime" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
startTime,
        ByteString
"userId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
userId,
        ByteString
"marker" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
marker,
        ByteString
"endTime" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
endTime,
        ByteString
"limit" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
limit,
        ByteString
"activityTypes" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
activityTypes,
        ByteString
"organizationId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
organizationId
      ]

-- | /See:/ 'newDescribeActivitiesResponse' smart constructor.
data DescribeActivitiesResponse = DescribeActivitiesResponse'
  { -- | The list of activities for the specified user and time period.
    DescribeActivitiesResponse -> Maybe [Activity]
userActivities :: Prelude.Maybe [Activity],
    -- | The marker for the next set of results.
    DescribeActivitiesResponse -> Maybe Text
marker :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeActivitiesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool
(DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool)
-> (DescribeActivitiesResponse
    -> DescribeActivitiesResponse -> Bool)
-> Eq DescribeActivitiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool
$c/= :: DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool
== :: DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool
$c== :: DescribeActivitiesResponse -> DescribeActivitiesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeActivitiesResponse]
ReadPrec DescribeActivitiesResponse
Int -> ReadS DescribeActivitiesResponse
ReadS [DescribeActivitiesResponse]
(Int -> ReadS DescribeActivitiesResponse)
-> ReadS [DescribeActivitiesResponse]
-> ReadPrec DescribeActivitiesResponse
-> ReadPrec [DescribeActivitiesResponse]
-> Read DescribeActivitiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeActivitiesResponse]
$creadListPrec :: ReadPrec [DescribeActivitiesResponse]
readPrec :: ReadPrec DescribeActivitiesResponse
$creadPrec :: ReadPrec DescribeActivitiesResponse
readList :: ReadS [DescribeActivitiesResponse]
$creadList :: ReadS [DescribeActivitiesResponse]
readsPrec :: Int -> ReadS DescribeActivitiesResponse
$creadsPrec :: Int -> ReadS DescribeActivitiesResponse
Prelude.Read, Int -> DescribeActivitiesResponse -> ShowS
[DescribeActivitiesResponse] -> ShowS
DescribeActivitiesResponse -> String
(Int -> DescribeActivitiesResponse -> ShowS)
-> (DescribeActivitiesResponse -> String)
-> ([DescribeActivitiesResponse] -> ShowS)
-> Show DescribeActivitiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeActivitiesResponse] -> ShowS
$cshowList :: [DescribeActivitiesResponse] -> ShowS
show :: DescribeActivitiesResponse -> String
$cshow :: DescribeActivitiesResponse -> String
showsPrec :: Int -> DescribeActivitiesResponse -> ShowS
$cshowsPrec :: Int -> DescribeActivitiesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeActivitiesResponse -> Rep DescribeActivitiesResponse x)
-> (forall x.
    Rep DescribeActivitiesResponse x -> DescribeActivitiesResponse)
-> Generic DescribeActivitiesResponse
forall x.
Rep DescribeActivitiesResponse x -> DescribeActivitiesResponse
forall x.
DescribeActivitiesResponse -> Rep DescribeActivitiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeActivitiesResponse x -> DescribeActivitiesResponse
$cfrom :: forall x.
DescribeActivitiesResponse -> Rep DescribeActivitiesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeActivitiesResponse' 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:
--
-- 'userActivities', 'describeActivitiesResponse_userActivities' - The list of activities for the specified user and time period.
--
-- 'marker', 'describeActivitiesResponse_marker' - The marker for the next set of results.
--
-- 'httpStatus', 'describeActivitiesResponse_httpStatus' - The response's http status code.
newDescribeActivitiesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeActivitiesResponse
newDescribeActivitiesResponse :: Int -> DescribeActivitiesResponse
newDescribeActivitiesResponse Int
pHttpStatus_ =
  DescribeActivitiesResponse' :: Maybe [Activity] -> Maybe Text -> Int -> DescribeActivitiesResponse
DescribeActivitiesResponse'
    { $sel:userActivities:DescribeActivitiesResponse' :: Maybe [Activity]
userActivities =
        Maybe [Activity]
forall a. Maybe a
Prelude.Nothing,
      $sel:marker:DescribeActivitiesResponse' :: Maybe Text
marker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeActivitiesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of activities for the specified user and time period.
describeActivitiesResponse_userActivities :: Lens.Lens' DescribeActivitiesResponse (Prelude.Maybe [Activity])
describeActivitiesResponse_userActivities :: (Maybe [Activity] -> f (Maybe [Activity]))
-> DescribeActivitiesResponse -> f DescribeActivitiesResponse
describeActivitiesResponse_userActivities = (DescribeActivitiesResponse -> Maybe [Activity])
-> (DescribeActivitiesResponse
    -> Maybe [Activity] -> DescribeActivitiesResponse)
-> Lens' DescribeActivitiesResponse (Maybe [Activity])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivitiesResponse' {Maybe [Activity]
userActivities :: Maybe [Activity]
$sel:userActivities:DescribeActivitiesResponse' :: DescribeActivitiesResponse -> Maybe [Activity]
userActivities} -> Maybe [Activity]
userActivities) (\s :: DescribeActivitiesResponse
s@DescribeActivitiesResponse' {} Maybe [Activity]
a -> DescribeActivitiesResponse
s {$sel:userActivities:DescribeActivitiesResponse' :: Maybe [Activity]
userActivities = Maybe [Activity]
a} :: DescribeActivitiesResponse) ((Maybe [Activity] -> f (Maybe [Activity]))
 -> DescribeActivitiesResponse -> f DescribeActivitiesResponse)
-> ((Maybe [Activity] -> f (Maybe [Activity]))
    -> Maybe [Activity] -> f (Maybe [Activity]))
-> (Maybe [Activity] -> f (Maybe [Activity]))
-> DescribeActivitiesResponse
-> f DescribeActivitiesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Activity] [Activity] [Activity] [Activity]
-> Iso
     (Maybe [Activity])
     (Maybe [Activity])
     (Maybe [Activity])
     (Maybe [Activity])
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 AnIso [Activity] [Activity] [Activity] [Activity]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The marker for the next set of results.
describeActivitiesResponse_marker :: Lens.Lens' DescribeActivitiesResponse (Prelude.Maybe Prelude.Text)
describeActivitiesResponse_marker :: (Maybe Text -> f (Maybe Text))
-> DescribeActivitiesResponse -> f DescribeActivitiesResponse
describeActivitiesResponse_marker = (DescribeActivitiesResponse -> Maybe Text)
-> (DescribeActivitiesResponse
    -> Maybe Text -> DescribeActivitiesResponse)
-> Lens' DescribeActivitiesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivitiesResponse' {Maybe Text
marker :: Maybe Text
$sel:marker:DescribeActivitiesResponse' :: DescribeActivitiesResponse -> Maybe Text
marker} -> Maybe Text
marker) (\s :: DescribeActivitiesResponse
s@DescribeActivitiesResponse' {} Maybe Text
a -> DescribeActivitiesResponse
s {$sel:marker:DescribeActivitiesResponse' :: Maybe Text
marker = Maybe Text
a} :: DescribeActivitiesResponse)

-- | The response's http status code.
describeActivitiesResponse_httpStatus :: Lens.Lens' DescribeActivitiesResponse Prelude.Int
describeActivitiesResponse_httpStatus :: (Int -> f Int)
-> DescribeActivitiesResponse -> f DescribeActivitiesResponse
describeActivitiesResponse_httpStatus = (DescribeActivitiesResponse -> Int)
-> (DescribeActivitiesResponse
    -> Int -> DescribeActivitiesResponse)
-> Lens
     DescribeActivitiesResponse DescribeActivitiesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeActivitiesResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeActivitiesResponse' :: DescribeActivitiesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeActivitiesResponse
s@DescribeActivitiesResponse' {} Int
a -> DescribeActivitiesResponse
s {$sel:httpStatus:DescribeActivitiesResponse' :: Int
httpStatus = Int
a} :: DescribeActivitiesResponse)

instance Prelude.NFData DescribeActivitiesResponse