{-# 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.ListRoots
-- 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 the roots that are defined in the current organization.
--
-- 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.
--
-- Policy types can be enabled and disabled in roots. This is distinct from
-- whether they\'re available in the organization. When you enable all
-- features, you make policy types available for use in that organization.
-- Individual policy types can then be enabled and disabled in a root. To
-- see the availability of a policy type in an organization, use
-- DescribeOrganization.
--
-- This operation returns paginated results.
module Amazonka.Organizations.ListRoots
  ( -- * Creating a Request
    ListRoots (..),
    newListRoots,

    -- * Request Lenses
    listRoots_nextToken,
    listRoots_maxResults,

    -- * Destructuring the Response
    ListRootsResponse (..),
    newListRootsResponse,

    -- * Response Lenses
    listRootsResponse_roots,
    listRootsResponse_nextToken,
    listRootsResponse_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:/ 'newListRoots' smart constructor.
data ListRoots = ListRoots'
  { -- | 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.
    ListRoots -> 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.
    ListRoots -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListRoots -> ListRoots -> Bool
(ListRoots -> ListRoots -> Bool)
-> (ListRoots -> ListRoots -> Bool) -> Eq ListRoots
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRoots -> ListRoots -> Bool
$c/= :: ListRoots -> ListRoots -> Bool
== :: ListRoots -> ListRoots -> Bool
$c== :: ListRoots -> ListRoots -> Bool
Prelude.Eq, ReadPrec [ListRoots]
ReadPrec ListRoots
Int -> ReadS ListRoots
ReadS [ListRoots]
(Int -> ReadS ListRoots)
-> ReadS [ListRoots]
-> ReadPrec ListRoots
-> ReadPrec [ListRoots]
-> Read ListRoots
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRoots]
$creadListPrec :: ReadPrec [ListRoots]
readPrec :: ReadPrec ListRoots
$creadPrec :: ReadPrec ListRoots
readList :: ReadS [ListRoots]
$creadList :: ReadS [ListRoots]
readsPrec :: Int -> ReadS ListRoots
$creadsPrec :: Int -> ReadS ListRoots
Prelude.Read, Int -> ListRoots -> ShowS
[ListRoots] -> ShowS
ListRoots -> String
(Int -> ListRoots -> ShowS)
-> (ListRoots -> String)
-> ([ListRoots] -> ShowS)
-> Show ListRoots
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRoots] -> ShowS
$cshowList :: [ListRoots] -> ShowS
show :: ListRoots -> String
$cshow :: ListRoots -> String
showsPrec :: Int -> ListRoots -> ShowS
$cshowsPrec :: Int -> ListRoots -> ShowS
Prelude.Show, (forall x. ListRoots -> Rep ListRoots x)
-> (forall x. Rep ListRoots x -> ListRoots) -> Generic ListRoots
forall x. Rep ListRoots x -> ListRoots
forall x. ListRoots -> Rep ListRoots x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRoots x -> ListRoots
$cfrom :: forall x. ListRoots -> Rep ListRoots x
Prelude.Generic)

-- |
-- Create a value of 'ListRoots' 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', 'listRoots_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', 'listRoots_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.
newListRoots ::
  ListRoots
newListRoots :: ListRoots
newListRoots =
  ListRoots' :: Maybe Text -> Maybe Natural -> ListRoots
ListRoots'
    { $sel:nextToken:ListRoots' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRoots' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | 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.
listRoots_nextToken :: Lens.Lens' ListRoots (Prelude.Maybe Prelude.Text)
listRoots_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListRoots -> f ListRoots
listRoots_nextToken = (ListRoots -> Maybe Text)
-> (ListRoots -> Maybe Text -> ListRoots)
-> Lens ListRoots ListRoots (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoots' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRoots' :: ListRoots -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRoots
s@ListRoots' {} Maybe Text
a -> ListRoots
s {$sel:nextToken:ListRoots' :: Maybe Text
nextToken = Maybe Text
a} :: ListRoots)

-- | 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.
listRoots_maxResults :: Lens.Lens' ListRoots (Prelude.Maybe Prelude.Natural)
listRoots_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListRoots -> f ListRoots
listRoots_maxResults = (ListRoots -> Maybe Natural)
-> (ListRoots -> Maybe Natural -> ListRoots)
-> Lens ListRoots ListRoots (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRoots' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRoots' :: ListRoots -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRoots
s@ListRoots' {} Maybe Natural
a -> ListRoots
s {$sel:maxResults:ListRoots' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRoots)

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

instance Prelude.NFData ListRoots

instance Core.ToHeaders ListRoots where
  toHeaders :: ListRoots -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRoots -> 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.ListRoots" ::
                          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 ListRoots where
  toJSON :: ListRoots -> Value
toJSON ListRoots' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListRoots' :: ListRoots -> Maybe Natural
$sel:nextToken:ListRoots' :: ListRoots -> 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
          ]
      )

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

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

-- | /See:/ 'newListRootsResponse' smart constructor.
data ListRootsResponse = ListRootsResponse'
  { -- | A list of roots that are defined in an organization.
    ListRootsResponse -> Maybe [Root]
roots :: Prelude.Maybe [Root],
    -- | 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@.
    ListRootsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListRootsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRootsResponse -> ListRootsResponse -> Bool
(ListRootsResponse -> ListRootsResponse -> Bool)
-> (ListRootsResponse -> ListRootsResponse -> Bool)
-> Eq ListRootsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRootsResponse -> ListRootsResponse -> Bool
$c/= :: ListRootsResponse -> ListRootsResponse -> Bool
== :: ListRootsResponse -> ListRootsResponse -> Bool
$c== :: ListRootsResponse -> ListRootsResponse -> Bool
Prelude.Eq, ReadPrec [ListRootsResponse]
ReadPrec ListRootsResponse
Int -> ReadS ListRootsResponse
ReadS [ListRootsResponse]
(Int -> ReadS ListRootsResponse)
-> ReadS [ListRootsResponse]
-> ReadPrec ListRootsResponse
-> ReadPrec [ListRootsResponse]
-> Read ListRootsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRootsResponse]
$creadListPrec :: ReadPrec [ListRootsResponse]
readPrec :: ReadPrec ListRootsResponse
$creadPrec :: ReadPrec ListRootsResponse
readList :: ReadS [ListRootsResponse]
$creadList :: ReadS [ListRootsResponse]
readsPrec :: Int -> ReadS ListRootsResponse
$creadsPrec :: Int -> ReadS ListRootsResponse
Prelude.Read, Int -> ListRootsResponse -> ShowS
[ListRootsResponse] -> ShowS
ListRootsResponse -> String
(Int -> ListRootsResponse -> ShowS)
-> (ListRootsResponse -> String)
-> ([ListRootsResponse] -> ShowS)
-> Show ListRootsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRootsResponse] -> ShowS
$cshowList :: [ListRootsResponse] -> ShowS
show :: ListRootsResponse -> String
$cshow :: ListRootsResponse -> String
showsPrec :: Int -> ListRootsResponse -> ShowS
$cshowsPrec :: Int -> ListRootsResponse -> ShowS
Prelude.Show, (forall x. ListRootsResponse -> Rep ListRootsResponse x)
-> (forall x. Rep ListRootsResponse x -> ListRootsResponse)
-> Generic ListRootsResponse
forall x. Rep ListRootsResponse x -> ListRootsResponse
forall x. ListRootsResponse -> Rep ListRootsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRootsResponse x -> ListRootsResponse
$cfrom :: forall x. ListRootsResponse -> Rep ListRootsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRootsResponse' 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:
--
-- 'roots', 'listRootsResponse_roots' - A list of roots that are defined in an organization.
--
-- 'nextToken', 'listRootsResponse_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', 'listRootsResponse_httpStatus' - The response's http status code.
newListRootsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRootsResponse
newListRootsResponse :: Int -> ListRootsResponse
newListRootsResponse Int
pHttpStatus_ =
  ListRootsResponse' :: Maybe [Root] -> Maybe Text -> Int -> ListRootsResponse
ListRootsResponse'
    { $sel:roots:ListRootsResponse' :: Maybe [Root]
roots = Maybe [Root]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListRootsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRootsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of roots that are defined in an organization.
listRootsResponse_roots :: Lens.Lens' ListRootsResponse (Prelude.Maybe [Root])
listRootsResponse_roots :: (Maybe [Root] -> f (Maybe [Root]))
-> ListRootsResponse -> f ListRootsResponse
listRootsResponse_roots = (ListRootsResponse -> Maybe [Root])
-> (ListRootsResponse -> Maybe [Root] -> ListRootsResponse)
-> Lens' ListRootsResponse (Maybe [Root])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRootsResponse' {Maybe [Root]
roots :: Maybe [Root]
$sel:roots:ListRootsResponse' :: ListRootsResponse -> Maybe [Root]
roots} -> Maybe [Root]
roots) (\s :: ListRootsResponse
s@ListRootsResponse' {} Maybe [Root]
a -> ListRootsResponse
s {$sel:roots:ListRootsResponse' :: Maybe [Root]
roots = Maybe [Root]
a} :: ListRootsResponse) ((Maybe [Root] -> f (Maybe [Root]))
 -> ListRootsResponse -> f ListRootsResponse)
-> ((Maybe [Root] -> f (Maybe [Root]))
    -> Maybe [Root] -> f (Maybe [Root]))
-> (Maybe [Root] -> f (Maybe [Root]))
-> ListRootsResponse
-> f ListRootsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Root] [Root] [Root] [Root]
-> Iso (Maybe [Root]) (Maybe [Root]) (Maybe [Root]) (Maybe [Root])
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 [Root] [Root] [Root] [Root]
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@.
listRootsResponse_nextToken :: Lens.Lens' ListRootsResponse (Prelude.Maybe Prelude.Text)
listRootsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRootsResponse -> f ListRootsResponse
listRootsResponse_nextToken = (ListRootsResponse -> Maybe Text)
-> (ListRootsResponse -> Maybe Text -> ListRootsResponse)
-> Lens' ListRootsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRootsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRootsResponse' :: ListRootsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRootsResponse
s@ListRootsResponse' {} Maybe Text
a -> ListRootsResponse
s {$sel:nextToken:ListRootsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRootsResponse)

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

instance Prelude.NFData ListRootsResponse