{-# 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.IoTWireless.ListServiceProfiles
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists the service profiles registered to your AWS account.
module Amazonka.IoTWireless.ListServiceProfiles
  ( -- * Creating a Request
    ListServiceProfiles (..),
    newListServiceProfiles,

    -- * Request Lenses
    listServiceProfiles_maxResults,
    listServiceProfiles_nextToken,

    -- * Destructuring the Response
    ListServiceProfilesResponse (..),
    newListServiceProfilesResponse,

    -- * Response Lenses
    listServiceProfilesResponse_nextToken,
    listServiceProfilesResponse_serviceProfileList,
    listServiceProfilesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IoTWireless.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListServiceProfiles' smart constructor.
data ListServiceProfiles = ListServiceProfiles'
  { -- | The maximum number of results to return in this operation.
    ListServiceProfiles -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | To retrieve the next set of results, the @nextToken@ value from a
    -- previous response; otherwise __null__ to receive the first set of
    -- results.
    ListServiceProfiles -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListServiceProfiles -> ListServiceProfiles -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceProfiles -> ListServiceProfiles -> Bool
$c/= :: ListServiceProfiles -> ListServiceProfiles -> Bool
== :: ListServiceProfiles -> ListServiceProfiles -> Bool
$c== :: ListServiceProfiles -> ListServiceProfiles -> Bool
Prelude.Eq, ReadPrec [ListServiceProfiles]
ReadPrec ListServiceProfiles
Int -> ReadS ListServiceProfiles
ReadS [ListServiceProfiles]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServiceProfiles]
$creadListPrec :: ReadPrec [ListServiceProfiles]
readPrec :: ReadPrec ListServiceProfiles
$creadPrec :: ReadPrec ListServiceProfiles
readList :: ReadS [ListServiceProfiles]
$creadList :: ReadS [ListServiceProfiles]
readsPrec :: Int -> ReadS ListServiceProfiles
$creadsPrec :: Int -> ReadS ListServiceProfiles
Prelude.Read, Int -> ListServiceProfiles -> ShowS
[ListServiceProfiles] -> ShowS
ListServiceProfiles -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceProfiles] -> ShowS
$cshowList :: [ListServiceProfiles] -> ShowS
show :: ListServiceProfiles -> String
$cshow :: ListServiceProfiles -> String
showsPrec :: Int -> ListServiceProfiles -> ShowS
$cshowsPrec :: Int -> ListServiceProfiles -> ShowS
Prelude.Show, forall x. Rep ListServiceProfiles x -> ListServiceProfiles
forall x. ListServiceProfiles -> Rep ListServiceProfiles x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListServiceProfiles x -> ListServiceProfiles
$cfrom :: forall x. ListServiceProfiles -> Rep ListServiceProfiles x
Prelude.Generic)

-- |
-- Create a value of 'ListServiceProfiles' 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:
--
-- 'maxResults', 'listServiceProfiles_maxResults' - The maximum number of results to return in this operation.
--
-- 'nextToken', 'listServiceProfiles_nextToken' - To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
newListServiceProfiles ::
  ListServiceProfiles
newListServiceProfiles :: ListServiceProfiles
newListServiceProfiles =
  ListServiceProfiles'
    { $sel:maxResults:ListServiceProfiles' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListServiceProfiles' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to return in this operation.
listServiceProfiles_maxResults :: Lens.Lens' ListServiceProfiles (Prelude.Maybe Prelude.Natural)
listServiceProfiles_maxResults :: Lens' ListServiceProfiles (Maybe Natural)
listServiceProfiles_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceProfiles' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListServiceProfiles' :: ListServiceProfiles -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListServiceProfiles
s@ListServiceProfiles' {} Maybe Natural
a -> ListServiceProfiles
s {$sel:maxResults:ListServiceProfiles' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListServiceProfiles)

-- | To retrieve the next set of results, the @nextToken@ value from a
-- previous response; otherwise __null__ to receive the first set of
-- results.
listServiceProfiles_nextToken :: Lens.Lens' ListServiceProfiles (Prelude.Maybe Prelude.Text)
listServiceProfiles_nextToken :: Lens' ListServiceProfiles (Maybe Text)
listServiceProfiles_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceProfiles' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceProfiles' :: ListServiceProfiles -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceProfiles
s@ListServiceProfiles' {} Maybe Text
a -> ListServiceProfiles
s {$sel:nextToken:ListServiceProfiles' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceProfiles)

instance Core.AWSRequest ListServiceProfiles where
  type
    AWSResponse ListServiceProfiles =
      ListServiceProfilesResponse
  request :: (Service -> Service)
-> ListServiceProfiles -> Request ListServiceProfiles
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListServiceProfiles
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListServiceProfiles)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ServiceProfile] -> Int -> ListServiceProfilesResponse
ListServiceProfilesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ServiceProfileList"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListServiceProfiles where
  hashWithSalt :: Int -> ListServiceProfiles -> Int
hashWithSalt Int
_salt ListServiceProfiles' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListServiceProfiles' :: ListServiceProfiles -> Maybe Text
$sel:maxResults:ListServiceProfiles' :: ListServiceProfiles -> Maybe Natural
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken

instance Prelude.NFData ListServiceProfiles where
  rnf :: ListServiceProfiles -> ()
rnf ListServiceProfiles' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListServiceProfiles' :: ListServiceProfiles -> Maybe Text
$sel:maxResults:ListServiceProfiles' :: ListServiceProfiles -> Maybe Natural
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken

instance Data.ToHeaders ListServiceProfiles where
  toHeaders :: ListServiceProfiles -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListServiceProfiles where
  toPath :: ListServiceProfiles -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/service-profiles"

instance Data.ToQuery ListServiceProfiles where
  toQuery :: ListServiceProfiles -> QueryString
toQuery ListServiceProfiles' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListServiceProfiles' :: ListServiceProfiles -> Maybe Text
$sel:maxResults:ListServiceProfiles' :: ListServiceProfiles -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newListServiceProfilesResponse' smart constructor.
data ListServiceProfilesResponse = ListServiceProfilesResponse'
  { -- | The token to use to get the next set of results, or __null__ if there
    -- are no additional results.
    ListServiceProfilesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of service profiles.
    ListServiceProfilesResponse -> Maybe [ServiceProfile]
serviceProfileList :: Prelude.Maybe [ServiceProfile],
    -- | The response's http status code.
    ListServiceProfilesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListServiceProfilesResponse -> ListServiceProfilesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListServiceProfilesResponse -> ListServiceProfilesResponse -> Bool
$c/= :: ListServiceProfilesResponse -> ListServiceProfilesResponse -> Bool
== :: ListServiceProfilesResponse -> ListServiceProfilesResponse -> Bool
$c== :: ListServiceProfilesResponse -> ListServiceProfilesResponse -> Bool
Prelude.Eq, ReadPrec [ListServiceProfilesResponse]
ReadPrec ListServiceProfilesResponse
Int -> ReadS ListServiceProfilesResponse
ReadS [ListServiceProfilesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListServiceProfilesResponse]
$creadListPrec :: ReadPrec [ListServiceProfilesResponse]
readPrec :: ReadPrec ListServiceProfilesResponse
$creadPrec :: ReadPrec ListServiceProfilesResponse
readList :: ReadS [ListServiceProfilesResponse]
$creadList :: ReadS [ListServiceProfilesResponse]
readsPrec :: Int -> ReadS ListServiceProfilesResponse
$creadsPrec :: Int -> ReadS ListServiceProfilesResponse
Prelude.Read, Int -> ListServiceProfilesResponse -> ShowS
[ListServiceProfilesResponse] -> ShowS
ListServiceProfilesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListServiceProfilesResponse] -> ShowS
$cshowList :: [ListServiceProfilesResponse] -> ShowS
show :: ListServiceProfilesResponse -> String
$cshow :: ListServiceProfilesResponse -> String
showsPrec :: Int -> ListServiceProfilesResponse -> ShowS
$cshowsPrec :: Int -> ListServiceProfilesResponse -> ShowS
Prelude.Show, forall x.
Rep ListServiceProfilesResponse x -> ListServiceProfilesResponse
forall x.
ListServiceProfilesResponse -> Rep ListServiceProfilesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListServiceProfilesResponse x -> ListServiceProfilesResponse
$cfrom :: forall x.
ListServiceProfilesResponse -> Rep ListServiceProfilesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListServiceProfilesResponse' 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', 'listServiceProfilesResponse_nextToken' - The token to use to get the next set of results, or __null__ if there
-- are no additional results.
--
-- 'serviceProfileList', 'listServiceProfilesResponse_serviceProfileList' - The list of service profiles.
--
-- 'httpStatus', 'listServiceProfilesResponse_httpStatus' - The response's http status code.
newListServiceProfilesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListServiceProfilesResponse
newListServiceProfilesResponse :: Int -> ListServiceProfilesResponse
newListServiceProfilesResponse Int
pHttpStatus_ =
  ListServiceProfilesResponse'
    { $sel:nextToken:ListServiceProfilesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:serviceProfileList:ListServiceProfilesResponse' :: Maybe [ServiceProfile]
serviceProfileList = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListServiceProfilesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token to use to get the next set of results, or __null__ if there
-- are no additional results.
listServiceProfilesResponse_nextToken :: Lens.Lens' ListServiceProfilesResponse (Prelude.Maybe Prelude.Text)
listServiceProfilesResponse_nextToken :: Lens' ListServiceProfilesResponse (Maybe Text)
listServiceProfilesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceProfilesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListServiceProfilesResponse' :: ListServiceProfilesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListServiceProfilesResponse
s@ListServiceProfilesResponse' {} Maybe Text
a -> ListServiceProfilesResponse
s {$sel:nextToken:ListServiceProfilesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListServiceProfilesResponse)

-- | The list of service profiles.
listServiceProfilesResponse_serviceProfileList :: Lens.Lens' ListServiceProfilesResponse (Prelude.Maybe [ServiceProfile])
listServiceProfilesResponse_serviceProfileList :: Lens' ListServiceProfilesResponse (Maybe [ServiceProfile])
listServiceProfilesResponse_serviceProfileList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListServiceProfilesResponse' {Maybe [ServiceProfile]
serviceProfileList :: Maybe [ServiceProfile]
$sel:serviceProfileList:ListServiceProfilesResponse' :: ListServiceProfilesResponse -> Maybe [ServiceProfile]
serviceProfileList} -> Maybe [ServiceProfile]
serviceProfileList) (\s :: ListServiceProfilesResponse
s@ListServiceProfilesResponse' {} Maybe [ServiceProfile]
a -> ListServiceProfilesResponse
s {$sel:serviceProfileList:ListServiceProfilesResponse' :: Maybe [ServiceProfile]
serviceProfileList = Maybe [ServiceProfile]
a} :: ListServiceProfilesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListServiceProfilesResponse where
  rnf :: ListServiceProfilesResponse -> ()
rnf ListServiceProfilesResponse' {Int
Maybe [ServiceProfile]
Maybe Text
httpStatus :: Int
serviceProfileList :: Maybe [ServiceProfile]
nextToken :: Maybe Text
$sel:httpStatus:ListServiceProfilesResponse' :: ListServiceProfilesResponse -> Int
$sel:serviceProfileList:ListServiceProfilesResponse' :: ListServiceProfilesResponse -> Maybe [ServiceProfile]
$sel:nextToken:ListServiceProfilesResponse' :: ListServiceProfilesResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [ServiceProfile]
serviceProfileList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus