{-# 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.Organizations.ListChildren
-- 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)
--
-- Lists all of the organizational units (OUs) or accounts that are
-- contained in the specified parent OU or root. This operation, along with
-- ListParents enables you to traverse the tree structure that makes up
-- this root.
--
-- Always check the @NextToken@ response parameter for a @null@ value when
-- calling a @List*@ operation. These operations can occasionally return an
-- empty set of results even when there are more results available. The
-- @NextToken@ response parameter value is @null@ /only/ when there are no
-- more results to display.
--
-- This operation can be called only from the organization\'s management
-- account or by a member account that is a delegated administrator for an
-- AWS service.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListChildren
  ( -- * Creating a Request
    ListChildren (..),
    newListChildren,

    -- * Request Lenses
    listChildren_nextToken,
    listChildren_maxResults,
    listChildren_parentId,
    listChildren_childType,

    -- * Destructuring the Response
    ListChildrenResponse (..),
    newListChildrenResponse,

    -- * Response Lenses
    listChildrenResponse_children,
    listChildrenResponse_nextToken,
    listChildrenResponse_httpStatus,
  )
where

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

-- | /See:/ 'newListChildren' smart constructor.
data ListChildren = ListChildren'
  { -- | The parameter for receiving additional results if you receive a
    -- @NextToken@ response in a previous request. A @NextToken@ response
    -- indicates that more output is available. Set this parameter to the value
    -- of the previous call\'s @NextToken@ response to indicate where the
    -- output should continue from.
    ListChildren -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The total number of results that you want included on each page of the
    -- response. If you do not include this parameter, it defaults to a value
    -- that is specific to the operation. If additional items exist beyond the
    -- maximum you specify, the @NextToken@ response element is present and has
    -- a value (is not null). Include that value as the @NextToken@ request
    -- parameter in the next call to the operation to get the next part of the
    -- results. Note that Organizations might return fewer results than the
    -- maximum even when there are more results available. You should check
    -- @NextToken@ after every operation to ensure that you receive all of the
    -- results.
    ListChildren -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The unique identifier (ID) for the parent root or OU whose children you
    -- want to list.
    --
    -- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
    -- string requires one of the following:
    --
    -- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
    --     lowercase letters or digits.
    --
    -- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
    --     followed by from 4 to 32 lowercase letters or digits (the ID of the
    --     root that the OU is in). This string is followed by a second \"-\"
    --     dash and from 8 to 32 additional lowercase letters or digits.
    ListChildren -> Text
parentId :: Prelude.Text,
    -- | Filters the output to include only the specified child type.
    ListChildren -> ChildType
childType :: ChildType
  }
  deriving (ListChildren -> ListChildren -> Bool
(ListChildren -> ListChildren -> Bool)
-> (ListChildren -> ListChildren -> Bool) -> Eq ListChildren
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChildren -> ListChildren -> Bool
$c/= :: ListChildren -> ListChildren -> Bool
== :: ListChildren -> ListChildren -> Bool
$c== :: ListChildren -> ListChildren -> Bool
Prelude.Eq, ReadPrec [ListChildren]
ReadPrec ListChildren
Int -> ReadS ListChildren
ReadS [ListChildren]
(Int -> ReadS ListChildren)
-> ReadS [ListChildren]
-> ReadPrec ListChildren
-> ReadPrec [ListChildren]
-> Read ListChildren
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListChildren]
$creadListPrec :: ReadPrec [ListChildren]
readPrec :: ReadPrec ListChildren
$creadPrec :: ReadPrec ListChildren
readList :: ReadS [ListChildren]
$creadList :: ReadS [ListChildren]
readsPrec :: Int -> ReadS ListChildren
$creadsPrec :: Int -> ReadS ListChildren
Prelude.Read, Int -> ListChildren -> ShowS
[ListChildren] -> ShowS
ListChildren -> String
(Int -> ListChildren -> ShowS)
-> (ListChildren -> String)
-> ([ListChildren] -> ShowS)
-> Show ListChildren
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChildren] -> ShowS
$cshowList :: [ListChildren] -> ShowS
show :: ListChildren -> String
$cshow :: ListChildren -> String
showsPrec :: Int -> ListChildren -> ShowS
$cshowsPrec :: Int -> ListChildren -> ShowS
Prelude.Show, (forall x. ListChildren -> Rep ListChildren x)
-> (forall x. Rep ListChildren x -> ListChildren)
-> Generic ListChildren
forall x. Rep ListChildren x -> ListChildren
forall x. ListChildren -> Rep ListChildren x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListChildren x -> ListChildren
$cfrom :: forall x. ListChildren -> Rep ListChildren x
Prelude.Generic)

-- |
-- Create a value of 'ListChildren' 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:
--
-- 'nextToken', 'listChildren_nextToken' - The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
--
-- 'maxResults', 'listChildren_maxResults' - The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
--
-- 'parentId', 'listChildren_parentId' - The unique identifier (ID) for the parent root or OU whose children you
-- want to list.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
-- string requires one of the following:
--
-- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
--     lowercase letters or digits.
--
-- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
--     followed by from 4 to 32 lowercase letters or digits (the ID of the
--     root that the OU is in). This string is followed by a second \"-\"
--     dash and from 8 to 32 additional lowercase letters or digits.
--
-- 'childType', 'listChildren_childType' - Filters the output to include only the specified child type.
newListChildren ::
  -- | 'parentId'
  Prelude.Text ->
  -- | 'childType'
  ChildType ->
  ListChildren
newListChildren :: Text -> ChildType -> ListChildren
newListChildren Text
pParentId_ ChildType
pChildType_ =
  ListChildren' :: Maybe Text -> Maybe Natural -> Text -> ChildType -> ListChildren
ListChildren'
    { $sel:nextToken:ListChildren' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListChildren' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:parentId:ListChildren' :: Text
parentId = Text
pParentId_,
      $sel:childType:ListChildren' :: ChildType
childType = ChildType
pChildType_
    }

-- | The parameter for receiving additional results if you receive a
-- @NextToken@ response in a previous request. A @NextToken@ response
-- indicates that more output is available. Set this parameter to the value
-- of the previous call\'s @NextToken@ response to indicate where the
-- output should continue from.
listChildren_nextToken :: Lens.Lens' ListChildren (Prelude.Maybe Prelude.Text)
listChildren_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListChildren -> f ListChildren
listChildren_nextToken = (ListChildren -> Maybe Text)
-> (ListChildren -> Maybe Text -> ListChildren)
-> Lens ListChildren ListChildren (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildren' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListChildren' :: ListChildren -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListChildren
s@ListChildren' {} Maybe Text
a -> ListChildren
s {$sel:nextToken:ListChildren' :: Maybe Text
nextToken = Maybe Text
a} :: ListChildren)

-- | The total number of results that you want included on each page of the
-- response. If you do not include this parameter, it defaults to a value
-- that is specific to the operation. If additional items exist beyond the
-- maximum you specify, the @NextToken@ response element is present and has
-- a value (is not null). Include that value as the @NextToken@ request
-- parameter in the next call to the operation to get the next part of the
-- results. Note that Organizations might return fewer results than the
-- maximum even when there are more results available. You should check
-- @NextToken@ after every operation to ensure that you receive all of the
-- results.
listChildren_maxResults :: Lens.Lens' ListChildren (Prelude.Maybe Prelude.Natural)
listChildren_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListChildren -> f ListChildren
listChildren_maxResults = (ListChildren -> Maybe Natural)
-> (ListChildren -> Maybe Natural -> ListChildren)
-> Lens ListChildren ListChildren (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildren' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListChildren' :: ListChildren -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListChildren
s@ListChildren' {} Maybe Natural
a -> ListChildren
s {$sel:maxResults:ListChildren' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListChildren)

-- | The unique identifier (ID) for the parent root or OU whose children you
-- want to list.
--
-- The <http://wikipedia.org/wiki/regex regex pattern> for a parent ID
-- string requires one of the following:
--
-- -   __Root__ - A string that begins with \"r-\" followed by from 4 to 32
--     lowercase letters or digits.
--
-- -   __Organizational unit (OU)__ - A string that begins with \"ou-\"
--     followed by from 4 to 32 lowercase letters or digits (the ID of the
--     root that the OU is in). This string is followed by a second \"-\"
--     dash and from 8 to 32 additional lowercase letters or digits.
listChildren_parentId :: Lens.Lens' ListChildren Prelude.Text
listChildren_parentId :: (Text -> f Text) -> ListChildren -> f ListChildren
listChildren_parentId = (ListChildren -> Text)
-> (ListChildren -> Text -> ListChildren)
-> Lens ListChildren ListChildren Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildren' {Text
parentId :: Text
$sel:parentId:ListChildren' :: ListChildren -> Text
parentId} -> Text
parentId) (\s :: ListChildren
s@ListChildren' {} Text
a -> ListChildren
s {$sel:parentId:ListChildren' :: Text
parentId = Text
a} :: ListChildren)

-- | Filters the output to include only the specified child type.
listChildren_childType :: Lens.Lens' ListChildren ChildType
listChildren_childType :: (ChildType -> f ChildType) -> ListChildren -> f ListChildren
listChildren_childType = (ListChildren -> ChildType)
-> (ListChildren -> ChildType -> ListChildren)
-> Lens ListChildren ListChildren ChildType ChildType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildren' {ChildType
childType :: ChildType
$sel:childType:ListChildren' :: ListChildren -> ChildType
childType} -> ChildType
childType) (\s :: ListChildren
s@ListChildren' {} ChildType
a -> ListChildren
s {$sel:childType:ListChildren' :: ChildType
childType = ChildType
a} :: ListChildren)

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

instance Prelude.NFData ListChildren

instance Core.ToHeaders ListChildren where
  toHeaders :: ListChildren -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListChildren -> 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
"AWSOrganizationsV20161128.ListChildren" ::
                          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 ListChildren where
  toJSON :: ListChildren -> Value
toJSON ListChildren' {Maybe Natural
Maybe Text
Text
ChildType
childType :: ChildType
parentId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:childType:ListChildren' :: ListChildren -> ChildType
$sel:parentId:ListChildren' :: ListChildren -> Text
$sel:maxResults:ListChildren' :: ListChildren -> Maybe Natural
$sel:nextToken:ListChildren' :: ListChildren -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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 -> 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ParentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
parentId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ChildType" Text -> ChildType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ChildType
childType)
          ]
      )

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

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

-- | /See:/ 'newListChildrenResponse' smart constructor.
data ListChildrenResponse = ListChildrenResponse'
  { -- | The list of children of the specified parent container.
    ListChildrenResponse -> Maybe [Child]
children :: Prelude.Maybe [Child],
    -- | If present, indicates that more output is available than is included in
    -- the current response. Use this value in the @NextToken@ request
    -- parameter in a subsequent call to the operation to get the next part of
    -- the output. You should repeat this until the @NextToken@ response
    -- element comes back as @null@.
    ListChildrenResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListChildrenResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListChildrenResponse -> ListChildrenResponse -> Bool
(ListChildrenResponse -> ListChildrenResponse -> Bool)
-> (ListChildrenResponse -> ListChildrenResponse -> Bool)
-> Eq ListChildrenResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListChildrenResponse -> ListChildrenResponse -> Bool
$c/= :: ListChildrenResponse -> ListChildrenResponse -> Bool
== :: ListChildrenResponse -> ListChildrenResponse -> Bool
$c== :: ListChildrenResponse -> ListChildrenResponse -> Bool
Prelude.Eq, ReadPrec [ListChildrenResponse]
ReadPrec ListChildrenResponse
Int -> ReadS ListChildrenResponse
ReadS [ListChildrenResponse]
(Int -> ReadS ListChildrenResponse)
-> ReadS [ListChildrenResponse]
-> ReadPrec ListChildrenResponse
-> ReadPrec [ListChildrenResponse]
-> Read ListChildrenResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListChildrenResponse]
$creadListPrec :: ReadPrec [ListChildrenResponse]
readPrec :: ReadPrec ListChildrenResponse
$creadPrec :: ReadPrec ListChildrenResponse
readList :: ReadS [ListChildrenResponse]
$creadList :: ReadS [ListChildrenResponse]
readsPrec :: Int -> ReadS ListChildrenResponse
$creadsPrec :: Int -> ReadS ListChildrenResponse
Prelude.Read, Int -> ListChildrenResponse -> ShowS
[ListChildrenResponse] -> ShowS
ListChildrenResponse -> String
(Int -> ListChildrenResponse -> ShowS)
-> (ListChildrenResponse -> String)
-> ([ListChildrenResponse] -> ShowS)
-> Show ListChildrenResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListChildrenResponse] -> ShowS
$cshowList :: [ListChildrenResponse] -> ShowS
show :: ListChildrenResponse -> String
$cshow :: ListChildrenResponse -> String
showsPrec :: Int -> ListChildrenResponse -> ShowS
$cshowsPrec :: Int -> ListChildrenResponse -> ShowS
Prelude.Show, (forall x. ListChildrenResponse -> Rep ListChildrenResponse x)
-> (forall x. Rep ListChildrenResponse x -> ListChildrenResponse)
-> Generic ListChildrenResponse
forall x. Rep ListChildrenResponse x -> ListChildrenResponse
forall x. ListChildrenResponse -> Rep ListChildrenResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListChildrenResponse x -> ListChildrenResponse
$cfrom :: forall x. ListChildrenResponse -> Rep ListChildrenResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListChildrenResponse' 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:
--
-- 'children', 'listChildrenResponse_children' - The list of children of the specified parent container.
--
-- 'nextToken', 'listChildrenResponse_nextToken' - If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
--
-- 'httpStatus', 'listChildrenResponse_httpStatus' - The response's http status code.
newListChildrenResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListChildrenResponse
newListChildrenResponse :: Int -> ListChildrenResponse
newListChildrenResponse Int
pHttpStatus_ =
  ListChildrenResponse' :: Maybe [Child] -> Maybe Text -> Int -> ListChildrenResponse
ListChildrenResponse'
    { $sel:children:ListChildrenResponse' :: Maybe [Child]
children = Maybe [Child]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListChildrenResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListChildrenResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of children of the specified parent container.
listChildrenResponse_children :: Lens.Lens' ListChildrenResponse (Prelude.Maybe [Child])
listChildrenResponse_children :: (Maybe [Child] -> f (Maybe [Child]))
-> ListChildrenResponse -> f ListChildrenResponse
listChildrenResponse_children = (ListChildrenResponse -> Maybe [Child])
-> (ListChildrenResponse -> Maybe [Child] -> ListChildrenResponse)
-> Lens' ListChildrenResponse (Maybe [Child])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildrenResponse' {Maybe [Child]
children :: Maybe [Child]
$sel:children:ListChildrenResponse' :: ListChildrenResponse -> Maybe [Child]
children} -> Maybe [Child]
children) (\s :: ListChildrenResponse
s@ListChildrenResponse' {} Maybe [Child]
a -> ListChildrenResponse
s {$sel:children:ListChildrenResponse' :: Maybe [Child]
children = Maybe [Child]
a} :: ListChildrenResponse) ((Maybe [Child] -> f (Maybe [Child]))
 -> ListChildrenResponse -> f ListChildrenResponse)
-> ((Maybe [Child] -> f (Maybe [Child]))
    -> Maybe [Child] -> f (Maybe [Child]))
-> (Maybe [Child] -> f (Maybe [Child]))
-> ListChildrenResponse
-> f ListChildrenResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Child] [Child] [Child] [Child]
-> Iso
     (Maybe [Child]) (Maybe [Child]) (Maybe [Child]) (Maybe [Child])
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 [Child] [Child] [Child] [Child]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If present, indicates that more output is available than is included in
-- the current response. Use this value in the @NextToken@ request
-- parameter in a subsequent call to the operation to get the next part of
-- the output. You should repeat this until the @NextToken@ response
-- element comes back as @null@.
listChildrenResponse_nextToken :: Lens.Lens' ListChildrenResponse (Prelude.Maybe Prelude.Text)
listChildrenResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListChildrenResponse -> f ListChildrenResponse
listChildrenResponse_nextToken = (ListChildrenResponse -> Maybe Text)
-> (ListChildrenResponse -> Maybe Text -> ListChildrenResponse)
-> Lens' ListChildrenResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListChildrenResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListChildrenResponse' :: ListChildrenResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListChildrenResponse
s@ListChildrenResponse' {} Maybe Text
a -> ListChildrenResponse
s {$sel:nextToken:ListChildrenResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListChildrenResponse)

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

instance Prelude.NFData ListChildrenResponse