{-# 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.WorkSpaces.DescribeWorkspaceDirectories
-- 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)
--
-- Describes the available directories that are registered with Amazon
-- WorkSpaces.
--
-- This operation returns paginated results.
module Amazonka.WorkSpaces.DescribeWorkspaceDirectories
  ( -- * Creating a Request
    DescribeWorkspaceDirectories (..),
    newDescribeWorkspaceDirectories,

    -- * Request Lenses
    describeWorkspaceDirectories_nextToken,
    describeWorkspaceDirectories_directoryIds,
    describeWorkspaceDirectories_limit,

    -- * Destructuring the Response
    DescribeWorkspaceDirectoriesResponse (..),
    newDescribeWorkspaceDirectoriesResponse,

    -- * Response Lenses
    describeWorkspaceDirectoriesResponse_directories,
    describeWorkspaceDirectoriesResponse_nextToken,
    describeWorkspaceDirectoriesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDescribeWorkspaceDirectories' smart constructor.
data DescribeWorkspaceDirectories = DescribeWorkspaceDirectories'
  { -- | If you received a @NextToken@ from a previous call that was paginated,
    -- provide this token to receive the next set of results.
    DescribeWorkspaceDirectories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The identifiers of the directories. If the value is null, all
    -- directories are retrieved.
    DescribeWorkspaceDirectories -> Maybe (NonEmpty Text)
directoryIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The maximum number of directories to return.
    DescribeWorkspaceDirectories -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeWorkspaceDirectories
-> DescribeWorkspaceDirectories -> Bool
(DescribeWorkspaceDirectories
 -> DescribeWorkspaceDirectories -> Bool)
-> (DescribeWorkspaceDirectories
    -> DescribeWorkspaceDirectories -> Bool)
-> Eq DescribeWorkspaceDirectories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceDirectories
-> DescribeWorkspaceDirectories -> Bool
$c/= :: DescribeWorkspaceDirectories
-> DescribeWorkspaceDirectories -> Bool
== :: DescribeWorkspaceDirectories
-> DescribeWorkspaceDirectories -> Bool
$c== :: DescribeWorkspaceDirectories
-> DescribeWorkspaceDirectories -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceDirectories]
ReadPrec DescribeWorkspaceDirectories
Int -> ReadS DescribeWorkspaceDirectories
ReadS [DescribeWorkspaceDirectories]
(Int -> ReadS DescribeWorkspaceDirectories)
-> ReadS [DescribeWorkspaceDirectories]
-> ReadPrec DescribeWorkspaceDirectories
-> ReadPrec [DescribeWorkspaceDirectories]
-> Read DescribeWorkspaceDirectories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceDirectories]
$creadListPrec :: ReadPrec [DescribeWorkspaceDirectories]
readPrec :: ReadPrec DescribeWorkspaceDirectories
$creadPrec :: ReadPrec DescribeWorkspaceDirectories
readList :: ReadS [DescribeWorkspaceDirectories]
$creadList :: ReadS [DescribeWorkspaceDirectories]
readsPrec :: Int -> ReadS DescribeWorkspaceDirectories
$creadsPrec :: Int -> ReadS DescribeWorkspaceDirectories
Prelude.Read, Int -> DescribeWorkspaceDirectories -> ShowS
[DescribeWorkspaceDirectories] -> ShowS
DescribeWorkspaceDirectories -> String
(Int -> DescribeWorkspaceDirectories -> ShowS)
-> (DescribeWorkspaceDirectories -> String)
-> ([DescribeWorkspaceDirectories] -> ShowS)
-> Show DescribeWorkspaceDirectories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceDirectories] -> ShowS
$cshowList :: [DescribeWorkspaceDirectories] -> ShowS
show :: DescribeWorkspaceDirectories -> String
$cshow :: DescribeWorkspaceDirectories -> String
showsPrec :: Int -> DescribeWorkspaceDirectories -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceDirectories -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceDirectories -> Rep DescribeWorkspaceDirectories x)
-> (forall x.
    Rep DescribeWorkspaceDirectories x -> DescribeWorkspaceDirectories)
-> Generic DescribeWorkspaceDirectories
forall x.
Rep DescribeWorkspaceDirectories x -> DescribeWorkspaceDirectories
forall x.
DescribeWorkspaceDirectories -> Rep DescribeWorkspaceDirectories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceDirectories x -> DescribeWorkspaceDirectories
$cfrom :: forall x.
DescribeWorkspaceDirectories -> Rep DescribeWorkspaceDirectories x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceDirectories' 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', 'describeWorkspaceDirectories_nextToken' - If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
--
-- 'directoryIds', 'describeWorkspaceDirectories_directoryIds' - The identifiers of the directories. If the value is null, all
-- directories are retrieved.
--
-- 'limit', 'describeWorkspaceDirectories_limit' - The maximum number of directories to return.
newDescribeWorkspaceDirectories ::
  DescribeWorkspaceDirectories
newDescribeWorkspaceDirectories :: DescribeWorkspaceDirectories
newDescribeWorkspaceDirectories =
  DescribeWorkspaceDirectories' :: Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe Natural
-> DescribeWorkspaceDirectories
DescribeWorkspaceDirectories'
    { $sel:nextToken:DescribeWorkspaceDirectories' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:directoryIds:DescribeWorkspaceDirectories' :: Maybe (NonEmpty Text)
directoryIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeWorkspaceDirectories' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | If you received a @NextToken@ from a previous call that was paginated,
-- provide this token to receive the next set of results.
describeWorkspaceDirectories_nextToken :: Lens.Lens' DescribeWorkspaceDirectories (Prelude.Maybe Prelude.Text)
describeWorkspaceDirectories_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceDirectories -> f DescribeWorkspaceDirectories
describeWorkspaceDirectories_nextToken = (DescribeWorkspaceDirectories -> Maybe Text)
-> (DescribeWorkspaceDirectories
    -> Maybe Text -> DescribeWorkspaceDirectories)
-> Lens
     DescribeWorkspaceDirectories
     DescribeWorkspaceDirectories
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceDirectories' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceDirectories
s@DescribeWorkspaceDirectories' {} Maybe Text
a -> DescribeWorkspaceDirectories
s {$sel:nextToken:DescribeWorkspaceDirectories' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceDirectories)

-- | The identifiers of the directories. If the value is null, all
-- directories are retrieved.
describeWorkspaceDirectories_directoryIds :: Lens.Lens' DescribeWorkspaceDirectories (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
describeWorkspaceDirectories_directoryIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceDirectories -> f DescribeWorkspaceDirectories
describeWorkspaceDirectories_directoryIds = (DescribeWorkspaceDirectories -> Maybe (NonEmpty Text))
-> (DescribeWorkspaceDirectories
    -> Maybe (NonEmpty Text) -> DescribeWorkspaceDirectories)
-> Lens
     DescribeWorkspaceDirectories
     DescribeWorkspaceDirectories
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceDirectories' {Maybe (NonEmpty Text)
directoryIds :: Maybe (NonEmpty Text)
$sel:directoryIds:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> Maybe (NonEmpty Text)
directoryIds} -> Maybe (NonEmpty Text)
directoryIds) (\s :: DescribeWorkspaceDirectories
s@DescribeWorkspaceDirectories' {} Maybe (NonEmpty Text)
a -> DescribeWorkspaceDirectories
s {$sel:directoryIds:DescribeWorkspaceDirectories' :: Maybe (NonEmpty Text)
directoryIds = Maybe (NonEmpty Text)
a} :: DescribeWorkspaceDirectories) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> DescribeWorkspaceDirectories -> f DescribeWorkspaceDirectories)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> DescribeWorkspaceDirectories
-> f DescribeWorkspaceDirectories
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The maximum number of directories to return.
describeWorkspaceDirectories_limit :: Lens.Lens' DescribeWorkspaceDirectories (Prelude.Maybe Prelude.Natural)
describeWorkspaceDirectories_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeWorkspaceDirectories -> f DescribeWorkspaceDirectories
describeWorkspaceDirectories_limit = (DescribeWorkspaceDirectories -> Maybe Natural)
-> (DescribeWorkspaceDirectories
    -> Maybe Natural -> DescribeWorkspaceDirectories)
-> Lens
     DescribeWorkspaceDirectories
     DescribeWorkspaceDirectories
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceDirectories' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeWorkspaceDirectories
s@DescribeWorkspaceDirectories' {} Maybe Natural
a -> DescribeWorkspaceDirectories
s {$sel:limit:DescribeWorkspaceDirectories' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeWorkspaceDirectories)

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

instance Prelude.NFData DescribeWorkspaceDirectories

instance Core.ToHeaders DescribeWorkspaceDirectories where
  toHeaders :: DescribeWorkspaceDirectories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeWorkspaceDirectories -> 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
"WorkspacesService.DescribeWorkspaceDirectories" ::
                          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 DescribeWorkspaceDirectories where
  toJSON :: DescribeWorkspaceDirectories -> Value
toJSON DescribeWorkspaceDirectories' {Maybe Natural
Maybe (NonEmpty Text)
Maybe Text
limit :: Maybe Natural
directoryIds :: Maybe (NonEmpty Text)
nextToken :: Maybe Text
$sel:limit:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> Maybe Natural
$sel:directoryIds:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> Maybe (NonEmpty Text)
$sel:nextToken:DescribeWorkspaceDirectories' :: DescribeWorkspaceDirectories -> 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 -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty 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 DescribeWorkspaceDirectories where
  toPath :: DescribeWorkspaceDirectories -> ByteString
toPath = ByteString -> DescribeWorkspaceDirectories -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newDescribeWorkspaceDirectoriesResponse' smart constructor.
data DescribeWorkspaceDirectoriesResponse = DescribeWorkspaceDirectoriesResponse'
  { -- | Information about the directories.
    DescribeWorkspaceDirectoriesResponse -> Maybe [WorkspaceDirectory]
directories :: Prelude.Maybe [WorkspaceDirectory],
    -- | The token to use to retrieve the next page of results. This value is
    -- null when there are no more results to return.
    DescribeWorkspaceDirectoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeWorkspaceDirectoriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeWorkspaceDirectoriesResponse
-> DescribeWorkspaceDirectoriesResponse -> Bool
(DescribeWorkspaceDirectoriesResponse
 -> DescribeWorkspaceDirectoriesResponse -> Bool)
-> (DescribeWorkspaceDirectoriesResponse
    -> DescribeWorkspaceDirectoriesResponse -> Bool)
-> Eq DescribeWorkspaceDirectoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeWorkspaceDirectoriesResponse
-> DescribeWorkspaceDirectoriesResponse -> Bool
$c/= :: DescribeWorkspaceDirectoriesResponse
-> DescribeWorkspaceDirectoriesResponse -> Bool
== :: DescribeWorkspaceDirectoriesResponse
-> DescribeWorkspaceDirectoriesResponse -> Bool
$c== :: DescribeWorkspaceDirectoriesResponse
-> DescribeWorkspaceDirectoriesResponse -> Bool
Prelude.Eq, ReadPrec [DescribeWorkspaceDirectoriesResponse]
ReadPrec DescribeWorkspaceDirectoriesResponse
Int -> ReadS DescribeWorkspaceDirectoriesResponse
ReadS [DescribeWorkspaceDirectoriesResponse]
(Int -> ReadS DescribeWorkspaceDirectoriesResponse)
-> ReadS [DescribeWorkspaceDirectoriesResponse]
-> ReadPrec DescribeWorkspaceDirectoriesResponse
-> ReadPrec [DescribeWorkspaceDirectoriesResponse]
-> Read DescribeWorkspaceDirectoriesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeWorkspaceDirectoriesResponse]
$creadListPrec :: ReadPrec [DescribeWorkspaceDirectoriesResponse]
readPrec :: ReadPrec DescribeWorkspaceDirectoriesResponse
$creadPrec :: ReadPrec DescribeWorkspaceDirectoriesResponse
readList :: ReadS [DescribeWorkspaceDirectoriesResponse]
$creadList :: ReadS [DescribeWorkspaceDirectoriesResponse]
readsPrec :: Int -> ReadS DescribeWorkspaceDirectoriesResponse
$creadsPrec :: Int -> ReadS DescribeWorkspaceDirectoriesResponse
Prelude.Read, Int -> DescribeWorkspaceDirectoriesResponse -> ShowS
[DescribeWorkspaceDirectoriesResponse] -> ShowS
DescribeWorkspaceDirectoriesResponse -> String
(Int -> DescribeWorkspaceDirectoriesResponse -> ShowS)
-> (DescribeWorkspaceDirectoriesResponse -> String)
-> ([DescribeWorkspaceDirectoriesResponse] -> ShowS)
-> Show DescribeWorkspaceDirectoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeWorkspaceDirectoriesResponse] -> ShowS
$cshowList :: [DescribeWorkspaceDirectoriesResponse] -> ShowS
show :: DescribeWorkspaceDirectoriesResponse -> String
$cshow :: DescribeWorkspaceDirectoriesResponse -> String
showsPrec :: Int -> DescribeWorkspaceDirectoriesResponse -> ShowS
$cshowsPrec :: Int -> DescribeWorkspaceDirectoriesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeWorkspaceDirectoriesResponse
 -> Rep DescribeWorkspaceDirectoriesResponse x)
-> (forall x.
    Rep DescribeWorkspaceDirectoriesResponse x
    -> DescribeWorkspaceDirectoriesResponse)
-> Generic DescribeWorkspaceDirectoriesResponse
forall x.
Rep DescribeWorkspaceDirectoriesResponse x
-> DescribeWorkspaceDirectoriesResponse
forall x.
DescribeWorkspaceDirectoriesResponse
-> Rep DescribeWorkspaceDirectoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeWorkspaceDirectoriesResponse x
-> DescribeWorkspaceDirectoriesResponse
$cfrom :: forall x.
DescribeWorkspaceDirectoriesResponse
-> Rep DescribeWorkspaceDirectoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeWorkspaceDirectoriesResponse' 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:
--
-- 'directories', 'describeWorkspaceDirectoriesResponse_directories' - Information about the directories.
--
-- 'nextToken', 'describeWorkspaceDirectoriesResponse_nextToken' - The token to use to retrieve the next page of results. This value is
-- null when there are no more results to return.
--
-- 'httpStatus', 'describeWorkspaceDirectoriesResponse_httpStatus' - The response's http status code.
newDescribeWorkspaceDirectoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeWorkspaceDirectoriesResponse
newDescribeWorkspaceDirectoriesResponse :: Int -> DescribeWorkspaceDirectoriesResponse
newDescribeWorkspaceDirectoriesResponse Int
pHttpStatus_ =
  DescribeWorkspaceDirectoriesResponse' :: Maybe [WorkspaceDirectory]
-> Maybe Text -> Int -> DescribeWorkspaceDirectoriesResponse
DescribeWorkspaceDirectoriesResponse'
    { $sel:directories:DescribeWorkspaceDirectoriesResponse' :: Maybe [WorkspaceDirectory]
directories =
        Maybe [WorkspaceDirectory]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeWorkspaceDirectoriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeWorkspaceDirectoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the directories.
describeWorkspaceDirectoriesResponse_directories :: Lens.Lens' DescribeWorkspaceDirectoriesResponse (Prelude.Maybe [WorkspaceDirectory])
describeWorkspaceDirectoriesResponse_directories :: (Maybe [WorkspaceDirectory] -> f (Maybe [WorkspaceDirectory]))
-> DescribeWorkspaceDirectoriesResponse
-> f DescribeWorkspaceDirectoriesResponse
describeWorkspaceDirectoriesResponse_directories = (DescribeWorkspaceDirectoriesResponse
 -> Maybe [WorkspaceDirectory])
-> (DescribeWorkspaceDirectoriesResponse
    -> Maybe [WorkspaceDirectory]
    -> DescribeWorkspaceDirectoriesResponse)
-> Lens'
     DescribeWorkspaceDirectoriesResponse (Maybe [WorkspaceDirectory])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceDirectoriesResponse' {Maybe [WorkspaceDirectory]
directories :: Maybe [WorkspaceDirectory]
$sel:directories:DescribeWorkspaceDirectoriesResponse' :: DescribeWorkspaceDirectoriesResponse -> Maybe [WorkspaceDirectory]
directories} -> Maybe [WorkspaceDirectory]
directories) (\s :: DescribeWorkspaceDirectoriesResponse
s@DescribeWorkspaceDirectoriesResponse' {} Maybe [WorkspaceDirectory]
a -> DescribeWorkspaceDirectoriesResponse
s {$sel:directories:DescribeWorkspaceDirectoriesResponse' :: Maybe [WorkspaceDirectory]
directories = Maybe [WorkspaceDirectory]
a} :: DescribeWorkspaceDirectoriesResponse) ((Maybe [WorkspaceDirectory] -> f (Maybe [WorkspaceDirectory]))
 -> DescribeWorkspaceDirectoriesResponse
 -> f DescribeWorkspaceDirectoriesResponse)
-> ((Maybe [WorkspaceDirectory] -> f (Maybe [WorkspaceDirectory]))
    -> Maybe [WorkspaceDirectory] -> f (Maybe [WorkspaceDirectory]))
-> (Maybe [WorkspaceDirectory] -> f (Maybe [WorkspaceDirectory]))
-> DescribeWorkspaceDirectoriesResponse
-> f DescribeWorkspaceDirectoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [WorkspaceDirectory]
  [WorkspaceDirectory]
  [WorkspaceDirectory]
  [WorkspaceDirectory]
-> Iso
     (Maybe [WorkspaceDirectory])
     (Maybe [WorkspaceDirectory])
     (Maybe [WorkspaceDirectory])
     (Maybe [WorkspaceDirectory])
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
  [WorkspaceDirectory]
  [WorkspaceDirectory]
  [WorkspaceDirectory]
  [WorkspaceDirectory]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The token to use to retrieve the next page of results. This value is
-- null when there are no more results to return.
describeWorkspaceDirectoriesResponse_nextToken :: Lens.Lens' DescribeWorkspaceDirectoriesResponse (Prelude.Maybe Prelude.Text)
describeWorkspaceDirectoriesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeWorkspaceDirectoriesResponse
-> f DescribeWorkspaceDirectoriesResponse
describeWorkspaceDirectoriesResponse_nextToken = (DescribeWorkspaceDirectoriesResponse -> Maybe Text)
-> (DescribeWorkspaceDirectoriesResponse
    -> Maybe Text -> DescribeWorkspaceDirectoriesResponse)
-> Lens' DescribeWorkspaceDirectoriesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeWorkspaceDirectoriesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeWorkspaceDirectoriesResponse' :: DescribeWorkspaceDirectoriesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeWorkspaceDirectoriesResponse
s@DescribeWorkspaceDirectoriesResponse' {} Maybe Text
a -> DescribeWorkspaceDirectoriesResponse
s {$sel:nextToken:DescribeWorkspaceDirectoriesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeWorkspaceDirectoriesResponse)

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

instance
  Prelude.NFData
    DescribeWorkspaceDirectoriesResponse