{-# 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.DirectoryService.DescribeDirectories
-- 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)
--
-- Obtains information about the directories that belong to this account.
--
-- You can retrieve information about specific directories by passing the
-- directory identifiers in the @DirectoryIds@ parameter. Otherwise, all
-- directories that belong to the current account are returned.
--
-- This operation supports pagination with the use of the @NextToken@
-- request and response parameters. If more results are available, the
-- @DescribeDirectoriesResult.NextToken@ member contains a token that you
-- pass in the next call to DescribeDirectories to retrieve the next set of
-- items.
--
-- You can also specify a maximum number of return results with the @Limit@
-- parameter.
--
-- This operation returns paginated results.
module Amazonka.DirectoryService.DescribeDirectories
  ( -- * Creating a Request
    DescribeDirectories (..),
    newDescribeDirectories,

    -- * Request Lenses
    describeDirectories_nextToken,
    describeDirectories_directoryIds,
    describeDirectories_limit,

    -- * Destructuring the Response
    DescribeDirectoriesResponse (..),
    newDescribeDirectoriesResponse,

    -- * Response Lenses
    describeDirectoriesResponse_directoryDescriptions,
    describeDirectoriesResponse_nextToken,
    describeDirectoriesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DirectoryService.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

-- | Contains the inputs for the DescribeDirectories operation.
--
-- /See:/ 'newDescribeDirectories' smart constructor.
data DescribeDirectories = DescribeDirectories'
  { -- | The @DescribeDirectoriesResult.NextToken@ value from a previous call to
    -- DescribeDirectories. Pass null if this is the first call.
    DescribeDirectories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of identifiers of the directories for which to obtain the
    -- information. If this member is null, all directories that belong to the
    -- current account are returned.
    --
    -- An empty list results in an @InvalidParameterException@ being thrown.
    DescribeDirectories -> Maybe [Text]
directoryIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of items to return. If this value is zero, the
    -- maximum number of items is specified by the limitations of the
    -- operation.
    DescribeDirectories -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeDirectories -> DescribeDirectories -> Bool
(DescribeDirectories -> DescribeDirectories -> Bool)
-> (DescribeDirectories -> DescribeDirectories -> Bool)
-> Eq DescribeDirectories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDirectories -> DescribeDirectories -> Bool
$c/= :: DescribeDirectories -> DescribeDirectories -> Bool
== :: DescribeDirectories -> DescribeDirectories -> Bool
$c== :: DescribeDirectories -> DescribeDirectories -> Bool
Prelude.Eq, ReadPrec [DescribeDirectories]
ReadPrec DescribeDirectories
Int -> ReadS DescribeDirectories
ReadS [DescribeDirectories]
(Int -> ReadS DescribeDirectories)
-> ReadS [DescribeDirectories]
-> ReadPrec DescribeDirectories
-> ReadPrec [DescribeDirectories]
-> Read DescribeDirectories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeDirectories]
$creadListPrec :: ReadPrec [DescribeDirectories]
readPrec :: ReadPrec DescribeDirectories
$creadPrec :: ReadPrec DescribeDirectories
readList :: ReadS [DescribeDirectories]
$creadList :: ReadS [DescribeDirectories]
readsPrec :: Int -> ReadS DescribeDirectories
$creadsPrec :: Int -> ReadS DescribeDirectories
Prelude.Read, Int -> DescribeDirectories -> ShowS
[DescribeDirectories] -> ShowS
DescribeDirectories -> String
(Int -> DescribeDirectories -> ShowS)
-> (DescribeDirectories -> String)
-> ([DescribeDirectories] -> ShowS)
-> Show DescribeDirectories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDirectories] -> ShowS
$cshowList :: [DescribeDirectories] -> ShowS
show :: DescribeDirectories -> String
$cshow :: DescribeDirectories -> String
showsPrec :: Int -> DescribeDirectories -> ShowS
$cshowsPrec :: Int -> DescribeDirectories -> ShowS
Prelude.Show, (forall x. DescribeDirectories -> Rep DescribeDirectories x)
-> (forall x. Rep DescribeDirectories x -> DescribeDirectories)
-> Generic DescribeDirectories
forall x. Rep DescribeDirectories x -> DescribeDirectories
forall x. DescribeDirectories -> Rep DescribeDirectories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeDirectories x -> DescribeDirectories
$cfrom :: forall x. DescribeDirectories -> Rep DescribeDirectories x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDirectories' 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', 'describeDirectories_nextToken' - The @DescribeDirectoriesResult.NextToken@ value from a previous call to
-- DescribeDirectories. Pass null if this is the first call.
--
-- 'directoryIds', 'describeDirectories_directoryIds' - A list of identifiers of the directories for which to obtain the
-- information. If this member is null, all directories that belong to the
-- current account are returned.
--
-- An empty list results in an @InvalidParameterException@ being thrown.
--
-- 'limit', 'describeDirectories_limit' - The maximum number of items to return. If this value is zero, the
-- maximum number of items is specified by the limitations of the
-- operation.
newDescribeDirectories ::
  DescribeDirectories
newDescribeDirectories :: DescribeDirectories
newDescribeDirectories =
  DescribeDirectories' :: Maybe Text -> Maybe [Text] -> Maybe Natural -> DescribeDirectories
DescribeDirectories'
    { $sel:nextToken:DescribeDirectories' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryIds:DescribeDirectories' :: Maybe [Text]
directoryIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeDirectories' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The @DescribeDirectoriesResult.NextToken@ value from a previous call to
-- DescribeDirectories. Pass null if this is the first call.
describeDirectories_nextToken :: Lens.Lens' DescribeDirectories (Prelude.Maybe Prelude.Text)
describeDirectories_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectories -> f DescribeDirectories
describeDirectories_nextToken = (DescribeDirectories -> Maybe Text)
-> (DescribeDirectories -> Maybe Text -> DescribeDirectories)
-> Lens
     DescribeDirectories DescribeDirectories (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectories' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDirectories' :: DescribeDirectories -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDirectories
s@DescribeDirectories' {} Maybe Text
a -> DescribeDirectories
s {$sel:nextToken:DescribeDirectories' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDirectories)

-- | A list of identifiers of the directories for which to obtain the
-- information. If this member is null, all directories that belong to the
-- current account are returned.
--
-- An empty list results in an @InvalidParameterException@ being thrown.
describeDirectories_directoryIds :: Lens.Lens' DescribeDirectories (Prelude.Maybe [Prelude.Text])
describeDirectories_directoryIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeDirectories -> f DescribeDirectories
describeDirectories_directoryIds = (DescribeDirectories -> Maybe [Text])
-> (DescribeDirectories -> Maybe [Text] -> DescribeDirectories)
-> Lens
     DescribeDirectories
     DescribeDirectories
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectories' {Maybe [Text]
directoryIds :: Maybe [Text]
$sel:directoryIds:DescribeDirectories' :: DescribeDirectories -> Maybe [Text]
directoryIds} -> Maybe [Text]
directoryIds) (\s :: DescribeDirectories
s@DescribeDirectories' {} Maybe [Text]
a -> DescribeDirectories
s {$sel:directoryIds:DescribeDirectories' :: Maybe [Text]
directoryIds = Maybe [Text]
a} :: DescribeDirectories) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeDirectories -> f DescribeDirectories)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeDirectories
-> f DescribeDirectories
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of items to return. If this value is zero, the
-- maximum number of items is specified by the limitations of the
-- operation.
describeDirectories_limit :: Lens.Lens' DescribeDirectories (Prelude.Maybe Prelude.Natural)
describeDirectories_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeDirectories -> f DescribeDirectories
describeDirectories_limit = (DescribeDirectories -> Maybe Natural)
-> (DescribeDirectories -> Maybe Natural -> DescribeDirectories)
-> Lens
     DescribeDirectories
     DescribeDirectories
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectories' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeDirectories' :: DescribeDirectories -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeDirectories
s@DescribeDirectories' {} Maybe Natural
a -> DescribeDirectories
s {$sel:limit:DescribeDirectories' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeDirectories)

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

instance Prelude.NFData DescribeDirectories

instance Core.ToHeaders DescribeDirectories where
  toHeaders :: DescribeDirectories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeDirectories -> 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
"DirectoryService_20150416.DescribeDirectories" ::
                          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 DescribeDirectories where
  toJSON :: DescribeDirectories -> Value
toJSON DescribeDirectories' {Maybe Natural
Maybe [Text]
Maybe Text
limit :: Maybe Natural
directoryIds :: Maybe [Text]
nextToken :: Maybe Text
$sel:limit:DescribeDirectories' :: DescribeDirectories -> Maybe Natural
$sel:directoryIds:DescribeDirectories' :: DescribeDirectories -> Maybe [Text]
$sel:nextToken:DescribeDirectories' :: DescribeDirectories -> 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
"DirectoryIds" 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]
directoryIds,
            (Text
"Limit" 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
limit
          ]
      )

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

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

-- | Contains the results of the DescribeDirectories operation.
--
-- /See:/ 'newDescribeDirectoriesResponse' smart constructor.
data DescribeDirectoriesResponse = DescribeDirectoriesResponse'
  { -- | The list of DirectoryDescription objects that were retrieved.
    --
    -- It is possible that this list contains less than the number of items
    -- specified in the @Limit@ member of the request. This occurs if there are
    -- less than the requested number of items left to retrieve, or if the
    -- limitations of the operation have been exceeded.
    DescribeDirectoriesResponse -> Maybe [DirectoryDescription]
directoryDescriptions :: Prelude.Maybe [DirectoryDescription],
    -- | If not null, more results are available. Pass this value for the
    -- @NextToken@ parameter in a subsequent call to DescribeDirectories to
    -- retrieve the next set of items.
    DescribeDirectoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeDirectoriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeDirectoriesResponse -> DescribeDirectoriesResponse -> Bool
(DescribeDirectoriesResponse
 -> DescribeDirectoriesResponse -> Bool)
-> (DescribeDirectoriesResponse
    -> DescribeDirectoriesResponse -> Bool)
-> Eq DescribeDirectoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeDirectoriesResponse -> DescribeDirectoriesResponse -> Bool
$c/= :: DescribeDirectoriesResponse -> DescribeDirectoriesResponse -> Bool
== :: DescribeDirectoriesResponse -> DescribeDirectoriesResponse -> Bool
$c== :: DescribeDirectoriesResponse -> DescribeDirectoriesResponse -> Bool
Prelude.Eq, Int -> DescribeDirectoriesResponse -> ShowS
[DescribeDirectoriesResponse] -> ShowS
DescribeDirectoriesResponse -> String
(Int -> DescribeDirectoriesResponse -> ShowS)
-> (DescribeDirectoriesResponse -> String)
-> ([DescribeDirectoriesResponse] -> ShowS)
-> Show DescribeDirectoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeDirectoriesResponse] -> ShowS
$cshowList :: [DescribeDirectoriesResponse] -> ShowS
show :: DescribeDirectoriesResponse -> String
$cshow :: DescribeDirectoriesResponse -> String
showsPrec :: Int -> DescribeDirectoriesResponse -> ShowS
$cshowsPrec :: Int -> DescribeDirectoriesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeDirectoriesResponse -> Rep DescribeDirectoriesResponse x)
-> (forall x.
    Rep DescribeDirectoriesResponse x -> DescribeDirectoriesResponse)
-> Generic DescribeDirectoriesResponse
forall x.
Rep DescribeDirectoriesResponse x -> DescribeDirectoriesResponse
forall x.
DescribeDirectoriesResponse -> Rep DescribeDirectoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeDirectoriesResponse x -> DescribeDirectoriesResponse
$cfrom :: forall x.
DescribeDirectoriesResponse -> Rep DescribeDirectoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeDirectoriesResponse' 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:
--
-- 'directoryDescriptions', 'describeDirectoriesResponse_directoryDescriptions' - The list of DirectoryDescription objects that were retrieved.
--
-- It is possible that this list contains less than the number of items
-- specified in the @Limit@ member of the request. This occurs if there are
-- less than the requested number of items left to retrieve, or if the
-- limitations of the operation have been exceeded.
--
-- 'nextToken', 'describeDirectoriesResponse_nextToken' - If not null, more results are available. Pass this value for the
-- @NextToken@ parameter in a subsequent call to DescribeDirectories to
-- retrieve the next set of items.
--
-- 'httpStatus', 'describeDirectoriesResponse_httpStatus' - The response's http status code.
newDescribeDirectoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeDirectoriesResponse
newDescribeDirectoriesResponse :: Int -> DescribeDirectoriesResponse
newDescribeDirectoriesResponse Int
pHttpStatus_ =
  DescribeDirectoriesResponse' :: Maybe [DirectoryDescription]
-> Maybe Text -> Int -> DescribeDirectoriesResponse
DescribeDirectoriesResponse'
    { $sel:directoryDescriptions:DescribeDirectoriesResponse' :: Maybe [DirectoryDescription]
directoryDescriptions =
        Maybe [DirectoryDescription]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeDirectoriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeDirectoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The list of DirectoryDescription objects that were retrieved.
--
-- It is possible that this list contains less than the number of items
-- specified in the @Limit@ member of the request. This occurs if there are
-- less than the requested number of items left to retrieve, or if the
-- limitations of the operation have been exceeded.
describeDirectoriesResponse_directoryDescriptions :: Lens.Lens' DescribeDirectoriesResponse (Prelude.Maybe [DirectoryDescription])
describeDirectoriesResponse_directoryDescriptions :: (Maybe [DirectoryDescription] -> f (Maybe [DirectoryDescription]))
-> DescribeDirectoriesResponse -> f DescribeDirectoriesResponse
describeDirectoriesResponse_directoryDescriptions = (DescribeDirectoriesResponse -> Maybe [DirectoryDescription])
-> (DescribeDirectoriesResponse
    -> Maybe [DirectoryDescription] -> DescribeDirectoriesResponse)
-> Lens' DescribeDirectoriesResponse (Maybe [DirectoryDescription])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectoriesResponse' {Maybe [DirectoryDescription]
directoryDescriptions :: Maybe [DirectoryDescription]
$sel:directoryDescriptions:DescribeDirectoriesResponse' :: DescribeDirectoriesResponse -> Maybe [DirectoryDescription]
directoryDescriptions} -> Maybe [DirectoryDescription]
directoryDescriptions) (\s :: DescribeDirectoriesResponse
s@DescribeDirectoriesResponse' {} Maybe [DirectoryDescription]
a -> DescribeDirectoriesResponse
s {$sel:directoryDescriptions:DescribeDirectoriesResponse' :: Maybe [DirectoryDescription]
directoryDescriptions = Maybe [DirectoryDescription]
a} :: DescribeDirectoriesResponse) ((Maybe [DirectoryDescription] -> f (Maybe [DirectoryDescription]))
 -> DescribeDirectoriesResponse -> f DescribeDirectoriesResponse)
-> ((Maybe [DirectoryDescription]
     -> f (Maybe [DirectoryDescription]))
    -> Maybe [DirectoryDescription]
    -> f (Maybe [DirectoryDescription]))
-> (Maybe [DirectoryDescription]
    -> f (Maybe [DirectoryDescription]))
-> DescribeDirectoriesResponse
-> f DescribeDirectoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DirectoryDescription]
  [DirectoryDescription]
  [DirectoryDescription]
  [DirectoryDescription]
-> Iso
     (Maybe [DirectoryDescription])
     (Maybe [DirectoryDescription])
     (Maybe [DirectoryDescription])
     (Maybe [DirectoryDescription])
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
  [DirectoryDescription]
  [DirectoryDescription]
  [DirectoryDescription]
  [DirectoryDescription]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If not null, more results are available. Pass this value for the
-- @NextToken@ parameter in a subsequent call to DescribeDirectories to
-- retrieve the next set of items.
describeDirectoriesResponse_nextToken :: Lens.Lens' DescribeDirectoriesResponse (Prelude.Maybe Prelude.Text)
describeDirectoriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeDirectoriesResponse -> f DescribeDirectoriesResponse
describeDirectoriesResponse_nextToken = (DescribeDirectoriesResponse -> Maybe Text)
-> (DescribeDirectoriesResponse
    -> Maybe Text -> DescribeDirectoriesResponse)
-> Lens' DescribeDirectoriesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeDirectoriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeDirectoriesResponse' :: DescribeDirectoriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeDirectoriesResponse
s@DescribeDirectoriesResponse' {} Maybe Text
a -> DescribeDirectoriesResponse
s {$sel:nextToken:DescribeDirectoriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeDirectoriesResponse)

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

instance Prelude.NFData DescribeDirectoriesResponse