{-# 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.GroundStation.ListSatellites
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of satellites.
--
-- This operation returns paginated results.
module Amazonka.GroundStation.ListSatellites
  ( -- * Creating a Request
    ListSatellites (..),
    newListSatellites,

    -- * Request Lenses
    listSatellites_maxResults,
    listSatellites_nextToken,

    -- * Destructuring the Response
    ListSatellitesResponse (..),
    newListSatellitesResponse,

    -- * Response Lenses
    listSatellitesResponse_nextToken,
    listSatellitesResponse_satellites,
    listSatellitesResponse_httpStatus,
  )
where

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

-- |
--
-- /See:/ 'newListSatellites' smart constructor.
data ListSatellites = ListSatellites'
  { -- | Maximum number of satellites returned.
    ListSatellites -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Next token that can be supplied in the next call to get the next page of
    -- satellites.
    ListSatellites -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListSatellites -> ListSatellites -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSatellites -> ListSatellites -> Bool
$c/= :: ListSatellites -> ListSatellites -> Bool
== :: ListSatellites -> ListSatellites -> Bool
$c== :: ListSatellites -> ListSatellites -> Bool
Prelude.Eq, ReadPrec [ListSatellites]
ReadPrec ListSatellites
Int -> ReadS ListSatellites
ReadS [ListSatellites]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSatellites]
$creadListPrec :: ReadPrec [ListSatellites]
readPrec :: ReadPrec ListSatellites
$creadPrec :: ReadPrec ListSatellites
readList :: ReadS [ListSatellites]
$creadList :: ReadS [ListSatellites]
readsPrec :: Int -> ReadS ListSatellites
$creadsPrec :: Int -> ReadS ListSatellites
Prelude.Read, Int -> ListSatellites -> ShowS
[ListSatellites] -> ShowS
ListSatellites -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSatellites] -> ShowS
$cshowList :: [ListSatellites] -> ShowS
show :: ListSatellites -> String
$cshow :: ListSatellites -> String
showsPrec :: Int -> ListSatellites -> ShowS
$cshowsPrec :: Int -> ListSatellites -> ShowS
Prelude.Show, forall x. Rep ListSatellites x -> ListSatellites
forall x. ListSatellites -> Rep ListSatellites x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSatellites x -> ListSatellites
$cfrom :: forall x. ListSatellites -> Rep ListSatellites x
Prelude.Generic)

-- |
-- Create a value of 'ListSatellites' 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', 'listSatellites_maxResults' - Maximum number of satellites returned.
--
-- 'nextToken', 'listSatellites_nextToken' - Next token that can be supplied in the next call to get the next page of
-- satellites.
newListSatellites ::
  ListSatellites
newListSatellites :: ListSatellites
newListSatellites =
  ListSatellites'
    { $sel:maxResults:ListSatellites' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListSatellites' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Maximum number of satellites returned.
listSatellites_maxResults :: Lens.Lens' ListSatellites (Prelude.Maybe Prelude.Natural)
listSatellites_maxResults :: Lens' ListSatellites (Maybe Natural)
listSatellites_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSatellites' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSatellites' :: ListSatellites -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSatellites
s@ListSatellites' {} Maybe Natural
a -> ListSatellites
s {$sel:maxResults:ListSatellites' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSatellites)

-- | Next token that can be supplied in the next call to get the next page of
-- satellites.
listSatellites_nextToken :: Lens.Lens' ListSatellites (Prelude.Maybe Prelude.Text)
listSatellites_nextToken :: Lens' ListSatellites (Maybe Text)
listSatellites_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSatellites' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSatellites' :: ListSatellites -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSatellites
s@ListSatellites' {} Maybe Text
a -> ListSatellites
s {$sel:nextToken:ListSatellites' :: Maybe Text
nextToken = Maybe Text
a} :: ListSatellites)

instance Core.AWSPager ListSatellites where
  page :: ListSatellites
-> AWSResponse ListSatellites -> Maybe ListSatellites
page ListSatellites
rq AWSResponse ListSatellites
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSatellites
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSatellitesResponse (Maybe Text)
listSatellitesResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListSatellites
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSatellitesResponse (Maybe [SatelliteListItem])
listSatellitesResponse_satellites
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListSatellites
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListSatellites (Maybe Text)
listSatellites_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListSatellites
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListSatellitesResponse (Maybe Text)
listSatellitesResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListSatellites where
  type
    AWSResponse ListSatellites =
      ListSatellitesResponse
  request :: (Service -> Service) -> ListSatellites -> Request ListSatellites
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 ListSatellites
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSatellites)))
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 [SatelliteListItem] -> Int -> ListSatellitesResponse
ListSatellitesResponse'
            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
"satellites" 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 ListSatellites where
  hashWithSalt :: Int -> ListSatellites -> Int
hashWithSalt Int
_salt ListSatellites' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSatellites' :: ListSatellites -> Maybe Text
$sel:maxResults:ListSatellites' :: ListSatellites -> 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 ListSatellites where
  rnf :: ListSatellites -> ()
rnf ListSatellites' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSatellites' :: ListSatellites -> Maybe Text
$sel:maxResults:ListSatellites' :: ListSatellites -> 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 ListSatellites where
  toHeaders :: ListSatellites -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath ListSatellites where
  toPath :: ListSatellites -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/satellite"

instance Data.ToQuery ListSatellites where
  toQuery :: ListSatellites -> QueryString
toQuery ListSatellites' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListSatellites' :: ListSatellites -> Maybe Text
$sel:maxResults:ListSatellites' :: ListSatellites -> 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:/ 'newListSatellitesResponse' smart constructor.
data ListSatellitesResponse = ListSatellitesResponse'
  { -- | Next token that can be supplied in the next call to get the next page of
    -- satellites.
    ListSatellitesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | List of satellites.
    ListSatellitesResponse -> Maybe [SatelliteListItem]
satellites :: Prelude.Maybe [SatelliteListItem],
    -- | The response's http status code.
    ListSatellitesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListSatellitesResponse -> ListSatellitesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSatellitesResponse -> ListSatellitesResponse -> Bool
$c/= :: ListSatellitesResponse -> ListSatellitesResponse -> Bool
== :: ListSatellitesResponse -> ListSatellitesResponse -> Bool
$c== :: ListSatellitesResponse -> ListSatellitesResponse -> Bool
Prelude.Eq, ReadPrec [ListSatellitesResponse]
ReadPrec ListSatellitesResponse
Int -> ReadS ListSatellitesResponse
ReadS [ListSatellitesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSatellitesResponse]
$creadListPrec :: ReadPrec [ListSatellitesResponse]
readPrec :: ReadPrec ListSatellitesResponse
$creadPrec :: ReadPrec ListSatellitesResponse
readList :: ReadS [ListSatellitesResponse]
$creadList :: ReadS [ListSatellitesResponse]
readsPrec :: Int -> ReadS ListSatellitesResponse
$creadsPrec :: Int -> ReadS ListSatellitesResponse
Prelude.Read, Int -> ListSatellitesResponse -> ShowS
[ListSatellitesResponse] -> ShowS
ListSatellitesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSatellitesResponse] -> ShowS
$cshowList :: [ListSatellitesResponse] -> ShowS
show :: ListSatellitesResponse -> String
$cshow :: ListSatellitesResponse -> String
showsPrec :: Int -> ListSatellitesResponse -> ShowS
$cshowsPrec :: Int -> ListSatellitesResponse -> ShowS
Prelude.Show, forall x. Rep ListSatellitesResponse x -> ListSatellitesResponse
forall x. ListSatellitesResponse -> Rep ListSatellitesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSatellitesResponse x -> ListSatellitesResponse
$cfrom :: forall x. ListSatellitesResponse -> Rep ListSatellitesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListSatellitesResponse' 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', 'listSatellitesResponse_nextToken' - Next token that can be supplied in the next call to get the next page of
-- satellites.
--
-- 'satellites', 'listSatellitesResponse_satellites' - List of satellites.
--
-- 'httpStatus', 'listSatellitesResponse_httpStatus' - The response's http status code.
newListSatellitesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListSatellitesResponse
newListSatellitesResponse :: Int -> ListSatellitesResponse
newListSatellitesResponse Int
pHttpStatus_ =
  ListSatellitesResponse'
    { $sel:nextToken:ListSatellitesResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:satellites:ListSatellitesResponse' :: Maybe [SatelliteListItem]
satellites = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListSatellitesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Next token that can be supplied in the next call to get the next page of
-- satellites.
listSatellitesResponse_nextToken :: Lens.Lens' ListSatellitesResponse (Prelude.Maybe Prelude.Text)
listSatellitesResponse_nextToken :: Lens' ListSatellitesResponse (Maybe Text)
listSatellitesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSatellitesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSatellitesResponse' :: ListSatellitesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSatellitesResponse
s@ListSatellitesResponse' {} Maybe Text
a -> ListSatellitesResponse
s {$sel:nextToken:ListSatellitesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSatellitesResponse)

-- | List of satellites.
listSatellitesResponse_satellites :: Lens.Lens' ListSatellitesResponse (Prelude.Maybe [SatelliteListItem])
listSatellitesResponse_satellites :: Lens' ListSatellitesResponse (Maybe [SatelliteListItem])
listSatellitesResponse_satellites = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSatellitesResponse' {Maybe [SatelliteListItem]
satellites :: Maybe [SatelliteListItem]
$sel:satellites:ListSatellitesResponse' :: ListSatellitesResponse -> Maybe [SatelliteListItem]
satellites} -> Maybe [SatelliteListItem]
satellites) (\s :: ListSatellitesResponse
s@ListSatellitesResponse' {} Maybe [SatelliteListItem]
a -> ListSatellitesResponse
s {$sel:satellites:ListSatellitesResponse' :: Maybe [SatelliteListItem]
satellites = Maybe [SatelliteListItem]
a} :: ListSatellitesResponse) 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.
listSatellitesResponse_httpStatus :: Lens.Lens' ListSatellitesResponse Prelude.Int
listSatellitesResponse_httpStatus :: Lens' ListSatellitesResponse Int
listSatellitesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSatellitesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSatellitesResponse' :: ListSatellitesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSatellitesResponse
s@ListSatellitesResponse' {} Int
a -> ListSatellitesResponse
s {$sel:httpStatus:ListSatellitesResponse' :: Int
httpStatus = Int
a} :: ListSatellitesResponse)

instance Prelude.NFData ListSatellitesResponse where
  rnf :: ListSatellitesResponse -> ()
rnf ListSatellitesResponse' {Int
Maybe [SatelliteListItem]
Maybe Text
httpStatus :: Int
satellites :: Maybe [SatelliteListItem]
nextToken :: Maybe Text
$sel:httpStatus:ListSatellitesResponse' :: ListSatellitesResponse -> Int
$sel:satellites:ListSatellitesResponse' :: ListSatellitesResponse -> Maybe [SatelliteListItem]
$sel:nextToken:ListSatellitesResponse' :: ListSatellitesResponse -> 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 [SatelliteListItem]
satellites
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus