{-# 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.QuickSight.SearchDashboards
-- 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)
--
-- Searches for dashboards that belong to a user.
--
-- This operation is eventually consistent. The results are best effort and
-- may not reflect very recent updates and changes.
--
-- This operation returns paginated results.
module Amazonka.QuickSight.SearchDashboards
  ( -- * Creating a Request
    SearchDashboards (..),
    newSearchDashboards,

    -- * Request Lenses
    searchDashboards_nextToken,
    searchDashboards_maxResults,
    searchDashboards_awsAccountId,
    searchDashboards_filters,

    -- * Destructuring the Response
    SearchDashboardsResponse (..),
    newSearchDashboardsResponse,

    -- * Response Lenses
    searchDashboardsResponse_requestId,
    searchDashboardsResponse_nextToken,
    searchDashboardsResponse_dashboardSummaryList,
    searchDashboardsResponse_status,
  )
where

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

-- | /See:/ 'newSearchDashboards' smart constructor.
data SearchDashboards = SearchDashboards'
  { -- | The token for the next set of results, or null if there are no more
    -- results.
    SearchDashboards -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to be returned per request.
    SearchDashboards -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The ID of the Amazon Web Services account that contains the user whose
    -- dashboards you\'re searching for.
    SearchDashboards -> Text
awsAccountId :: Prelude.Text,
    -- | The filters to apply to the search. Currently, you can search only by
    -- user name, for example,
    -- @\"Filters\": [ { \"Name\": \"QUICKSIGHT_USER\", \"Operator\": \"StringEquals\", \"Value\": \"arn:aws:quicksight:us-east-1:1:user\/default\/UserName1\" } ]@
    SearchDashboards -> NonEmpty DashboardSearchFilter
filters :: Prelude.NonEmpty DashboardSearchFilter
  }
  deriving (SearchDashboards -> SearchDashboards -> Bool
(SearchDashboards -> SearchDashboards -> Bool)
-> (SearchDashboards -> SearchDashboards -> Bool)
-> Eq SearchDashboards
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchDashboards -> SearchDashboards -> Bool
$c/= :: SearchDashboards -> SearchDashboards -> Bool
== :: SearchDashboards -> SearchDashboards -> Bool
$c== :: SearchDashboards -> SearchDashboards -> Bool
Prelude.Eq, ReadPrec [SearchDashboards]
ReadPrec SearchDashboards
Int -> ReadS SearchDashboards
ReadS [SearchDashboards]
(Int -> ReadS SearchDashboards)
-> ReadS [SearchDashboards]
-> ReadPrec SearchDashboards
-> ReadPrec [SearchDashboards]
-> Read SearchDashboards
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchDashboards]
$creadListPrec :: ReadPrec [SearchDashboards]
readPrec :: ReadPrec SearchDashboards
$creadPrec :: ReadPrec SearchDashboards
readList :: ReadS [SearchDashboards]
$creadList :: ReadS [SearchDashboards]
readsPrec :: Int -> ReadS SearchDashboards
$creadsPrec :: Int -> ReadS SearchDashboards
Prelude.Read, Int -> SearchDashboards -> ShowS
[SearchDashboards] -> ShowS
SearchDashboards -> String
(Int -> SearchDashboards -> ShowS)
-> (SearchDashboards -> String)
-> ([SearchDashboards] -> ShowS)
-> Show SearchDashboards
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchDashboards] -> ShowS
$cshowList :: [SearchDashboards] -> ShowS
show :: SearchDashboards -> String
$cshow :: SearchDashboards -> String
showsPrec :: Int -> SearchDashboards -> ShowS
$cshowsPrec :: Int -> SearchDashboards -> ShowS
Prelude.Show, (forall x. SearchDashboards -> Rep SearchDashboards x)
-> (forall x. Rep SearchDashboards x -> SearchDashboards)
-> Generic SearchDashboards
forall x. Rep SearchDashboards x -> SearchDashboards
forall x. SearchDashboards -> Rep SearchDashboards x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchDashboards x -> SearchDashboards
$cfrom :: forall x. SearchDashboards -> Rep SearchDashboards x
Prelude.Generic)

-- |
-- Create a value of 'SearchDashboards' 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', 'searchDashboards_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'maxResults', 'searchDashboards_maxResults' - The maximum number of results to be returned per request.
--
-- 'awsAccountId', 'searchDashboards_awsAccountId' - The ID of the Amazon Web Services account that contains the user whose
-- dashboards you\'re searching for.
--
-- 'filters', 'searchDashboards_filters' - The filters to apply to the search. Currently, you can search only by
-- user name, for example,
-- @\"Filters\": [ { \"Name\": \"QUICKSIGHT_USER\", \"Operator\": \"StringEquals\", \"Value\": \"arn:aws:quicksight:us-east-1:1:user\/default\/UserName1\" } ]@
newSearchDashboards ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'filters'
  Prelude.NonEmpty DashboardSearchFilter ->
  SearchDashboards
newSearchDashboards :: Text -> NonEmpty DashboardSearchFilter -> SearchDashboards
newSearchDashboards Text
pAwsAccountId_ NonEmpty DashboardSearchFilter
pFilters_ =
  SearchDashboards' :: Maybe Text
-> Maybe Natural
-> Text
-> NonEmpty DashboardSearchFilter
-> SearchDashboards
SearchDashboards'
    { $sel:nextToken:SearchDashboards' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchDashboards' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:SearchDashboards' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:filters:SearchDashboards' :: NonEmpty DashboardSearchFilter
filters = Tagged
  (NonEmpty DashboardSearchFilter)
  (Identity (NonEmpty DashboardSearchFilter))
-> Tagged
     (NonEmpty DashboardSearchFilter)
     (Identity (NonEmpty DashboardSearchFilter))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
   (NonEmpty DashboardSearchFilter)
   (Identity (NonEmpty DashboardSearchFilter))
 -> Tagged
      (NonEmpty DashboardSearchFilter)
      (Identity (NonEmpty DashboardSearchFilter)))
-> NonEmpty DashboardSearchFilter -> NonEmpty DashboardSearchFilter
forall t b. AReview t b -> b -> t
Lens.# NonEmpty DashboardSearchFilter
pFilters_
    }

-- | The token for the next set of results, or null if there are no more
-- results.
searchDashboards_nextToken :: Lens.Lens' SearchDashboards (Prelude.Maybe Prelude.Text)
searchDashboards_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchDashboards -> f SearchDashboards
searchDashboards_nextToken = (SearchDashboards -> Maybe Text)
-> (SearchDashboards -> Maybe Text -> SearchDashboards)
-> Lens SearchDashboards SearchDashboards (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboards' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchDashboards' :: SearchDashboards -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchDashboards
s@SearchDashboards' {} Maybe Text
a -> SearchDashboards
s {$sel:nextToken:SearchDashboards' :: Maybe Text
nextToken = Maybe Text
a} :: SearchDashboards)

-- | The maximum number of results to be returned per request.
searchDashboards_maxResults :: Lens.Lens' SearchDashboards (Prelude.Maybe Prelude.Natural)
searchDashboards_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchDashboards -> f SearchDashboards
searchDashboards_maxResults = (SearchDashboards -> Maybe Natural)
-> (SearchDashboards -> Maybe Natural -> SearchDashboards)
-> Lens
     SearchDashboards SearchDashboards (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboards' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchDashboards' :: SearchDashboards -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchDashboards
s@SearchDashboards' {} Maybe Natural
a -> SearchDashboards
s {$sel:maxResults:SearchDashboards' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchDashboards)

-- | The ID of the Amazon Web Services account that contains the user whose
-- dashboards you\'re searching for.
searchDashboards_awsAccountId :: Lens.Lens' SearchDashboards Prelude.Text
searchDashboards_awsAccountId :: (Text -> f Text) -> SearchDashboards -> f SearchDashboards
searchDashboards_awsAccountId = (SearchDashboards -> Text)
-> (SearchDashboards -> Text -> SearchDashboards)
-> Lens SearchDashboards SearchDashboards Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboards' {Text
awsAccountId :: Text
$sel:awsAccountId:SearchDashboards' :: SearchDashboards -> Text
awsAccountId} -> Text
awsAccountId) (\s :: SearchDashboards
s@SearchDashboards' {} Text
a -> SearchDashboards
s {$sel:awsAccountId:SearchDashboards' :: Text
awsAccountId = Text
a} :: SearchDashboards)

-- | The filters to apply to the search. Currently, you can search only by
-- user name, for example,
-- @\"Filters\": [ { \"Name\": \"QUICKSIGHT_USER\", \"Operator\": \"StringEquals\", \"Value\": \"arn:aws:quicksight:us-east-1:1:user\/default\/UserName1\" } ]@
searchDashboards_filters :: Lens.Lens' SearchDashboards (Prelude.NonEmpty DashboardSearchFilter)
searchDashboards_filters :: (NonEmpty DashboardSearchFilter
 -> f (NonEmpty DashboardSearchFilter))
-> SearchDashboards -> f SearchDashboards
searchDashboards_filters = (SearchDashboards -> NonEmpty DashboardSearchFilter)
-> (SearchDashboards
    -> NonEmpty DashboardSearchFilter -> SearchDashboards)
-> Lens
     SearchDashboards
     SearchDashboards
     (NonEmpty DashboardSearchFilter)
     (NonEmpty DashboardSearchFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboards' {NonEmpty DashboardSearchFilter
filters :: NonEmpty DashboardSearchFilter
$sel:filters:SearchDashboards' :: SearchDashboards -> NonEmpty DashboardSearchFilter
filters} -> NonEmpty DashboardSearchFilter
filters) (\s :: SearchDashboards
s@SearchDashboards' {} NonEmpty DashboardSearchFilter
a -> SearchDashboards
s {$sel:filters:SearchDashboards' :: NonEmpty DashboardSearchFilter
filters = NonEmpty DashboardSearchFilter
a} :: SearchDashboards) ((NonEmpty DashboardSearchFilter
  -> f (NonEmpty DashboardSearchFilter))
 -> SearchDashboards -> f SearchDashboards)
-> ((NonEmpty DashboardSearchFilter
     -> f (NonEmpty DashboardSearchFilter))
    -> NonEmpty DashboardSearchFilter
    -> f (NonEmpty DashboardSearchFilter))
-> (NonEmpty DashboardSearchFilter
    -> f (NonEmpty DashboardSearchFilter))
-> SearchDashboards
-> f SearchDashboards
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty DashboardSearchFilter
 -> f (NonEmpty DashboardSearchFilter))
-> NonEmpty DashboardSearchFilter
-> f (NonEmpty DashboardSearchFilter)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData SearchDashboards

instance Core.ToHeaders SearchDashboards where
  toHeaders :: SearchDashboards -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchDashboards -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON SearchDashboards where
  toJSON :: SearchDashboards -> Value
toJSON SearchDashboards' {Maybe Natural
Maybe Text
NonEmpty DashboardSearchFilter
Text
filters :: NonEmpty DashboardSearchFilter
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:filters:SearchDashboards' :: SearchDashboards -> NonEmpty DashboardSearchFilter
$sel:awsAccountId:SearchDashboards' :: SearchDashboards -> Text
$sel:maxResults:SearchDashboards' :: SearchDashboards -> Maybe Natural
$sel:nextToken:SearchDashboards' :: SearchDashboards -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Filters" Text -> NonEmpty DashboardSearchFilter -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty DashboardSearchFilter
filters)
          ]
      )

instance Core.ToPath SearchDashboards where
  toPath :: SearchDashboards -> ByteString
toPath SearchDashboards' {Maybe Natural
Maybe Text
NonEmpty DashboardSearchFilter
Text
filters :: NonEmpty DashboardSearchFilter
awsAccountId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:filters:SearchDashboards' :: SearchDashboards -> NonEmpty DashboardSearchFilter
$sel:awsAccountId:SearchDashboards' :: SearchDashboards -> Text
$sel:maxResults:SearchDashboards' :: SearchDashboards -> Maybe Natural
$sel:nextToken:SearchDashboards' :: SearchDashboards -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
        ByteString
"/search/dashboards"
      ]

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

-- | /See:/ 'newSearchDashboardsResponse' smart constructor.
data SearchDashboardsResponse = SearchDashboardsResponse'
  { -- | The Amazon Web Services request ID for this operation.
    SearchDashboardsResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The token for the next set of results, or null if there are no more
    -- results.
    SearchDashboardsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of dashboards owned by the user specified in @Filters@ in your
    -- request.
    SearchDashboardsResponse -> Maybe [DashboardSummary]
dashboardSummaryList :: Prelude.Maybe [DashboardSummary],
    -- | The HTTP status of the request.
    SearchDashboardsResponse -> Int
status :: Prelude.Int
  }
  deriving (SearchDashboardsResponse -> SearchDashboardsResponse -> Bool
(SearchDashboardsResponse -> SearchDashboardsResponse -> Bool)
-> (SearchDashboardsResponse -> SearchDashboardsResponse -> Bool)
-> Eq SearchDashboardsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchDashboardsResponse -> SearchDashboardsResponse -> Bool
$c/= :: SearchDashboardsResponse -> SearchDashboardsResponse -> Bool
== :: SearchDashboardsResponse -> SearchDashboardsResponse -> Bool
$c== :: SearchDashboardsResponse -> SearchDashboardsResponse -> Bool
Prelude.Eq, ReadPrec [SearchDashboardsResponse]
ReadPrec SearchDashboardsResponse
Int -> ReadS SearchDashboardsResponse
ReadS [SearchDashboardsResponse]
(Int -> ReadS SearchDashboardsResponse)
-> ReadS [SearchDashboardsResponse]
-> ReadPrec SearchDashboardsResponse
-> ReadPrec [SearchDashboardsResponse]
-> Read SearchDashboardsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchDashboardsResponse]
$creadListPrec :: ReadPrec [SearchDashboardsResponse]
readPrec :: ReadPrec SearchDashboardsResponse
$creadPrec :: ReadPrec SearchDashboardsResponse
readList :: ReadS [SearchDashboardsResponse]
$creadList :: ReadS [SearchDashboardsResponse]
readsPrec :: Int -> ReadS SearchDashboardsResponse
$creadsPrec :: Int -> ReadS SearchDashboardsResponse
Prelude.Read, Int -> SearchDashboardsResponse -> ShowS
[SearchDashboardsResponse] -> ShowS
SearchDashboardsResponse -> String
(Int -> SearchDashboardsResponse -> ShowS)
-> (SearchDashboardsResponse -> String)
-> ([SearchDashboardsResponse] -> ShowS)
-> Show SearchDashboardsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchDashboardsResponse] -> ShowS
$cshowList :: [SearchDashboardsResponse] -> ShowS
show :: SearchDashboardsResponse -> String
$cshow :: SearchDashboardsResponse -> String
showsPrec :: Int -> SearchDashboardsResponse -> ShowS
$cshowsPrec :: Int -> SearchDashboardsResponse -> ShowS
Prelude.Show, (forall x.
 SearchDashboardsResponse -> Rep SearchDashboardsResponse x)
-> (forall x.
    Rep SearchDashboardsResponse x -> SearchDashboardsResponse)
-> Generic SearchDashboardsResponse
forall x.
Rep SearchDashboardsResponse x -> SearchDashboardsResponse
forall x.
SearchDashboardsResponse -> Rep SearchDashboardsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchDashboardsResponse x -> SearchDashboardsResponse
$cfrom :: forall x.
SearchDashboardsResponse -> Rep SearchDashboardsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchDashboardsResponse' 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:
--
-- 'requestId', 'searchDashboardsResponse_requestId' - The Amazon Web Services request ID for this operation.
--
-- 'nextToken', 'searchDashboardsResponse_nextToken' - The token for the next set of results, or null if there are no more
-- results.
--
-- 'dashboardSummaryList', 'searchDashboardsResponse_dashboardSummaryList' - The list of dashboards owned by the user specified in @Filters@ in your
-- request.
--
-- 'status', 'searchDashboardsResponse_status' - The HTTP status of the request.
newSearchDashboardsResponse ::
  -- | 'status'
  Prelude.Int ->
  SearchDashboardsResponse
newSearchDashboardsResponse :: Int -> SearchDashboardsResponse
newSearchDashboardsResponse Int
pStatus_ =
  SearchDashboardsResponse' :: Maybe Text
-> Maybe Text
-> Maybe [DashboardSummary]
-> Int
-> SearchDashboardsResponse
SearchDashboardsResponse'
    { $sel:requestId:SearchDashboardsResponse' :: Maybe Text
requestId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchDashboardsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:dashboardSummaryList:SearchDashboardsResponse' :: Maybe [DashboardSummary]
dashboardSummaryList = Maybe [DashboardSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:status:SearchDashboardsResponse' :: Int
status = Int
pStatus_
    }

-- | The Amazon Web Services request ID for this operation.
searchDashboardsResponse_requestId :: Lens.Lens' SearchDashboardsResponse (Prelude.Maybe Prelude.Text)
searchDashboardsResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> SearchDashboardsResponse -> f SearchDashboardsResponse
searchDashboardsResponse_requestId = (SearchDashboardsResponse -> Maybe Text)
-> (SearchDashboardsResponse
    -> Maybe Text -> SearchDashboardsResponse)
-> Lens' SearchDashboardsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboardsResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:SearchDashboardsResponse' :: SearchDashboardsResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: SearchDashboardsResponse
s@SearchDashboardsResponse' {} Maybe Text
a -> SearchDashboardsResponse
s {$sel:requestId:SearchDashboardsResponse' :: Maybe Text
requestId = Maybe Text
a} :: SearchDashboardsResponse)

-- | The token for the next set of results, or null if there are no more
-- results.
searchDashboardsResponse_nextToken :: Lens.Lens' SearchDashboardsResponse (Prelude.Maybe Prelude.Text)
searchDashboardsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchDashboardsResponse -> f SearchDashboardsResponse
searchDashboardsResponse_nextToken = (SearchDashboardsResponse -> Maybe Text)
-> (SearchDashboardsResponse
    -> Maybe Text -> SearchDashboardsResponse)
-> Lens' SearchDashboardsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboardsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchDashboardsResponse' :: SearchDashboardsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchDashboardsResponse
s@SearchDashboardsResponse' {} Maybe Text
a -> SearchDashboardsResponse
s {$sel:nextToken:SearchDashboardsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchDashboardsResponse)

-- | The list of dashboards owned by the user specified in @Filters@ in your
-- request.
searchDashboardsResponse_dashboardSummaryList :: Lens.Lens' SearchDashboardsResponse (Prelude.Maybe [DashboardSummary])
searchDashboardsResponse_dashboardSummaryList :: (Maybe [DashboardSummary] -> f (Maybe [DashboardSummary]))
-> SearchDashboardsResponse -> f SearchDashboardsResponse
searchDashboardsResponse_dashboardSummaryList = (SearchDashboardsResponse -> Maybe [DashboardSummary])
-> (SearchDashboardsResponse
    -> Maybe [DashboardSummary] -> SearchDashboardsResponse)
-> Lens' SearchDashboardsResponse (Maybe [DashboardSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboardsResponse' {Maybe [DashboardSummary]
dashboardSummaryList :: Maybe [DashboardSummary]
$sel:dashboardSummaryList:SearchDashboardsResponse' :: SearchDashboardsResponse -> Maybe [DashboardSummary]
dashboardSummaryList} -> Maybe [DashboardSummary]
dashboardSummaryList) (\s :: SearchDashboardsResponse
s@SearchDashboardsResponse' {} Maybe [DashboardSummary]
a -> SearchDashboardsResponse
s {$sel:dashboardSummaryList:SearchDashboardsResponse' :: Maybe [DashboardSummary]
dashboardSummaryList = Maybe [DashboardSummary]
a} :: SearchDashboardsResponse) ((Maybe [DashboardSummary] -> f (Maybe [DashboardSummary]))
 -> SearchDashboardsResponse -> f SearchDashboardsResponse)
-> ((Maybe [DashboardSummary] -> f (Maybe [DashboardSummary]))
    -> Maybe [DashboardSummary] -> f (Maybe [DashboardSummary]))
-> (Maybe [DashboardSummary] -> f (Maybe [DashboardSummary]))
-> SearchDashboardsResponse
-> f SearchDashboardsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DashboardSummary]
  [DashboardSummary]
  [DashboardSummary]
  [DashboardSummary]
-> Iso
     (Maybe [DashboardSummary])
     (Maybe [DashboardSummary])
     (Maybe [DashboardSummary])
     (Maybe [DashboardSummary])
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
  [DashboardSummary]
  [DashboardSummary]
  [DashboardSummary]
  [DashboardSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The HTTP status of the request.
searchDashboardsResponse_status :: Lens.Lens' SearchDashboardsResponse Prelude.Int
searchDashboardsResponse_status :: (Int -> f Int)
-> SearchDashboardsResponse -> f SearchDashboardsResponse
searchDashboardsResponse_status = (SearchDashboardsResponse -> Int)
-> (SearchDashboardsResponse -> Int -> SearchDashboardsResponse)
-> Lens SearchDashboardsResponse SearchDashboardsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchDashboardsResponse' {Int
status :: Int
$sel:status:SearchDashboardsResponse' :: SearchDashboardsResponse -> Int
status} -> Int
status) (\s :: SearchDashboardsResponse
s@SearchDashboardsResponse' {} Int
a -> SearchDashboardsResponse
s {$sel:status:SearchDashboardsResponse' :: Int
status = Int
a} :: SearchDashboardsResponse)

instance Prelude.NFData SearchDashboardsResponse