{-# 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.DescribeTrusts
-- 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 trust relationships for this account.
--
-- If no input parameters are provided, such as DirectoryId or TrustIds,
-- this request describes all the trust relationships belonging to the
-- account.
--
-- This operation returns paginated results.
module Amazonka.DirectoryService.DescribeTrusts
  ( -- * Creating a Request
    DescribeTrusts (..),
    newDescribeTrusts,

    -- * Request Lenses
    describeTrusts_directoryId,
    describeTrusts_nextToken,
    describeTrusts_trustIds,
    describeTrusts_limit,

    -- * Destructuring the Response
    DescribeTrustsResponse (..),
    newDescribeTrustsResponse,

    -- * Response Lenses
    describeTrustsResponse_nextToken,
    describeTrustsResponse_trusts,
    describeTrustsResponse_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

-- | Describes the trust relationships for a particular Managed Microsoft AD
-- directory. If no input parameters are provided, such as directory ID or
-- trust ID, this request describes all the trust relationships.
--
-- /See:/ 'newDescribeTrusts' smart constructor.
data DescribeTrusts = DescribeTrusts'
  { -- | The Directory ID of the Amazon Web Services directory that is a part of
    -- the requested trust relationship.
    DescribeTrusts -> Maybe Text
directoryId :: Prelude.Maybe Prelude.Text,
    -- | The /DescribeTrustsResult.NextToken/ value from a previous call to
    -- DescribeTrusts. Pass null if this is the first call.
    DescribeTrusts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A list of identifiers of the trust relationships for which to obtain the
    -- information. If this member is null, all trust relationships that belong
    -- to the current account are returned.
    --
    -- An empty list results in an @InvalidParameterException@ being thrown.
    DescribeTrusts -> Maybe [Text]
trustIds :: Prelude.Maybe [Prelude.Text],
    -- | The maximum number of objects to return.
    DescribeTrusts -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (DescribeTrusts -> DescribeTrusts -> Bool
(DescribeTrusts -> DescribeTrusts -> Bool)
-> (DescribeTrusts -> DescribeTrusts -> Bool) -> Eq DescribeTrusts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrusts -> DescribeTrusts -> Bool
$c/= :: DescribeTrusts -> DescribeTrusts -> Bool
== :: DescribeTrusts -> DescribeTrusts -> Bool
$c== :: DescribeTrusts -> DescribeTrusts -> Bool
Prelude.Eq, ReadPrec [DescribeTrusts]
ReadPrec DescribeTrusts
Int -> ReadS DescribeTrusts
ReadS [DescribeTrusts]
(Int -> ReadS DescribeTrusts)
-> ReadS [DescribeTrusts]
-> ReadPrec DescribeTrusts
-> ReadPrec [DescribeTrusts]
-> Read DescribeTrusts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrusts]
$creadListPrec :: ReadPrec [DescribeTrusts]
readPrec :: ReadPrec DescribeTrusts
$creadPrec :: ReadPrec DescribeTrusts
readList :: ReadS [DescribeTrusts]
$creadList :: ReadS [DescribeTrusts]
readsPrec :: Int -> ReadS DescribeTrusts
$creadsPrec :: Int -> ReadS DescribeTrusts
Prelude.Read, Int -> DescribeTrusts -> ShowS
[DescribeTrusts] -> ShowS
DescribeTrusts -> String
(Int -> DescribeTrusts -> ShowS)
-> (DescribeTrusts -> String)
-> ([DescribeTrusts] -> ShowS)
-> Show DescribeTrusts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrusts] -> ShowS
$cshowList :: [DescribeTrusts] -> ShowS
show :: DescribeTrusts -> String
$cshow :: DescribeTrusts -> String
showsPrec :: Int -> DescribeTrusts -> ShowS
$cshowsPrec :: Int -> DescribeTrusts -> ShowS
Prelude.Show, (forall x. DescribeTrusts -> Rep DescribeTrusts x)
-> (forall x. Rep DescribeTrusts x -> DescribeTrusts)
-> Generic DescribeTrusts
forall x. Rep DescribeTrusts x -> DescribeTrusts
forall x. DescribeTrusts -> Rep DescribeTrusts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTrusts x -> DescribeTrusts
$cfrom :: forall x. DescribeTrusts -> Rep DescribeTrusts x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTrusts' 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:
--
-- 'directoryId', 'describeTrusts_directoryId' - The Directory ID of the Amazon Web Services directory that is a part of
-- the requested trust relationship.
--
-- 'nextToken', 'describeTrusts_nextToken' - The /DescribeTrustsResult.NextToken/ value from a previous call to
-- DescribeTrusts. Pass null if this is the first call.
--
-- 'trustIds', 'describeTrusts_trustIds' - A list of identifiers of the trust relationships for which to obtain the
-- information. If this member is null, all trust relationships that belong
-- to the current account are returned.
--
-- An empty list results in an @InvalidParameterException@ being thrown.
--
-- 'limit', 'describeTrusts_limit' - The maximum number of objects to return.
newDescribeTrusts ::
  DescribeTrusts
newDescribeTrusts :: DescribeTrusts
newDescribeTrusts =
  DescribeTrusts' :: Maybe Text
-> Maybe Text -> Maybe [Text] -> Maybe Natural -> DescribeTrusts
DescribeTrusts'
    { $sel:directoryId:DescribeTrusts' :: Maybe Text
directoryId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribeTrusts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trustIds:DescribeTrusts' :: Maybe [Text]
trustIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:DescribeTrusts' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The Directory ID of the Amazon Web Services directory that is a part of
-- the requested trust relationship.
describeTrusts_directoryId :: Lens.Lens' DescribeTrusts (Prelude.Maybe Prelude.Text)
describeTrusts_directoryId :: (Maybe Text -> f (Maybe Text))
-> DescribeTrusts -> f DescribeTrusts
describeTrusts_directoryId = (DescribeTrusts -> Maybe Text)
-> (DescribeTrusts -> Maybe Text -> DescribeTrusts)
-> Lens DescribeTrusts DescribeTrusts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrusts' {Maybe Text
directoryId :: Maybe Text
$sel:directoryId:DescribeTrusts' :: DescribeTrusts -> Maybe Text
directoryId} -> Maybe Text
directoryId) (\s :: DescribeTrusts
s@DescribeTrusts' {} Maybe Text
a -> DescribeTrusts
s {$sel:directoryId:DescribeTrusts' :: Maybe Text
directoryId = Maybe Text
a} :: DescribeTrusts)

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

-- | A list of identifiers of the trust relationships for which to obtain the
-- information. If this member is null, all trust relationships that belong
-- to the current account are returned.
--
-- An empty list results in an @InvalidParameterException@ being thrown.
describeTrusts_trustIds :: Lens.Lens' DescribeTrusts (Prelude.Maybe [Prelude.Text])
describeTrusts_trustIds :: (Maybe [Text] -> f (Maybe [Text]))
-> DescribeTrusts -> f DescribeTrusts
describeTrusts_trustIds = (DescribeTrusts -> Maybe [Text])
-> (DescribeTrusts -> Maybe [Text] -> DescribeTrusts)
-> Lens DescribeTrusts DescribeTrusts (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrusts' {Maybe [Text]
trustIds :: Maybe [Text]
$sel:trustIds:DescribeTrusts' :: DescribeTrusts -> Maybe [Text]
trustIds} -> Maybe [Text]
trustIds) (\s :: DescribeTrusts
s@DescribeTrusts' {} Maybe [Text]
a -> DescribeTrusts
s {$sel:trustIds:DescribeTrusts' :: Maybe [Text]
trustIds = Maybe [Text]
a} :: DescribeTrusts) ((Maybe [Text] -> f (Maybe [Text]))
 -> DescribeTrusts -> f DescribeTrusts)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> DescribeTrusts
-> f DescribeTrusts
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 objects to return.
describeTrusts_limit :: Lens.Lens' DescribeTrusts (Prelude.Maybe Prelude.Natural)
describeTrusts_limit :: (Maybe Natural -> f (Maybe Natural))
-> DescribeTrusts -> f DescribeTrusts
describeTrusts_limit = (DescribeTrusts -> Maybe Natural)
-> (DescribeTrusts -> Maybe Natural -> DescribeTrusts)
-> Lens
     DescribeTrusts DescribeTrusts (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrusts' {Maybe Natural
limit :: Maybe Natural
$sel:limit:DescribeTrusts' :: DescribeTrusts -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: DescribeTrusts
s@DescribeTrusts' {} Maybe Natural
a -> DescribeTrusts
s {$sel:limit:DescribeTrusts' :: Maybe Natural
limit = Maybe Natural
a} :: DescribeTrusts)

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

instance Prelude.NFData DescribeTrusts

instance Core.ToHeaders DescribeTrusts where
  toHeaders :: DescribeTrusts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribeTrusts -> 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.DescribeTrusts" ::
                          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 DescribeTrusts where
  toJSON :: DescribeTrusts -> Value
toJSON DescribeTrusts' {Maybe Natural
Maybe [Text]
Maybe Text
limit :: Maybe Natural
trustIds :: Maybe [Text]
nextToken :: Maybe Text
directoryId :: Maybe Text
$sel:limit:DescribeTrusts' :: DescribeTrusts -> Maybe Natural
$sel:trustIds:DescribeTrusts' :: DescribeTrusts -> Maybe [Text]
$sel:nextToken:DescribeTrusts' :: DescribeTrusts -> Maybe Text
$sel:directoryId:DescribeTrusts' :: DescribeTrusts -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DirectoryId" 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
directoryId,
            (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
"TrustIds" 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]
trustIds,
            (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 DescribeTrusts where
  toPath :: DescribeTrusts -> ByteString
toPath = ByteString -> DescribeTrusts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | The result of a DescribeTrust request.
--
-- /See:/ 'newDescribeTrustsResponse' smart constructor.
data DescribeTrustsResponse = DescribeTrustsResponse'
  { -- | If not null, more results are available. Pass this value for the
    -- /NextToken/ parameter in a subsequent call to DescribeTrusts to retrieve
    -- the next set of items.
    DescribeTrustsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of Trust 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.
    DescribeTrustsResponse -> Maybe [Trust]
trusts :: Prelude.Maybe [Trust],
    -- | The response's http status code.
    DescribeTrustsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeTrustsResponse -> DescribeTrustsResponse -> Bool
(DescribeTrustsResponse -> DescribeTrustsResponse -> Bool)
-> (DescribeTrustsResponse -> DescribeTrustsResponse -> Bool)
-> Eq DescribeTrustsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeTrustsResponse -> DescribeTrustsResponse -> Bool
$c/= :: DescribeTrustsResponse -> DescribeTrustsResponse -> Bool
== :: DescribeTrustsResponse -> DescribeTrustsResponse -> Bool
$c== :: DescribeTrustsResponse -> DescribeTrustsResponse -> Bool
Prelude.Eq, ReadPrec [DescribeTrustsResponse]
ReadPrec DescribeTrustsResponse
Int -> ReadS DescribeTrustsResponse
ReadS [DescribeTrustsResponse]
(Int -> ReadS DescribeTrustsResponse)
-> ReadS [DescribeTrustsResponse]
-> ReadPrec DescribeTrustsResponse
-> ReadPrec [DescribeTrustsResponse]
-> Read DescribeTrustsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeTrustsResponse]
$creadListPrec :: ReadPrec [DescribeTrustsResponse]
readPrec :: ReadPrec DescribeTrustsResponse
$creadPrec :: ReadPrec DescribeTrustsResponse
readList :: ReadS [DescribeTrustsResponse]
$creadList :: ReadS [DescribeTrustsResponse]
readsPrec :: Int -> ReadS DescribeTrustsResponse
$creadsPrec :: Int -> ReadS DescribeTrustsResponse
Prelude.Read, Int -> DescribeTrustsResponse -> ShowS
[DescribeTrustsResponse] -> ShowS
DescribeTrustsResponse -> String
(Int -> DescribeTrustsResponse -> ShowS)
-> (DescribeTrustsResponse -> String)
-> ([DescribeTrustsResponse] -> ShowS)
-> Show DescribeTrustsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeTrustsResponse] -> ShowS
$cshowList :: [DescribeTrustsResponse] -> ShowS
show :: DescribeTrustsResponse -> String
$cshow :: DescribeTrustsResponse -> String
showsPrec :: Int -> DescribeTrustsResponse -> ShowS
$cshowsPrec :: Int -> DescribeTrustsResponse -> ShowS
Prelude.Show, (forall x. DescribeTrustsResponse -> Rep DescribeTrustsResponse x)
-> (forall x.
    Rep DescribeTrustsResponse x -> DescribeTrustsResponse)
-> Generic DescribeTrustsResponse
forall x. Rep DescribeTrustsResponse x -> DescribeTrustsResponse
forall x. DescribeTrustsResponse -> Rep DescribeTrustsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeTrustsResponse x -> DescribeTrustsResponse
$cfrom :: forall x. DescribeTrustsResponse -> Rep DescribeTrustsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeTrustsResponse' 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', 'describeTrustsResponse_nextToken' - If not null, more results are available. Pass this value for the
-- /NextToken/ parameter in a subsequent call to DescribeTrusts to retrieve
-- the next set of items.
--
-- 'trusts', 'describeTrustsResponse_trusts' - The list of Trust 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.
--
-- 'httpStatus', 'describeTrustsResponse_httpStatus' - The response's http status code.
newDescribeTrustsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeTrustsResponse
newDescribeTrustsResponse :: Int -> DescribeTrustsResponse
newDescribeTrustsResponse Int
pHttpStatus_ =
  DescribeTrustsResponse' :: Maybe Text -> Maybe [Trust] -> Int -> DescribeTrustsResponse
DescribeTrustsResponse'
    { $sel:nextToken:DescribeTrustsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:trusts:DescribeTrustsResponse' :: Maybe [Trust]
trusts = Maybe [Trust]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeTrustsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The list of Trust 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.
describeTrustsResponse_trusts :: Lens.Lens' DescribeTrustsResponse (Prelude.Maybe [Trust])
describeTrustsResponse_trusts :: (Maybe [Trust] -> f (Maybe [Trust]))
-> DescribeTrustsResponse -> f DescribeTrustsResponse
describeTrustsResponse_trusts = (DescribeTrustsResponse -> Maybe [Trust])
-> (DescribeTrustsResponse
    -> Maybe [Trust] -> DescribeTrustsResponse)
-> Lens' DescribeTrustsResponse (Maybe [Trust])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeTrustsResponse' {Maybe [Trust]
trusts :: Maybe [Trust]
$sel:trusts:DescribeTrustsResponse' :: DescribeTrustsResponse -> Maybe [Trust]
trusts} -> Maybe [Trust]
trusts) (\s :: DescribeTrustsResponse
s@DescribeTrustsResponse' {} Maybe [Trust]
a -> DescribeTrustsResponse
s {$sel:trusts:DescribeTrustsResponse' :: Maybe [Trust]
trusts = Maybe [Trust]
a} :: DescribeTrustsResponse) ((Maybe [Trust] -> f (Maybe [Trust]))
 -> DescribeTrustsResponse -> f DescribeTrustsResponse)
-> ((Maybe [Trust] -> f (Maybe [Trust]))
    -> Maybe [Trust] -> f (Maybe [Trust]))
-> (Maybe [Trust] -> f (Maybe [Trust]))
-> DescribeTrustsResponse
-> f DescribeTrustsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Trust] [Trust] [Trust] [Trust]
-> Iso
     (Maybe [Trust]) (Maybe [Trust]) (Maybe [Trust]) (Maybe [Trust])
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 [Trust] [Trust] [Trust] [Trust]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData DescribeTrustsResponse