{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_maximumPageSize,
    listWorkflowTypes_name,
    listWorkflowTypes_nextPageToken,
    listWorkflowTypes_reverseOrder,
    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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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'
  { -- | 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,
    -- | If specified, lists the workflow type with this name.
    ListWorkflowTypes -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | 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
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]
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
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. 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:
--
-- 'maximumPageSize', 'listWorkflowTypes_maximumPageSize' - The maximum number of results that are returned per call. Use
-- @nextPageToken@ to obtain further pages of results.
--
-- 'name', 'listWorkflowTypes_name' - If specified, lists the workflow type with this name.
--
-- '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.
--
-- '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'
    { $sel:maximumPageSize:ListWorkflowTypes' :: Maybe Natural
maximumPageSize =
        forall a. Maybe a
Prelude.Nothing,
      $sel:name:ListWorkflowTypes' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:nextPageToken:ListWorkflowTypes' :: Maybe Text
nextPageToken = forall a. Maybe a
Prelude.Nothing,
      $sel:reverseOrder:ListWorkflowTypes' :: Maybe Bool
reverseOrder = forall a. Maybe a
Prelude.Nothing,
      $sel:domain:ListWorkflowTypes' :: Text
domain = Text
pDomain_,
      $sel:registrationStatus:ListWorkflowTypes' :: RegistrationStatus
registrationStatus = RegistrationStatus
pRegistrationStatus_
    }

-- | 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 :: Lens' ListWorkflowTypes (Maybe Natural)
listWorkflowTypes_maximumPageSize = 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)

-- | If specified, lists the workflow type with this name.
listWorkflowTypes_name :: Lens.Lens' ListWorkflowTypes (Prelude.Maybe Prelude.Text)
listWorkflowTypes_name :: Lens' ListWorkflowTypes (Maybe Text)
listWorkflowTypes_name = 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)

-- | 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 :: Lens' ListWorkflowTypes (Maybe Text)
listWorkflowTypes_nextPageToken = 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 :: Lens' ListWorkflowTypes (Maybe Bool)
listWorkflowTypes_reverseOrder = 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)

-- | The name of the domain in which the workflow types have been registered.
listWorkflowTypes_domain :: Lens.Lens' ListWorkflowTypes Prelude.Text
listWorkflowTypes_domain :: Lens' ListWorkflowTypes Text
listWorkflowTypes_domain = 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 :: Lens' ListWorkflowTypes RegistrationStatus
listWorkflowTypes_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
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListWorkflowTypes
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkflowTypesResponse (Maybe Text)
listWorkflowTypesResponse_nextPageToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        (AWSResponse ListWorkflowTypes
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListWorkflowTypesResponse [WorkflowTypeInfo]
listWorkflowTypesResponse_typeInfos) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListWorkflowTypes
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListWorkflowTypes (Maybe Text)
listWorkflowTypes_nextPageToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListWorkflowTypes
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListWorkflowTypesResponse (Maybe Text)
listWorkflowTypesResponse_nextPageToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListWorkflowTypes where
  type
    AWSResponse ListWorkflowTypes =
      ListWorkflowTypesResponse
  request :: (Service -> Service)
-> ListWorkflowTypes -> Request ListWorkflowTypes
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListWorkflowTypes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListWorkflowTypes)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> 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'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextPageToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"typeInfos" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ListWorkflowTypes where
  hashWithSalt :: Int -> ListWorkflowTypes -> Int
hashWithSalt Int
_salt ListWorkflowTypes' {Maybe Bool
Maybe Natural
Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
domain :: Text
reverseOrder :: Maybe Bool
nextPageToken :: Maybe Text
name :: Maybe Text
maximumPageSize :: Maybe Natural
$sel:registrationStatus:ListWorkflowTypes' :: ListWorkflowTypes -> RegistrationStatus
$sel:domain:ListWorkflowTypes' :: ListWorkflowTypes -> Text
$sel:reverseOrder:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Bool
$sel:nextPageToken:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
$sel:name:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
$sel:maximumPageSize:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maximumPageSize
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextPageToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
reverseOrder
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domain
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` RegistrationStatus
registrationStatus

instance Prelude.NFData ListWorkflowTypes where
  rnf :: ListWorkflowTypes -> ()
rnf ListWorkflowTypes' {Maybe Bool
Maybe Natural
Maybe Text
Text
RegistrationStatus
registrationStatus :: RegistrationStatus
domain :: Text
reverseOrder :: Maybe Bool
nextPageToken :: Maybe Text
name :: Maybe Text
maximumPageSize :: Maybe Natural
$sel:registrationStatus:ListWorkflowTypes' :: ListWorkflowTypes -> RegistrationStatus
$sel:domain:ListWorkflowTypes' :: ListWorkflowTypes -> Text
$sel:reverseOrder:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Bool
$sel:nextPageToken:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
$sel:name:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Text
$sel:maximumPageSize:ListWorkflowTypes' :: ListWorkflowTypes -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maximumPageSize
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
reverseOrder
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domain
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf RegistrationStatus
registrationStatus

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

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

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

instance Data.ToQuery ListWorkflowTypes where
  toQuery :: ListWorkflowTypes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:nextPageToken:ListWorkflowTypesResponse' :: Maybe Text
nextPageToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListWorkflowTypesResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:typeInfos:ListWorkflowTypesResponse' :: [WorkflowTypeInfo]
typeInfos = 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 :: Lens' ListWorkflowTypesResponse (Maybe Text)
listWorkflowTypesResponse_nextPageToken = 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 :: Lens' ListWorkflowTypesResponse Int
listWorkflowTypesResponse_httpStatus = 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 :: Lens' ListWorkflowTypesResponse [WorkflowTypeInfo]
listWorkflowTypesResponse_typeInfos = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListWorkflowTypesResponse where
  rnf :: ListWorkflowTypesResponse -> ()
rnf ListWorkflowTypesResponse' {Int
[WorkflowTypeInfo]
Maybe Text
typeInfos :: [WorkflowTypeInfo]
httpStatus :: Int
nextPageToken :: Maybe Text
$sel:typeInfos:ListWorkflowTypesResponse' :: ListWorkflowTypesResponse -> [WorkflowTypeInfo]
$sel:httpStatus:ListWorkflowTypesResponse' :: ListWorkflowTypesResponse -> Int
$sel:nextPageToken:ListWorkflowTypesResponse' :: ListWorkflowTypesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextPageToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [WorkflowTypeInfo]
typeInfos