{-# 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.AlexaBusiness.SearchSkillGroups
-- 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 skill groups and lists the ones that meet a set of filter and
-- sort criteria.
--
-- This operation returns paginated results.
module Amazonka.AlexaBusiness.SearchSkillGroups
  ( -- * Creating a Request
    SearchSkillGroups (..),
    newSearchSkillGroups,

    -- * Request Lenses
    searchSkillGroups_filters,
    searchSkillGroups_sortCriteria,
    searchSkillGroups_nextToken,
    searchSkillGroups_maxResults,

    -- * Destructuring the Response
    SearchSkillGroupsResponse (..),
    newSearchSkillGroupsResponse,

    -- * Response Lenses
    searchSkillGroupsResponse_nextToken,
    searchSkillGroupsResponse_skillGroups,
    searchSkillGroupsResponse_totalCount,
    searchSkillGroupsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newSearchSkillGroups' smart constructor.
data SearchSkillGroups = SearchSkillGroups'
  { -- | The filters to use to list a specified set of skill groups. The
    -- supported filter key is SkillGroupName.
    SearchSkillGroups -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The sort order to use in listing the specified set of skill groups. The
    -- supported sort key is SkillGroupName.
    SearchSkillGroups -> Maybe [Sort]
sortCriteria :: Prelude.Maybe [Sort],
    -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response includes only results beyond the token, up to the value
    -- specified by @MaxResults@. Required.
    SearchSkillGroups -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to include in the response. If more
    -- results exist than the specified @MaxResults@ value, a token is included
    -- in the response so that the remaining results can be retrieved.
    SearchSkillGroups -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchSkillGroups -> SearchSkillGroups -> Bool
(SearchSkillGroups -> SearchSkillGroups -> Bool)
-> (SearchSkillGroups -> SearchSkillGroups -> Bool)
-> Eq SearchSkillGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchSkillGroups -> SearchSkillGroups -> Bool
$c/= :: SearchSkillGroups -> SearchSkillGroups -> Bool
== :: SearchSkillGroups -> SearchSkillGroups -> Bool
$c== :: SearchSkillGroups -> SearchSkillGroups -> Bool
Prelude.Eq, ReadPrec [SearchSkillGroups]
ReadPrec SearchSkillGroups
Int -> ReadS SearchSkillGroups
ReadS [SearchSkillGroups]
(Int -> ReadS SearchSkillGroups)
-> ReadS [SearchSkillGroups]
-> ReadPrec SearchSkillGroups
-> ReadPrec [SearchSkillGroups]
-> Read SearchSkillGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchSkillGroups]
$creadListPrec :: ReadPrec [SearchSkillGroups]
readPrec :: ReadPrec SearchSkillGroups
$creadPrec :: ReadPrec SearchSkillGroups
readList :: ReadS [SearchSkillGroups]
$creadList :: ReadS [SearchSkillGroups]
readsPrec :: Int -> ReadS SearchSkillGroups
$creadsPrec :: Int -> ReadS SearchSkillGroups
Prelude.Read, Int -> SearchSkillGroups -> ShowS
[SearchSkillGroups] -> ShowS
SearchSkillGroups -> String
(Int -> SearchSkillGroups -> ShowS)
-> (SearchSkillGroups -> String)
-> ([SearchSkillGroups] -> ShowS)
-> Show SearchSkillGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchSkillGroups] -> ShowS
$cshowList :: [SearchSkillGroups] -> ShowS
show :: SearchSkillGroups -> String
$cshow :: SearchSkillGroups -> String
showsPrec :: Int -> SearchSkillGroups -> ShowS
$cshowsPrec :: Int -> SearchSkillGroups -> ShowS
Prelude.Show, (forall x. SearchSkillGroups -> Rep SearchSkillGroups x)
-> (forall x. Rep SearchSkillGroups x -> SearchSkillGroups)
-> Generic SearchSkillGroups
forall x. Rep SearchSkillGroups x -> SearchSkillGroups
forall x. SearchSkillGroups -> Rep SearchSkillGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchSkillGroups x -> SearchSkillGroups
$cfrom :: forall x. SearchSkillGroups -> Rep SearchSkillGroups x
Prelude.Generic)

-- |
-- Create a value of 'SearchSkillGroups' 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:
--
-- 'filters', 'searchSkillGroups_filters' - The filters to use to list a specified set of skill groups. The
-- supported filter key is SkillGroupName.
--
-- 'sortCriteria', 'searchSkillGroups_sortCriteria' - The sort order to use in listing the specified set of skill groups. The
-- supported sort key is SkillGroupName.
--
-- 'nextToken', 'searchSkillGroups_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@. Required.
--
-- 'maxResults', 'searchSkillGroups_maxResults' - The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
newSearchSkillGroups ::
  SearchSkillGroups
newSearchSkillGroups :: SearchSkillGroups
newSearchSkillGroups =
  SearchSkillGroups' :: Maybe [Filter]
-> Maybe [Sort] -> Maybe Text -> Maybe Natural -> SearchSkillGroups
SearchSkillGroups'
    { $sel:filters:SearchSkillGroups' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchSkillGroups' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchSkillGroups' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchSkillGroups' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to list a specified set of skill groups. The
-- supported filter key is SkillGroupName.
searchSkillGroups_filters :: Lens.Lens' SearchSkillGroups (Prelude.Maybe [Filter])
searchSkillGroups_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchSkillGroups -> f SearchSkillGroups
searchSkillGroups_filters = (SearchSkillGroups -> Maybe [Filter])
-> (SearchSkillGroups -> Maybe [Filter] -> SearchSkillGroups)
-> Lens
     SearchSkillGroups
     SearchSkillGroups
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroups' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchSkillGroups' :: SearchSkillGroups -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchSkillGroups
s@SearchSkillGroups' {} Maybe [Filter]
a -> SearchSkillGroups
s {$sel:filters:SearchSkillGroups' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchSkillGroups) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> SearchSkillGroups -> f SearchSkillGroups)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchSkillGroups
-> f SearchSkillGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The sort order to use in listing the specified set of skill groups. The
-- supported sort key is SkillGroupName.
searchSkillGroups_sortCriteria :: Lens.Lens' SearchSkillGroups (Prelude.Maybe [Sort])
searchSkillGroups_sortCriteria :: (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchSkillGroups -> f SearchSkillGroups
searchSkillGroups_sortCriteria = (SearchSkillGroups -> Maybe [Sort])
-> (SearchSkillGroups -> Maybe [Sort] -> SearchSkillGroups)
-> Lens
     SearchSkillGroups SearchSkillGroups (Maybe [Sort]) (Maybe [Sort])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroups' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchSkillGroups' :: SearchSkillGroups -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchSkillGroups
s@SearchSkillGroups' {} Maybe [Sort]
a -> SearchSkillGroups
s {$sel:sortCriteria:SearchSkillGroups' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchSkillGroups) ((Maybe [Sort] -> f (Maybe [Sort]))
 -> SearchSkillGroups -> f SearchSkillGroups)
-> ((Maybe [Sort] -> f (Maybe [Sort]))
    -> Maybe [Sort] -> f (Maybe [Sort]))
-> (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchSkillGroups
-> f SearchSkillGroups
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Sort] [Sort] [Sort] [Sort]
-> Iso (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort])
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 [Sort] [Sort] [Sort] [Sort]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response includes only results beyond the token, up to the value
-- specified by @MaxResults@. Required.
searchSkillGroups_nextToken :: Lens.Lens' SearchSkillGroups (Prelude.Maybe Prelude.Text)
searchSkillGroups_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchSkillGroups -> f SearchSkillGroups
searchSkillGroups_nextToken = (SearchSkillGroups -> Maybe Text)
-> (SearchSkillGroups -> Maybe Text -> SearchSkillGroups)
-> Lens
     SearchSkillGroups SearchSkillGroups (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroups' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchSkillGroups' :: SearchSkillGroups -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchSkillGroups
s@SearchSkillGroups' {} Maybe Text
a -> SearchSkillGroups
s {$sel:nextToken:SearchSkillGroups' :: Maybe Text
nextToken = Maybe Text
a} :: SearchSkillGroups)

-- | The maximum number of results to include in the response. If more
-- results exist than the specified @MaxResults@ value, a token is included
-- in the response so that the remaining results can be retrieved.
searchSkillGroups_maxResults :: Lens.Lens' SearchSkillGroups (Prelude.Maybe Prelude.Natural)
searchSkillGroups_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchSkillGroups -> f SearchSkillGroups
searchSkillGroups_maxResults = (SearchSkillGroups -> Maybe Natural)
-> (SearchSkillGroups -> Maybe Natural -> SearchSkillGroups)
-> Lens
     SearchSkillGroups SearchSkillGroups (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroups' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchSkillGroups' :: SearchSkillGroups -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchSkillGroups
s@SearchSkillGroups' {} Maybe Natural
a -> SearchSkillGroups
s {$sel:maxResults:SearchSkillGroups' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchSkillGroups)

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

instance Prelude.NFData SearchSkillGroups

instance Core.ToHeaders SearchSkillGroups where
  toHeaders :: SearchSkillGroups -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchSkillGroups -> 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
"AlexaForBusiness.SearchSkillGroups" ::
                          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 SearchSkillGroups where
  toJSON :: SearchSkillGroups -> Value
toJSON SearchSkillGroups' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [Sort]
filters :: Maybe [Filter]
$sel:maxResults:SearchSkillGroups' :: SearchSkillGroups -> Maybe Natural
$sel:nextToken:SearchSkillGroups' :: SearchSkillGroups -> Maybe Text
$sel:sortCriteria:SearchSkillGroups' :: SearchSkillGroups -> Maybe [Sort]
$sel:filters:SearchSkillGroups' :: SearchSkillGroups -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"SortCriteria" Text -> [Sort] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Sort] -> Pair) -> Maybe [Sort] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Sort]
sortCriteria,
            (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
          ]
      )

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

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

-- | /See:/ 'newSearchSkillGroupsResponse' smart constructor.
data SearchSkillGroupsResponse = SearchSkillGroupsResponse'
  { -- | The token returned to indicate that there is more data available.
    SearchSkillGroupsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The skill groups that meet the filter criteria, in sort order.
    SearchSkillGroupsResponse -> Maybe [SkillGroupData]
skillGroups :: Prelude.Maybe [SkillGroupData],
    -- | The total number of skill groups returned.
    SearchSkillGroupsResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    SearchSkillGroupsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool
(SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool)
-> (SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool)
-> Eq SearchSkillGroupsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool
$c/= :: SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool
== :: SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool
$c== :: SearchSkillGroupsResponse -> SearchSkillGroupsResponse -> Bool
Prelude.Eq, ReadPrec [SearchSkillGroupsResponse]
ReadPrec SearchSkillGroupsResponse
Int -> ReadS SearchSkillGroupsResponse
ReadS [SearchSkillGroupsResponse]
(Int -> ReadS SearchSkillGroupsResponse)
-> ReadS [SearchSkillGroupsResponse]
-> ReadPrec SearchSkillGroupsResponse
-> ReadPrec [SearchSkillGroupsResponse]
-> Read SearchSkillGroupsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchSkillGroupsResponse]
$creadListPrec :: ReadPrec [SearchSkillGroupsResponse]
readPrec :: ReadPrec SearchSkillGroupsResponse
$creadPrec :: ReadPrec SearchSkillGroupsResponse
readList :: ReadS [SearchSkillGroupsResponse]
$creadList :: ReadS [SearchSkillGroupsResponse]
readsPrec :: Int -> ReadS SearchSkillGroupsResponse
$creadsPrec :: Int -> ReadS SearchSkillGroupsResponse
Prelude.Read, Int -> SearchSkillGroupsResponse -> ShowS
[SearchSkillGroupsResponse] -> ShowS
SearchSkillGroupsResponse -> String
(Int -> SearchSkillGroupsResponse -> ShowS)
-> (SearchSkillGroupsResponse -> String)
-> ([SearchSkillGroupsResponse] -> ShowS)
-> Show SearchSkillGroupsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchSkillGroupsResponse] -> ShowS
$cshowList :: [SearchSkillGroupsResponse] -> ShowS
show :: SearchSkillGroupsResponse -> String
$cshow :: SearchSkillGroupsResponse -> String
showsPrec :: Int -> SearchSkillGroupsResponse -> ShowS
$cshowsPrec :: Int -> SearchSkillGroupsResponse -> ShowS
Prelude.Show, (forall x.
 SearchSkillGroupsResponse -> Rep SearchSkillGroupsResponse x)
-> (forall x.
    Rep SearchSkillGroupsResponse x -> SearchSkillGroupsResponse)
-> Generic SearchSkillGroupsResponse
forall x.
Rep SearchSkillGroupsResponse x -> SearchSkillGroupsResponse
forall x.
SearchSkillGroupsResponse -> Rep SearchSkillGroupsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchSkillGroupsResponse x -> SearchSkillGroupsResponse
$cfrom :: forall x.
SearchSkillGroupsResponse -> Rep SearchSkillGroupsResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchSkillGroupsResponse' 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', 'searchSkillGroupsResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'skillGroups', 'searchSkillGroupsResponse_skillGroups' - The skill groups that meet the filter criteria, in sort order.
--
-- 'totalCount', 'searchSkillGroupsResponse_totalCount' - The total number of skill groups returned.
--
-- 'httpStatus', 'searchSkillGroupsResponse_httpStatus' - The response's http status code.
newSearchSkillGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchSkillGroupsResponse
newSearchSkillGroupsResponse :: Int -> SearchSkillGroupsResponse
newSearchSkillGroupsResponse Int
pHttpStatus_ =
  SearchSkillGroupsResponse' :: Maybe Text
-> Maybe [SkillGroupData]
-> Maybe Int
-> Int
-> SearchSkillGroupsResponse
SearchSkillGroupsResponse'
    { $sel:nextToken:SearchSkillGroupsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:skillGroups:SearchSkillGroupsResponse' :: Maybe [SkillGroupData]
skillGroups = Maybe [SkillGroupData]
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchSkillGroupsResponse' :: Maybe Int
totalCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchSkillGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token returned to indicate that there is more data available.
searchSkillGroupsResponse_nextToken :: Lens.Lens' SearchSkillGroupsResponse (Prelude.Maybe Prelude.Text)
searchSkillGroupsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchSkillGroupsResponse -> f SearchSkillGroupsResponse
searchSkillGroupsResponse_nextToken = (SearchSkillGroupsResponse -> Maybe Text)
-> (SearchSkillGroupsResponse
    -> Maybe Text -> SearchSkillGroupsResponse)
-> Lens' SearchSkillGroupsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroupsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchSkillGroupsResponse' :: SearchSkillGroupsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchSkillGroupsResponse
s@SearchSkillGroupsResponse' {} Maybe Text
a -> SearchSkillGroupsResponse
s {$sel:nextToken:SearchSkillGroupsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchSkillGroupsResponse)

-- | The skill groups that meet the filter criteria, in sort order.
searchSkillGroupsResponse_skillGroups :: Lens.Lens' SearchSkillGroupsResponse (Prelude.Maybe [SkillGroupData])
searchSkillGroupsResponse_skillGroups :: (Maybe [SkillGroupData] -> f (Maybe [SkillGroupData]))
-> SearchSkillGroupsResponse -> f SearchSkillGroupsResponse
searchSkillGroupsResponse_skillGroups = (SearchSkillGroupsResponse -> Maybe [SkillGroupData])
-> (SearchSkillGroupsResponse
    -> Maybe [SkillGroupData] -> SearchSkillGroupsResponse)
-> Lens' SearchSkillGroupsResponse (Maybe [SkillGroupData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroupsResponse' {Maybe [SkillGroupData]
skillGroups :: Maybe [SkillGroupData]
$sel:skillGroups:SearchSkillGroupsResponse' :: SearchSkillGroupsResponse -> Maybe [SkillGroupData]
skillGroups} -> Maybe [SkillGroupData]
skillGroups) (\s :: SearchSkillGroupsResponse
s@SearchSkillGroupsResponse' {} Maybe [SkillGroupData]
a -> SearchSkillGroupsResponse
s {$sel:skillGroups:SearchSkillGroupsResponse' :: Maybe [SkillGroupData]
skillGroups = Maybe [SkillGroupData]
a} :: SearchSkillGroupsResponse) ((Maybe [SkillGroupData] -> f (Maybe [SkillGroupData]))
 -> SearchSkillGroupsResponse -> f SearchSkillGroupsResponse)
-> ((Maybe [SkillGroupData] -> f (Maybe [SkillGroupData]))
    -> Maybe [SkillGroupData] -> f (Maybe [SkillGroupData]))
-> (Maybe [SkillGroupData] -> f (Maybe [SkillGroupData]))
-> SearchSkillGroupsResponse
-> f SearchSkillGroupsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [SkillGroupData] [SkillGroupData] [SkillGroupData] [SkillGroupData]
-> Iso
     (Maybe [SkillGroupData])
     (Maybe [SkillGroupData])
     (Maybe [SkillGroupData])
     (Maybe [SkillGroupData])
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
  [SkillGroupData] [SkillGroupData] [SkillGroupData] [SkillGroupData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total number of skill groups returned.
searchSkillGroupsResponse_totalCount :: Lens.Lens' SearchSkillGroupsResponse (Prelude.Maybe Prelude.Int)
searchSkillGroupsResponse_totalCount :: (Maybe Int -> f (Maybe Int))
-> SearchSkillGroupsResponse -> f SearchSkillGroupsResponse
searchSkillGroupsResponse_totalCount = (SearchSkillGroupsResponse -> Maybe Int)
-> (SearchSkillGroupsResponse
    -> Maybe Int -> SearchSkillGroupsResponse)
-> Lens
     SearchSkillGroupsResponse
     SearchSkillGroupsResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchSkillGroupsResponse' {Maybe Int
totalCount :: Maybe Int
$sel:totalCount:SearchSkillGroupsResponse' :: SearchSkillGroupsResponse -> Maybe Int
totalCount} -> Maybe Int
totalCount) (\s :: SearchSkillGroupsResponse
s@SearchSkillGroupsResponse' {} Maybe Int
a -> SearchSkillGroupsResponse
s {$sel:totalCount:SearchSkillGroupsResponse' :: Maybe Int
totalCount = Maybe Int
a} :: SearchSkillGroupsResponse)

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

instance Prelude.NFData SearchSkillGroupsResponse