{-# 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.Discovery.ListConfigurations
-- 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)
--
-- Retrieves a list of configuration items as specified by the value passed
-- to the required parameter @configurationType@. Optional filtering may be
-- applied to refine search results.
--
-- This operation returns paginated results.
module Amazonka.Discovery.ListConfigurations
  ( -- * Creating a Request
    ListConfigurations (..),
    newListConfigurations,

    -- * Request Lenses
    listConfigurations_orderBy,
    listConfigurations_filters,
    listConfigurations_nextToken,
    listConfigurations_maxResults,
    listConfigurations_configurationType,

    -- * Destructuring the Response
    ListConfigurationsResponse (..),
    newListConfigurationsResponse,

    -- * Response Lenses
    listConfigurationsResponse_configurations,
    listConfigurationsResponse_nextToken,
    listConfigurationsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListConfigurations' smart constructor.
data ListConfigurations = ListConfigurations'
  { -- | Certain filter criteria return output that can be sorted in ascending or
    -- descending order. For a list of output characteristics for each filter,
    -- see
    -- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
    -- in the /AWS Application Discovery Service User Guide/.
    ListConfigurations -> Maybe [OrderByElement]
orderBy :: Prelude.Maybe [OrderByElement],
    -- | You can filter the request using various logical operators and a
    -- /key/-/value/ format. For example:
    --
    -- @{\"key\": \"serverType\", \"value\": \"webServer\"}@
    --
    -- For a complete list of filter options and guidance about using them with
    -- this action, see
    -- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
    -- in the /AWS Application Discovery Service User Guide/.
    ListConfigurations -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | Token to retrieve the next set of results. For example, if a previous
    -- call to ListConfigurations returned 100 items, but you set
    -- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
    -- results along with a token. Use that token in this query to get the next
    -- set of 10.
    ListConfigurations -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of items to return. The maximum value is 100.
    ListConfigurations -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | A valid configuration identified by Application Discovery Service.
    ListConfigurations -> ConfigurationItemType
configurationType :: ConfigurationItemType
  }
  deriving (ListConfigurations -> ListConfigurations -> Bool
(ListConfigurations -> ListConfigurations -> Bool)
-> (ListConfigurations -> ListConfigurations -> Bool)
-> Eq ListConfigurations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConfigurations -> ListConfigurations -> Bool
$c/= :: ListConfigurations -> ListConfigurations -> Bool
== :: ListConfigurations -> ListConfigurations -> Bool
$c== :: ListConfigurations -> ListConfigurations -> Bool
Prelude.Eq, ReadPrec [ListConfigurations]
ReadPrec ListConfigurations
Int -> ReadS ListConfigurations
ReadS [ListConfigurations]
(Int -> ReadS ListConfigurations)
-> ReadS [ListConfigurations]
-> ReadPrec ListConfigurations
-> ReadPrec [ListConfigurations]
-> Read ListConfigurations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConfigurations]
$creadListPrec :: ReadPrec [ListConfigurations]
readPrec :: ReadPrec ListConfigurations
$creadPrec :: ReadPrec ListConfigurations
readList :: ReadS [ListConfigurations]
$creadList :: ReadS [ListConfigurations]
readsPrec :: Int -> ReadS ListConfigurations
$creadsPrec :: Int -> ReadS ListConfigurations
Prelude.Read, Int -> ListConfigurations -> ShowS
[ListConfigurations] -> ShowS
ListConfigurations -> String
(Int -> ListConfigurations -> ShowS)
-> (ListConfigurations -> String)
-> ([ListConfigurations] -> ShowS)
-> Show ListConfigurations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConfigurations] -> ShowS
$cshowList :: [ListConfigurations] -> ShowS
show :: ListConfigurations -> String
$cshow :: ListConfigurations -> String
showsPrec :: Int -> ListConfigurations -> ShowS
$cshowsPrec :: Int -> ListConfigurations -> ShowS
Prelude.Show, (forall x. ListConfigurations -> Rep ListConfigurations x)
-> (forall x. Rep ListConfigurations x -> ListConfigurations)
-> Generic ListConfigurations
forall x. Rep ListConfigurations x -> ListConfigurations
forall x. ListConfigurations -> Rep ListConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListConfigurations x -> ListConfigurations
$cfrom :: forall x. ListConfigurations -> Rep ListConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'ListConfigurations' 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:
--
-- 'orderBy', 'listConfigurations_orderBy' - Certain filter criteria return output that can be sorted in ascending or
-- descending order. For a list of output characteristics for each filter,
-- see
-- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
-- in the /AWS Application Discovery Service User Guide/.
--
-- 'filters', 'listConfigurations_filters' - You can filter the request using various logical operators and a
-- /key/-/value/ format. For example:
--
-- @{\"key\": \"serverType\", \"value\": \"webServer\"}@
--
-- For a complete list of filter options and guidance about using them with
-- this action, see
-- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
-- in the /AWS Application Discovery Service User Guide/.
--
-- 'nextToken', 'listConfigurations_nextToken' - Token to retrieve the next set of results. For example, if a previous
-- call to ListConfigurations returned 100 items, but you set
-- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
-- results along with a token. Use that token in this query to get the next
-- set of 10.
--
-- 'maxResults', 'listConfigurations_maxResults' - The total number of items to return. The maximum value is 100.
--
-- 'configurationType', 'listConfigurations_configurationType' - A valid configuration identified by Application Discovery Service.
newListConfigurations ::
  -- | 'configurationType'
  ConfigurationItemType ->
  ListConfigurations
newListConfigurations :: ConfigurationItemType -> ListConfigurations
newListConfigurations ConfigurationItemType
pConfigurationType_ =
  ListConfigurations' :: Maybe [OrderByElement]
-> Maybe [Filter]
-> Maybe Text
-> Maybe Int
-> ConfigurationItemType
-> ListConfigurations
ListConfigurations'
    { $sel:orderBy:ListConfigurations' :: Maybe [OrderByElement]
orderBy = Maybe [OrderByElement]
forall a. Maybe a
Prelude.Nothing,
      $sel:filters:ListConfigurations' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListConfigurations' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListConfigurations' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:configurationType:ListConfigurations' :: ConfigurationItemType
configurationType = ConfigurationItemType
pConfigurationType_
    }

-- | Certain filter criteria return output that can be sorted in ascending or
-- descending order. For a list of output characteristics for each filter,
-- see
-- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
-- in the /AWS Application Discovery Service User Guide/.
listConfigurations_orderBy :: Lens.Lens' ListConfigurations (Prelude.Maybe [OrderByElement])
listConfigurations_orderBy :: (Maybe [OrderByElement] -> f (Maybe [OrderByElement]))
-> ListConfigurations -> f ListConfigurations
listConfigurations_orderBy = (ListConfigurations -> Maybe [OrderByElement])
-> (ListConfigurations
    -> Maybe [OrderByElement] -> ListConfigurations)
-> Lens
     ListConfigurations
     ListConfigurations
     (Maybe [OrderByElement])
     (Maybe [OrderByElement])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurations' {Maybe [OrderByElement]
orderBy :: Maybe [OrderByElement]
$sel:orderBy:ListConfigurations' :: ListConfigurations -> Maybe [OrderByElement]
orderBy} -> Maybe [OrderByElement]
orderBy) (\s :: ListConfigurations
s@ListConfigurations' {} Maybe [OrderByElement]
a -> ListConfigurations
s {$sel:orderBy:ListConfigurations' :: Maybe [OrderByElement]
orderBy = Maybe [OrderByElement]
a} :: ListConfigurations) ((Maybe [OrderByElement] -> f (Maybe [OrderByElement]))
 -> ListConfigurations -> f ListConfigurations)
-> ((Maybe [OrderByElement] -> f (Maybe [OrderByElement]))
    -> Maybe [OrderByElement] -> f (Maybe [OrderByElement]))
-> (Maybe [OrderByElement] -> f (Maybe [OrderByElement]))
-> ListConfigurations
-> f ListConfigurations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [OrderByElement] [OrderByElement] [OrderByElement] [OrderByElement]
-> Iso
     (Maybe [OrderByElement])
     (Maybe [OrderByElement])
     (Maybe [OrderByElement])
     (Maybe [OrderByElement])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [OrderByElement] [OrderByElement] [OrderByElement] [OrderByElement]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | You can filter the request using various logical operators and a
-- /key/-/value/ format. For example:
--
-- @{\"key\": \"serverType\", \"value\": \"webServer\"}@
--
-- For a complete list of filter options and guidance about using them with
-- this action, see
-- <https://docs.aws.amazon.com/application-discovery/latest/userguide/discovery-api-queries.html#ListConfigurations Using the ListConfigurations Action>
-- in the /AWS Application Discovery Service User Guide/.
listConfigurations_filters :: Lens.Lens' ListConfigurations (Prelude.Maybe [Filter])
listConfigurations_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> ListConfigurations -> f ListConfigurations
listConfigurations_filters = (ListConfigurations -> Maybe [Filter])
-> (ListConfigurations -> Maybe [Filter] -> ListConfigurations)
-> Lens
     ListConfigurations
     ListConfigurations
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurations' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:ListConfigurations' :: ListConfigurations -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: ListConfigurations
s@ListConfigurations' {} Maybe [Filter]
a -> ListConfigurations
s {$sel:filters:ListConfigurations' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: ListConfigurations) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> ListConfigurations -> f ListConfigurations)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> ListConfigurations
-> f ListConfigurations
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token to retrieve the next set of results. For example, if a previous
-- call to ListConfigurations returned 100 items, but you set
-- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
-- results along with a token. Use that token in this query to get the next
-- set of 10.
listConfigurations_nextToken :: Lens.Lens' ListConfigurations (Prelude.Maybe Prelude.Text)
listConfigurations_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConfigurations -> f ListConfigurations
listConfigurations_nextToken = (ListConfigurations -> Maybe Text)
-> (ListConfigurations -> Maybe Text -> ListConfigurations)
-> Lens
     ListConfigurations ListConfigurations (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurations' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConfigurations' :: ListConfigurations -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConfigurations
s@ListConfigurations' {} Maybe Text
a -> ListConfigurations
s {$sel:nextToken:ListConfigurations' :: Maybe Text
nextToken = Maybe Text
a} :: ListConfigurations)

-- | The total number of items to return. The maximum value is 100.
listConfigurations_maxResults :: Lens.Lens' ListConfigurations (Prelude.Maybe Prelude.Int)
listConfigurations_maxResults :: (Maybe Int -> f (Maybe Int))
-> ListConfigurations -> f ListConfigurations
listConfigurations_maxResults = (ListConfigurations -> Maybe Int)
-> (ListConfigurations -> Maybe Int -> ListConfigurations)
-> Lens
     ListConfigurations ListConfigurations (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurations' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListConfigurations' :: ListConfigurations -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListConfigurations
s@ListConfigurations' {} Maybe Int
a -> ListConfigurations
s {$sel:maxResults:ListConfigurations' :: Maybe Int
maxResults = Maybe Int
a} :: ListConfigurations)

-- | A valid configuration identified by Application Discovery Service.
listConfigurations_configurationType :: Lens.Lens' ListConfigurations ConfigurationItemType
listConfigurations_configurationType :: (ConfigurationItemType -> f ConfigurationItemType)
-> ListConfigurations -> f ListConfigurations
listConfigurations_configurationType = (ListConfigurations -> ConfigurationItemType)
-> (ListConfigurations
    -> ConfigurationItemType -> ListConfigurations)
-> Lens
     ListConfigurations
     ListConfigurations
     ConfigurationItemType
     ConfigurationItemType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurations' {ConfigurationItemType
configurationType :: ConfigurationItemType
$sel:configurationType:ListConfigurations' :: ListConfigurations -> ConfigurationItemType
configurationType} -> ConfigurationItemType
configurationType) (\s :: ListConfigurations
s@ListConfigurations' {} ConfigurationItemType
a -> ListConfigurations
s {$sel:configurationType:ListConfigurations' :: ConfigurationItemType
configurationType = ConfigurationItemType
a} :: ListConfigurations)

instance Core.AWSPager ListConfigurations where
  page :: ListConfigurations
-> AWSResponse ListConfigurations -> Maybe ListConfigurations
page ListConfigurations
rq AWSResponse ListConfigurations
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListConfigurations
ListConfigurationsResponse
rs
            ListConfigurationsResponse
-> Getting (First Text) ListConfigurationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListConfigurationsResponse
-> Const (First Text) ListConfigurationsResponse
Lens' ListConfigurationsResponse (Maybe Text)
listConfigurationsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListConfigurationsResponse
 -> Const (First Text) ListConfigurationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListConfigurationsResponse 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 ListConfigurations
forall a. Maybe a
Prelude.Nothing
    | Maybe [HashMap Text Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListConfigurations
ListConfigurationsResponse
rs
            ListConfigurationsResponse
-> Getting
     (First [HashMap Text Text])
     ListConfigurationsResponse
     [HashMap Text Text]
-> Maybe [HashMap Text Text]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [HashMap Text Text]
 -> Const (First [HashMap Text Text]) (Maybe [HashMap Text Text]))
-> ListConfigurationsResponse
-> Const (First [HashMap Text Text]) ListConfigurationsResponse
Lens' ListConfigurationsResponse (Maybe [HashMap Text Text])
listConfigurationsResponse_configurations
              ((Maybe [HashMap Text Text]
  -> Const (First [HashMap Text Text]) (Maybe [HashMap Text Text]))
 -> ListConfigurationsResponse
 -> Const (First [HashMap Text Text]) ListConfigurationsResponse)
-> (([HashMap Text Text]
     -> Const (First [HashMap Text Text]) [HashMap Text Text])
    -> Maybe [HashMap Text Text]
    -> Const (First [HashMap Text Text]) (Maybe [HashMap Text Text]))
-> Getting
     (First [HashMap Text Text])
     ListConfigurationsResponse
     [HashMap Text Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HashMap Text Text]
 -> Const (First [HashMap Text Text]) [HashMap Text Text])
-> Maybe [HashMap Text Text]
-> Const (First [HashMap Text Text]) (Maybe [HashMap Text Text])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListConfigurations
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListConfigurations -> Maybe ListConfigurations
forall a. a -> Maybe a
Prelude.Just (ListConfigurations -> Maybe ListConfigurations)
-> ListConfigurations -> Maybe ListConfigurations
forall a b. (a -> b) -> a -> b
Prelude.$
        ListConfigurations
rq
          ListConfigurations
-> (ListConfigurations -> ListConfigurations) -> ListConfigurations
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListConfigurations -> Identity ListConfigurations
Lens
  ListConfigurations ListConfigurations (Maybe Text) (Maybe Text)
listConfigurations_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListConfigurations -> Identity ListConfigurations)
-> Maybe Text -> ListConfigurations -> ListConfigurations
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListConfigurations
ListConfigurationsResponse
rs
          ListConfigurationsResponse
-> Getting (First Text) ListConfigurationsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListConfigurationsResponse
-> Const (First Text) ListConfigurationsResponse
Lens' ListConfigurationsResponse (Maybe Text)
listConfigurationsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListConfigurationsResponse
 -> Const (First Text) ListConfigurationsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListConfigurationsResponse 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 ListConfigurations where
  type
    AWSResponse ListConfigurations =
      ListConfigurationsResponse
  request :: ListConfigurations -> Request ListConfigurations
request = Service -> ListConfigurations -> Request ListConfigurations
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListConfigurations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListConfigurations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListConfigurations))
-> Logger
-> Service
-> Proxy ListConfigurations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListConfigurations)))
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 [HashMap Text Text]
-> Maybe Text -> Int -> ListConfigurationsResponse
ListConfigurationsResponse'
            (Maybe [HashMap Text Text]
 -> Maybe Text -> Int -> ListConfigurationsResponse)
-> Either String (Maybe [HashMap Text Text])
-> Either String (Maybe Text -> Int -> ListConfigurationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [HashMap Text Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"configurations" Either String (Maybe (Maybe [HashMap Text Text]))
-> Maybe [HashMap Text Text]
-> Either String (Maybe [HashMap Text Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [HashMap Text Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListConfigurationsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListConfigurationsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Int -> ListConfigurationsResponse)
-> Either String Int -> Either String ListConfigurationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListConfigurations

instance Prelude.NFData ListConfigurations

instance Core.ToHeaders ListConfigurations where
  toHeaders :: ListConfigurations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListConfigurations -> 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
"AWSPoseidonService_V2015_11_01.ListConfigurations" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON ListConfigurations where
  toJSON :: ListConfigurations -> Value
toJSON ListConfigurations' {Maybe Int
Maybe [Filter]
Maybe [OrderByElement]
Maybe Text
ConfigurationItemType
configurationType :: ConfigurationItemType
maxResults :: Maybe Int
nextToken :: Maybe Text
filters :: Maybe [Filter]
orderBy :: Maybe [OrderByElement]
$sel:configurationType:ListConfigurations' :: ListConfigurations -> ConfigurationItemType
$sel:maxResults:ListConfigurations' :: ListConfigurations -> Maybe Int
$sel:nextToken:ListConfigurations' :: ListConfigurations -> Maybe Text
$sel:filters:ListConfigurations' :: ListConfigurations -> Maybe [Filter]
$sel:orderBy:ListConfigurations' :: ListConfigurations -> Maybe [OrderByElement]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"orderBy" Text -> [OrderByElement] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([OrderByElement] -> Pair) -> Maybe [OrderByElement] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [OrderByElement]
orderBy,
            (Text
"filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"nextToken" 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
nextToken,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"configurationType" Text -> ConfigurationItemType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConfigurationItemType
configurationType)
          ]
      )

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

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

-- | /See:/ 'newListConfigurationsResponse' smart constructor.
data ListConfigurationsResponse = ListConfigurationsResponse'
  { -- | Returns configuration details, including the configuration ID, attribute
    -- names, and attribute values.
    ListConfigurationsResponse -> Maybe [HashMap Text Text]
configurations :: Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text],
    -- | Token to retrieve the next set of results. For example, if your call to
    -- ListConfigurations returned 100 items, but you set
    -- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
    -- results along with this token. Use this token in the next query to
    -- retrieve the next set of 10.
    ListConfigurationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListConfigurationsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListConfigurationsResponse -> ListConfigurationsResponse -> Bool
(ListConfigurationsResponse -> ListConfigurationsResponse -> Bool)
-> (ListConfigurationsResponse
    -> ListConfigurationsResponse -> Bool)
-> Eq ListConfigurationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListConfigurationsResponse -> ListConfigurationsResponse -> Bool
$c/= :: ListConfigurationsResponse -> ListConfigurationsResponse -> Bool
== :: ListConfigurationsResponse -> ListConfigurationsResponse -> Bool
$c== :: ListConfigurationsResponse -> ListConfigurationsResponse -> Bool
Prelude.Eq, ReadPrec [ListConfigurationsResponse]
ReadPrec ListConfigurationsResponse
Int -> ReadS ListConfigurationsResponse
ReadS [ListConfigurationsResponse]
(Int -> ReadS ListConfigurationsResponse)
-> ReadS [ListConfigurationsResponse]
-> ReadPrec ListConfigurationsResponse
-> ReadPrec [ListConfigurationsResponse]
-> Read ListConfigurationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListConfigurationsResponse]
$creadListPrec :: ReadPrec [ListConfigurationsResponse]
readPrec :: ReadPrec ListConfigurationsResponse
$creadPrec :: ReadPrec ListConfigurationsResponse
readList :: ReadS [ListConfigurationsResponse]
$creadList :: ReadS [ListConfigurationsResponse]
readsPrec :: Int -> ReadS ListConfigurationsResponse
$creadsPrec :: Int -> ReadS ListConfigurationsResponse
Prelude.Read, Int -> ListConfigurationsResponse -> ShowS
[ListConfigurationsResponse] -> ShowS
ListConfigurationsResponse -> String
(Int -> ListConfigurationsResponse -> ShowS)
-> (ListConfigurationsResponse -> String)
-> ([ListConfigurationsResponse] -> ShowS)
-> Show ListConfigurationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListConfigurationsResponse] -> ShowS
$cshowList :: [ListConfigurationsResponse] -> ShowS
show :: ListConfigurationsResponse -> String
$cshow :: ListConfigurationsResponse -> String
showsPrec :: Int -> ListConfigurationsResponse -> ShowS
$cshowsPrec :: Int -> ListConfigurationsResponse -> ShowS
Prelude.Show, (forall x.
 ListConfigurationsResponse -> Rep ListConfigurationsResponse x)
-> (forall x.
    Rep ListConfigurationsResponse x -> ListConfigurationsResponse)
-> Generic ListConfigurationsResponse
forall x.
Rep ListConfigurationsResponse x -> ListConfigurationsResponse
forall x.
ListConfigurationsResponse -> Rep ListConfigurationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListConfigurationsResponse x -> ListConfigurationsResponse
$cfrom :: forall x.
ListConfigurationsResponse -> Rep ListConfigurationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListConfigurationsResponse' 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:
--
-- 'configurations', 'listConfigurationsResponse_configurations' - Returns configuration details, including the configuration ID, attribute
-- names, and attribute values.
--
-- 'nextToken', 'listConfigurationsResponse_nextToken' - Token to retrieve the next set of results. For example, if your call to
-- ListConfigurations returned 100 items, but you set
-- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
-- results along with this token. Use this token in the next query to
-- retrieve the next set of 10.
--
-- 'httpStatus', 'listConfigurationsResponse_httpStatus' - The response's http status code.
newListConfigurationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListConfigurationsResponse
newListConfigurationsResponse :: Int -> ListConfigurationsResponse
newListConfigurationsResponse Int
pHttpStatus_ =
  ListConfigurationsResponse' :: Maybe [HashMap Text Text]
-> Maybe Text -> Int -> ListConfigurationsResponse
ListConfigurationsResponse'
    { $sel:configurations:ListConfigurationsResponse' :: Maybe [HashMap Text Text]
configurations =
        Maybe [HashMap Text Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListConfigurationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListConfigurationsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Returns configuration details, including the configuration ID, attribute
-- names, and attribute values.
listConfigurationsResponse_configurations :: Lens.Lens' ListConfigurationsResponse (Prelude.Maybe [Prelude.HashMap Prelude.Text Prelude.Text])
listConfigurationsResponse_configurations :: (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> ListConfigurationsResponse -> f ListConfigurationsResponse
listConfigurationsResponse_configurations = (ListConfigurationsResponse -> Maybe [HashMap Text Text])
-> (ListConfigurationsResponse
    -> Maybe [HashMap Text Text] -> ListConfigurationsResponse)
-> Lens' ListConfigurationsResponse (Maybe [HashMap Text Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationsResponse' {Maybe [HashMap Text Text]
configurations :: Maybe [HashMap Text Text]
$sel:configurations:ListConfigurationsResponse' :: ListConfigurationsResponse -> Maybe [HashMap Text Text]
configurations} -> Maybe [HashMap Text Text]
configurations) (\s :: ListConfigurationsResponse
s@ListConfigurationsResponse' {} Maybe [HashMap Text Text]
a -> ListConfigurationsResponse
s {$sel:configurations:ListConfigurationsResponse' :: Maybe [HashMap Text Text]
configurations = Maybe [HashMap Text Text]
a} :: ListConfigurationsResponse) ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
 -> ListConfigurationsResponse -> f ListConfigurationsResponse)
-> ((Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
    -> Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> (Maybe [HashMap Text Text] -> f (Maybe [HashMap Text Text]))
-> ListConfigurationsResponse
-> f ListConfigurationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
-> Iso
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
     (Maybe [HashMap Text Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
  [HashMap Text Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Token to retrieve the next set of results. For example, if your call to
-- ListConfigurations returned 100 items, but you set
-- @ListConfigurationsRequest$maxResults@ to 10, you received a set of 10
-- results along with this token. Use this token in the next query to
-- retrieve the next set of 10.
listConfigurationsResponse_nextToken :: Lens.Lens' ListConfigurationsResponse (Prelude.Maybe Prelude.Text)
listConfigurationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListConfigurationsResponse -> f ListConfigurationsResponse
listConfigurationsResponse_nextToken = (ListConfigurationsResponse -> Maybe Text)
-> (ListConfigurationsResponse
    -> Maybe Text -> ListConfigurationsResponse)
-> Lens' ListConfigurationsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListConfigurationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListConfigurationsResponse' :: ListConfigurationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListConfigurationsResponse
s@ListConfigurationsResponse' {} Maybe Text
a -> ListConfigurationsResponse
s {$sel:nextToken:ListConfigurationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListConfigurationsResponse)

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

instance Prelude.NFData ListConfigurationsResponse