{-# 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.SWF.ListActivityTypes
-- 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)
--
-- Returns information about all activities registered in the specified
-- domain that match the specified name and registration status. The result
-- includes information like creation date, current status of the activity,
-- etc. The results may be split into multiple pages. To retrieve
-- subsequent pages, make the call again using the @nextPageToken@ returned
-- by the initial call.
--
-- __Access Control__
--
-- You can use IAM policies to control this action\'s access to Amazon SWF
-- resources as follows:
--
-- -   Use a @Resource@ element with the domain name to limit the action to
--     only specified domains.
--
-- -   Use an @Action@ element to allow or deny permission to call this
--     action.
--
-- -   You cannot use an IAM policy to constrain this action\'s parameters.
--
-- If the caller doesn\'t have sufficient permissions to invoke the action,
-- or the parameter values fall outside the specified constraints, the
-- action fails. The associated event attribute\'s @cause@ parameter is set
-- to @OPERATION_NOT_PERMITTED@. For details and example IAM policies, see
-- <https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html Using IAM to Manage Access to Amazon SWF Workflows>
-- in the /Amazon SWF Developer Guide/.
--
-- This operation returns paginated results.
module Amazonka.SWF.ListActivityTypes
  ( -- * Creating a Request
    ListActivityTypes (..),
    newListActivityTypes,

    -- * Request Lenses
    listActivityTypes_nextPageToken,
    listActivityTypes_reverseOrder,
    listActivityTypes_name,
    listActivityTypes_maximumPageSize,
    listActivityTypes_domain,
    listActivityTypes_registrationStatus,

    -- * Destructuring the Response
    ListActivityTypesResponse (..),
    newListActivityTypesResponse,

    -- * Response Lenses
    listActivityTypesResponse_nextPageToken,
    listActivityTypesResponse_httpStatus,
    listActivityTypesResponse_typeInfos,
  )
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.SWF.Types

-- | /See:/ 'newListActivityTypes' smart constructor.
data ListActivityTypes = ListActivityTypes'
  { -- | If @NextPageToken@ is returned there are more results available. The
    -- value of @NextPageToken@ is a unique pagination token for each page.
    -- Make the call again using the returned token to retrieve the next page.
    -- Keep all other arguments unchanged. Each pagination token expires after
    -- 60 seconds. Using an expired pagination token will return a @400@ error:
    -- \"@Specified token has exceeded its maximum lifetime@\".
    --
    -- The configured @maximumPageSize@ determines how many results can be
    -- returned in a single call.
    ListActivityTypes -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | When set to @true@, returns the results in reverse order. By default,
    -- the results are returned in ascending alphabetical order by @name@ of
    -- the activity types.
    ListActivityTypes -> Maybe Bool
reverseOrder :: Prelude.Maybe Prelude.Bool,
    -- | If specified, only lists the activity types that have this name.
    ListActivityTypes -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results that are returned per call. Use
    -- @nextPageToken@ to obtain further pages of results.
    ListActivityTypes -> Maybe Natural
maximumPageSize :: Prelude.Maybe Prelude.Natural,
    -- | The name of the domain in which the activity types have been registered.
    ListActivityTypes -> Text
domain :: Prelude.Text,
    -- | Specifies the registration status of the activity types to list.
    ListActivityTypes -> RegistrationStatus
registrationStatus :: RegistrationStatus
  }
  deriving (ListActivityTypes -> ListActivityTypes -> Bool
(ListActivityTypes -> ListActivityTypes -> Bool)
-> (ListActivityTypes -> ListActivityTypes -> Bool)
-> Eq ListActivityTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivityTypes -> ListActivityTypes -> Bool
$c/= :: ListActivityTypes -> ListActivityTypes -> Bool
== :: ListActivityTypes -> ListActivityTypes -> Bool
$c== :: ListActivityTypes -> ListActivityTypes -> Bool
Prelude.Eq, ReadPrec [ListActivityTypes]
ReadPrec ListActivityTypes
Int -> ReadS ListActivityTypes
ReadS [ListActivityTypes]
(Int -> ReadS ListActivityTypes)
-> ReadS [ListActivityTypes]
-> ReadPrec ListActivityTypes
-> ReadPrec [ListActivityTypes]
-> Read ListActivityTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivityTypes]
$creadListPrec :: ReadPrec [ListActivityTypes]
readPrec :: ReadPrec ListActivityTypes
$creadPrec :: ReadPrec ListActivityTypes
readList :: ReadS [ListActivityTypes]
$creadList :: ReadS [ListActivityTypes]
readsPrec :: Int -> ReadS ListActivityTypes
$creadsPrec :: Int -> ReadS ListActivityTypes
Prelude.Read, Int -> ListActivityTypes -> ShowS
[ListActivityTypes] -> ShowS
ListActivityTypes -> String
(Int -> ListActivityTypes -> ShowS)
-> (ListActivityTypes -> String)
-> ([ListActivityTypes] -> ShowS)
-> Show ListActivityTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivityTypes] -> ShowS
$cshowList :: [ListActivityTypes] -> ShowS
show :: ListActivityTypes -> String
$cshow :: ListActivityTypes -> String
showsPrec :: Int -> ListActivityTypes -> ShowS
$cshowsPrec :: Int -> ListActivityTypes -> ShowS
Prelude.Show, (forall x. ListActivityTypes -> Rep ListActivityTypes x)
-> (forall x. Rep ListActivityTypes x -> ListActivityTypes)
-> Generic ListActivityTypes
forall x. Rep ListActivityTypes x -> ListActivityTypes
forall x. ListActivityTypes -> Rep ListActivityTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListActivityTypes x -> ListActivityTypes
$cfrom :: forall x. ListActivityTypes -> Rep ListActivityTypes x
Prelude.Generic)

-- |
-- Create a value of 'ListActivityTypes' 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:
--
-- 'nextPageToken', 'listActivityTypes_nextPageToken' - If @NextPageToken@ is returned there are more results available. The
-- value of @NextPageToken@ is a unique pagination token for each page.
-- Make the call again using the returned token to retrieve the next page.
-- Keep all other arguments unchanged. Each pagination token expires after
-- 60 seconds. Using an expired pagination token will return a @400@ error:
-- \"@Specified token has exceeded its maximum lifetime@\".
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
--
-- 'reverseOrder', 'listActivityTypes_reverseOrder' - When set to @true@, returns the results in reverse order. By default,
-- the results are returned in ascending alphabetical order by @name@ of
-- the activity types.
--
-- 'name', 'listActivityTypes_name' - If specified, only lists the activity types that have this name.
--
-- 'maximumPageSize', 'listActivityTypes_maximumPageSize' - The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
--
-- 'domain', 'listActivityTypes_domain' - The name of the domain in which the activity types have been registered.
--
-- 'registrationStatus', 'listActivityTypes_registrationStatus' - Specifies the registration status of the activity types to list.
newListActivityTypes ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'registrationStatus'
  RegistrationStatus ->
  ListActivityTypes
newListActivityTypes :: Text -> RegistrationStatus -> ListActivityTypes
newListActivityTypes Text
pDomain_ RegistrationStatus
pRegistrationStatus_ =
  ListActivityTypes' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Text
-> RegistrationStatus
-> ListActivityTypes
ListActivityTypes'
    { $sel:nextPageToken:ListActivityTypes' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reverseOrder:ListActivityTypes' :: Maybe Bool
reverseOrder = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListActivityTypes' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumPageSize:ListActivityTypes' :: Maybe Natural
maximumPageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:ListActivityTypes' :: Text
domain = Text
pDomain_,
      $sel:registrationStatus:ListActivityTypes' :: RegistrationStatus
registrationStatus = RegistrationStatus
pRegistrationStatus_
    }

-- | If @NextPageToken@ is returned there are more results available. The
-- value of @NextPageToken@ is a unique pagination token for each page.
-- Make the call again using the returned token to retrieve the next page.
-- Keep all other arguments unchanged. Each pagination token expires after
-- 60 seconds. Using an expired pagination token will return a @400@ error:
-- \"@Specified token has exceeded its maximum lifetime@\".
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
listActivityTypes_nextPageToken :: Lens.Lens' ListActivityTypes (Prelude.Maybe Prelude.Text)
listActivityTypes_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListActivityTypes -> f ListActivityTypes
listActivityTypes_nextPageToken = (ListActivityTypes -> Maybe Text)
-> (ListActivityTypes -> Maybe Text -> ListActivityTypes)
-> Lens
     ListActivityTypes ListActivityTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListActivityTypes' :: ListActivityTypes -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListActivityTypes
s@ListActivityTypes' {} Maybe Text
a -> ListActivityTypes
s {$sel:nextPageToken:ListActivityTypes' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListActivityTypes)

-- | When set to @true@, returns the results in reverse order. By default,
-- the results are returned in ascending alphabetical order by @name@ of
-- the activity types.
listActivityTypes_reverseOrder :: Lens.Lens' ListActivityTypes (Prelude.Maybe Prelude.Bool)
listActivityTypes_reverseOrder :: (Maybe Bool -> f (Maybe Bool))
-> ListActivityTypes -> f ListActivityTypes
listActivityTypes_reverseOrder = (ListActivityTypes -> Maybe Bool)
-> (ListActivityTypes -> Maybe Bool -> ListActivityTypes)
-> Lens
     ListActivityTypes ListActivityTypes (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {Maybe Bool
reverseOrder :: Maybe Bool
$sel:reverseOrder:ListActivityTypes' :: ListActivityTypes -> Maybe Bool
reverseOrder} -> Maybe Bool
reverseOrder) (\s :: ListActivityTypes
s@ListActivityTypes' {} Maybe Bool
a -> ListActivityTypes
s {$sel:reverseOrder:ListActivityTypes' :: Maybe Bool
reverseOrder = Maybe Bool
a} :: ListActivityTypes)

-- | If specified, only lists the activity types that have this name.
listActivityTypes_name :: Lens.Lens' ListActivityTypes (Prelude.Maybe Prelude.Text)
listActivityTypes_name :: (Maybe Text -> f (Maybe Text))
-> ListActivityTypes -> f ListActivityTypes
listActivityTypes_name = (ListActivityTypes -> Maybe Text)
-> (ListActivityTypes -> Maybe Text -> ListActivityTypes)
-> Lens
     ListActivityTypes ListActivityTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {Maybe Text
name :: Maybe Text
$sel:name:ListActivityTypes' :: ListActivityTypes -> Maybe Text
name} -> Maybe Text
name) (\s :: ListActivityTypes
s@ListActivityTypes' {} Maybe Text
a -> ListActivityTypes
s {$sel:name:ListActivityTypes' :: Maybe Text
name = Maybe Text
a} :: ListActivityTypes)

-- | The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
listActivityTypes_maximumPageSize :: Lens.Lens' ListActivityTypes (Prelude.Maybe Prelude.Natural)
listActivityTypes_maximumPageSize :: (Maybe Natural -> f (Maybe Natural))
-> ListActivityTypes -> f ListActivityTypes
listActivityTypes_maximumPageSize = (ListActivityTypes -> Maybe Natural)
-> (ListActivityTypes -> Maybe Natural -> ListActivityTypes)
-> Lens
     ListActivityTypes ListActivityTypes (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {Maybe Natural
maximumPageSize :: Maybe Natural
$sel:maximumPageSize:ListActivityTypes' :: ListActivityTypes -> Maybe Natural
maximumPageSize} -> Maybe Natural
maximumPageSize) (\s :: ListActivityTypes
s@ListActivityTypes' {} Maybe Natural
a -> ListActivityTypes
s {$sel:maximumPageSize:ListActivityTypes' :: Maybe Natural
maximumPageSize = Maybe Natural
a} :: ListActivityTypes)

-- | The name of the domain in which the activity types have been registered.
listActivityTypes_domain :: Lens.Lens' ListActivityTypes Prelude.Text
listActivityTypes_domain :: (Text -> f Text) -> ListActivityTypes -> f ListActivityTypes
listActivityTypes_domain = (ListActivityTypes -> Text)
-> (ListActivityTypes -> Text -> ListActivityTypes)
-> Lens ListActivityTypes ListActivityTypes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {Text
domain :: Text
$sel:domain:ListActivityTypes' :: ListActivityTypes -> Text
domain} -> Text
domain) (\s :: ListActivityTypes
s@ListActivityTypes' {} Text
a -> ListActivityTypes
s {$sel:domain:ListActivityTypes' :: Text
domain = Text
a} :: ListActivityTypes)

-- | Specifies the registration status of the activity types to list.
listActivityTypes_registrationStatus :: Lens.Lens' ListActivityTypes RegistrationStatus
listActivityTypes_registrationStatus :: (RegistrationStatus -> f RegistrationStatus)
-> ListActivityTypes -> f ListActivityTypes
listActivityTypes_registrationStatus = (ListActivityTypes -> RegistrationStatus)
-> (ListActivityTypes -> RegistrationStatus -> ListActivityTypes)
-> Lens
     ListActivityTypes
     ListActivityTypes
     RegistrationStatus
     RegistrationStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypes' {RegistrationStatus
registrationStatus :: RegistrationStatus
$sel:registrationStatus:ListActivityTypes' :: ListActivityTypes -> RegistrationStatus
registrationStatus} -> RegistrationStatus
registrationStatus) (\s :: ListActivityTypes
s@ListActivityTypes' {} RegistrationStatus
a -> ListActivityTypes
s {$sel:registrationStatus:ListActivityTypes' :: RegistrationStatus
registrationStatus = RegistrationStatus
a} :: ListActivityTypes)

instance Core.AWSPager ListActivityTypes where
  page :: ListActivityTypes
-> AWSResponse ListActivityTypes -> Maybe ListActivityTypes
page ListActivityTypes
rq AWSResponse ListActivityTypes
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListActivityTypes
ListActivityTypesResponse
rs
            ListActivityTypesResponse
-> Getting (First Text) ListActivityTypesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivityTypesResponse
-> Const (First Text) ListActivityTypesResponse
Lens' ListActivityTypesResponse (Maybe Text)
listActivityTypesResponse_nextPageToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListActivityTypesResponse
 -> Const (First Text) ListActivityTypesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivityTypesResponse 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 ListActivityTypes
forall a. Maybe a
Prelude.Nothing
    | [ActivityTypeInfo] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListActivityTypes
ListActivityTypesResponse
rs ListActivityTypesResponse
-> Getting
     [ActivityTypeInfo] ListActivityTypesResponse [ActivityTypeInfo]
-> [ActivityTypeInfo]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [ActivityTypeInfo] ListActivityTypesResponse [ActivityTypeInfo]
Lens' ListActivityTypesResponse [ActivityTypeInfo]
listActivityTypesResponse_typeInfos) =
      Maybe ListActivityTypes
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListActivityTypes -> Maybe ListActivityTypes
forall a. a -> Maybe a
Prelude.Just (ListActivityTypes -> Maybe ListActivityTypes)
-> ListActivityTypes -> Maybe ListActivityTypes
forall a b. (a -> b) -> a -> b
Prelude.$
        ListActivityTypes
rq
          ListActivityTypes
-> (ListActivityTypes -> ListActivityTypes) -> ListActivityTypes
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListActivityTypes -> Identity ListActivityTypes
Lens ListActivityTypes ListActivityTypes (Maybe Text) (Maybe Text)
listActivityTypes_nextPageToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListActivityTypes -> Identity ListActivityTypes)
-> Maybe Text -> ListActivityTypes -> ListActivityTypes
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListActivityTypes
ListActivityTypesResponse
rs
          ListActivityTypesResponse
-> Getting (First Text) ListActivityTypesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivityTypesResponse
-> Const (First Text) ListActivityTypesResponse
Lens' ListActivityTypesResponse (Maybe Text)
listActivityTypesResponse_nextPageToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListActivityTypesResponse
 -> Const (First Text) ListActivityTypesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivityTypesResponse 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 ListActivityTypes where
  type
    AWSResponse ListActivityTypes =
      ListActivityTypesResponse
  request :: ListActivityTypes -> Request ListActivityTypes
request = Service -> ListActivityTypes -> Request ListActivityTypes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListActivityTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListActivityTypes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListActivityTypes))
-> Logger
-> Service
-> Proxy ListActivityTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListActivityTypes)))
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 Text
-> Int -> [ActivityTypeInfo] -> ListActivityTypesResponse
ListActivityTypesResponse'
            (Maybe Text
 -> Int -> [ActivityTypeInfo] -> ListActivityTypesResponse)
-> Either String (Maybe Text)
-> Either
     String (Int -> [ActivityTypeInfo] -> ListActivityTypesResponse)
forall (f :: * -> *) a b. Functor 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
"nextPageToken")
            Either
  String (Int -> [ActivityTypeInfo] -> ListActivityTypesResponse)
-> Either String Int
-> Either String ([ActivityTypeInfo] -> ListActivityTypesResponse)
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))
            Either String ([ActivityTypeInfo] -> ListActivityTypesResponse)
-> Either String [ActivityTypeInfo]
-> Either String ListActivityTypesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [ActivityTypeInfo])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"typeInfos" Either String (Maybe [ActivityTypeInfo])
-> [ActivityTypeInfo] -> Either String [ActivityTypeInfo]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [ActivityTypeInfo]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListActivityTypes

instance Prelude.NFData ListActivityTypes

instance Core.ToHeaders ListActivityTypes where
  toHeaders :: ListActivityTypes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListActivityTypes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"SimpleWorkflowService.ListActivityTypes" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListActivityTypes where
  toJSON :: ListActivityTypes -> Value
toJSON ListActivityTypes' {Maybe Bool
Maybe Natural
Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
domain :: Text
maximumPageSize :: Maybe Natural
name :: Maybe Text
reverseOrder :: Maybe Bool
nextPageToken :: Maybe Text
$sel:registrationStatus:ListActivityTypes' :: ListActivityTypes -> RegistrationStatus
$sel:domain:ListActivityTypes' :: ListActivityTypes -> Text
$sel:maximumPageSize:ListActivityTypes' :: ListActivityTypes -> Maybe Natural
$sel:name:ListActivityTypes' :: ListActivityTypes -> Maybe Text
$sel:reverseOrder:ListActivityTypes' :: ListActivityTypes -> Maybe Bool
$sel:nextPageToken:ListActivityTypes' :: ListActivityTypes -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nextPageToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextPageToken,
            (Text
"reverseOrder" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
reverseOrder,
            (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
            (Text
"maximumPageSize" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maximumPageSize,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"registrationStatus" Text -> RegistrationStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= RegistrationStatus
registrationStatus)
          ]
      )

instance Core.ToPath ListActivityTypes where
  toPath :: ListActivityTypes -> ByteString
toPath = ByteString -> ListActivityTypes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery ListActivityTypes where
  toQuery :: ListActivityTypes -> QueryString
toQuery = QueryString -> ListActivityTypes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | Contains a paginated list of activity type information structures.
--
-- /See:/ 'newListActivityTypesResponse' smart constructor.
data ListActivityTypesResponse = ListActivityTypesResponse'
  { -- | If a @NextPageToken@ was returned by a previous call, there are more
    -- results available. To retrieve the next page of results, make the call
    -- again using the returned token in @nextPageToken@. Keep all other
    -- arguments unchanged.
    --
    -- The configured @maximumPageSize@ determines how many results can be
    -- returned in a single call.
    ListActivityTypesResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListActivityTypesResponse -> Int
httpStatus :: Prelude.Int,
    -- | List of activity type information.
    ListActivityTypesResponse -> [ActivityTypeInfo]
typeInfos :: [ActivityTypeInfo]
  }
  deriving (ListActivityTypesResponse -> ListActivityTypesResponse -> Bool
(ListActivityTypesResponse -> ListActivityTypesResponse -> Bool)
-> (ListActivityTypesResponse -> ListActivityTypesResponse -> Bool)
-> Eq ListActivityTypesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivityTypesResponse -> ListActivityTypesResponse -> Bool
$c/= :: ListActivityTypesResponse -> ListActivityTypesResponse -> Bool
== :: ListActivityTypesResponse -> ListActivityTypesResponse -> Bool
$c== :: ListActivityTypesResponse -> ListActivityTypesResponse -> Bool
Prelude.Eq, ReadPrec [ListActivityTypesResponse]
ReadPrec ListActivityTypesResponse
Int -> ReadS ListActivityTypesResponse
ReadS [ListActivityTypesResponse]
(Int -> ReadS ListActivityTypesResponse)
-> ReadS [ListActivityTypesResponse]
-> ReadPrec ListActivityTypesResponse
-> ReadPrec [ListActivityTypesResponse]
-> Read ListActivityTypesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivityTypesResponse]
$creadListPrec :: ReadPrec [ListActivityTypesResponse]
readPrec :: ReadPrec ListActivityTypesResponse
$creadPrec :: ReadPrec ListActivityTypesResponse
readList :: ReadS [ListActivityTypesResponse]
$creadList :: ReadS [ListActivityTypesResponse]
readsPrec :: Int -> ReadS ListActivityTypesResponse
$creadsPrec :: Int -> ReadS ListActivityTypesResponse
Prelude.Read, Int -> ListActivityTypesResponse -> ShowS
[ListActivityTypesResponse] -> ShowS
ListActivityTypesResponse -> String
(Int -> ListActivityTypesResponse -> ShowS)
-> (ListActivityTypesResponse -> String)
-> ([ListActivityTypesResponse] -> ShowS)
-> Show ListActivityTypesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivityTypesResponse] -> ShowS
$cshowList :: [ListActivityTypesResponse] -> ShowS
show :: ListActivityTypesResponse -> String
$cshow :: ListActivityTypesResponse -> String
showsPrec :: Int -> ListActivityTypesResponse -> ShowS
$cshowsPrec :: Int -> ListActivityTypesResponse -> ShowS
Prelude.Show, (forall x.
 ListActivityTypesResponse -> Rep ListActivityTypesResponse x)
-> (forall x.
    Rep ListActivityTypesResponse x -> ListActivityTypesResponse)
-> Generic ListActivityTypesResponse
forall x.
Rep ListActivityTypesResponse x -> ListActivityTypesResponse
forall x.
ListActivityTypesResponse -> Rep ListActivityTypesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListActivityTypesResponse x -> ListActivityTypesResponse
$cfrom :: forall x.
ListActivityTypesResponse -> Rep ListActivityTypesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListActivityTypesResponse' 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:
--
-- 'nextPageToken', 'listActivityTypesResponse_nextPageToken' - If a @NextPageToken@ was returned by a previous call, there are more
-- results available. To retrieve the next page of results, make the call
-- again using the returned token in @nextPageToken@. Keep all other
-- arguments unchanged.
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
--
-- 'httpStatus', 'listActivityTypesResponse_httpStatus' - The response's http status code.
--
-- 'typeInfos', 'listActivityTypesResponse_typeInfos' - List of activity type information.
newListActivityTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListActivityTypesResponse
newListActivityTypesResponse :: Int -> ListActivityTypesResponse
newListActivityTypesResponse Int
pHttpStatus_ =
  ListActivityTypesResponse' :: Maybe Text
-> Int -> [ActivityTypeInfo] -> ListActivityTypesResponse
ListActivityTypesResponse'
    { $sel:nextPageToken:ListActivityTypesResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListActivityTypesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:typeInfos:ListActivityTypesResponse' :: [ActivityTypeInfo]
typeInfos = [ActivityTypeInfo]
forall a. Monoid a => a
Prelude.mempty
    }

-- | If a @NextPageToken@ was returned by a previous call, there are more
-- results available. To retrieve the next page of results, make the call
-- again using the returned token in @nextPageToken@. Keep all other
-- arguments unchanged.
--
-- The configured @maximumPageSize@ determines how many results can be
-- returned in a single call.
listActivityTypesResponse_nextPageToken :: Lens.Lens' ListActivityTypesResponse (Prelude.Maybe Prelude.Text)
listActivityTypesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListActivityTypesResponse -> f ListActivityTypesResponse
listActivityTypesResponse_nextPageToken = (ListActivityTypesResponse -> Maybe Text)
-> (ListActivityTypesResponse
    -> Maybe Text -> ListActivityTypesResponse)
-> Lens' ListActivityTypesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListActivityTypesResponse' :: ListActivityTypesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListActivityTypesResponse
s@ListActivityTypesResponse' {} Maybe Text
a -> ListActivityTypesResponse
s {$sel:nextPageToken:ListActivityTypesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListActivityTypesResponse)

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

-- | List of activity type information.
listActivityTypesResponse_typeInfos :: Lens.Lens' ListActivityTypesResponse [ActivityTypeInfo]
listActivityTypesResponse_typeInfos :: ([ActivityTypeInfo] -> f [ActivityTypeInfo])
-> ListActivityTypesResponse -> f ListActivityTypesResponse
listActivityTypesResponse_typeInfos = (ListActivityTypesResponse -> [ActivityTypeInfo])
-> (ListActivityTypesResponse
    -> [ActivityTypeInfo] -> ListActivityTypesResponse)
-> Lens' ListActivityTypesResponse [ActivityTypeInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivityTypesResponse' {[ActivityTypeInfo]
typeInfos :: [ActivityTypeInfo]
$sel:typeInfos:ListActivityTypesResponse' :: ListActivityTypesResponse -> [ActivityTypeInfo]
typeInfos} -> [ActivityTypeInfo]
typeInfos) (\s :: ListActivityTypesResponse
s@ListActivityTypesResponse' {} [ActivityTypeInfo]
a -> ListActivityTypesResponse
s {$sel:typeInfos:ListActivityTypesResponse' :: [ActivityTypeInfo]
typeInfos = [ActivityTypeInfo]
a} :: ListActivityTypesResponse) (([ActivityTypeInfo] -> f [ActivityTypeInfo])
 -> ListActivityTypesResponse -> f ListActivityTypesResponse)
-> (([ActivityTypeInfo] -> f [ActivityTypeInfo])
    -> [ActivityTypeInfo] -> f [ActivityTypeInfo])
-> ([ActivityTypeInfo] -> f [ActivityTypeInfo])
-> ListActivityTypesResponse
-> f ListActivityTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ActivityTypeInfo] -> f [ActivityTypeInfo])
-> [ActivityTypeInfo] -> f [ActivityTypeInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListActivityTypesResponse