{-# 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.DescribeSharedDirectories
-- 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)
--
-- Returns the shared directories in your account.
--
-- This operation returns paginated results.
module Amazonka.DirectoryService.DescribeSharedDirectories
  ( -- * Creating a Request
    DescribeSharedDirectories (..),
    newDescribeSharedDirectories,

    -- * Request Lenses
    describeSharedDirectories_sharedDirectoryIds,
    describeSharedDirectories_nextToken,
    describeSharedDirectories_limit,
    describeSharedDirectories_ownerDirectoryId,

    -- * Destructuring the Response
    DescribeSharedDirectoriesResponse (..),
    newDescribeSharedDirectoriesResponse,

    -- * Response Lenses
    describeSharedDirectoriesResponse_sharedDirectories,
    describeSharedDirectoriesResponse_nextToken,
    describeSharedDirectoriesResponse_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

-- | /See:/ 'newDescribeSharedDirectories' smart constructor.
data DescribeSharedDirectories = DescribeSharedDirectories'
  { -- | A list of identifiers of all shared directories in your account.
    DescribeSharedDirectories -> Maybe [Text]
sharedDirectoryIds :: Prelude.Maybe [Prelude.Text],
    -- | The @DescribeSharedDirectoriesResult.NextToken@ value from a previous
    -- call to DescribeSharedDirectories. Pass null if this is the first call.
    DescribeSharedDirectories -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The number of shared directories to return in the response object.
    DescribeSharedDirectories -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
    -- | Returns the identifier of the directory in the directory owner account.
    DescribeSharedDirectories -> Text
ownerDirectoryId :: Prelude.Text
  }
  deriving (DescribeSharedDirectories -> DescribeSharedDirectories -> Bool
(DescribeSharedDirectories -> DescribeSharedDirectories -> Bool)
-> (DescribeSharedDirectories -> DescribeSharedDirectories -> Bool)
-> Eq DescribeSharedDirectories
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSharedDirectories -> DescribeSharedDirectories -> Bool
$c/= :: DescribeSharedDirectories -> DescribeSharedDirectories -> Bool
== :: DescribeSharedDirectories -> DescribeSharedDirectories -> Bool
$c== :: DescribeSharedDirectories -> DescribeSharedDirectories -> Bool
Prelude.Eq, ReadPrec [DescribeSharedDirectories]
ReadPrec DescribeSharedDirectories
Int -> ReadS DescribeSharedDirectories
ReadS [DescribeSharedDirectories]
(Int -> ReadS DescribeSharedDirectories)
-> ReadS [DescribeSharedDirectories]
-> ReadPrec DescribeSharedDirectories
-> ReadPrec [DescribeSharedDirectories]
-> Read DescribeSharedDirectories
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeSharedDirectories]
$creadListPrec :: ReadPrec [DescribeSharedDirectories]
readPrec :: ReadPrec DescribeSharedDirectories
$creadPrec :: ReadPrec DescribeSharedDirectories
readList :: ReadS [DescribeSharedDirectories]
$creadList :: ReadS [DescribeSharedDirectories]
readsPrec :: Int -> ReadS DescribeSharedDirectories
$creadsPrec :: Int -> ReadS DescribeSharedDirectories
Prelude.Read, Int -> DescribeSharedDirectories -> ShowS
[DescribeSharedDirectories] -> ShowS
DescribeSharedDirectories -> String
(Int -> DescribeSharedDirectories -> ShowS)
-> (DescribeSharedDirectories -> String)
-> ([DescribeSharedDirectories] -> ShowS)
-> Show DescribeSharedDirectories
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSharedDirectories] -> ShowS
$cshowList :: [DescribeSharedDirectories] -> ShowS
show :: DescribeSharedDirectories -> String
$cshow :: DescribeSharedDirectories -> String
showsPrec :: Int -> DescribeSharedDirectories -> ShowS
$cshowsPrec :: Int -> DescribeSharedDirectories -> ShowS
Prelude.Show, (forall x.
 DescribeSharedDirectories -> Rep DescribeSharedDirectories x)
-> (forall x.
    Rep DescribeSharedDirectories x -> DescribeSharedDirectories)
-> Generic DescribeSharedDirectories
forall x.
Rep DescribeSharedDirectories x -> DescribeSharedDirectories
forall x.
DescribeSharedDirectories -> Rep DescribeSharedDirectories x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSharedDirectories x -> DescribeSharedDirectories
$cfrom :: forall x.
DescribeSharedDirectories -> Rep DescribeSharedDirectories x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSharedDirectories' 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:
--
-- 'sharedDirectoryIds', 'describeSharedDirectories_sharedDirectoryIds' - A list of identifiers of all shared directories in your account.
--
-- 'nextToken', 'describeSharedDirectories_nextToken' - The @DescribeSharedDirectoriesResult.NextToken@ value from a previous
-- call to DescribeSharedDirectories. Pass null if this is the first call.
--
-- 'limit', 'describeSharedDirectories_limit' - The number of shared directories to return in the response object.
--
-- 'ownerDirectoryId', 'describeSharedDirectories_ownerDirectoryId' - Returns the identifier of the directory in the directory owner account.
newDescribeSharedDirectories ::
  -- | 'ownerDirectoryId'
  Prelude.Text ->
  DescribeSharedDirectories
newDescribeSharedDirectories :: Text -> DescribeSharedDirectories
newDescribeSharedDirectories Text
pOwnerDirectoryId_ =
  DescribeSharedDirectories' :: Maybe [Text]
-> Maybe Text -> Maybe Natural -> Text -> DescribeSharedDirectories
DescribeSharedDirectories'
    { $sel:sharedDirectoryIds:DescribeSharedDirectories' :: Maybe [Text]
sharedDirectoryIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSharedDirectories' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeSharedDirectories' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:ownerDirectoryId:DescribeSharedDirectories' :: Text
ownerDirectoryId = Text
pOwnerDirectoryId_
    }

-- | A list of identifiers of all shared directories in your account.
describeSharedDirectories_sharedDirectoryIds :: Lens.Lens' DescribeSharedDirectories (Prelude.Maybe [Prelude.Text])
describeSharedDirectories_sharedDirectoryIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSharedDirectories -> f DescribeSharedDirectories
describeSharedDirectories_sharedDirectoryIds = (DescribeSharedDirectories -> Maybe [Text])
-> (DescribeSharedDirectories
    -> Maybe [Text] -> DescribeSharedDirectories)
-> Lens
     DescribeSharedDirectories
     DescribeSharedDirectories
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSharedDirectories' {Maybe [Text]
sharedDirectoryIds :: Maybe [Text]
$sel:sharedDirectoryIds:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe [Text]
sharedDirectoryIds} -> Maybe [Text]
sharedDirectoryIds) (\s :: DescribeSharedDirectories
s@DescribeSharedDirectories' {} Maybe [Text]
a -> DescribeSharedDirectories
s {$sel:sharedDirectoryIds:DescribeSharedDirectories' :: Maybe [Text]
sharedDirectoryIds = Maybe [Text]
a} :: DescribeSharedDirectories) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeSharedDirectories -> f DescribeSharedDirectories)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeSharedDirectories
-> f DescribeSharedDirectories
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 @DescribeSharedDirectoriesResult.NextToken@ value from a previous
-- call to DescribeSharedDirectories. Pass null if this is the first call.
describeSharedDirectories_nextToken :: Lens.Lens' DescribeSharedDirectories (Prelude.Maybe Prelude.Text)
describeSharedDirectories_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribeSharedDirectories -> f DescribeSharedDirectories
describeSharedDirectories_nextToken = (DescribeSharedDirectories -> Maybe Text)
-> (DescribeSharedDirectories
    -> Maybe Text -> DescribeSharedDirectories)
-> Lens
     DescribeSharedDirectories
     DescribeSharedDirectories
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSharedDirectories' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribeSharedDirectories
s@DescribeSharedDirectories' {} Maybe Text
a -> DescribeSharedDirectories
s {$sel:nextToken:DescribeSharedDirectories' :: Maybe Text
nextToken = Maybe Text
a} :: DescribeSharedDirectories)

-- | The number of shared directories to return in the response object.
describeSharedDirectories_limit :: Lens.Lens' DescribeSharedDirectories (Prelude.Maybe Prelude.Natural)
describeSharedDirectories_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeSharedDirectories -> f DescribeSharedDirectories
describeSharedDirectories_limit = (DescribeSharedDirectories -> Maybe Natural)
-> (DescribeSharedDirectories
    -> Maybe Natural -> DescribeSharedDirectories)
-> Lens
     DescribeSharedDirectories
     DescribeSharedDirectories
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSharedDirectories' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeSharedDirectories
s@DescribeSharedDirectories' {} Maybe Natural
a -> DescribeSharedDirectories
s {$sel:limit:DescribeSharedDirectories' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeSharedDirectories)

-- | Returns the identifier of the directory in the directory owner account.
describeSharedDirectories_ownerDirectoryId :: Lens.Lens' DescribeSharedDirectories Prelude.Text
describeSharedDirectories_ownerDirectoryId :: (Text -> f Text)
-> DescribeSharedDirectories -> f DescribeSharedDirectories
describeSharedDirectories_ownerDirectoryId = (DescribeSharedDirectories -> Text)
-> (DescribeSharedDirectories -> Text -> DescribeSharedDirectories)
-> Lens
     DescribeSharedDirectories DescribeSharedDirectories Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSharedDirectories' {Text
ownerDirectoryId :: Text
$sel:ownerDirectoryId:DescribeSharedDirectories' :: DescribeSharedDirectories -> Text
ownerDirectoryId} -> Text
ownerDirectoryId) (\s :: DescribeSharedDirectories
s@DescribeSharedDirectories' {} Text
a -> DescribeSharedDirectories
s {$sel:ownerDirectoryId:DescribeSharedDirectories' :: Text
ownerDirectoryId = Text
a} :: DescribeSharedDirectories)

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

instance Prelude.NFData DescribeSharedDirectories

instance Core.ToHeaders DescribeSharedDirectories where
  toHeaders :: DescribeSharedDirectories -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeSharedDirectories -> 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.DescribeSharedDirectories" ::
                          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 DescribeSharedDirectories where
  toJSON :: DescribeSharedDirectories -> Value
toJSON DescribeSharedDirectories' {Maybe Natural
Maybe [Text]
Maybe Text
Text
ownerDirectoryId :: Text
limit :: Maybe Natural
nextToken :: Maybe Text
sharedDirectoryIds :: Maybe [Text]
$sel:ownerDirectoryId:DescribeSharedDirectories' :: DescribeSharedDirectories -> Text
$sel:limit:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe Natural
$sel:nextToken:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe Text
$sel:sharedDirectoryIds:DescribeSharedDirectories' :: DescribeSharedDirectories -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SharedDirectoryIds" 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]
sharedDirectoryIds,
            (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
"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,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OwnerDirectoryId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ownerDirectoryId)
          ]
      )

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

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

-- | /See:/ 'newDescribeSharedDirectoriesResponse' smart constructor.
data DescribeSharedDirectoriesResponse = DescribeSharedDirectoriesResponse'
  { -- | A list of all shared directories in your account.
    DescribeSharedDirectoriesResponse -> Maybe [SharedDirectory]
sharedDirectories :: Prelude.Maybe [SharedDirectory],
    -- | If not null, token that indicates that more results are available. Pass
    -- this value for the @NextToken@ parameter in a subsequent call to
    -- DescribeSharedDirectories to retrieve the next set of items.
    DescribeSharedDirectoriesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeSharedDirectoriesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeSharedDirectoriesResponse
-> DescribeSharedDirectoriesResponse -> Bool
(DescribeSharedDirectoriesResponse
 -> DescribeSharedDirectoriesResponse -> Bool)
-> (DescribeSharedDirectoriesResponse
    -> DescribeSharedDirectoriesResponse -> Bool)
-> Eq DescribeSharedDirectoriesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeSharedDirectoriesResponse
-> DescribeSharedDirectoriesResponse -> Bool
$c/= :: DescribeSharedDirectoriesResponse
-> DescribeSharedDirectoriesResponse -> Bool
== :: DescribeSharedDirectoriesResponse
-> DescribeSharedDirectoriesResponse -> Bool
$c== :: DescribeSharedDirectoriesResponse
-> DescribeSharedDirectoriesResponse -> Bool
Prelude.Eq, Int -> DescribeSharedDirectoriesResponse -> ShowS
[DescribeSharedDirectoriesResponse] -> ShowS
DescribeSharedDirectoriesResponse -> String
(Int -> DescribeSharedDirectoriesResponse -> ShowS)
-> (DescribeSharedDirectoriesResponse -> String)
-> ([DescribeSharedDirectoriesResponse] -> ShowS)
-> Show DescribeSharedDirectoriesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeSharedDirectoriesResponse] -> ShowS
$cshowList :: [DescribeSharedDirectoriesResponse] -> ShowS
show :: DescribeSharedDirectoriesResponse -> String
$cshow :: DescribeSharedDirectoriesResponse -> String
showsPrec :: Int -> DescribeSharedDirectoriesResponse -> ShowS
$cshowsPrec :: Int -> DescribeSharedDirectoriesResponse -> ShowS
Prelude.Show, (forall x.
 DescribeSharedDirectoriesResponse
 -> Rep DescribeSharedDirectoriesResponse x)
-> (forall x.
    Rep DescribeSharedDirectoriesResponse x
    -> DescribeSharedDirectoriesResponse)
-> Generic DescribeSharedDirectoriesResponse
forall x.
Rep DescribeSharedDirectoriesResponse x
-> DescribeSharedDirectoriesResponse
forall x.
DescribeSharedDirectoriesResponse
-> Rep DescribeSharedDirectoriesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeSharedDirectoriesResponse x
-> DescribeSharedDirectoriesResponse
$cfrom :: forall x.
DescribeSharedDirectoriesResponse
-> Rep DescribeSharedDirectoriesResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeSharedDirectoriesResponse' 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:
--
-- 'sharedDirectories', 'describeSharedDirectoriesResponse_sharedDirectories' - A list of all shared directories in your account.
--
-- 'nextToken', 'describeSharedDirectoriesResponse_nextToken' - If not null, token that indicates that more results are available. Pass
-- this value for the @NextToken@ parameter in a subsequent call to
-- DescribeSharedDirectories to retrieve the next set of items.
--
-- 'httpStatus', 'describeSharedDirectoriesResponse_httpStatus' - The response's http status code.
newDescribeSharedDirectoriesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeSharedDirectoriesResponse
newDescribeSharedDirectoriesResponse :: Int -> DescribeSharedDirectoriesResponse
newDescribeSharedDirectoriesResponse Int
pHttpStatus_ =
  DescribeSharedDirectoriesResponse' :: Maybe [SharedDirectory]
-> Maybe Text -> Int -> DescribeSharedDirectoriesResponse
DescribeSharedDirectoriesResponse'
    { $sel:sharedDirectories:DescribeSharedDirectoriesResponse' :: Maybe [SharedDirectory]
sharedDirectories =
        Maybe [SharedDirectory]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeSharedDirectoriesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeSharedDirectoriesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of all shared directories in your account.
describeSharedDirectoriesResponse_sharedDirectories :: Lens.Lens' DescribeSharedDirectoriesResponse (Prelude.Maybe [SharedDirectory])
describeSharedDirectoriesResponse_sharedDirectories :: (Maybe [SharedDirectory] -> f (Maybe [SharedDirectory]))
-> DescribeSharedDirectoriesResponse
-> f DescribeSharedDirectoriesResponse
describeSharedDirectoriesResponse_sharedDirectories = (DescribeSharedDirectoriesResponse -> Maybe [SharedDirectory])
-> (DescribeSharedDirectoriesResponse
    -> Maybe [SharedDirectory] -> DescribeSharedDirectoriesResponse)
-> Lens'
     DescribeSharedDirectoriesResponse (Maybe [SharedDirectory])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeSharedDirectoriesResponse' {Maybe [SharedDirectory]
sharedDirectories :: Maybe [SharedDirectory]
$sel:sharedDirectories:DescribeSharedDirectoriesResponse' :: DescribeSharedDirectoriesResponse -> Maybe [SharedDirectory]
sharedDirectories} -> Maybe [SharedDirectory]
sharedDirectories) (\s :: DescribeSharedDirectoriesResponse
s@DescribeSharedDirectoriesResponse' {} Maybe [SharedDirectory]
a -> DescribeSharedDirectoriesResponse
s {$sel:sharedDirectories:DescribeSharedDirectoriesResponse' :: Maybe [SharedDirectory]
sharedDirectories = Maybe [SharedDirectory]
a} :: DescribeSharedDirectoriesResponse) ((Maybe [SharedDirectory] -> f (Maybe [SharedDirectory]))
 -> DescribeSharedDirectoriesResponse
 -> f DescribeSharedDirectoriesResponse)
-> ((Maybe [SharedDirectory] -> f (Maybe [SharedDirectory]))
    -> Maybe [SharedDirectory] -> f (Maybe [SharedDirectory]))
-> (Maybe [SharedDirectory] -> f (Maybe [SharedDirectory]))
-> DescribeSharedDirectoriesResponse
-> f DescribeSharedDirectoriesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SharedDirectory]
  [SharedDirectory]
  [SharedDirectory]
  [SharedDirectory]
-> Iso
     (Maybe [SharedDirectory])
     (Maybe [SharedDirectory])
     (Maybe [SharedDirectory])
     (Maybe [SharedDirectory])
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
  [SharedDirectory]
  [SharedDirectory]
  [SharedDirectory]
  [SharedDirectory]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

instance
  Prelude.NFData
    DescribeSharedDirectoriesResponse