{-# 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.ListWorkflowTypes
-- 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 workflow types in the specified domain. The
-- results may be split into multiple pages that can be retrieved by making
-- the call repeatedly.
--
-- __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.ListWorkflowTypes
  ( -- * Creating a Request
    ListWorkflowTypes (..),
    newListWorkflowTypes,

    -- * Request Lenses
    listWorkflowTypes_nextPageToken,
    listWorkflowTypes_reverseOrder,
    listWorkflowTypes_name,
    listWorkflowTypes_maximumPageSize,
    listWorkflowTypes_domain,
    listWorkflowTypes_registrationStatus,

    -- * Destructuring the Response
    ListWorkflowTypesResponse (..),
    newListWorkflowTypesResponse,

    -- * Response Lenses
    listWorkflowTypesResponse_nextPageToken,
    listWorkflowTypesResponse_httpStatus,
    listWorkflowTypesResponse_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:/ 'newListWorkflowTypes' smart constructor.
data ListWorkflowTypes = ListWorkflowTypes'
  { -- | 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.
    ListWorkflowTypes -> 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 of the @name@ of
    -- the workflow types.
    ListWorkflowTypes -> Maybe Bool
reverseOrder :: Prelude.Maybe Prelude.Bool,
    -- | If specified, lists the workflow type with this name.
    ListWorkflowTypes -> 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.
    ListWorkflowTypes -> Maybe Natural
maximumPageSize :: Prelude.Maybe Prelude.Natural,
    -- | The name of the domain in which the workflow types have been registered.
    ListWorkflowTypes -> Text
domain :: Prelude.Text,
    -- | Specifies the registration status of the workflow types to list.
    ListWorkflowTypes -> RegistrationStatus
registrationStatus :: RegistrationStatus
  }
  deriving (ListWorkflowTypes -> ListWorkflowTypes -> Bool
(ListWorkflowTypes -> ListWorkflowTypes -> Bool)
-> (ListWorkflowTypes -> ListWorkflowTypes -> Bool)
-> Eq ListWorkflowTypes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkflowTypes -> ListWorkflowTypes -> Bool
$c/= :: ListWorkflowTypes -> ListWorkflowTypes -> Bool
== :: ListWorkflowTypes -> ListWorkflowTypes -> Bool
$c== :: ListWorkflowTypes -> ListWorkflowTypes -> Bool
Prelude.Eq, ReadPrec [ListWorkflowTypes]
ReadPrec ListWorkflowTypes
Int -> ReadS ListWorkflowTypes
ReadS [ListWorkflowTypes]
(Int -> ReadS ListWorkflowTypes)
-> ReadS [ListWorkflowTypes]
-> ReadPrec ListWorkflowTypes
-> ReadPrec [ListWorkflowTypes]
-> Read ListWorkflowTypes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkflowTypes]
$creadListPrec :: ReadPrec [ListWorkflowTypes]
readPrec :: ReadPrec ListWorkflowTypes
$creadPrec :: ReadPrec ListWorkflowTypes
readList :: ReadS [ListWorkflowTypes]
$creadList :: ReadS [ListWorkflowTypes]
readsPrec :: Int -> ReadS ListWorkflowTypes
$creadsPrec :: Int -> ReadS ListWorkflowTypes
Prelude.Read, Int -> ListWorkflowTypes -> ShowS
[ListWorkflowTypes] -> ShowS
ListWorkflowTypes -> String
(Int -> ListWorkflowTypes -> ShowS)
-> (ListWorkflowTypes -> String)
-> ([ListWorkflowTypes] -> ShowS)
-> Show ListWorkflowTypes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkflowTypes] -> ShowS
$cshowList :: [ListWorkflowTypes] -> ShowS
show :: ListWorkflowTypes -> String
$cshow :: ListWorkflowTypes -> String
showsPrec :: Int -> ListWorkflowTypes -> ShowS
$cshowsPrec :: Int -> ListWorkflowTypes -> ShowS
Prelude.Show, (forall x. ListWorkflowTypes -> Rep ListWorkflowTypes x)
-> (forall x. Rep ListWorkflowTypes x -> ListWorkflowTypes)
-> Generic ListWorkflowTypes
forall x. Rep ListWorkflowTypes x -> ListWorkflowTypes
forall x. ListWorkflowTypes -> Rep ListWorkflowTypes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListWorkflowTypes x -> ListWorkflowTypes
$cfrom :: forall x. ListWorkflowTypes -> Rep ListWorkflowTypes x
Prelude.Generic)

-- |
-- Create a value of 'ListWorkflowTypes' 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', 'listWorkflowTypes_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', 'listWorkflowTypes_reverseOrder' - When set to @true@, returns the results in reverse order. By default the
-- results are returned in ascending alphabetical order of the @name@ of
-- the workflow types.
--
-- 'name', 'listWorkflowTypes_name' - If specified, lists the workflow type with this name.
--
-- 'maximumPageSize', 'listWorkflowTypes_maximumPageSize' - The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
--
-- 'domain', 'listWorkflowTypes_domain' - The name of the domain in which the workflow types have been registered.
--
-- 'registrationStatus', 'listWorkflowTypes_registrationStatus' - Specifies the registration status of the workflow types to list.
newListWorkflowTypes ::
  -- | 'domain'
  Prelude.Text ->
  -- | 'registrationStatus'
  RegistrationStatus ->
  ListWorkflowTypes
newListWorkflowTypes :: Text -> RegistrationStatus -> ListWorkflowTypes
newListWorkflowTypes Text
pDomain_ RegistrationStatus
pRegistrationStatus_ =
  ListWorkflowTypes' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Natural
-> Text
-> RegistrationStatus
-> ListWorkflowTypes
ListWorkflowTypes'
    { $sel:nextPageToken:ListWorkflowTypes' :: Maybe Text
nextPageToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:reverseOrder:ListWorkflowTypes' :: Maybe Bool
reverseOrder = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListWorkflowTypes' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumPageSize:ListWorkflowTypes' :: Maybe Natural
maximumPageSize = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:domain:ListWorkflowTypes' :: Text
domain = Text
pDomain_,
      $sel:registrationStatus:ListWorkflowTypes' :: 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.
listWorkflowTypes_nextPageToken :: Lens.Lens' ListWorkflowTypes (Prelude.Maybe Prelude.Text)
listWorkflowTypes_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkflowTypes -> f ListWorkflowTypes
listWorkflowTypes_nextPageToken = (ListWorkflowTypes -> Maybe Text)
-> (ListWorkflowTypes -> Maybe Text -> ListWorkflowTypes)
-> Lens
     ListWorkflowTypes ListWorkflowTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkflowTypes' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListWorkflowTypes
s@ListWorkflowTypes' {} Maybe Text
a -> ListWorkflowTypes
s {$sel:nextPageToken:ListWorkflowTypes' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListWorkflowTypes)

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

-- | If specified, lists the workflow type with this name.
listWorkflowTypes_name :: Lens.Lens' ListWorkflowTypes (Prelude.Maybe Prelude.Text)
listWorkflowTypes_name :: (Maybe Text -> f (Maybe Text))
-> ListWorkflowTypes -> f ListWorkflowTypes
listWorkflowTypes_name = (ListWorkflowTypes -> Maybe Text)
-> (ListWorkflowTypes -> Maybe Text -> ListWorkflowTypes)
-> Lens
     ListWorkflowTypes ListWorkflowTypes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkflowTypes' {Maybe Text
name :: Maybe Text
$sel:name:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
name} -> Maybe Text
name) (\s :: ListWorkflowTypes
s@ListWorkflowTypes' {} Maybe Text
a -> ListWorkflowTypes
s {$sel:name:ListWorkflowTypes' :: Maybe Text
name = Maybe Text
a} :: ListWorkflowTypes)

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

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

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

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

instance Prelude.Hashable ListWorkflowTypes

instance Prelude.NFData ListWorkflowTypes

instance Core.ToHeaders ListWorkflowTypes where
  toHeaders :: ListWorkflowTypes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListWorkflowTypes -> 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.ListWorkflowTypes" ::
                          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 ListWorkflowTypes where
  toJSON :: ListWorkflowTypes -> Value
toJSON ListWorkflowTypes' {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:ListWorkflowTypes' :: ListWorkflowTypes -> RegistrationStatus
$sel:domain:ListWorkflowTypes' :: ListWorkflowTypes -> Text
$sel:maximumPageSize:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Natural
$sel:name:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
$sel:reverseOrder:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Bool
$sel:nextPageToken:ListWorkflowTypes' :: ListWorkflowTypes -> 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 ListWorkflowTypes where
  toPath :: ListWorkflowTypes -> ByteString
toPath = ByteString -> ListWorkflowTypes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | Contains a paginated list of information structures about workflow
-- types.
--
-- /See:/ 'newListWorkflowTypesResponse' smart constructor.
data ListWorkflowTypesResponse = ListWorkflowTypesResponse'
  { -- | 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.
    ListWorkflowTypesResponse -> Maybe Text
nextPageToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListWorkflowTypesResponse -> Int
httpStatus :: Prelude.Int,
    -- | The list of workflow type information.
    ListWorkflowTypesResponse -> [WorkflowTypeInfo]
typeInfos :: [WorkflowTypeInfo]
  }
  deriving (ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool
(ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool)
-> (ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool)
-> Eq ListWorkflowTypesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool
$c/= :: ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool
== :: ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool
$c== :: ListWorkflowTypesResponse -> ListWorkflowTypesResponse -> Bool
Prelude.Eq, ReadPrec [ListWorkflowTypesResponse]
ReadPrec ListWorkflowTypesResponse
Int -> ReadS ListWorkflowTypesResponse
ReadS [ListWorkflowTypesResponse]
(Int -> ReadS ListWorkflowTypesResponse)
-> ReadS [ListWorkflowTypesResponse]
-> ReadPrec ListWorkflowTypesResponse
-> ReadPrec [ListWorkflowTypesResponse]
-> Read ListWorkflowTypesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListWorkflowTypesResponse]
$creadListPrec :: ReadPrec [ListWorkflowTypesResponse]
readPrec :: ReadPrec ListWorkflowTypesResponse
$creadPrec :: ReadPrec ListWorkflowTypesResponse
readList :: ReadS [ListWorkflowTypesResponse]
$creadList :: ReadS [ListWorkflowTypesResponse]
readsPrec :: Int -> ReadS ListWorkflowTypesResponse
$creadsPrec :: Int -> ReadS ListWorkflowTypesResponse
Prelude.Read, Int -> ListWorkflowTypesResponse -> ShowS
[ListWorkflowTypesResponse] -> ShowS
ListWorkflowTypesResponse -> String
(Int -> ListWorkflowTypesResponse -> ShowS)
-> (ListWorkflowTypesResponse -> String)
-> ([ListWorkflowTypesResponse] -> ShowS)
-> Show ListWorkflowTypesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListWorkflowTypesResponse] -> ShowS
$cshowList :: [ListWorkflowTypesResponse] -> ShowS
show :: ListWorkflowTypesResponse -> String
$cshow :: ListWorkflowTypesResponse -> String
showsPrec :: Int -> ListWorkflowTypesResponse -> ShowS
$cshowsPrec :: Int -> ListWorkflowTypesResponse -> ShowS
Prelude.Show, (forall x.
 ListWorkflowTypesResponse -> Rep ListWorkflowTypesResponse x)
-> (forall x.
    Rep ListWorkflowTypesResponse x -> ListWorkflowTypesResponse)
-> Generic ListWorkflowTypesResponse
forall x.
Rep ListWorkflowTypesResponse x -> ListWorkflowTypesResponse
forall x.
ListWorkflowTypesResponse -> Rep ListWorkflowTypesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListWorkflowTypesResponse x -> ListWorkflowTypesResponse
$cfrom :: forall x.
ListWorkflowTypesResponse -> Rep ListWorkflowTypesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListWorkflowTypesResponse' 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', 'listWorkflowTypesResponse_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', 'listWorkflowTypesResponse_httpStatus' - The response's http status code.
--
-- 'typeInfos', 'listWorkflowTypesResponse_typeInfos' - The list of workflow type information.
newListWorkflowTypesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListWorkflowTypesResponse
newListWorkflowTypesResponse :: Int -> ListWorkflowTypesResponse
newListWorkflowTypesResponse Int
pHttpStatus_ =
  ListWorkflowTypesResponse' :: Maybe Text
-> Int -> [WorkflowTypeInfo] -> ListWorkflowTypesResponse
ListWorkflowTypesResponse'
    { $sel:nextPageToken:ListWorkflowTypesResponse' :: Maybe Text
nextPageToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListWorkflowTypesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:typeInfos:ListWorkflowTypesResponse' :: [WorkflowTypeInfo]
typeInfos = [WorkflowTypeInfo]
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.
listWorkflowTypesResponse_nextPageToken :: Lens.Lens' ListWorkflowTypesResponse (Prelude.Maybe Prelude.Text)
listWorkflowTypesResponse_nextPageToken :: (Maybe Text -> f (Maybe Text))
-> ListWorkflowTypesResponse -> f ListWorkflowTypesResponse
listWorkflowTypesResponse_nextPageToken = (ListWorkflowTypesResponse -> Maybe Text)
-> (ListWorkflowTypesResponse
    -> Maybe Text -> ListWorkflowTypesResponse)
-> Lens' ListWorkflowTypesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkflowTypesResponse' {Maybe Text
nextPageToken :: Maybe Text
$sel:nextPageToken:ListWorkflowTypesResponse' :: ListWorkflowTypesResponse -> Maybe Text
nextPageToken} -> Maybe Text
nextPageToken) (\s :: ListWorkflowTypesResponse
s@ListWorkflowTypesResponse' {} Maybe Text
a -> ListWorkflowTypesResponse
s {$sel:nextPageToken:ListWorkflowTypesResponse' :: Maybe Text
nextPageToken = Maybe Text
a} :: ListWorkflowTypesResponse)

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

-- | The list of workflow type information.
listWorkflowTypesResponse_typeInfos :: Lens.Lens' ListWorkflowTypesResponse [WorkflowTypeInfo]
listWorkflowTypesResponse_typeInfos :: ([WorkflowTypeInfo] -> f [WorkflowTypeInfo])
-> ListWorkflowTypesResponse -> f ListWorkflowTypesResponse
listWorkflowTypesResponse_typeInfos = (ListWorkflowTypesResponse -> [WorkflowTypeInfo])
-> (ListWorkflowTypesResponse
    -> [WorkflowTypeInfo] -> ListWorkflowTypesResponse)
-> Lens' ListWorkflowTypesResponse [WorkflowTypeInfo]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListWorkflowTypesResponse' {[WorkflowTypeInfo]
typeInfos :: [WorkflowTypeInfo]
$sel:typeInfos:ListWorkflowTypesResponse' :: ListWorkflowTypesResponse -> [WorkflowTypeInfo]
typeInfos} -> [WorkflowTypeInfo]
typeInfos) (\s :: ListWorkflowTypesResponse
s@ListWorkflowTypesResponse' {} [WorkflowTypeInfo]
a -> ListWorkflowTypesResponse
s {$sel:typeInfos:ListWorkflowTypesResponse' :: [WorkflowTypeInfo]
typeInfos = [WorkflowTypeInfo]
a} :: ListWorkflowTypesResponse) (([WorkflowTypeInfo] -> f [WorkflowTypeInfo])
 -> ListWorkflowTypesResponse -> f ListWorkflowTypesResponse)
-> (([WorkflowTypeInfo] -> f [WorkflowTypeInfo])
    -> [WorkflowTypeInfo] -> f [WorkflowTypeInfo])
-> ([WorkflowTypeInfo] -> f [WorkflowTypeInfo])
-> ListWorkflowTypesResponse
-> f ListWorkflowTypesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([WorkflowTypeInfo] -> f [WorkflowTypeInfo])
-> [WorkflowTypeInfo] -> f [WorkflowTypeInfo]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListWorkflowTypesResponse